Update auto-generated bindings to upstream 0.0.98
[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 logger being silent
214     */
215    LDKLevel_Off,
216    /**
217     * Designates very serious errors
218     */
219    LDKLevel_Error,
220    /**
221     * Designates hazardous situations
222     */
223    LDKLevel_Warn,
224    /**
225     * Designates useful information
226     */
227    LDKLevel_Info,
228    /**
229     * Designates lower priority information
230     */
231    LDKLevel_Debug,
232    /**
233     * Designates very low priority, often extremely verbose, information
234     */
235    LDKLevel_Trace,
236    /**
237     * Must be last for serialization purposes
238     */
239    LDKLevel_Sentinel,
240 } LDKLevel;
241
242 /**
243  * An enum representing the possible Bitcoin or test networks which we can run on
244  */
245 typedef enum LDKNetwork {
246    /**
247     * The main Bitcoin blockchain.
248     */
249    LDKNetwork_Bitcoin,
250    /**
251     * The testnet3 blockchain.
252     */
253    LDKNetwork_Testnet,
254    /**
255     * A local test blockchain.
256     */
257    LDKNetwork_Regtest,
258    /**
259     * A blockchain on which blocks are signed instead of mined.
260     */
261    LDKNetwork_Signet,
262    /**
263     * Must be last for serialization purposes
264     */
265    LDKNetwork_Sentinel,
266 } LDKNetwork;
267
268 /**
269  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
270  */
271 typedef enum LDKSecp256k1Error {
272    /**
273     * Signature failed verification
274     */
275    LDKSecp256k1Error_IncorrectSignature,
276    /**
277     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
278     */
279    LDKSecp256k1Error_InvalidMessage,
280    /**
281     * Bad public key
282     */
283    LDKSecp256k1Error_InvalidPublicKey,
284    /**
285     * Bad signature
286     */
287    LDKSecp256k1Error_InvalidSignature,
288    /**
289     * Bad secret key
290     */
291    LDKSecp256k1Error_InvalidSecretKey,
292    /**
293     * Bad recovery id
294     */
295    LDKSecp256k1Error_InvalidRecoveryId,
296    /**
297     * Invalid tweak for add_assign or mul_assign
298     */
299    LDKSecp256k1Error_InvalidTweak,
300    /**
301     * tweak_add_check failed on an xonly public key
302     */
303    LDKSecp256k1Error_TweakCheckFailed,
304    /**
305     * Didn't pass enough memory to context creation with preallocated memory
306     */
307    LDKSecp256k1Error_NotEnoughMemory,
308    /**
309     * Must be last for serialization purposes
310     */
311    LDKSecp256k1Error_Sentinel,
312 } LDKSecp256k1Error;
313
314 /**
315  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
316  * requirements sections in BOLT #11
317  */
318 typedef enum LDKSemanticError {
319    /**
320     * The invoice is missing the mandatory payment hash
321     */
322    LDKSemanticError_NoPaymentHash,
323    /**
324     * The invoice has multiple payment hashes which isn't allowed
325     */
326    LDKSemanticError_MultiplePaymentHashes,
327    /**
328     * No description or description hash are part of the invoice
329     */
330    LDKSemanticError_NoDescription,
331    /**
332     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
333     */
334    LDKSemanticError_MultipleDescriptions,
335    /**
336     * The invoice contains multiple payment secrets
337     */
338    LDKSemanticError_MultiplePaymentSecrets,
339    /**
340     * The invoice's features are invalid
341     */
342    LDKSemanticError_InvalidFeatures,
343    /**
344     * The recovery id doesn't fit the signature/pub key
345     */
346    LDKSemanticError_InvalidRecoveryId,
347    /**
348     * The invoice's signature is invalid
349     */
350    LDKSemanticError_InvalidSignature,
351    /**
352     * Must be last for serialization purposes
353     */
354    LDKSemanticError_Sentinel,
355 } LDKSemanticError;
356
357 /**
358  * SI prefixes for the human readable part
359  */
360 typedef enum LDKSiPrefix {
361    /**
362     * 10^-3
363     */
364    LDKSiPrefix_Milli,
365    /**
366     * 10^-6
367     */
368    LDKSiPrefix_Micro,
369    /**
370     * 10^-9
371     */
372    LDKSiPrefix_Nano,
373    /**
374     * 10^-12
375     */
376    LDKSiPrefix_Pico,
377    /**
378     * Must be last for serialization purposes
379     */
380    LDKSiPrefix_Sentinel,
381 } LDKSiPrefix;
382
383 /**
384  * A Rust str object, ie a reference to a UTF8-valid string.
385  * This is *not* null-terminated so cannot be used directly as a C string!
386  */
387 typedef struct LDKStr {
388    /**
389     * A pointer to the string's bytes, in UTF8 encoding
390     */
391    const uint8_t *chars;
392    /**
393     * The number of bytes (not characters!) pointed to by `chars`
394     */
395    uintptr_t len;
396    /**
397     * Whether the data pointed to by `chars` should be freed or not.
398     */
399    bool chars_is_owned;
400 } LDKStr;
401
402 /**
403  * A serialized transaction, in (pointer, length) form.
404  *
405  * This type optionally owns its own memory, and thus the semantics around access change based on
406  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
407  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
408  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
409  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
410  * you would be invalid.
411  *
412  * Note that, while it may change in the future, because transactions on the Rust side are stored
413  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
414  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
415  * `data_is_owned` either set or unset at your discretion.
416  */
417 typedef struct LDKTransaction {
418    /**
419     * The serialized transaction data.
420     *
421     * This is non-const for your convenience, an object passed to Rust is never written to.
422     */
423    uint8_t *data;
424    /**
425     * The length of the serialized transaction
426     */
427    uintptr_t datalen;
428    /**
429     * Whether the data pointed to by `data` should be freed or not.
430     */
431    bool data_is_owned;
432 } LDKTransaction;
433
434 /**
435  * A dynamically-allocated array of u8s of arbitrary size.
436  * This corresponds to std::vector in C++
437  */
438 typedef struct LDKCVec_u8Z {
439    /**
440     * The elements in the array.
441     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
442     */
443    uint8_t *data;
444    /**
445     * The number of elements pointed to by `data`.
446     */
447    uintptr_t datalen;
448 } LDKCVec_u8Z;
449
450 /**
451  * A transaction output including a scriptPubKey and value.
452  * This type *does* own its own memory, so must be free'd appropriately.
453  */
454 typedef struct LDKTxOut {
455    /**
456     * The script_pubkey in this output
457     */
458    struct LDKCVec_u8Z script_pubkey;
459    /**
460     * The value, in satoshis, of this output
461     */
462    uint64_t value;
463 } LDKTxOut;
464
465 /**
466  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
467  */
468 typedef struct LDKSecretKey {
469    /**
470     * The bytes of the secret key
471     */
472    uint8_t bytes[32];
473 } LDKSecretKey;
474
475 /**
476  * The contents of CResult_SecretKeyErrorZ
477  */
478 typedef union LDKCResult_SecretKeyErrorZPtr {
479    /**
480     * A pointer to the contents in the success state.
481     * Reading from this pointer when `result_ok` is not set is undefined.
482     */
483    struct LDKSecretKey *result;
484    /**
485     * A pointer to the contents in the error state.
486     * Reading from this pointer when `result_ok` is set is undefined.
487     */
488    enum LDKSecp256k1Error *err;
489 } LDKCResult_SecretKeyErrorZPtr;
490
491 /**
492  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
493  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
494  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
495  */
496 typedef struct LDKCResult_SecretKeyErrorZ {
497    /**
498     * The contents of this CResult_SecretKeyErrorZ, accessible via either
499     * `err` or `result` depending on the state of `result_ok`.
500     */
501    union LDKCResult_SecretKeyErrorZPtr contents;
502    /**
503     * Whether this CResult_SecretKeyErrorZ represents a success state.
504     */
505    bool result_ok;
506 } LDKCResult_SecretKeyErrorZ;
507
508 /**
509  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
510  */
511 typedef struct LDKPublicKey {
512    /**
513     * The bytes of the public key
514     */
515    uint8_t compressed_form[33];
516 } LDKPublicKey;
517
518 /**
519  * The contents of CResult_PublicKeyErrorZ
520  */
521 typedef union LDKCResult_PublicKeyErrorZPtr {
522    /**
523     * A pointer to the contents in the success state.
524     * Reading from this pointer when `result_ok` is not set is undefined.
525     */
526    struct LDKPublicKey *result;
527    /**
528     * A pointer to the contents in the error state.
529     * Reading from this pointer when `result_ok` is set is undefined.
530     */
531    enum LDKSecp256k1Error *err;
532 } LDKCResult_PublicKeyErrorZPtr;
533
534 /**
535  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
536  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
538  */
539 typedef struct LDKCResult_PublicKeyErrorZ {
540    /**
541     * The contents of this CResult_PublicKeyErrorZ, accessible via either
542     * `err` or `result` depending on the state of `result_ok`.
543     */
544    union LDKCResult_PublicKeyErrorZPtr contents;
545    /**
546     * Whether this CResult_PublicKeyErrorZ represents a success state.
547     */
548    bool result_ok;
549 } LDKCResult_PublicKeyErrorZ;
550
551
552
553 /**
554  * The set of public keys which are used in the creation of one commitment transaction.
555  * These are derived from the channel base keys and per-commitment data.
556  *
557  * A broadcaster key is provided from potential broadcaster of the computed transaction.
558  * A countersignatory key is coming from a protocol participant unable to broadcast the
559  * transaction.
560  *
561  * These keys are assumed to be good, either because the code derived them from
562  * channel basepoints via the new function, or they were obtained via
563  * CommitmentTransaction.trust().keys() because we trusted the source of the
564  * pre-calculated keys.
565  */
566 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
567    /**
568     * A pointer to the opaque Rust object.
569     * Nearly everywhere, inner must be non-null, however in places where
570     * the Rust equivalent takes an Option, it may be set to null to indicate None.
571     */
572    LDKnativeTxCreationKeys *inner;
573    /**
574     * Indicates that this is the only struct which contains the same pointer.
575     * Rust functions which take ownership of an object provided via an argument require
576     * this to be true and invalidate the object pointed to by inner.
577     */
578    bool is_owned;
579 } LDKTxCreationKeys;
580
581
582
583 /**
584  * An error in decoding a message or struct.
585  */
586 typedef struct MUST_USE_STRUCT LDKDecodeError {
587    /**
588     * A pointer to the opaque Rust object.
589     * Nearly everywhere, inner must be non-null, however in places where
590     * the Rust equivalent takes an Option, it may be set to null to indicate None.
591     */
592    LDKnativeDecodeError *inner;
593    /**
594     * Indicates that this is the only struct which contains the same pointer.
595     * Rust functions which take ownership of an object provided via an argument require
596     * this to be true and invalidate the object pointed to by inner.
597     */
598    bool is_owned;
599 } LDKDecodeError;
600
601 /**
602  * The contents of CResult_TxCreationKeysDecodeErrorZ
603  */
604 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
605    /**
606     * A pointer to the contents in the success state.
607     * Reading from this pointer when `result_ok` is not set is undefined.
608     */
609    struct LDKTxCreationKeys *result;
610    /**
611     * A pointer to the contents in the error state.
612     * Reading from this pointer when `result_ok` is set is undefined.
613     */
614    struct LDKDecodeError *err;
615 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
616
617 /**
618  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
619  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
620  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
621  */
622 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
623    /**
624     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
625     * `err` or `result` depending on the state of `result_ok`.
626     */
627    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
628    /**
629     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
630     */
631    bool result_ok;
632 } LDKCResult_TxCreationKeysDecodeErrorZ;
633
634
635
636 /**
637  * One counterparty's public keys which do not change over the life of a channel.
638  */
639 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
640    /**
641     * A pointer to the opaque Rust object.
642     * Nearly everywhere, inner must be non-null, however in places where
643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
644     */
645    LDKnativeChannelPublicKeys *inner;
646    /**
647     * Indicates that this is the only struct which contains the same pointer.
648     * Rust functions which take ownership of an object provided via an argument require
649     * this to be true and invalidate the object pointed to by inner.
650     */
651    bool is_owned;
652 } LDKChannelPublicKeys;
653
654 /**
655  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
656  */
657 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
658    /**
659     * A pointer to the contents in the success state.
660     * Reading from this pointer when `result_ok` is not set is undefined.
661     */
662    struct LDKChannelPublicKeys *result;
663    /**
664     * A pointer to the contents in the error state.
665     * Reading from this pointer when `result_ok` is set is undefined.
666     */
667    struct LDKDecodeError *err;
668 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
669
670 /**
671  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
672  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
673  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
674  */
675 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
676    /**
677     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
678     * `err` or `result` depending on the state of `result_ok`.
679     */
680    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
681    /**
682     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
683     */
684    bool result_ok;
685 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
686
687 /**
688  * The contents of CResult_TxCreationKeysErrorZ
689  */
690 typedef union LDKCResult_TxCreationKeysErrorZPtr {
691    /**
692     * A pointer to the contents in the success state.
693     * Reading from this pointer when `result_ok` is not set is undefined.
694     */
695    struct LDKTxCreationKeys *result;
696    /**
697     * A pointer to the contents in the error state.
698     * Reading from this pointer when `result_ok` is set is undefined.
699     */
700    enum LDKSecp256k1Error *err;
701 } LDKCResult_TxCreationKeysErrorZPtr;
702
703 /**
704  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
705  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
706  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
707  */
708 typedef struct LDKCResult_TxCreationKeysErrorZ {
709    /**
710     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
711     * `err` or `result` depending on the state of `result_ok`.
712     */
713    union LDKCResult_TxCreationKeysErrorZPtr contents;
714    /**
715     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
716     */
717    bool result_ok;
718 } LDKCResult_TxCreationKeysErrorZ;
719
720 /**
721  * An enum which can either contain a u32 or not
722  */
723 typedef enum LDKCOption_u32Z_Tag {
724    /**
725     * When we're in this state, this COption_u32Z contains a u32
726     */
727    LDKCOption_u32Z_Some,
728    /**
729     * When we're in this state, this COption_u32Z contains nothing
730     */
731    LDKCOption_u32Z_None,
732    /**
733     * Must be last for serialization purposes
734     */
735    LDKCOption_u32Z_Sentinel,
736 } LDKCOption_u32Z_Tag;
737
738 typedef struct LDKCOption_u32Z {
739    LDKCOption_u32Z_Tag tag;
740    union {
741       struct {
742          uint32_t some;
743       };
744    };
745 } LDKCOption_u32Z;
746
747
748
749 /**
750  * Information about an HTLC as it appears in a commitment transaction
751  */
752 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
753    /**
754     * A pointer to the opaque Rust object.
755     * Nearly everywhere, inner must be non-null, however in places where
756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
757     */
758    LDKnativeHTLCOutputInCommitment *inner;
759    /**
760     * Indicates that this is the only struct which contains the same pointer.
761     * Rust functions which take ownership of an object provided via an argument require
762     * this to be true and invalidate the object pointed to by inner.
763     */
764    bool is_owned;
765 } LDKHTLCOutputInCommitment;
766
767 /**
768  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
769  */
770 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
771    /**
772     * A pointer to the contents in the success state.
773     * Reading from this pointer when `result_ok` is not set is undefined.
774     */
775    struct LDKHTLCOutputInCommitment *result;
776    /**
777     * A pointer to the contents in the error state.
778     * Reading from this pointer when `result_ok` is set is undefined.
779     */
780    struct LDKDecodeError *err;
781 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
782
783 /**
784  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
785  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
787  */
788 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
789    /**
790     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
791     * `err` or `result` depending on the state of `result_ok`.
792     */
793    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
794    /**
795     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
796     */
797    bool result_ok;
798 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
799
800
801
802 /**
803  * Late-bound per-channel counterparty data used to build transactions.
804  */
805 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
806    /**
807     * A pointer to the opaque Rust object.
808     * Nearly everywhere, inner must be non-null, however in places where
809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
810     */
811    LDKnativeCounterpartyChannelTransactionParameters *inner;
812    /**
813     * Indicates that this is the only struct which contains the same pointer.
814     * Rust functions which take ownership of an object provided via an argument require
815     * this to be true and invalidate the object pointed to by inner.
816     */
817    bool is_owned;
818 } LDKCounterpartyChannelTransactionParameters;
819
820 /**
821  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
822  */
823 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
824    /**
825     * A pointer to the contents in the success state.
826     * Reading from this pointer when `result_ok` is not set is undefined.
827     */
828    struct LDKCounterpartyChannelTransactionParameters *result;
829    /**
830     * A pointer to the contents in the error state.
831     * Reading from this pointer when `result_ok` is set is undefined.
832     */
833    struct LDKDecodeError *err;
834 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
835
836 /**
837  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
838  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
840  */
841 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
842    /**
843     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
844     * `err` or `result` depending on the state of `result_ok`.
845     */
846    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
847    /**
848     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
849     */
850    bool result_ok;
851 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
852
853
854
855 /**
856  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
857  * The fields are organized by holder/counterparty.
858  *
859  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
860  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
861  */
862 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
863    /**
864     * A pointer to the opaque Rust object.
865     * Nearly everywhere, inner must be non-null, however in places where
866     * the Rust equivalent takes an Option, it may be set to null to indicate None.
867     */
868    LDKnativeChannelTransactionParameters *inner;
869    /**
870     * Indicates that this is the only struct which contains the same pointer.
871     * Rust functions which take ownership of an object provided via an argument require
872     * this to be true and invalidate the object pointed to by inner.
873     */
874    bool is_owned;
875 } LDKChannelTransactionParameters;
876
877 /**
878  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
879  */
880 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
881    /**
882     * A pointer to the contents in the success state.
883     * Reading from this pointer when `result_ok` is not set is undefined.
884     */
885    struct LDKChannelTransactionParameters *result;
886    /**
887     * A pointer to the contents in the error state.
888     * Reading from this pointer when `result_ok` is set is undefined.
889     */
890    struct LDKDecodeError *err;
891 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
892
893 /**
894  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
895  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
896  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
897  */
898 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
899    /**
900     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
901     * `err` or `result` depending on the state of `result_ok`.
902     */
903    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
904    /**
905     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
906     */
907    bool result_ok;
908 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
909
910 /**
911  * Represents a secp256k1 signature serialized as two 32-byte numbers
912  */
913 typedef struct LDKSignature {
914    /**
915     * The bytes of the signature in "compact" form
916     */
917    uint8_t compact_form[64];
918 } LDKSignature;
919
920 /**
921  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
922  * This corresponds to std::vector in C++
923  */
924 typedef struct LDKCVec_SignatureZ {
925    /**
926     * The elements in the array.
927     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
928     */
929    struct LDKSignature *data;
930    /**
931     * The number of elements pointed to by `data`.
932     */
933    uintptr_t datalen;
934 } LDKCVec_SignatureZ;
935
936
937
938 /**
939  * Information needed to build and sign a holder's commitment transaction.
940  *
941  * The transaction is only signed once we are ready to broadcast.
942  */
943 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
944    /**
945     * A pointer to the opaque Rust object.
946     * Nearly everywhere, inner must be non-null, however in places where
947     * the Rust equivalent takes an Option, it may be set to null to indicate None.
948     */
949    LDKnativeHolderCommitmentTransaction *inner;
950    /**
951     * Indicates that this is the only struct which contains the same pointer.
952     * Rust functions which take ownership of an object provided via an argument require
953     * this to be true and invalidate the object pointed to by inner.
954     */
955    bool is_owned;
956 } LDKHolderCommitmentTransaction;
957
958 /**
959  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
960  */
961 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
962    /**
963     * A pointer to the contents in the success state.
964     * Reading from this pointer when `result_ok` is not set is undefined.
965     */
966    struct LDKHolderCommitmentTransaction *result;
967    /**
968     * A pointer to the contents in the error state.
969     * Reading from this pointer when `result_ok` is set is undefined.
970     */
971    struct LDKDecodeError *err;
972 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
973
974 /**
975  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
976  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
977  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
978  */
979 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
980    /**
981     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
982     * `err` or `result` depending on the state of `result_ok`.
983     */
984    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
985    /**
986     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
987     */
988    bool result_ok;
989 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
990
991
992
993 /**
994  * A pre-built Bitcoin commitment transaction and its txid.
995  */
996 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
997    /**
998     * A pointer to the opaque Rust object.
999     * Nearly everywhere, inner must be non-null, however in places where
1000     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1001     */
1002    LDKnativeBuiltCommitmentTransaction *inner;
1003    /**
1004     * Indicates that this is the only struct which contains the same pointer.
1005     * Rust functions which take ownership of an object provided via an argument require
1006     * this to be true and invalidate the object pointed to by inner.
1007     */
1008    bool is_owned;
1009 } LDKBuiltCommitmentTransaction;
1010
1011 /**
1012  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1013  */
1014 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1015    /**
1016     * A pointer to the contents in the success state.
1017     * Reading from this pointer when `result_ok` is not set is undefined.
1018     */
1019    struct LDKBuiltCommitmentTransaction *result;
1020    /**
1021     * A pointer to the contents in the error state.
1022     * Reading from this pointer when `result_ok` is set is undefined.
1023     */
1024    struct LDKDecodeError *err;
1025 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1026
1027 /**
1028  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1029  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1030  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1031  */
1032 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1033    /**
1034     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1035     * `err` or `result` depending on the state of `result_ok`.
1036     */
1037    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1038    /**
1039     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1040     */
1041    bool result_ok;
1042 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1043
1044
1045
1046 /**
1047  * This class tracks the per-transaction information needed to build a commitment transaction and to
1048  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1049  * and for transactions we sign for the counterparty.
1050  *
1051  * This class can be used inside a signer implementation to generate a signature given the relevant
1052  * secret key.
1053  */
1054 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1055    /**
1056     * A pointer to the opaque Rust object.
1057     * Nearly everywhere, inner must be non-null, however in places where
1058     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1059     */
1060    LDKnativeCommitmentTransaction *inner;
1061    /**
1062     * Indicates that this is the only struct which contains the same pointer.
1063     * Rust functions which take ownership of an object provided via an argument require
1064     * this to be true and invalidate the object pointed to by inner.
1065     */
1066    bool is_owned;
1067 } LDKCommitmentTransaction;
1068
1069 /**
1070  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1071  */
1072 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1073    /**
1074     * A pointer to the contents in the success state.
1075     * Reading from this pointer when `result_ok` is not set is undefined.
1076     */
1077    struct LDKCommitmentTransaction *result;
1078    /**
1079     * A pointer to the contents in the error state.
1080     * Reading from this pointer when `result_ok` is set is undefined.
1081     */
1082    struct LDKDecodeError *err;
1083 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1084
1085 /**
1086  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1087  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1088  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1089  */
1090 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1091    /**
1092     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1093     * `err` or `result` depending on the state of `result_ok`.
1094     */
1095    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1096    /**
1097     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1098     */
1099    bool result_ok;
1100 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1101
1102
1103
1104 /**
1105  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1106  * transaction and the transaction creation keys) are trusted.
1107  *
1108  * See trust() and verify() functions on CommitmentTransaction.
1109  *
1110  * This structure implements Deref.
1111  */
1112 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1113    /**
1114     * A pointer to the opaque Rust object.
1115     * Nearly everywhere, inner must be non-null, however in places where
1116     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1117     */
1118    LDKnativeTrustedCommitmentTransaction *inner;
1119    /**
1120     * Indicates that this is the only struct which contains the same pointer.
1121     * Rust functions which take ownership of an object provided via an argument require
1122     * this to be true and invalidate the object pointed to by inner.
1123     */
1124    bool is_owned;
1125 } LDKTrustedCommitmentTransaction;
1126
1127 /**
1128  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1129  */
1130 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1131    /**
1132     * A pointer to the contents in the success state.
1133     * Reading from this pointer when `result_ok` is not set is undefined.
1134     */
1135    struct LDKTrustedCommitmentTransaction *result;
1136    /**
1137     * Note that this value is always NULL, as there are no contents in the Err variant
1138     */
1139    void *err;
1140 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1141
1142 /**
1143  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1144  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1145  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1146  */
1147 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1148    /**
1149     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1150     * `err` or `result` depending on the state of `result_ok`.
1151     */
1152    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1153    /**
1154     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1155     */
1156    bool result_ok;
1157 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1158
1159 /**
1160  * The contents of CResult_CVec_SignatureZNoneZ
1161  */
1162 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1163    /**
1164     * A pointer to the contents in the success state.
1165     * Reading from this pointer when `result_ok` is not set is undefined.
1166     */
1167    struct LDKCVec_SignatureZ *result;
1168    /**
1169     * Note that this value is always NULL, as there are no contents in the Err variant
1170     */
1171    void *err;
1172 } LDKCResult_CVec_SignatureZNoneZPtr;
1173
1174 /**
1175  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1176  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1177  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1178  */
1179 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1180    /**
1181     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1182     * `err` or `result` depending on the state of `result_ok`.
1183     */
1184    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1185    /**
1186     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1187     */
1188    bool result_ok;
1189 } LDKCResult_CVec_SignatureZNoneZ;
1190
1191 /**
1192  * The contents of CResult_NoneErrorZ
1193  */
1194 typedef union LDKCResult_NoneErrorZPtr {
1195    /**
1196     * Note that this value is always NULL, as there are no contents in the OK variant
1197     */
1198    void *result;
1199    /**
1200     * A pointer to the contents in the error state.
1201     * Reading from this pointer when `result_ok` is set is undefined.
1202     */
1203    enum LDKIOError *err;
1204 } LDKCResult_NoneErrorZPtr;
1205
1206 /**
1207  * A CResult_NoneErrorZ represents the result of a fallible operation,
1208  * containing a () on success and a crate::c_types::IOError on failure.
1209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1210  */
1211 typedef struct LDKCResult_NoneErrorZ {
1212    /**
1213     * The contents of this CResult_NoneErrorZ, accessible via either
1214     * `err` or `result` depending on the state of `result_ok`.
1215     */
1216    union LDKCResult_NoneErrorZPtr contents;
1217    /**
1218     * Whether this CResult_NoneErrorZ represents a success state.
1219     */
1220    bool result_ok;
1221 } LDKCResult_NoneErrorZ;
1222
1223
1224
1225 /**
1226  * A hop in a route
1227  */
1228 typedef struct MUST_USE_STRUCT LDKRouteHop {
1229    /**
1230     * A pointer to the opaque Rust object.
1231     * Nearly everywhere, inner must be non-null, however in places where
1232     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1233     */
1234    LDKnativeRouteHop *inner;
1235    /**
1236     * Indicates that this is the only struct which contains the same pointer.
1237     * Rust functions which take ownership of an object provided via an argument require
1238     * this to be true and invalidate the object pointed to by inner.
1239     */
1240    bool is_owned;
1241 } LDKRouteHop;
1242
1243 /**
1244  * The contents of CResult_RouteHopDecodeErrorZ
1245  */
1246 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1247    /**
1248     * A pointer to the contents in the success state.
1249     * Reading from this pointer when `result_ok` is not set is undefined.
1250     */
1251    struct LDKRouteHop *result;
1252    /**
1253     * A pointer to the contents in the error state.
1254     * Reading from this pointer when `result_ok` is set is undefined.
1255     */
1256    struct LDKDecodeError *err;
1257 } LDKCResult_RouteHopDecodeErrorZPtr;
1258
1259 /**
1260  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1261  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1263  */
1264 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1265    /**
1266     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1267     * `err` or `result` depending on the state of `result_ok`.
1268     */
1269    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1270    /**
1271     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1272     */
1273    bool result_ok;
1274 } LDKCResult_RouteHopDecodeErrorZ;
1275
1276 /**
1277  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1278  * This corresponds to std::vector in C++
1279  */
1280 typedef struct LDKCVec_RouteHopZ {
1281    /**
1282     * The elements in the array.
1283     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1284     */
1285    struct LDKRouteHop *data;
1286    /**
1287     * The number of elements pointed to by `data`.
1288     */
1289    uintptr_t datalen;
1290 } LDKCVec_RouteHopZ;
1291
1292 /**
1293  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1294  * This corresponds to std::vector in C++
1295  */
1296 typedef struct LDKCVec_CVec_RouteHopZZ {
1297    /**
1298     * The elements in the array.
1299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1300     */
1301    struct LDKCVec_RouteHopZ *data;
1302    /**
1303     * The number of elements pointed to by `data`.
1304     */
1305    uintptr_t datalen;
1306 } LDKCVec_CVec_RouteHopZZ;
1307
1308
1309
1310 /**
1311  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1312  * it can take multiple paths. Each path is composed of one or more hops through the network.
1313  */
1314 typedef struct MUST_USE_STRUCT LDKRoute {
1315    /**
1316     * A pointer to the opaque Rust object.
1317     * Nearly everywhere, inner must be non-null, however in places where
1318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1319     */
1320    LDKnativeRoute *inner;
1321    /**
1322     * Indicates that this is the only struct which contains the same pointer.
1323     * Rust functions which take ownership of an object provided via an argument require
1324     * this to be true and invalidate the object pointed to by inner.
1325     */
1326    bool is_owned;
1327 } LDKRoute;
1328
1329 /**
1330  * The contents of CResult_RouteDecodeErrorZ
1331  */
1332 typedef union LDKCResult_RouteDecodeErrorZPtr {
1333    /**
1334     * A pointer to the contents in the success state.
1335     * Reading from this pointer when `result_ok` is not set is undefined.
1336     */
1337    struct LDKRoute *result;
1338    /**
1339     * A pointer to the contents in the error state.
1340     * Reading from this pointer when `result_ok` is set is undefined.
1341     */
1342    struct LDKDecodeError *err;
1343 } LDKCResult_RouteDecodeErrorZPtr;
1344
1345 /**
1346  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1347  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1349  */
1350 typedef struct LDKCResult_RouteDecodeErrorZ {
1351    /**
1352     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1353     * `err` or `result` depending on the state of `result_ok`.
1354     */
1355    union LDKCResult_RouteDecodeErrorZPtr contents;
1356    /**
1357     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1358     */
1359    bool result_ok;
1360 } LDKCResult_RouteDecodeErrorZ;
1361
1362 /**
1363  * An enum which can either contain a u64 or not
1364  */
1365 typedef enum LDKCOption_u64Z_Tag {
1366    /**
1367     * When we're in this state, this COption_u64Z contains a u64
1368     */
1369    LDKCOption_u64Z_Some,
1370    /**
1371     * When we're in this state, this COption_u64Z contains nothing
1372     */
1373    LDKCOption_u64Z_None,
1374    /**
1375     * Must be last for serialization purposes
1376     */
1377    LDKCOption_u64Z_Sentinel,
1378 } LDKCOption_u64Z_Tag;
1379
1380 typedef struct LDKCOption_u64Z {
1381    LDKCOption_u64Z_Tag tag;
1382    union {
1383       struct {
1384          uint64_t some;
1385       };
1386    };
1387 } LDKCOption_u64Z;
1388
1389
1390
1391 /**
1392  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1393  */
1394 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1395    /**
1396     * A pointer to the opaque Rust object.
1397     * Nearly everywhere, inner must be non-null, however in places where
1398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1399     */
1400    LDKnativeChannelDetails *inner;
1401    /**
1402     * Indicates that this is the only struct which contains the same pointer.
1403     * Rust functions which take ownership of an object provided via an argument require
1404     * this to be true and invalidate the object pointed to by inner.
1405     */
1406    bool is_owned;
1407 } LDKChannelDetails;
1408
1409 /**
1410  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1411  * This corresponds to std::vector in C++
1412  */
1413 typedef struct LDKCVec_ChannelDetailsZ {
1414    /**
1415     * The elements in the array.
1416     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1417     */
1418    struct LDKChannelDetails *data;
1419    /**
1420     * The number of elements pointed to by `data`.
1421     */
1422    uintptr_t datalen;
1423 } LDKCVec_ChannelDetailsZ;
1424
1425
1426
1427 /**
1428  * A list of hops along a payment path terminating with a channel to the recipient.
1429  */
1430 typedef struct MUST_USE_STRUCT LDKRouteHint {
1431    /**
1432     * A pointer to the opaque Rust object.
1433     * Nearly everywhere, inner must be non-null, however in places where
1434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1435     */
1436    LDKnativeRouteHint *inner;
1437    /**
1438     * Indicates that this is the only struct which contains the same pointer.
1439     * Rust functions which take ownership of an object provided via an argument require
1440     * this to be true and invalidate the object pointed to by inner.
1441     */
1442    bool is_owned;
1443 } LDKRouteHint;
1444
1445 /**
1446  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1447  * This corresponds to std::vector in C++
1448  */
1449 typedef struct LDKCVec_RouteHintZ {
1450    /**
1451     * The elements in the array.
1452     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1453     */
1454    struct LDKRouteHint *data;
1455    /**
1456     * The number of elements pointed to by `data`.
1457     */
1458    uintptr_t datalen;
1459 } LDKCVec_RouteHintZ;
1460
1461
1462
1463 /**
1464  * An Err type for failure to process messages.
1465  */
1466 typedef struct MUST_USE_STRUCT LDKLightningError {
1467    /**
1468     * A pointer to the opaque Rust object.
1469     * Nearly everywhere, inner must be non-null, however in places where
1470     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1471     */
1472    LDKnativeLightningError *inner;
1473    /**
1474     * Indicates that this is the only struct which contains the same pointer.
1475     * Rust functions which take ownership of an object provided via an argument require
1476     * this to be true and invalidate the object pointed to by inner.
1477     */
1478    bool is_owned;
1479 } LDKLightningError;
1480
1481 /**
1482  * The contents of CResult_RouteLightningErrorZ
1483  */
1484 typedef union LDKCResult_RouteLightningErrorZPtr {
1485    /**
1486     * A pointer to the contents in the success state.
1487     * Reading from this pointer when `result_ok` is not set is undefined.
1488     */
1489    struct LDKRoute *result;
1490    /**
1491     * A pointer to the contents in the error state.
1492     * Reading from this pointer when `result_ok` is set is undefined.
1493     */
1494    struct LDKLightningError *err;
1495 } LDKCResult_RouteLightningErrorZPtr;
1496
1497 /**
1498  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1499  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1500  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1501  */
1502 typedef struct LDKCResult_RouteLightningErrorZ {
1503    /**
1504     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1505     * `err` or `result` depending on the state of `result_ok`.
1506     */
1507    union LDKCResult_RouteLightningErrorZPtr contents;
1508    /**
1509     * Whether this CResult_RouteLightningErrorZ represents a success state.
1510     */
1511    bool result_ok;
1512 } LDKCResult_RouteLightningErrorZ;
1513
1514 /**
1515  * The contents of CResult_TxOutAccessErrorZ
1516  */
1517 typedef union LDKCResult_TxOutAccessErrorZPtr {
1518    /**
1519     * A pointer to the contents in the success state.
1520     * Reading from this pointer when `result_ok` is not set is undefined.
1521     */
1522    struct LDKTxOut *result;
1523    /**
1524     * A pointer to the contents in the error state.
1525     * Reading from this pointer when `result_ok` is set is undefined.
1526     */
1527    enum LDKAccessError *err;
1528 } LDKCResult_TxOutAccessErrorZPtr;
1529
1530 /**
1531  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1532  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1534  */
1535 typedef struct LDKCResult_TxOutAccessErrorZ {
1536    /**
1537     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1538     * `err` or `result` depending on the state of `result_ok`.
1539     */
1540    union LDKCResult_TxOutAccessErrorZPtr contents;
1541    /**
1542     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1543     */
1544    bool result_ok;
1545 } LDKCResult_TxOutAccessErrorZ;
1546
1547 /**
1548  * A tuple of 2 elements. See the individual fields for the types contained.
1549  */
1550 typedef struct LDKC2Tuple_usizeTransactionZ {
1551    /**
1552     * The element at position 0
1553     */
1554    uintptr_t a;
1555    /**
1556     * The element at position 1
1557     */
1558    struct LDKTransaction b;
1559 } LDKC2Tuple_usizeTransactionZ;
1560
1561 /**
1562  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1563  * This corresponds to std::vector in C++
1564  */
1565 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1566    /**
1567     * The elements in the array.
1568     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1569     */
1570    struct LDKC2Tuple_usizeTransactionZ *data;
1571    /**
1572     * The number of elements pointed to by `data`.
1573     */
1574    uintptr_t datalen;
1575 } LDKCVec_C2Tuple_usizeTransactionZZ;
1576
1577 /**
1578  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1579  * look up the corresponding function in rust-lightning's docs.
1580  */
1581 typedef struct LDKThirtyTwoBytes {
1582    /**
1583     * The thirty-two bytes
1584     */
1585    uint8_t data[32];
1586 } LDKThirtyTwoBytes;
1587
1588 /**
1589  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1590  * This corresponds to std::vector in C++
1591  */
1592 typedef struct LDKCVec_TxidZ {
1593    /**
1594     * The elements in the array.
1595     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1596     */
1597    struct LDKThirtyTwoBytes *data;
1598    /**
1599     * The number of elements pointed to by `data`.
1600     */
1601    uintptr_t datalen;
1602 } LDKCVec_TxidZ;
1603
1604 /**
1605  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1606  */
1607 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1608    /**
1609     * Note that this value is always NULL, as there are no contents in the OK variant
1610     */
1611    void *result;
1612    /**
1613     * A pointer to the contents in the error state.
1614     * Reading from this pointer when `result_ok` is set is undefined.
1615     */
1616    enum LDKChannelMonitorUpdateErr *err;
1617 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1618
1619 /**
1620  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1621  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1623  */
1624 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1625    /**
1626     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1627     * `err` or `result` depending on the state of `result_ok`.
1628     */
1629    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1630    /**
1631     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1632     */
1633    bool result_ok;
1634 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1635
1636
1637
1638 /**
1639  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1640  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1641  * preimage claim backward will lead to loss of funds.
1642  */
1643 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1644    /**
1645     * A pointer to the opaque Rust object.
1646     * Nearly everywhere, inner must be non-null, however in places where
1647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1648     */
1649    LDKnativeHTLCUpdate *inner;
1650    /**
1651     * Indicates that this is the only struct which contains the same pointer.
1652     * Rust functions which take ownership of an object provided via an argument require
1653     * this to be true and invalidate the object pointed to by inner.
1654     */
1655    bool is_owned;
1656 } LDKHTLCUpdate;
1657
1658
1659
1660 /**
1661  * A reference to a transaction output.
1662  *
1663  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1664  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1665  */
1666 typedef struct MUST_USE_STRUCT LDKOutPoint {
1667    /**
1668     * A pointer to the opaque Rust object.
1669     * Nearly everywhere, inner must be non-null, however in places where
1670     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1671     */
1672    LDKnativeOutPoint *inner;
1673    /**
1674     * Indicates that this is the only struct which contains the same pointer.
1675     * Rust functions which take ownership of an object provided via an argument require
1676     * this to be true and invalidate the object pointed to by inner.
1677     */
1678    bool is_owned;
1679 } LDKOutPoint;
1680
1681 /**
1682  * An event to be processed by the ChannelManager.
1683  */
1684 typedef enum LDKMonitorEvent_Tag {
1685    /**
1686     * A monitor event containing an HTLCUpdate.
1687     */
1688    LDKMonitorEvent_HTLCEvent,
1689    /**
1690     * A monitor event that the Channel's commitment transaction was broadcasted.
1691     */
1692    LDKMonitorEvent_CommitmentTxBroadcasted,
1693    /**
1694     * Must be last for serialization purposes
1695     */
1696    LDKMonitorEvent_Sentinel,
1697 } LDKMonitorEvent_Tag;
1698
1699 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1700    LDKMonitorEvent_Tag tag;
1701    union {
1702       struct {
1703          struct LDKHTLCUpdate htlc_event;
1704       };
1705       struct {
1706          struct LDKOutPoint commitment_tx_broadcasted;
1707       };
1708    };
1709 } LDKMonitorEvent;
1710
1711 /**
1712  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1713  * This corresponds to std::vector in C++
1714  */
1715 typedef struct LDKCVec_MonitorEventZ {
1716    /**
1717     * The elements in the array.
1718     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1719     */
1720    struct LDKMonitorEvent *data;
1721    /**
1722     * The number of elements pointed to by `data`.
1723     */
1724    uintptr_t datalen;
1725 } LDKCVec_MonitorEventZ;
1726
1727 /**
1728  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
1729  */
1730 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
1731    /**
1732     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
1733     */
1734    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
1735    /**
1736     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
1737     */
1738    LDKCOption_C2Tuple_usizeTransactionZZ_None,
1739    /**
1740     * Must be last for serialization purposes
1741     */
1742    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
1743 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
1744
1745 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
1746    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
1747    union {
1748       struct {
1749          struct LDKC2Tuple_usizeTransactionZ some;
1750       };
1751    };
1752 } LDKCOption_C2Tuple_usizeTransactionZZ;
1753
1754
1755
1756 /**
1757  * Information about a spendable output to a P2WSH script. See
1758  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1759  */
1760 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1761    /**
1762     * A pointer to the opaque Rust object.
1763     * Nearly everywhere, inner must be non-null, however in places where
1764     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1765     */
1766    LDKnativeDelayedPaymentOutputDescriptor *inner;
1767    /**
1768     * Indicates that this is the only struct which contains the same pointer.
1769     * Rust functions which take ownership of an object provided via an argument require
1770     * this to be true and invalidate the object pointed to by inner.
1771     */
1772    bool is_owned;
1773 } LDKDelayedPaymentOutputDescriptor;
1774
1775
1776
1777 /**
1778  * Information about a spendable output to our \"payment key\". See
1779  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1780  */
1781 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1782    /**
1783     * A pointer to the opaque Rust object.
1784     * Nearly everywhere, inner must be non-null, however in places where
1785     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1786     */
1787    LDKnativeStaticPaymentOutputDescriptor *inner;
1788    /**
1789     * Indicates that this is the only struct which contains the same pointer.
1790     * Rust functions which take ownership of an object provided via an argument require
1791     * this to be true and invalidate the object pointed to by inner.
1792     */
1793    bool is_owned;
1794 } LDKStaticPaymentOutputDescriptor;
1795
1796 /**
1797  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1798  * claim at any point in the future) an event is generated which you must track and be able to
1799  * spend on-chain. The information needed to do this is provided in this enum, including the
1800  * outpoint describing which txid and output index is available, the full output which exists at
1801  * that txid/index, and any keys or other information required to sign.
1802  */
1803 typedef enum LDKSpendableOutputDescriptor_Tag {
1804    /**
1805     * An output to a script which was provided via KeysInterface directly, either from
1806     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1807     * spend it. No secret keys are provided as rust-lightning was never given any key.
1808     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1809     * on-chain using the payment preimage or after it has timed out.
1810     */
1811    LDKSpendableOutputDescriptor_StaticOutput,
1812    /**
1813     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1814     *
1815     * The witness in the spending input should be:
1816     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1817     *
1818     * Note that the nSequence field in the spending input must be set to to_self_delay
1819     * (which means the transaction is not broadcastable until at least to_self_delay
1820     * blocks after the outpoint confirms).
1821     *
1822     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1823     * it is an output from an old state which we broadcast (which should never happen).
1824     *
1825     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1826     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1827     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1828     * chan_utils::derive_private_key. The public key can be generated without the secret key
1829     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1830     * Sign::pubkeys().
1831     *
1832     * To derive the revocation_pubkey provided here (which is used in the witness
1833     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1834     * call to Sign::ready_channel) and the provided per_commitment point
1835     * to chan_utils::derive_public_revocation_key.
1836     *
1837     * The witness script which is hashed and included in the output script_pubkey may be
1838     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1839     * (derived as above), and the to_self_delay contained here to
1840     * chan_utils::get_revokeable_redeemscript.
1841     */
1842    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1843    /**
1844     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1845     * corresponds to the public key in Sign::pubkeys().payment_point).
1846     * The witness in the spending input, is, thus, simply:
1847     * <BIP 143 signature> <payment key>
1848     *
1849     * These are generally the result of our counterparty having broadcast the current state,
1850     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1851     */
1852    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1853    /**
1854     * Must be last for serialization purposes
1855     */
1856    LDKSpendableOutputDescriptor_Sentinel,
1857 } LDKSpendableOutputDescriptor_Tag;
1858
1859 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1860    /**
1861     * The outpoint which is spendable
1862     */
1863    struct LDKOutPoint outpoint;
1864    /**
1865     * The output which is referenced by the given outpoint.
1866     */
1867    struct LDKTxOut output;
1868 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1869
1870 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1871    LDKSpendableOutputDescriptor_Tag tag;
1872    union {
1873       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1874       struct {
1875          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1876       };
1877       struct {
1878          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1879       };
1880    };
1881 } LDKSpendableOutputDescriptor;
1882
1883 /**
1884  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1885  * This corresponds to std::vector in C++
1886  */
1887 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1888    /**
1889     * The elements in the array.
1890     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1891     */
1892    struct LDKSpendableOutputDescriptor *data;
1893    /**
1894     * The number of elements pointed to by `data`.
1895     */
1896    uintptr_t datalen;
1897 } LDKCVec_SpendableOutputDescriptorZ;
1898
1899
1900
1901 /**
1902  * An accept_channel message to be sent or received from a peer
1903  */
1904 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
1905    /**
1906     * A pointer to the opaque Rust object.
1907     * Nearly everywhere, inner must be non-null, however in places where
1908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1909     */
1910    LDKnativeAcceptChannel *inner;
1911    /**
1912     * Indicates that this is the only struct which contains the same pointer.
1913     * Rust functions which take ownership of an object provided via an argument require
1914     * this to be true and invalidate the object pointed to by inner.
1915     */
1916    bool is_owned;
1917 } LDKAcceptChannel;
1918
1919
1920
1921 /**
1922  * An open_channel message to be sent or received from a peer
1923  */
1924 typedef struct MUST_USE_STRUCT LDKOpenChannel {
1925    /**
1926     * A pointer to the opaque Rust object.
1927     * Nearly everywhere, inner must be non-null, however in places where
1928     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1929     */
1930    LDKnativeOpenChannel *inner;
1931    /**
1932     * Indicates that this is the only struct which contains the same pointer.
1933     * Rust functions which take ownership of an object provided via an argument require
1934     * this to be true and invalidate the object pointed to by inner.
1935     */
1936    bool is_owned;
1937 } LDKOpenChannel;
1938
1939
1940
1941 /**
1942  * A funding_created message to be sent or received from a peer
1943  */
1944 typedef struct MUST_USE_STRUCT LDKFundingCreated {
1945    /**
1946     * A pointer to the opaque Rust object.
1947     * Nearly everywhere, inner must be non-null, however in places where
1948     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1949     */
1950    LDKnativeFundingCreated *inner;
1951    /**
1952     * Indicates that this is the only struct which contains the same pointer.
1953     * Rust functions which take ownership of an object provided via an argument require
1954     * this to be true and invalidate the object pointed to by inner.
1955     */
1956    bool is_owned;
1957 } LDKFundingCreated;
1958
1959
1960
1961 /**
1962  * A funding_signed message to be sent or received from a peer
1963  */
1964 typedef struct MUST_USE_STRUCT LDKFundingSigned {
1965    /**
1966     * A pointer to the opaque Rust object.
1967     * Nearly everywhere, inner must be non-null, however in places where
1968     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1969     */
1970    LDKnativeFundingSigned *inner;
1971    /**
1972     * Indicates that this is the only struct which contains the same pointer.
1973     * Rust functions which take ownership of an object provided via an argument require
1974     * this to be true and invalidate the object pointed to by inner.
1975     */
1976    bool is_owned;
1977 } LDKFundingSigned;
1978
1979
1980
1981 /**
1982  * A funding_locked message to be sent or received from a peer
1983  */
1984 typedef struct MUST_USE_STRUCT LDKFundingLocked {
1985    /**
1986     * A pointer to the opaque Rust object.
1987     * Nearly everywhere, inner must be non-null, however in places where
1988     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1989     */
1990    LDKnativeFundingLocked *inner;
1991    /**
1992     * Indicates that this is the only struct which contains the same pointer.
1993     * Rust functions which take ownership of an object provided via an argument require
1994     * this to be true and invalidate the object pointed to by inner.
1995     */
1996    bool is_owned;
1997 } LDKFundingLocked;
1998
1999
2000
2001 /**
2002  * An announcement_signatures message to be sent or received from a peer
2003  */
2004 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2005    /**
2006     * A pointer to the opaque Rust object.
2007     * Nearly everywhere, inner must be non-null, however in places where
2008     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2009     */
2010    LDKnativeAnnouncementSignatures *inner;
2011    /**
2012     * Indicates that this is the only struct which contains the same pointer.
2013     * Rust functions which take ownership of an object provided via an argument require
2014     * this to be true and invalidate the object pointed to by inner.
2015     */
2016    bool is_owned;
2017 } LDKAnnouncementSignatures;
2018
2019
2020
2021 /**
2022  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2023  * transaction updates if they were pending.
2024  */
2025 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2026    /**
2027     * A pointer to the opaque Rust object.
2028     * Nearly everywhere, inner must be non-null, however in places where
2029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2030     */
2031    LDKnativeCommitmentUpdate *inner;
2032    /**
2033     * Indicates that this is the only struct which contains the same pointer.
2034     * Rust functions which take ownership of an object provided via an argument require
2035     * this to be true and invalidate the object pointed to by inner.
2036     */
2037    bool is_owned;
2038 } LDKCommitmentUpdate;
2039
2040
2041
2042 /**
2043  * A revoke_and_ack message to be sent or received from a peer
2044  */
2045 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2046    /**
2047     * A pointer to the opaque Rust object.
2048     * Nearly everywhere, inner must be non-null, however in places where
2049     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2050     */
2051    LDKnativeRevokeAndACK *inner;
2052    /**
2053     * Indicates that this is the only struct which contains the same pointer.
2054     * Rust functions which take ownership of an object provided via an argument require
2055     * this to be true and invalidate the object pointed to by inner.
2056     */
2057    bool is_owned;
2058 } LDKRevokeAndACK;
2059
2060
2061
2062 /**
2063  * A closing_signed message to be sent or received from a peer
2064  */
2065 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2066    /**
2067     * A pointer to the opaque Rust object.
2068     * Nearly everywhere, inner must be non-null, however in places where
2069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2070     */
2071    LDKnativeClosingSigned *inner;
2072    /**
2073     * Indicates that this is the only struct which contains the same pointer.
2074     * Rust functions which take ownership of an object provided via an argument require
2075     * this to be true and invalidate the object pointed to by inner.
2076     */
2077    bool is_owned;
2078 } LDKClosingSigned;
2079
2080
2081
2082 /**
2083  * A shutdown message to be sent or received from a peer
2084  */
2085 typedef struct MUST_USE_STRUCT LDKShutdown {
2086    /**
2087     * A pointer to the opaque Rust object.
2088     * Nearly everywhere, inner must be non-null, however in places where
2089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2090     */
2091    LDKnativeShutdown *inner;
2092    /**
2093     * Indicates that this is the only struct which contains the same pointer.
2094     * Rust functions which take ownership of an object provided via an argument require
2095     * this to be true and invalidate the object pointed to by inner.
2096     */
2097    bool is_owned;
2098 } LDKShutdown;
2099
2100
2101
2102 /**
2103  * A channel_reestablish message to be sent or received from a peer
2104  */
2105 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2106    /**
2107     * A pointer to the opaque Rust object.
2108     * Nearly everywhere, inner must be non-null, however in places where
2109     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2110     */
2111    LDKnativeChannelReestablish *inner;
2112    /**
2113     * Indicates that this is the only struct which contains the same pointer.
2114     * Rust functions which take ownership of an object provided via an argument require
2115     * this to be true and invalidate the object pointed to by inner.
2116     */
2117    bool is_owned;
2118 } LDKChannelReestablish;
2119
2120
2121
2122 /**
2123  * A channel_announcement message to be sent or received from a peer
2124  */
2125 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2126    /**
2127     * A pointer to the opaque Rust object.
2128     * Nearly everywhere, inner must be non-null, however in places where
2129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2130     */
2131    LDKnativeChannelAnnouncement *inner;
2132    /**
2133     * Indicates that this is the only struct which contains the same pointer.
2134     * Rust functions which take ownership of an object provided via an argument require
2135     * this to be true and invalidate the object pointed to by inner.
2136     */
2137    bool is_owned;
2138 } LDKChannelAnnouncement;
2139
2140
2141
2142 /**
2143  * A channel_update message to be sent or received from a peer
2144  */
2145 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2146    /**
2147     * A pointer to the opaque Rust object.
2148     * Nearly everywhere, inner must be non-null, however in places where
2149     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2150     */
2151    LDKnativeChannelUpdate *inner;
2152    /**
2153     * Indicates that this is the only struct which contains the same pointer.
2154     * Rust functions which take ownership of an object provided via an argument require
2155     * this to be true and invalidate the object pointed to by inner.
2156     */
2157    bool is_owned;
2158 } LDKChannelUpdate;
2159
2160
2161
2162 /**
2163  * A node_announcement message to be sent or received from a peer
2164  */
2165 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2166    /**
2167     * A pointer to the opaque Rust object.
2168     * Nearly everywhere, inner must be non-null, however in places where
2169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2170     */
2171    LDKnativeNodeAnnouncement *inner;
2172    /**
2173     * Indicates that this is the only struct which contains the same pointer.
2174     * Rust functions which take ownership of an object provided via an argument require
2175     * this to be true and invalidate the object pointed to by inner.
2176     */
2177    bool is_owned;
2178 } LDKNodeAnnouncement;
2179
2180
2181
2182 /**
2183  * An error message to be sent or received from a peer
2184  */
2185 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2186    /**
2187     * A pointer to the opaque Rust object.
2188     * Nearly everywhere, inner must be non-null, however in places where
2189     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2190     */
2191    LDKnativeErrorMessage *inner;
2192    /**
2193     * Indicates that this is the only struct which contains the same pointer.
2194     * Rust functions which take ownership of an object provided via an argument require
2195     * this to be true and invalidate the object pointed to by inner.
2196     */
2197    bool is_owned;
2198 } LDKErrorMessage;
2199
2200 /**
2201  * Used to put an error message in a LightningError
2202  */
2203 typedef enum LDKErrorAction_Tag {
2204    /**
2205     * The peer took some action which made us think they were useless. Disconnect them.
2206     */
2207    LDKErrorAction_DisconnectPeer,
2208    /**
2209     * The peer did something harmless that we weren't able to process, just log and ignore
2210     */
2211    LDKErrorAction_IgnoreError,
2212    /**
2213     * The peer did something incorrect. Tell them.
2214     */
2215    LDKErrorAction_SendErrorMessage,
2216    /**
2217     * Must be last for serialization purposes
2218     */
2219    LDKErrorAction_Sentinel,
2220 } LDKErrorAction_Tag;
2221
2222 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2223    /**
2224     * An error message which we should make an effort to send before we disconnect.
2225     */
2226    struct LDKErrorMessage msg;
2227 } LDKErrorAction_LDKDisconnectPeer_Body;
2228
2229 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2230    /**
2231     * The message to send.
2232     */
2233    struct LDKErrorMessage msg;
2234 } LDKErrorAction_LDKSendErrorMessage_Body;
2235
2236 typedef struct MUST_USE_STRUCT LDKErrorAction {
2237    LDKErrorAction_Tag tag;
2238    union {
2239       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2240       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2241    };
2242 } LDKErrorAction;
2243
2244 /**
2245  * The information we received from a peer along the route of a payment we originated. This is
2246  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2247  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2248  */
2249 typedef enum LDKHTLCFailChannelUpdate_Tag {
2250    /**
2251     * We received an error which included a full ChannelUpdate message.
2252     */
2253    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2254    /**
2255     * We received an error which indicated only that a channel has been closed
2256     */
2257    LDKHTLCFailChannelUpdate_ChannelClosed,
2258    /**
2259     * We received an error which indicated only that a node has failed
2260     */
2261    LDKHTLCFailChannelUpdate_NodeFailure,
2262    /**
2263     * Must be last for serialization purposes
2264     */
2265    LDKHTLCFailChannelUpdate_Sentinel,
2266 } LDKHTLCFailChannelUpdate_Tag;
2267
2268 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2269    /**
2270     * The unwrapped message we received
2271     */
2272    struct LDKChannelUpdate msg;
2273 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2274
2275 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2276    /**
2277     * The short_channel_id which has now closed.
2278     */
2279    uint64_t short_channel_id;
2280    /**
2281     * when this true, this channel should be permanently removed from the
2282     * consideration. Otherwise, this channel can be restored as new channel_update is received
2283     */
2284    bool is_permanent;
2285 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2286
2287 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2288    /**
2289     * The node_id that has failed.
2290     */
2291    struct LDKPublicKey node_id;
2292    /**
2293     * when this true, node should be permanently removed from the
2294     * consideration. Otherwise, the channels connected to this node can be
2295     * restored as new channel_update is received
2296     */
2297    bool is_permanent;
2298 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2299
2300 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2301    LDKHTLCFailChannelUpdate_Tag tag;
2302    union {
2303       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2304       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2305       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2306    };
2307 } LDKHTLCFailChannelUpdate;
2308
2309
2310
2311 /**
2312  * A query_channel_range message is used to query a peer for channel
2313  * UTXOs in a range of blocks. The recipient of a query makes a best
2314  * effort to reply to the query using one or more reply_channel_range
2315  * messages.
2316  */
2317 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2318    /**
2319     * A pointer to the opaque Rust object.
2320     * Nearly everywhere, inner must be non-null, however in places where
2321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2322     */
2323    LDKnativeQueryChannelRange *inner;
2324    /**
2325     * Indicates that this is the only struct which contains the same pointer.
2326     * Rust functions which take ownership of an object provided via an argument require
2327     * this to be true and invalidate the object pointed to by inner.
2328     */
2329    bool is_owned;
2330 } LDKQueryChannelRange;
2331
2332
2333
2334 /**
2335  * A query_short_channel_ids message is used to query a peer for
2336  * routing gossip messages related to one or more short_channel_ids.
2337  * The query recipient will reply with the latest, if available,
2338  * channel_announcement, channel_update and node_announcement messages
2339  * it maintains for the requested short_channel_ids followed by a
2340  * reply_short_channel_ids_end message. The short_channel_ids sent in
2341  * this query are encoded. We only support encoding_type=0 uncompressed
2342  * serialization and do not support encoding_type=1 zlib serialization.
2343  */
2344 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2345    /**
2346     * A pointer to the opaque Rust object.
2347     * Nearly everywhere, inner must be non-null, however in places where
2348     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2349     */
2350    LDKnativeQueryShortChannelIds *inner;
2351    /**
2352     * Indicates that this is the only struct which contains the same pointer.
2353     * Rust functions which take ownership of an object provided via an argument require
2354     * this to be true and invalidate the object pointed to by inner.
2355     */
2356    bool is_owned;
2357 } LDKQueryShortChannelIds;
2358
2359
2360
2361 /**
2362  * A reply_channel_range message is a reply to a query_channel_range
2363  * message. Multiple reply_channel_range messages can be sent in reply
2364  * to a single query_channel_range message. The query recipient makes a
2365  * best effort to respond based on their local network view which may
2366  * not be a perfect view of the network. The short_channel_ids in the
2367  * reply are encoded. We only support encoding_type=0 uncompressed
2368  * serialization and do not support encoding_type=1 zlib serialization.
2369  */
2370 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2371    /**
2372     * A pointer to the opaque Rust object.
2373     * Nearly everywhere, inner must be non-null, however in places where
2374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2375     */
2376    LDKnativeReplyChannelRange *inner;
2377    /**
2378     * Indicates that this is the only struct which contains the same pointer.
2379     * Rust functions which take ownership of an object provided via an argument require
2380     * this to be true and invalidate the object pointed to by inner.
2381     */
2382    bool is_owned;
2383 } LDKReplyChannelRange;
2384
2385 /**
2386  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2387  * broadcast to most peers).
2388  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2389  */
2390 typedef enum LDKMessageSendEvent_Tag {
2391    /**
2392     * Used to indicate that we've accepted a channel open and should send the accept_channel
2393     * message provided to the given peer.
2394     */
2395    LDKMessageSendEvent_SendAcceptChannel,
2396    /**
2397     * Used to indicate that we've initiated a channel open and should send the open_channel
2398     * message provided to the given peer.
2399     */
2400    LDKMessageSendEvent_SendOpenChannel,
2401    /**
2402     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2403     */
2404    LDKMessageSendEvent_SendFundingCreated,
2405    /**
2406     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2407     */
2408    LDKMessageSendEvent_SendFundingSigned,
2409    /**
2410     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2411     */
2412    LDKMessageSendEvent_SendFundingLocked,
2413    /**
2414     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2415     */
2416    LDKMessageSendEvent_SendAnnouncementSignatures,
2417    /**
2418     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2419     * message should be sent to the peer with the given node_id.
2420     */
2421    LDKMessageSendEvent_UpdateHTLCs,
2422    /**
2423     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2424     */
2425    LDKMessageSendEvent_SendRevokeAndACK,
2426    /**
2427     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2428     */
2429    LDKMessageSendEvent_SendClosingSigned,
2430    /**
2431     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2432     */
2433    LDKMessageSendEvent_SendShutdown,
2434    /**
2435     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2436     */
2437    LDKMessageSendEvent_SendChannelReestablish,
2438    /**
2439     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2440     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2441     *
2442     * Note that after doing so, you very likely (unless you did so very recently) want to call
2443     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2444     * This ensures that any nodes which see our channel_announcement also have a relevant
2445     * node_announcement, including relevant feature flags which may be important for routing
2446     * through or to us.
2447     */
2448    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2449    /**
2450     * Used to indicate that a node_announcement should be broadcast to all peers.
2451     */
2452    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2453    /**
2454     * Used to indicate that a channel_update should be broadcast to all peers.
2455     */
2456    LDKMessageSendEvent_BroadcastChannelUpdate,
2457    /**
2458     * Broadcast an error downstream to be handled
2459     */
2460    LDKMessageSendEvent_HandleError,
2461    /**
2462     * When a payment fails we may receive updates back from the hop where it failed. In such
2463     * cases this event is generated so that we can inform the network graph of this information.
2464     */
2465    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
2466    /**
2467     * Query a peer for channels with funding transaction UTXOs in a block range.
2468     */
2469    LDKMessageSendEvent_SendChannelRangeQuery,
2470    /**
2471     * Request routing gossip messages from a peer for a list of channels identified by
2472     * their short_channel_ids.
2473     */
2474    LDKMessageSendEvent_SendShortIdsQuery,
2475    /**
2476     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2477     * emitted during processing of the query.
2478     */
2479    LDKMessageSendEvent_SendReplyChannelRange,
2480    /**
2481     * Must be last for serialization purposes
2482     */
2483    LDKMessageSendEvent_Sentinel,
2484 } LDKMessageSendEvent_Tag;
2485
2486 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2487    /**
2488     * The node_id of the node which should receive this message
2489     */
2490    struct LDKPublicKey node_id;
2491    /**
2492     * The message which should be sent.
2493     */
2494    struct LDKAcceptChannel msg;
2495 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2496
2497 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2498    /**
2499     * The node_id of the node which should receive this message
2500     */
2501    struct LDKPublicKey node_id;
2502    /**
2503     * The message which should be sent.
2504     */
2505    struct LDKOpenChannel msg;
2506 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2507
2508 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2509    /**
2510     * The node_id of the node which should receive this message
2511     */
2512    struct LDKPublicKey node_id;
2513    /**
2514     * The message which should be sent.
2515     */
2516    struct LDKFundingCreated msg;
2517 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2518
2519 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2520    /**
2521     * The node_id of the node which should receive this message
2522     */
2523    struct LDKPublicKey node_id;
2524    /**
2525     * The message which should be sent.
2526     */
2527    struct LDKFundingSigned msg;
2528 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2529
2530 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2531    /**
2532     * The node_id of the node which should receive these message(s)
2533     */
2534    struct LDKPublicKey node_id;
2535    /**
2536     * The funding_locked message which should be sent.
2537     */
2538    struct LDKFundingLocked msg;
2539 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2540
2541 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2542    /**
2543     * The node_id of the node which should receive these message(s)
2544     */
2545    struct LDKPublicKey node_id;
2546    /**
2547     * The announcement_signatures message which should be sent.
2548     */
2549    struct LDKAnnouncementSignatures msg;
2550 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2551
2552 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2553    /**
2554     * The node_id of the node which should receive these message(s)
2555     */
2556    struct LDKPublicKey node_id;
2557    /**
2558     * The update messages which should be sent. ALL messages in the struct should be sent!
2559     */
2560    struct LDKCommitmentUpdate updates;
2561 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2562
2563 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2564    /**
2565     * The node_id of the node which should receive this message
2566     */
2567    struct LDKPublicKey node_id;
2568    /**
2569     * The message which should be sent.
2570     */
2571    struct LDKRevokeAndACK msg;
2572 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2573
2574 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2575    /**
2576     * The node_id of the node which should receive this message
2577     */
2578    struct LDKPublicKey node_id;
2579    /**
2580     * The message which should be sent.
2581     */
2582    struct LDKClosingSigned msg;
2583 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2584
2585 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2586    /**
2587     * The node_id of the node which should receive this message
2588     */
2589    struct LDKPublicKey node_id;
2590    /**
2591     * The message which should be sent.
2592     */
2593    struct LDKShutdown msg;
2594 } LDKMessageSendEvent_LDKSendShutdown_Body;
2595
2596 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
2597    /**
2598     * The node_id of the node which should receive this message
2599     */
2600    struct LDKPublicKey node_id;
2601    /**
2602     * The message which should be sent.
2603     */
2604    struct LDKChannelReestablish msg;
2605 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2606
2607 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2608    /**
2609     * The channel_announcement which should be sent.
2610     */
2611    struct LDKChannelAnnouncement msg;
2612    /**
2613     * The followup channel_update which should be sent.
2614     */
2615    struct LDKChannelUpdate update_msg;
2616 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2617
2618 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2619    /**
2620     * The node_announcement which should be sent.
2621     */
2622    struct LDKNodeAnnouncement msg;
2623 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2624
2625 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2626    /**
2627     * The channel_update which should be sent.
2628     */
2629    struct LDKChannelUpdate msg;
2630 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2631
2632 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2633    /**
2634     * The node_id of the node which should receive this message
2635     */
2636    struct LDKPublicKey node_id;
2637    /**
2638     * The action which should be taken.
2639     */
2640    struct LDKErrorAction action;
2641 } LDKMessageSendEvent_LDKHandleError_Body;
2642
2643 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
2644    /**
2645     * The channel/node update which should be sent to NetGraphMsgHandler
2646     */
2647    struct LDKHTLCFailChannelUpdate update;
2648 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
2649
2650 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2651    /**
2652     * The node_id of this message recipient
2653     */
2654    struct LDKPublicKey node_id;
2655    /**
2656     * The query_channel_range which should be sent.
2657     */
2658    struct LDKQueryChannelRange msg;
2659 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2660
2661 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2662    /**
2663     * The node_id of this message recipient
2664     */
2665    struct LDKPublicKey node_id;
2666    /**
2667     * The query_short_channel_ids which should be sent.
2668     */
2669    struct LDKQueryShortChannelIds msg;
2670 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2671
2672 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
2673    /**
2674     * The node_id of this message recipient
2675     */
2676    struct LDKPublicKey node_id;
2677    /**
2678     * The reply_channel_range which should be sent.
2679     */
2680    struct LDKReplyChannelRange msg;
2681 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
2682
2683 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2684    LDKMessageSendEvent_Tag tag;
2685    union {
2686       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2687       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2688       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2689       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2690       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2691       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2692       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2693       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2694       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2695       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2696       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2697       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2698       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2699       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2700       LDKMessageSendEvent_LDKHandleError_Body handle_error;
2701       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
2702       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2703       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2704       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
2705    };
2706 } LDKMessageSendEvent;
2707
2708 /**
2709  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2710  * This corresponds to std::vector in C++
2711  */
2712 typedef struct LDKCVec_MessageSendEventZ {
2713    /**
2714     * The elements in the array.
2715     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2716     */
2717    struct LDKMessageSendEvent *data;
2718    /**
2719     * The number of elements pointed to by `data`.
2720     */
2721    uintptr_t datalen;
2722 } LDKCVec_MessageSendEventZ;
2723
2724
2725
2726 /**
2727  * Features used within an `init` message.
2728  */
2729 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2730    /**
2731     * A pointer to the opaque Rust object.
2732     * Nearly everywhere, inner must be non-null, however in places where
2733     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2734     */
2735    LDKnativeInitFeatures *inner;
2736    /**
2737     * Indicates that this is the only struct which contains the same pointer.
2738     * Rust functions which take ownership of an object provided via an argument require
2739     * this to be true and invalidate the object pointed to by inner.
2740     */
2741    bool is_owned;
2742 } LDKInitFeatures;
2743
2744 /**
2745  * The contents of CResult_InitFeaturesDecodeErrorZ
2746  */
2747 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2748    /**
2749     * A pointer to the contents in the success state.
2750     * Reading from this pointer when `result_ok` is not set is undefined.
2751     */
2752    struct LDKInitFeatures *result;
2753    /**
2754     * A pointer to the contents in the error state.
2755     * Reading from this pointer when `result_ok` is set is undefined.
2756     */
2757    struct LDKDecodeError *err;
2758 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2759
2760 /**
2761  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2762  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2764  */
2765 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2766    /**
2767     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2768     * `err` or `result` depending on the state of `result_ok`.
2769     */
2770    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2771    /**
2772     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2773     */
2774    bool result_ok;
2775 } LDKCResult_InitFeaturesDecodeErrorZ;
2776
2777
2778
2779 /**
2780  * Features used within a `node_announcement` message.
2781  */
2782 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2783    /**
2784     * A pointer to the opaque Rust object.
2785     * Nearly everywhere, inner must be non-null, however in places where
2786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2787     */
2788    LDKnativeNodeFeatures *inner;
2789    /**
2790     * Indicates that this is the only struct which contains the same pointer.
2791     * Rust functions which take ownership of an object provided via an argument require
2792     * this to be true and invalidate the object pointed to by inner.
2793     */
2794    bool is_owned;
2795 } LDKNodeFeatures;
2796
2797 /**
2798  * The contents of CResult_NodeFeaturesDecodeErrorZ
2799  */
2800 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
2801    /**
2802     * A pointer to the contents in the success state.
2803     * Reading from this pointer when `result_ok` is not set is undefined.
2804     */
2805    struct LDKNodeFeatures *result;
2806    /**
2807     * A pointer to the contents in the error state.
2808     * Reading from this pointer when `result_ok` is set is undefined.
2809     */
2810    struct LDKDecodeError *err;
2811 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
2812
2813 /**
2814  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2815  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2817  */
2818 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
2819    /**
2820     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2821     * `err` or `result` depending on the state of `result_ok`.
2822     */
2823    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
2824    /**
2825     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2826     */
2827    bool result_ok;
2828 } LDKCResult_NodeFeaturesDecodeErrorZ;
2829
2830
2831
2832 /**
2833  * Features used within a `channel_announcement` message.
2834  */
2835 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2836    /**
2837     * A pointer to the opaque Rust object.
2838     * Nearly everywhere, inner must be non-null, however in places where
2839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2840     */
2841    LDKnativeChannelFeatures *inner;
2842    /**
2843     * Indicates that this is the only struct which contains the same pointer.
2844     * Rust functions which take ownership of an object provided via an argument require
2845     * this to be true and invalidate the object pointed to by inner.
2846     */
2847    bool is_owned;
2848 } LDKChannelFeatures;
2849
2850 /**
2851  * The contents of CResult_ChannelFeaturesDecodeErrorZ
2852  */
2853 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
2854    /**
2855     * A pointer to the contents in the success state.
2856     * Reading from this pointer when `result_ok` is not set is undefined.
2857     */
2858    struct LDKChannelFeatures *result;
2859    /**
2860     * A pointer to the contents in the error state.
2861     * Reading from this pointer when `result_ok` is set is undefined.
2862     */
2863    struct LDKDecodeError *err;
2864 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
2865
2866 /**
2867  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2868  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2869  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2870  */
2871 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
2872    /**
2873     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2874     * `err` or `result` depending on the state of `result_ok`.
2875     */
2876    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
2877    /**
2878     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2879     */
2880    bool result_ok;
2881 } LDKCResult_ChannelFeaturesDecodeErrorZ;
2882
2883
2884
2885 /**
2886  * Features used within an invoice.
2887  */
2888 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
2889    /**
2890     * A pointer to the opaque Rust object.
2891     * Nearly everywhere, inner must be non-null, however in places where
2892     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2893     */
2894    LDKnativeInvoiceFeatures *inner;
2895    /**
2896     * Indicates that this is the only struct which contains the same pointer.
2897     * Rust functions which take ownership of an object provided via an argument require
2898     * this to be true and invalidate the object pointed to by inner.
2899     */
2900    bool is_owned;
2901 } LDKInvoiceFeatures;
2902
2903 /**
2904  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
2905  */
2906 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
2907    /**
2908     * A pointer to the contents in the success state.
2909     * Reading from this pointer when `result_ok` is not set is undefined.
2910     */
2911    struct LDKInvoiceFeatures *result;
2912    /**
2913     * A pointer to the contents in the error state.
2914     * Reading from this pointer when `result_ok` is set is undefined.
2915     */
2916    struct LDKDecodeError *err;
2917 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
2918
2919 /**
2920  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2921  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2922  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2923  */
2924 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
2925    /**
2926     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2927     * `err` or `result` depending on the state of `result_ok`.
2928     */
2929    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
2930    /**
2931     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2932     */
2933    bool result_ok;
2934 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
2935
2936 /**
2937  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2938  */
2939 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2940    /**
2941     * A pointer to the contents in the success state.
2942     * Reading from this pointer when `result_ok` is not set is undefined.
2943     */
2944    struct LDKDelayedPaymentOutputDescriptor *result;
2945    /**
2946     * A pointer to the contents in the error state.
2947     * Reading from this pointer when `result_ok` is set is undefined.
2948     */
2949    struct LDKDecodeError *err;
2950 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
2951
2952 /**
2953  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2954  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2955  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2956  */
2957 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2958    /**
2959     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2960     * `err` or `result` depending on the state of `result_ok`.
2961     */
2962    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
2963    /**
2964     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2965     */
2966    bool result_ok;
2967 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
2968
2969 /**
2970  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2971  */
2972 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2973    /**
2974     * A pointer to the contents in the success state.
2975     * Reading from this pointer when `result_ok` is not set is undefined.
2976     */
2977    struct LDKStaticPaymentOutputDescriptor *result;
2978    /**
2979     * A pointer to the contents in the error state.
2980     * Reading from this pointer when `result_ok` is set is undefined.
2981     */
2982    struct LDKDecodeError *err;
2983 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
2984
2985 /**
2986  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2987  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2988  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2989  */
2990 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2991    /**
2992     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2993     * `err` or `result` depending on the state of `result_ok`.
2994     */
2995    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
2996    /**
2997     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2998     */
2999    bool result_ok;
3000 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3001
3002 /**
3003  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3004  */
3005 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3006    /**
3007     * A pointer to the contents in the success state.
3008     * Reading from this pointer when `result_ok` is not set is undefined.
3009     */
3010    struct LDKSpendableOutputDescriptor *result;
3011    /**
3012     * A pointer to the contents in the error state.
3013     * Reading from this pointer when `result_ok` is set is undefined.
3014     */
3015    struct LDKDecodeError *err;
3016 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3017
3018 /**
3019  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3020  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3021  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3022  */
3023 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3024    /**
3025     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3026     * `err` or `result` depending on the state of `result_ok`.
3027     */
3028    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3029    /**
3030     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3031     */
3032    bool result_ok;
3033 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3034
3035 /**
3036  * A tuple of 2 elements. See the individual fields for the types contained.
3037  */
3038 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3039    /**
3040     * The element at position 0
3041     */
3042    struct LDKSignature a;
3043    /**
3044     * The element at position 1
3045     */
3046    struct LDKCVec_SignatureZ b;
3047 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3048
3049 /**
3050  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3051  */
3052 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3053    /**
3054     * A pointer to the contents in the success state.
3055     * Reading from this pointer when `result_ok` is not set is undefined.
3056     */
3057    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3058    /**
3059     * Note that this value is always NULL, as there are no contents in the Err variant
3060     */
3061    void *err;
3062 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3063
3064 /**
3065  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3066  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3068  */
3069 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3070    /**
3071     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3072     * `err` or `result` depending on the state of `result_ok`.
3073     */
3074    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3075    /**
3076     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3077     */
3078    bool result_ok;
3079 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3080
3081 /**
3082  * The contents of CResult_SignatureNoneZ
3083  */
3084 typedef union LDKCResult_SignatureNoneZPtr {
3085    /**
3086     * A pointer to the contents in the success state.
3087     * Reading from this pointer when `result_ok` is not set is undefined.
3088     */
3089    struct LDKSignature *result;
3090    /**
3091     * Note that this value is always NULL, as there are no contents in the Err variant
3092     */
3093    void *err;
3094 } LDKCResult_SignatureNoneZPtr;
3095
3096 /**
3097  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3098  * containing a crate::c_types::Signature on success and a () on failure.
3099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3100  */
3101 typedef struct LDKCResult_SignatureNoneZ {
3102    /**
3103     * The contents of this CResult_SignatureNoneZ, accessible via either
3104     * `err` or `result` depending on the state of `result_ok`.
3105     */
3106    union LDKCResult_SignatureNoneZPtr contents;
3107    /**
3108     * Whether this CResult_SignatureNoneZ represents a success state.
3109     */
3110    bool result_ok;
3111 } LDKCResult_SignatureNoneZ;
3112
3113
3114
3115 /**
3116  * The unsigned part of a channel_announcement
3117  */
3118 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3119    /**
3120     * A pointer to the opaque Rust object.
3121     * Nearly everywhere, inner must be non-null, however in places where
3122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3123     */
3124    LDKnativeUnsignedChannelAnnouncement *inner;
3125    /**
3126     * Indicates that this is the only struct which contains the same pointer.
3127     * Rust functions which take ownership of an object provided via an argument require
3128     * this to be true and invalidate the object pointed to by inner.
3129     */
3130    bool is_owned;
3131 } LDKUnsignedChannelAnnouncement;
3132
3133 /**
3134  * A trait to sign lightning channel transactions as described in BOLT 3.
3135  *
3136  * Signing services could be implemented on a hardware wallet. In this case,
3137  * the current Sign would be a front-end on top of a communication
3138  * channel connected to your secure device and lightning key material wouldn't
3139  * reside on a hot server. Nevertheless, a this deployment would still need
3140  * to trust the ChannelManager to avoid loss of funds as this latest component
3141  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3142  *
3143  * A more secure iteration would be to use hashlock (or payment points) to pair
3144  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3145  * at the price of more state and computation on the hardware wallet side. In the future,
3146  * we are looking forward to design such interface.
3147  *
3148  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3149  * to act, as liveness and breach reply correctness are always going to be hard requirements
3150  * of LN security model, orthogonal of key management issues.
3151  */
3152 typedef struct LDKBaseSign {
3153    /**
3154     * An opaque pointer which is passed to your function implementations as an argument.
3155     * This has no meaning in the LDK, and can be NULL or any other value.
3156     */
3157    void *this_arg;
3158    /**
3159     * Gets the per-commitment point for a specific commitment number
3160     *
3161     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3162     */
3163    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3164    /**
3165     * Gets the commitment secret for a specific commitment number as part of the revocation process
3166     *
3167     * An external signer implementation should error here if the commitment was already signed
3168     * and should refuse to sign it in the future.
3169     *
3170     * May be called more than once for the same index.
3171     *
3172     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3173     */
3174    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3175    /**
3176     * Gets the holder's channel public keys and basepoints
3177     */
3178    struct LDKChannelPublicKeys pubkeys;
3179    /**
3180     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3181     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3182     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3183     */
3184    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3185    /**
3186     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3187     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3188     * Sign object uniquely and lookup or re-derive its keys.
3189     */
3190    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3191    /**
3192     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3193     *
3194     * Note that if signing fails or is rejected, the channel will be force-closed.
3195     */
3196    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3197    /**
3198     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3199     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3200     * latest commitment_tx when we initiate a force-close.
3201     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3202     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3203     * the latest.
3204     * This may be called multiple times for the same transaction.
3205     *
3206     * An external signer implementation should check that the commitment has not been revoked.
3207     *
3208     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3209     */
3210    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3211    /**
3212     * Create a signature for the given input in a transaction spending an HTLC transaction output
3213     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3214     *
3215     * A justice transaction may claim multiple outputs at the same time if timelocks are
3216     * similar, but only a signature for the input at index `input` should be signed for here.
3217     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3218     * to an upcoming timelock expiration.
3219     *
3220     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3221     *
3222     * per_commitment_key is revocation secret which was provided by our counterparty when they
3223     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3224     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3225     * so).
3226     */
3227    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]);
3228    /**
3229     * Create a signature for the given input in a transaction spending a commitment transaction
3230     * HTLC output when our counterparty broadcasts an old state.
3231     *
3232     * A justice transaction may claim multiple outputs at the same time if timelocks are
3233     * similar, but only a signature for the input at index `input` should be signed for here.
3234     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3235     * to an upcoming timelock expiration.
3236     *
3237     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3238     *
3239     * per_commitment_key is revocation secret which was provided by our counterparty when they
3240     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3241     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3242     * so).
3243     *
3244     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3245     * (which is committed to in the BIP 143 signatures).
3246     */
3247    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);
3248    /**
3249     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3250     * transaction, either offered or received.
3251     *
3252     * Such a transaction may claim multiples offered outputs at same time if we know the
3253     * preimage for each when we create it, but only the input at index `input` should be
3254     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3255     * needed with regards to an upcoming timelock expiration.
3256     *
3257     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3258     * outputs.
3259     *
3260     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3261     *
3262     * Per_commitment_point is the dynamic point corresponding to the channel state
3263     * detected onchain. It has been generated by our counterparty and is used to derive
3264     * channel state keys, which are then included in the witness script and committed to in the
3265     * BIP 143 signature.
3266     */
3267    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);
3268    /**
3269     * Create a signature for a (proposed) closing transaction.
3270     *
3271     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3272     * chosen to forgo their output as dust.
3273     */
3274    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3275    /**
3276     * Signs a channel announcement message with our funding key, proving it comes from one
3277     * of the channel participants.
3278     *
3279     * Note that if this fails or is rejected, the channel will not be publicly announced and
3280     * our counterparty may (though likely will not) close the channel on us for violating the
3281     * protocol.
3282     */
3283    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3284    /**
3285     * Set the counterparty static channel data, including basepoints,
3286     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3287     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3288     * they MUST NOT be allowed to change to different values once set.
3289     *
3290     * channel_parameters.is_populated() MUST be true.
3291     *
3292     * We bind holder_selected_contest_delay late here for API convenience.
3293     *
3294     * Will be called before any signatures are applied.
3295     */
3296    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3297    /**
3298     * Frees any resources associated with this object given its this_arg pointer.
3299     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3300     */
3301    void (*free)(void *this_arg);
3302 } LDKBaseSign;
3303
3304 /**
3305  * A cloneable signer.
3306  *
3307  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3308  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3309  * which implies Sized, into this derived trait.
3310  */
3311 typedef struct LDKSign {
3312    /**
3313     * An opaque pointer which is passed to your function implementations as an argument.
3314     * This has no meaning in the LDK, and can be NULL or any other value.
3315     */
3316    void *this_arg;
3317    /**
3318     * Implementation of BaseSign for this object.
3319     */
3320    struct LDKBaseSign BaseSign;
3321    /**
3322     * Creates a copy of the BaseSign, for a copy of this Sign.
3323     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3324     */
3325    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3326    /**
3327     * Serialize the object into a byte array
3328     */
3329    struct LDKCVec_u8Z (*write)(const void *this_arg);
3330    /**
3331     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3332     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3333     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3334     */
3335    void *(*clone)(const void *this_arg);
3336    /**
3337     * Frees any resources associated with this object given its this_arg pointer.
3338     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3339     */
3340    void (*free)(void *this_arg);
3341 } LDKSign;
3342
3343 /**
3344  * The contents of CResult_SignDecodeErrorZ
3345  */
3346 typedef union LDKCResult_SignDecodeErrorZPtr {
3347    /**
3348     * A pointer to the contents in the success state.
3349     * Reading from this pointer when `result_ok` is not set is undefined.
3350     */
3351    struct LDKSign *result;
3352    /**
3353     * A pointer to the contents in the error state.
3354     * Reading from this pointer when `result_ok` is set is undefined.
3355     */
3356    struct LDKDecodeError *err;
3357 } LDKCResult_SignDecodeErrorZPtr;
3358
3359 /**
3360  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3361  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3362  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3363  */
3364 typedef struct LDKCResult_SignDecodeErrorZ {
3365    /**
3366     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3367     * `err` or `result` depending on the state of `result_ok`.
3368     */
3369    union LDKCResult_SignDecodeErrorZPtr contents;
3370    /**
3371     * Whether this CResult_SignDecodeErrorZ represents a success state.
3372     */
3373    bool result_ok;
3374 } LDKCResult_SignDecodeErrorZ;
3375
3376 /**
3377  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3378  * allows recovering the exact public key which created the signature given the message.
3379  */
3380 typedef struct LDKRecoverableSignature {
3381    /**
3382     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3383     * recovery.
3384     */
3385    uint8_t serialized_form[68];
3386 } LDKRecoverableSignature;
3387
3388 /**
3389  * The contents of CResult_RecoverableSignatureNoneZ
3390  */
3391 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3392    /**
3393     * A pointer to the contents in the success state.
3394     * Reading from this pointer when `result_ok` is not set is undefined.
3395     */
3396    struct LDKRecoverableSignature *result;
3397    /**
3398     * Note that this value is always NULL, as there are no contents in the Err variant
3399     */
3400    void *err;
3401 } LDKCResult_RecoverableSignatureNoneZPtr;
3402
3403 /**
3404  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3405  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3406  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3407  */
3408 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3409    /**
3410     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3411     * `err` or `result` depending on the state of `result_ok`.
3412     */
3413    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3414    /**
3415     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3416     */
3417    bool result_ok;
3418 } LDKCResult_RecoverableSignatureNoneZ;
3419
3420 /**
3421  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3422  * This corresponds to std::vector in C++
3423  */
3424 typedef struct LDKCVec_CVec_u8ZZ {
3425    /**
3426     * The elements in the array.
3427     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3428     */
3429    struct LDKCVec_u8Z *data;
3430    /**
3431     * The number of elements pointed to by `data`.
3432     */
3433    uintptr_t datalen;
3434 } LDKCVec_CVec_u8ZZ;
3435
3436 /**
3437  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3438  */
3439 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3440    /**
3441     * A pointer to the contents in the success state.
3442     * Reading from this pointer when `result_ok` is not set is undefined.
3443     */
3444    struct LDKCVec_CVec_u8ZZ *result;
3445    /**
3446     * Note that this value is always NULL, as there are no contents in the Err variant
3447     */
3448    void *err;
3449 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3450
3451 /**
3452  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3453  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3454  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3455  */
3456 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3457    /**
3458     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3459     * `err` or `result` depending on the state of `result_ok`.
3460     */
3461    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3462    /**
3463     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3464     */
3465    bool result_ok;
3466 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3467
3468
3469
3470 /**
3471  * A simple implementation of Sign that just keeps the private keys in memory.
3472  *
3473  * This implementation performs no policy checks and is insufficient by itself as
3474  * a secure external signer.
3475  */
3476 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3477    /**
3478     * A pointer to the opaque Rust object.
3479     * Nearly everywhere, inner must be non-null, however in places where
3480     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3481     */
3482    LDKnativeInMemorySigner *inner;
3483    /**
3484     * Indicates that this is the only struct which contains the same pointer.
3485     * Rust functions which take ownership of an object provided via an argument require
3486     * this to be true and invalidate the object pointed to by inner.
3487     */
3488    bool is_owned;
3489 } LDKInMemorySigner;
3490
3491 /**
3492  * The contents of CResult_InMemorySignerDecodeErrorZ
3493  */
3494 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3495    /**
3496     * A pointer to the contents in the success state.
3497     * Reading from this pointer when `result_ok` is not set is undefined.
3498     */
3499    struct LDKInMemorySigner *result;
3500    /**
3501     * A pointer to the contents in the error state.
3502     * Reading from this pointer when `result_ok` is set is undefined.
3503     */
3504    struct LDKDecodeError *err;
3505 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3506
3507 /**
3508  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3509  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3510  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3511  */
3512 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3513    /**
3514     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3515     * `err` or `result` depending on the state of `result_ok`.
3516     */
3517    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3518    /**
3519     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3520     */
3521    bool result_ok;
3522 } LDKCResult_InMemorySignerDecodeErrorZ;
3523
3524 /**
3525  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3526  * This corresponds to std::vector in C++
3527  */
3528 typedef struct LDKCVec_TxOutZ {
3529    /**
3530     * The elements in the array.
3531     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3532     */
3533    struct LDKTxOut *data;
3534    /**
3535     * The number of elements pointed to by `data`.
3536     */
3537    uintptr_t datalen;
3538 } LDKCVec_TxOutZ;
3539
3540 /**
3541  * The contents of CResult_TransactionNoneZ
3542  */
3543 typedef union LDKCResult_TransactionNoneZPtr {
3544    /**
3545     * A pointer to the contents in the success state.
3546     * Reading from this pointer when `result_ok` is not set is undefined.
3547     */
3548    struct LDKTransaction *result;
3549    /**
3550     * Note that this value is always NULL, as there are no contents in the Err variant
3551     */
3552    void *err;
3553 } LDKCResult_TransactionNoneZPtr;
3554
3555 /**
3556  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3557  * containing a crate::c_types::Transaction on success and a () on failure.
3558  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3559  */
3560 typedef struct LDKCResult_TransactionNoneZ {
3561    /**
3562     * The contents of this CResult_TransactionNoneZ, accessible via either
3563     * `err` or `result` depending on the state of `result_ok`.
3564     */
3565    union LDKCResult_TransactionNoneZPtr contents;
3566    /**
3567     * Whether this CResult_TransactionNoneZ represents a success state.
3568     */
3569    bool result_ok;
3570 } LDKCResult_TransactionNoneZ;
3571
3572
3573
3574 /**
3575  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3576  * on-chain transactions to ensure no loss of funds occurs.
3577  *
3578  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3579  * information and are actively monitoring the chain.
3580  *
3581  * Pending Events or updated HTLCs which have not yet been read out by
3582  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3583  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3584  * gotten are fully handled before re-serializing the new state.
3585  *
3586  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3587  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3588  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3589  * returned block hash and the the current chain and then reconnecting blocks to get to the
3590  * best chain) upon deserializing the object!
3591  */
3592 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3593    /**
3594     * A pointer to the opaque Rust object.
3595     * Nearly everywhere, inner must be non-null, however in places where
3596     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3597     */
3598    LDKnativeChannelMonitor *inner;
3599    /**
3600     * Indicates that this is the only struct which contains the same pointer.
3601     * Rust functions which take ownership of an object provided via an argument require
3602     * this to be true and invalidate the object pointed to by inner.
3603     */
3604    bool is_owned;
3605 } LDKChannelMonitor;
3606
3607 /**
3608  * A tuple of 2 elements. See the individual fields for the types contained.
3609  */
3610 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3611    /**
3612     * The element at position 0
3613     */
3614    struct LDKThirtyTwoBytes a;
3615    /**
3616     * The element at position 1
3617     */
3618    struct LDKChannelMonitor b;
3619 } LDKC2Tuple_BlockHashChannelMonitorZ;
3620
3621 /**
3622  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3623  * This corresponds to std::vector in C++
3624  */
3625 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
3626    /**
3627     * The elements in the array.
3628     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3629     */
3630    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
3631    /**
3632     * The number of elements pointed to by `data`.
3633     */
3634    uintptr_t datalen;
3635 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
3636
3637 /**
3638  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3639  */
3640 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3641    /**
3642     * A pointer to the contents in the success state.
3643     * Reading from this pointer when `result_ok` is not set is undefined.
3644     */
3645    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
3646    /**
3647     * A pointer to the contents in the error state.
3648     * Reading from this pointer when `result_ok` is set is undefined.
3649     */
3650    enum LDKIOError *err;
3651 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
3652
3653 /**
3654  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3655  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3656  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3657  */
3658 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3659    /**
3660     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3661     * `err` or `result` depending on the state of `result_ok`.
3662     */
3663    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
3664    /**
3665     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3666     */
3667    bool result_ok;
3668 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
3669
3670 /**
3671  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
3672  * too-high values)
3673  */
3674 typedef enum LDKAPIError_Tag {
3675    /**
3676     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
3677     * are documented, but generally indicates some precondition of a function was violated.
3678     */
3679    LDKAPIError_APIMisuseError,
3680    /**
3681     * Due to a high feerate, we were unable to complete the request.
3682     * For example, this may be returned if the feerate implies we cannot open a channel at the
3683     * requested value, but opening a larger channel would succeed.
3684     */
3685    LDKAPIError_FeeRateTooHigh,
3686    /**
3687     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3688     * too-many-hops, etc).
3689     */
3690    LDKAPIError_RouteError,
3691    /**
3692     * We were unable to complete the request as the Channel required to do so is unable to
3693     * complete the request (or was not found). This can take many forms, including disconnected
3694     * peer, channel at capacity, channel shutting down, etc.
3695     */
3696    LDKAPIError_ChannelUnavailable,
3697    /**
3698     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
3699     * attempted action to fail.
3700     */
3701    LDKAPIError_MonitorUpdateFailed,
3702    /**
3703     * Must be last for serialization purposes
3704     */
3705    LDKAPIError_Sentinel,
3706 } LDKAPIError_Tag;
3707
3708 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
3709    /**
3710     * A human-readable error message
3711     */
3712    struct LDKStr err;
3713 } LDKAPIError_LDKAPIMisuseError_Body;
3714
3715 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
3716    /**
3717     * A human-readable error message
3718     */
3719    struct LDKStr err;
3720    /**
3721     * The feerate which was too high.
3722     */
3723    uint32_t feerate;
3724 } LDKAPIError_LDKFeeRateTooHigh_Body;
3725
3726 typedef struct LDKAPIError_LDKRouteError_Body {
3727    /**
3728     * A human-readable error message
3729     */
3730    struct LDKStr err;
3731 } LDKAPIError_LDKRouteError_Body;
3732
3733 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
3734    /**
3735     * A human-readable error message
3736     */
3737    struct LDKStr err;
3738 } LDKAPIError_LDKChannelUnavailable_Body;
3739
3740 typedef struct MUST_USE_STRUCT LDKAPIError {
3741    LDKAPIError_Tag tag;
3742    union {
3743       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
3744       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
3745       LDKAPIError_LDKRouteError_Body route_error;
3746       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
3747    };
3748 } LDKAPIError;
3749
3750 /**
3751  * The contents of CResult_NoneAPIErrorZ
3752  */
3753 typedef union LDKCResult_NoneAPIErrorZPtr {
3754    /**
3755     * Note that this value is always NULL, as there are no contents in the OK variant
3756     */
3757    void *result;
3758    /**
3759     * A pointer to the contents in the error state.
3760     * Reading from this pointer when `result_ok` is set is undefined.
3761     */
3762    struct LDKAPIError *err;
3763 } LDKCResult_NoneAPIErrorZPtr;
3764
3765 /**
3766  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3767  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
3768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3769  */
3770 typedef struct LDKCResult_NoneAPIErrorZ {
3771    /**
3772     * The contents of this CResult_NoneAPIErrorZ, accessible via either
3773     * `err` or `result` depending on the state of `result_ok`.
3774     */
3775    union LDKCResult_NoneAPIErrorZPtr contents;
3776    /**
3777     * Whether this CResult_NoneAPIErrorZ represents a success state.
3778     */
3779    bool result_ok;
3780 } LDKCResult_NoneAPIErrorZ;
3781
3782 /**
3783  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3784  * This corresponds to std::vector in C++
3785  */
3786 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
3787    /**
3788     * The elements in the array.
3789     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3790     */
3791    struct LDKCResult_NoneAPIErrorZ *data;
3792    /**
3793     * The number of elements pointed to by `data`.
3794     */
3795    uintptr_t datalen;
3796 } LDKCVec_CResult_NoneAPIErrorZZ;
3797
3798 /**
3799  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3800  * This corresponds to std::vector in C++
3801  */
3802 typedef struct LDKCVec_APIErrorZ {
3803    /**
3804     * The elements in the array.
3805     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3806     */
3807    struct LDKAPIError *data;
3808    /**
3809     * The number of elements pointed to by `data`.
3810     */
3811    uintptr_t datalen;
3812 } LDKCVec_APIErrorZ;
3813
3814 /**
3815  * If a payment fails to send, it can be in one of several states. This enum is returned as the
3816  * Err() type describing which state the payment is in, see the description of individual enum
3817  * states for more.
3818  */
3819 typedef enum LDKPaymentSendFailure_Tag {
3820    /**
3821     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
3822     * send the payment at all. No channel state has been changed or messages sent to peers, and
3823     * once you've changed the parameter at error, you can freely retry the payment in full.
3824     */
3825    LDKPaymentSendFailure_ParameterError,
3826    /**
3827     * A parameter in a single path which was passed to send_payment was invalid, preventing us
3828     * from attempting to send the payment at all. No channel state has been changed or messages
3829     * sent to peers, and once you've changed the parameter at error, you can freely retry the
3830     * payment in full.
3831     *
3832     * The results here are ordered the same as the paths in the route object which was passed to
3833     * send_payment.
3834     */
3835    LDKPaymentSendFailure_PathParameterError,
3836    /**
3837     * All paths which were attempted failed to send, with no channel state change taking place.
3838     * You can freely retry the payment in full (though you probably want to do so over different
3839     * paths than the ones selected).
3840     */
3841    LDKPaymentSendFailure_AllFailedRetrySafe,
3842    /**
3843     * Some paths which were attempted failed to send, though possibly not all. At least some
3844     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
3845     * in over-/re-payment.
3846     *
3847     * The results here are ordered the same as the paths in the route object which was passed to
3848     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
3849     * retried (though there is currently no API with which to do so).
3850     *
3851     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
3852     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
3853     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
3854     * with the latest update_id.
3855     */
3856    LDKPaymentSendFailure_PartialFailure,
3857    /**
3858     * Must be last for serialization purposes
3859     */
3860    LDKPaymentSendFailure_Sentinel,
3861 } LDKPaymentSendFailure_Tag;
3862
3863 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
3864    LDKPaymentSendFailure_Tag tag;
3865    union {
3866       struct {
3867          struct LDKAPIError parameter_error;
3868       };
3869       struct {
3870          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
3871       };
3872       struct {
3873          struct LDKCVec_APIErrorZ all_failed_retry_safe;
3874       };
3875       struct {
3876          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
3877       };
3878    };
3879 } LDKPaymentSendFailure;
3880
3881 /**
3882  * The contents of CResult_NonePaymentSendFailureZ
3883  */
3884 typedef union LDKCResult_NonePaymentSendFailureZPtr {
3885    /**
3886     * Note that this value is always NULL, as there are no contents in the OK variant
3887     */
3888    void *result;
3889    /**
3890     * A pointer to the contents in the error state.
3891     * Reading from this pointer when `result_ok` is set is undefined.
3892     */
3893    struct LDKPaymentSendFailure *err;
3894 } LDKCResult_NonePaymentSendFailureZPtr;
3895
3896 /**
3897  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
3898  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3899  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3900  */
3901 typedef struct LDKCResult_NonePaymentSendFailureZ {
3902    /**
3903     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
3904     * `err` or `result` depending on the state of `result_ok`.
3905     */
3906    union LDKCResult_NonePaymentSendFailureZPtr contents;
3907    /**
3908     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
3909     */
3910    bool result_ok;
3911 } LDKCResult_NonePaymentSendFailureZ;
3912
3913 /**
3914  * A 4-byte byte array.
3915  */
3916 typedef struct LDKFourBytes {
3917    /**
3918     * The four bytes
3919     */
3920    uint8_t data[4];
3921 } LDKFourBytes;
3922
3923 /**
3924  * A 16-byte byte array.
3925  */
3926 typedef struct LDKSixteenBytes {
3927    /**
3928     * The sixteen bytes
3929     */
3930    uint8_t data[16];
3931 } LDKSixteenBytes;
3932
3933 /**
3934  * A 10-byte byte array.
3935  */
3936 typedef struct LDKTenBytes {
3937    /**
3938     * The ten bytes
3939     */
3940    uint8_t data[10];
3941 } LDKTenBytes;
3942
3943 /**
3944  * An address which can be used to connect to a remote peer
3945  */
3946 typedef enum LDKNetAddress_Tag {
3947    /**
3948     * An IPv4 address/port on which the peer is listening.
3949     */
3950    LDKNetAddress_IPv4,
3951    /**
3952     * An IPv6 address/port on which the peer is listening.
3953     */
3954    LDKNetAddress_IPv6,
3955    /**
3956     * An old-style Tor onion address/port on which the peer is listening.
3957     */
3958    LDKNetAddress_OnionV2,
3959    /**
3960     * A new-style Tor onion address/port on which the peer is listening.
3961     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
3962     * wrap as base32 and append \".onion\".
3963     */
3964    LDKNetAddress_OnionV3,
3965    /**
3966     * Must be last for serialization purposes
3967     */
3968    LDKNetAddress_Sentinel,
3969 } LDKNetAddress_Tag;
3970
3971 typedef struct LDKNetAddress_LDKIPv4_Body {
3972    /**
3973     * The 4-byte IPv4 address
3974     */
3975    struct LDKFourBytes addr;
3976    /**
3977     * The port on which the node is listening
3978     */
3979    uint16_t port;
3980 } LDKNetAddress_LDKIPv4_Body;
3981
3982 typedef struct LDKNetAddress_LDKIPv6_Body {
3983    /**
3984     * The 16-byte IPv6 address
3985     */
3986    struct LDKSixteenBytes addr;
3987    /**
3988     * The port on which the node is listening
3989     */
3990    uint16_t port;
3991 } LDKNetAddress_LDKIPv6_Body;
3992
3993 typedef struct LDKNetAddress_LDKOnionV2_Body {
3994    /**
3995     * The bytes (usually encoded in base32 with \".onion\" appended)
3996     */
3997    struct LDKTenBytes addr;
3998    /**
3999     * The port on which the node is listening
4000     */
4001    uint16_t port;
4002 } LDKNetAddress_LDKOnionV2_Body;
4003
4004 typedef struct LDKNetAddress_LDKOnionV3_Body {
4005    /**
4006     * The ed25519 long-term public key of the peer
4007     */
4008    struct LDKThirtyTwoBytes ed25519_pubkey;
4009    /**
4010     * The checksum of the pubkey and version, as included in the onion address
4011     */
4012    uint16_t checksum;
4013    /**
4014     * The version byte, as defined by the Tor Onion v3 spec.
4015     */
4016    uint8_t version;
4017    /**
4018     * The port on which the node is listening
4019     */
4020    uint16_t port;
4021 } LDKNetAddress_LDKOnionV3_Body;
4022
4023 typedef struct MUST_USE_STRUCT LDKNetAddress {
4024    LDKNetAddress_Tag tag;
4025    union {
4026       LDKNetAddress_LDKIPv4_Body i_pv4;
4027       LDKNetAddress_LDKIPv6_Body i_pv6;
4028       LDKNetAddress_LDKOnionV2_Body onion_v2;
4029       LDKNetAddress_LDKOnionV3_Body onion_v3;
4030    };
4031 } LDKNetAddress;
4032
4033 /**
4034  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4035  * This corresponds to std::vector in C++
4036  */
4037 typedef struct LDKCVec_NetAddressZ {
4038    /**
4039     * The elements in the array.
4040     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4041     */
4042    struct LDKNetAddress *data;
4043    /**
4044     * The number of elements pointed to by `data`.
4045     */
4046    uintptr_t datalen;
4047 } LDKCVec_NetAddressZ;
4048
4049 /**
4050  * A tuple of 2 elements. See the individual fields for the types contained.
4051  */
4052 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4053    /**
4054     * The element at position 0
4055     */
4056    struct LDKThirtyTwoBytes a;
4057    /**
4058     * The element at position 1
4059     */
4060    struct LDKThirtyTwoBytes b;
4061 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4062
4063 /**
4064  * The contents of CResult_PaymentSecretAPIErrorZ
4065  */
4066 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4067    /**
4068     * A pointer to the contents in the success state.
4069     * Reading from this pointer when `result_ok` is not set is undefined.
4070     */
4071    struct LDKThirtyTwoBytes *result;
4072    /**
4073     * A pointer to the contents in the error state.
4074     * Reading from this pointer when `result_ok` is set is undefined.
4075     */
4076    struct LDKAPIError *err;
4077 } LDKCResult_PaymentSecretAPIErrorZPtr;
4078
4079 /**
4080  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4081  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4082  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4083  */
4084 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4085    /**
4086     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4087     * `err` or `result` depending on the state of `result_ok`.
4088     */
4089    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4090    /**
4091     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4092     */
4093    bool result_ok;
4094 } LDKCResult_PaymentSecretAPIErrorZ;
4095
4096 /**
4097  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4098  * This corresponds to std::vector in C++
4099  */
4100 typedef struct LDKCVec_ChannelMonitorZ {
4101    /**
4102     * The elements in the array.
4103     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4104     */
4105    struct LDKChannelMonitor *data;
4106    /**
4107     * The number of elements pointed to by `data`.
4108     */
4109    uintptr_t datalen;
4110 } LDKCVec_ChannelMonitorZ;
4111
4112
4113
4114 /**
4115  * An update generated by the underlying Channel itself which contains some new information the
4116  * ChannelMonitor should be made aware of.
4117  */
4118 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4119    /**
4120     * A pointer to the opaque Rust object.
4121     * Nearly everywhere, inner must be non-null, however in places where
4122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4123     */
4124    LDKnativeChannelMonitorUpdate *inner;
4125    /**
4126     * Indicates that this is the only struct which contains the same pointer.
4127     * Rust functions which take ownership of an object provided via an argument require
4128     * this to be true and invalidate the object pointed to by inner.
4129     */
4130    bool is_owned;
4131 } LDKChannelMonitorUpdate;
4132
4133 /**
4134  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4135  * blocks are connected and disconnected.
4136  *
4137  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4138  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4139  * channel state changes and HTLCs are resolved. See method documentation for specific
4140  * requirements.
4141  *
4142  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4143  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4144  * without taking any further action such as persisting the current state.
4145  *
4146  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4147  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4148  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4149  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4150  * multiple instances.
4151  *
4152  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4153  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4154  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4155  */
4156 typedef struct LDKWatch {
4157    /**
4158     * An opaque pointer which is passed to your function implementations as an argument.
4159     * This has no meaning in the LDK, and can be NULL or any other value.
4160     */
4161    void *this_arg;
4162    /**
4163     * Watches a channel identified by `funding_txo` using `monitor`.
4164     *
4165     * Implementations are responsible for watching the chain for the funding transaction along
4166     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4167     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4168     *
4169     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4170     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4171     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4172     */
4173    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4174    /**
4175     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4176     *
4177     * Implementations must call [`update_monitor`] with the given update. See
4178     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4179     *
4180     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4181     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4182     */
4183    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4184    /**
4185     * Returns any monitor events since the last call. Subsequent calls must only return new
4186     * events.
4187     */
4188    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4189    /**
4190     * Frees any resources associated with this object given its this_arg pointer.
4191     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4192     */
4193    void (*free)(void *this_arg);
4194 } LDKWatch;
4195
4196 /**
4197  * An interface to send a transaction to the Bitcoin network.
4198  */
4199 typedef struct LDKBroadcasterInterface {
4200    /**
4201     * An opaque pointer which is passed to your function implementations as an argument.
4202     * This has no meaning in the LDK, and can be NULL or any other value.
4203     */
4204    void *this_arg;
4205    /**
4206     * Sends a transaction out to (hopefully) be mined.
4207     */
4208    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4209    /**
4210     * Frees any resources associated with this object given its this_arg pointer.
4211     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4212     */
4213    void (*free)(void *this_arg);
4214 } LDKBroadcasterInterface;
4215
4216 /**
4217  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4218  * own the memory pointed to by data.
4219  */
4220 typedef struct LDKu8slice {
4221    /**
4222     * A pointer to the byte buffer
4223     */
4224    const uint8_t *data;
4225    /**
4226     * The number of bytes pointed to by `data`.
4227     */
4228    uintptr_t datalen;
4229 } LDKu8slice;
4230
4231 /**
4232  * A trait to describe an object which can get user secrets and key material.
4233  */
4234 typedef struct LDKKeysInterface {
4235    /**
4236     * An opaque pointer which is passed to your function implementations as an argument.
4237     * This has no meaning in the LDK, and can be NULL or any other value.
4238     */
4239    void *this_arg;
4240    /**
4241     * Get node secret key (aka node_id or network_key).
4242     *
4243     * This method must return the same value each time it is called.
4244     */
4245    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4246    /**
4247     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4248     *
4249     * This method should return a different value each time it is called, to avoid linking
4250     * on-chain funds across channels as controlled to the same user.
4251     */
4252    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4253    /**
4254     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
4255     * a channel.
4256     *
4257     * This method should return a different value each time it is called, to avoid linking
4258     * on-chain funds across channels as controlled to the same user.
4259     */
4260    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
4261    /**
4262     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4263     * restarted with some stale data!
4264     *
4265     * This method must return a different value each time it is called.
4266     */
4267    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4268    /**
4269     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4270     * onion packets and for temporary channel IDs. There is no requirement that these be
4271     * persisted anywhere, though they must be unique across restarts.
4272     *
4273     * This method must return a different value each time it is called.
4274     */
4275    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4276    /**
4277     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4278     * This is only called during deserialization of other objects which contain
4279     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4280     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4281     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4282     * you've read all of the provided bytes to ensure no corruption occurred.
4283     */
4284    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4285    /**
4286     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4287     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4288     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4289     * blindly signing the hash.
4290     */
4291    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4292    /**
4293     * Frees any resources associated with this object given its this_arg pointer.
4294     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4295     */
4296    void (*free)(void *this_arg);
4297 } LDKKeysInterface;
4298
4299 /**
4300  * A trait which should be implemented to provide feerate information on a number of time
4301  * horizons.
4302  *
4303  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4304  * called from inside the library in response to chain events, P2P events, or timer events).
4305  */
4306 typedef struct LDKFeeEstimator {
4307    /**
4308     * An opaque pointer which is passed to your function implementations as an argument.
4309     * This has no meaning in the LDK, and can be NULL or any other value.
4310     */
4311    void *this_arg;
4312    /**
4313     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4314     *
4315     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4316     * don't put us below 1 satoshi-per-byte).
4317     *
4318     * This translates to:
4319     *  * satoshis-per-byte * 250
4320     *  * ceil(satoshis-per-kbyte / 4)
4321     */
4322    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4323    /**
4324     * Frees any resources associated with this object given its this_arg pointer.
4325     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4326     */
4327    void (*free)(void *this_arg);
4328 } LDKFeeEstimator;
4329
4330 /**
4331  * A trait encapsulating the operations required of a logger
4332  */
4333 typedef struct LDKLogger {
4334    /**
4335     * An opaque pointer which is passed to your function implementations as an argument.
4336     * This has no meaning in the LDK, and can be NULL or any other value.
4337     */
4338    void *this_arg;
4339    /**
4340     * Logs the `Record`
4341     */
4342    void (*log)(const void *this_arg, const char *record);
4343    /**
4344     * Frees any resources associated with this object given its this_arg pointer.
4345     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4346     */
4347    void (*free)(void *this_arg);
4348 } LDKLogger;
4349
4350
4351
4352 /**
4353  * Manager which keeps track of a number of channels and sends messages to the appropriate
4354  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4355  *
4356  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4357  * to individual Channels.
4358  *
4359  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4360  * all peers during write/read (though does not modify this instance, only the instance being
4361  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4362  * called funding_transaction_generated for outbound channels).
4363  *
4364  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4365  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4366  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4367  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4368  * the serialization process). If the deserialized version is out-of-date compared to the
4369  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4370  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4371  *
4372  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4373  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4374  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4375  * block_connected() to step towards your best block) upon deserialization before using the
4376  * object!
4377  *
4378  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4379  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4380  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4381  * offline for a full minute. In order to track this, you must call
4382  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4383  *
4384  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4385  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4386  * essentially you should default to using a SimpleRefChannelManager, and use a
4387  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4388  * you're using lightning-net-tokio.
4389  */
4390 typedef struct MUST_USE_STRUCT LDKChannelManager {
4391    /**
4392     * A pointer to the opaque Rust object.
4393     * Nearly everywhere, inner must be non-null, however in places where
4394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4395     */
4396    LDKnativeChannelManager *inner;
4397    /**
4398     * Indicates that this is the only struct which contains the same pointer.
4399     * Rust functions which take ownership of an object provided via an argument require
4400     * this to be true and invalidate the object pointed to by inner.
4401     */
4402    bool is_owned;
4403 } LDKChannelManager;
4404
4405 /**
4406  * A tuple of 2 elements. See the individual fields for the types contained.
4407  */
4408 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4409    /**
4410     * The element at position 0
4411     */
4412    struct LDKThirtyTwoBytes a;
4413    /**
4414     * The element at position 1
4415     */
4416    struct LDKChannelManager b;
4417 } LDKC2Tuple_BlockHashChannelManagerZ;
4418
4419 /**
4420  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4421  */
4422 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4423    /**
4424     * A pointer to the contents in the success state.
4425     * Reading from this pointer when `result_ok` is not set is undefined.
4426     */
4427    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4428    /**
4429     * A pointer to the contents in the error state.
4430     * Reading from this pointer when `result_ok` is set is undefined.
4431     */
4432    struct LDKDecodeError *err;
4433 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4434
4435 /**
4436  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4437  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4439  */
4440 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4441    /**
4442     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4443     * `err` or `result` depending on the state of `result_ok`.
4444     */
4445    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4446    /**
4447     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4448     */
4449    bool result_ok;
4450 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4451
4452
4453
4454 /**
4455  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4456  * with our counterparty.
4457  */
4458 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4459    /**
4460     * A pointer to the opaque Rust object.
4461     * Nearly everywhere, inner must be non-null, however in places where
4462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4463     */
4464    LDKnativeChannelConfig *inner;
4465    /**
4466     * Indicates that this is the only struct which contains the same pointer.
4467     * Rust functions which take ownership of an object provided via an argument require
4468     * this to be true and invalidate the object pointed to by inner.
4469     */
4470    bool is_owned;
4471 } LDKChannelConfig;
4472
4473 /**
4474  * The contents of CResult_ChannelConfigDecodeErrorZ
4475  */
4476 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4477    /**
4478     * A pointer to the contents in the success state.
4479     * Reading from this pointer when `result_ok` is not set is undefined.
4480     */
4481    struct LDKChannelConfig *result;
4482    /**
4483     * A pointer to the contents in the error state.
4484     * Reading from this pointer when `result_ok` is set is undefined.
4485     */
4486    struct LDKDecodeError *err;
4487 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4488
4489 /**
4490  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4491  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4492  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4493  */
4494 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4495    /**
4496     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4497     * `err` or `result` depending on the state of `result_ok`.
4498     */
4499    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4500    /**
4501     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4502     */
4503    bool result_ok;
4504 } LDKCResult_ChannelConfigDecodeErrorZ;
4505
4506 /**
4507  * The contents of CResult_OutPointDecodeErrorZ
4508  */
4509 typedef union LDKCResult_OutPointDecodeErrorZPtr {
4510    /**
4511     * A pointer to the contents in the success state.
4512     * Reading from this pointer when `result_ok` is not set is undefined.
4513     */
4514    struct LDKOutPoint *result;
4515    /**
4516     * A pointer to the contents in the error state.
4517     * Reading from this pointer when `result_ok` is set is undefined.
4518     */
4519    struct LDKDecodeError *err;
4520 } LDKCResult_OutPointDecodeErrorZPtr;
4521
4522 /**
4523  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4524  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4525  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4526  */
4527 typedef struct LDKCResult_OutPointDecodeErrorZ {
4528    /**
4529     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4530     * `err` or `result` depending on the state of `result_ok`.
4531     */
4532    union LDKCResult_OutPointDecodeErrorZPtr contents;
4533    /**
4534     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
4535     */
4536    bool result_ok;
4537 } LDKCResult_OutPointDecodeErrorZ;
4538
4539 /**
4540  * The contents of CResult_SiPrefixNoneZ
4541  */
4542 typedef union LDKCResult_SiPrefixNoneZPtr {
4543    /**
4544     * A pointer to the contents in the success state.
4545     * Reading from this pointer when `result_ok` is not set is undefined.
4546     */
4547    enum LDKSiPrefix *result;
4548    /**
4549     * Note that this value is always NULL, as there are no contents in the Err variant
4550     */
4551    void *err;
4552 } LDKCResult_SiPrefixNoneZPtr;
4553
4554 /**
4555  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4556  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4557  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4558  */
4559 typedef struct LDKCResult_SiPrefixNoneZ {
4560    /**
4561     * The contents of this CResult_SiPrefixNoneZ, accessible via either
4562     * `err` or `result` depending on the state of `result_ok`.
4563     */
4564    union LDKCResult_SiPrefixNoneZPtr contents;
4565    /**
4566     * Whether this CResult_SiPrefixNoneZ represents a success state.
4567     */
4568    bool result_ok;
4569 } LDKCResult_SiPrefixNoneZ;
4570
4571
4572
4573 /**
4574  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
4575  *
4576  * There are three ways to construct an `Invoice`:
4577  *  1. using `InvoiceBuilder`
4578  *  2. using `Invoice::from_signed(SignedRawInvoice)`
4579  *  3. using `str::parse::<Invoice>(&str)`
4580  */
4581 typedef struct MUST_USE_STRUCT LDKInvoice {
4582    /**
4583     * A pointer to the opaque Rust object.
4584     * Nearly everywhere, inner must be non-null, however in places where
4585     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4586     */
4587    LDKnativeInvoice *inner;
4588    /**
4589     * Indicates that this is the only struct which contains the same pointer.
4590     * Rust functions which take ownership of an object provided via an argument require
4591     * this to be true and invalidate the object pointed to by inner.
4592     */
4593    bool is_owned;
4594 } LDKInvoice;
4595
4596 /**
4597  * The contents of CResult_InvoiceNoneZ
4598  */
4599 typedef union LDKCResult_InvoiceNoneZPtr {
4600    /**
4601     * A pointer to the contents in the success state.
4602     * Reading from this pointer when `result_ok` is not set is undefined.
4603     */
4604    struct LDKInvoice *result;
4605    /**
4606     * Note that this value is always NULL, as there are no contents in the Err variant
4607     */
4608    void *err;
4609 } LDKCResult_InvoiceNoneZPtr;
4610
4611 /**
4612  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
4613  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
4614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4615  */
4616 typedef struct LDKCResult_InvoiceNoneZ {
4617    /**
4618     * The contents of this CResult_InvoiceNoneZ, accessible via either
4619     * `err` or `result` depending on the state of `result_ok`.
4620     */
4621    union LDKCResult_InvoiceNoneZPtr contents;
4622    /**
4623     * Whether this CResult_InvoiceNoneZ represents a success state.
4624     */
4625    bool result_ok;
4626 } LDKCResult_InvoiceNoneZ;
4627
4628
4629
4630 /**
4631  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
4632  * invalid.
4633  *
4634  * # Invariants
4635  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
4636  */
4637 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
4638    /**
4639     * A pointer to the opaque Rust object.
4640     * Nearly everywhere, inner must be non-null, however in places where
4641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4642     */
4643    LDKnativeSignedRawInvoice *inner;
4644    /**
4645     * Indicates that this is the only struct which contains the same pointer.
4646     * Rust functions which take ownership of an object provided via an argument require
4647     * this to be true and invalidate the object pointed to by inner.
4648     */
4649    bool is_owned;
4650 } LDKSignedRawInvoice;
4651
4652 /**
4653  * The contents of CResult_SignedRawInvoiceNoneZ
4654  */
4655 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
4656    /**
4657     * A pointer to the contents in the success state.
4658     * Reading from this pointer when `result_ok` is not set is undefined.
4659     */
4660    struct LDKSignedRawInvoice *result;
4661    /**
4662     * Note that this value is always NULL, as there are no contents in the Err variant
4663     */
4664    void *err;
4665 } LDKCResult_SignedRawInvoiceNoneZPtr;
4666
4667 /**
4668  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4669  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4670  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4671  */
4672 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
4673    /**
4674     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4675     * `err` or `result` depending on the state of `result_ok`.
4676     */
4677    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
4678    /**
4679     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4680     */
4681    bool result_ok;
4682 } LDKCResult_SignedRawInvoiceNoneZ;
4683
4684
4685
4686 /**
4687  * Represents an syntactically correct Invoice for a payment on the lightning network,
4688  * but without the signature information.
4689  * De- and encoding should not lead to information loss but may lead to different hashes.
4690  *
4691  * For methods without docs see the corresponding methods in `Invoice`.
4692  */
4693 typedef struct MUST_USE_STRUCT LDKRawInvoice {
4694    /**
4695     * A pointer to the opaque Rust object.
4696     * Nearly everywhere, inner must be non-null, however in places where
4697     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4698     */
4699    LDKnativeRawInvoice *inner;
4700    /**
4701     * Indicates that this is the only struct which contains the same pointer.
4702     * Rust functions which take ownership of an object provided via an argument require
4703     * this to be true and invalidate the object pointed to by inner.
4704     */
4705    bool is_owned;
4706 } LDKRawInvoice;
4707
4708
4709
4710 /**
4711  * Recoverable signature
4712  */
4713 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
4714    /**
4715     * A pointer to the opaque Rust object.
4716     * Nearly everywhere, inner must be non-null, however in places where
4717     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4718     */
4719    LDKnativeInvoiceSignature *inner;
4720    /**
4721     * Indicates that this is the only struct which contains the same pointer.
4722     * Rust functions which take ownership of an object provided via an argument require
4723     * this to be true and invalidate the object pointed to by inner.
4724     */
4725    bool is_owned;
4726 } LDKInvoiceSignature;
4727
4728 /**
4729  * A tuple of 3 elements. See the individual fields for the types contained.
4730  */
4731 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
4732    /**
4733     * The element at position 0
4734     */
4735    struct LDKRawInvoice a;
4736    /**
4737     * The element at position 1
4738     */
4739    struct LDKThirtyTwoBytes b;
4740    /**
4741     * The element at position 2
4742     */
4743    struct LDKInvoiceSignature c;
4744 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
4745
4746
4747
4748 /**
4749  * Payee public key
4750  */
4751 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
4752    /**
4753     * A pointer to the opaque Rust object.
4754     * Nearly everywhere, inner must be non-null, however in places where
4755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4756     */
4757    LDKnativePayeePubKey *inner;
4758    /**
4759     * Indicates that this is the only struct which contains the same pointer.
4760     * Rust functions which take ownership of an object provided via an argument require
4761     * this to be true and invalidate the object pointed to by inner.
4762     */
4763    bool is_owned;
4764 } LDKPayeePubKey;
4765
4766 /**
4767  * The contents of CResult_PayeePubKeyErrorZ
4768  */
4769 typedef union LDKCResult_PayeePubKeyErrorZPtr {
4770    /**
4771     * A pointer to the contents in the success state.
4772     * Reading from this pointer when `result_ok` is not set is undefined.
4773     */
4774    struct LDKPayeePubKey *result;
4775    /**
4776     * A pointer to the contents in the error state.
4777     * Reading from this pointer when `result_ok` is set is undefined.
4778     */
4779    enum LDKSecp256k1Error *err;
4780 } LDKCResult_PayeePubKeyErrorZPtr;
4781
4782 /**
4783  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4784  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4785  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4786  */
4787 typedef struct LDKCResult_PayeePubKeyErrorZ {
4788    /**
4789     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4790     * `err` or `result` depending on the state of `result_ok`.
4791     */
4792    union LDKCResult_PayeePubKeyErrorZPtr contents;
4793    /**
4794     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
4795     */
4796    bool result_ok;
4797 } LDKCResult_PayeePubKeyErrorZ;
4798
4799
4800
4801 /**
4802  * Private routing information
4803  *
4804  * # Invariants
4805  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
4806  *
4807  */
4808 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
4809    /**
4810     * A pointer to the opaque Rust object.
4811     * Nearly everywhere, inner must be non-null, however in places where
4812     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4813     */
4814    LDKnativePrivateRoute *inner;
4815    /**
4816     * Indicates that this is the only struct which contains the same pointer.
4817     * Rust functions which take ownership of an object provided via an argument require
4818     * this to be true and invalidate the object pointed to by inner.
4819     */
4820    bool is_owned;
4821 } LDKPrivateRoute;
4822
4823 /**
4824  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
4825  * This corresponds to std::vector in C++
4826  */
4827 typedef struct LDKCVec_PrivateRouteZ {
4828    /**
4829     * The elements in the array.
4830     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4831     */
4832    struct LDKPrivateRoute *data;
4833    /**
4834     * The number of elements pointed to by `data`.
4835     */
4836    uintptr_t datalen;
4837 } LDKCVec_PrivateRouteZ;
4838
4839
4840
4841 /**
4842  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
4843  * timestamp is positive.
4844  *
4845  * # Invariants
4846  * The UNIX timestamp representing the stored time has to be positive and small enough so that
4847  * a `EpiryTime` can be added to it without an overflow.
4848  */
4849 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
4850    /**
4851     * A pointer to the opaque Rust object.
4852     * Nearly everywhere, inner must be non-null, however in places where
4853     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4854     */
4855    LDKnativePositiveTimestamp *inner;
4856    /**
4857     * Indicates that this is the only struct which contains the same pointer.
4858     * Rust functions which take ownership of an object provided via an argument require
4859     * this to be true and invalidate the object pointed to by inner.
4860     */
4861    bool is_owned;
4862 } LDKPositiveTimestamp;
4863
4864 /**
4865  * The contents of CResult_PositiveTimestampCreationErrorZ
4866  */
4867 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
4868    /**
4869     * A pointer to the contents in the success state.
4870     * Reading from this pointer when `result_ok` is not set is undefined.
4871     */
4872    struct LDKPositiveTimestamp *result;
4873    /**
4874     * A pointer to the contents in the error state.
4875     * Reading from this pointer when `result_ok` is set is undefined.
4876     */
4877    enum LDKCreationError *err;
4878 } LDKCResult_PositiveTimestampCreationErrorZPtr;
4879
4880 /**
4881  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
4882  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
4883  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4884  */
4885 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
4886    /**
4887     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
4888     * `err` or `result` depending on the state of `result_ok`.
4889     */
4890    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
4891    /**
4892     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
4893     */
4894    bool result_ok;
4895 } LDKCResult_PositiveTimestampCreationErrorZ;
4896
4897 /**
4898  * The contents of CResult_NoneSemanticErrorZ
4899  */
4900 typedef union LDKCResult_NoneSemanticErrorZPtr {
4901    /**
4902     * Note that this value is always NULL, as there are no contents in the OK variant
4903     */
4904    void *result;
4905    /**
4906     * A pointer to the contents in the error state.
4907     * Reading from this pointer when `result_ok` is set is undefined.
4908     */
4909    enum LDKSemanticError *err;
4910 } LDKCResult_NoneSemanticErrorZPtr;
4911
4912 /**
4913  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
4914  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
4915  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4916  */
4917 typedef struct LDKCResult_NoneSemanticErrorZ {
4918    /**
4919     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
4920     * `err` or `result` depending on the state of `result_ok`.
4921     */
4922    union LDKCResult_NoneSemanticErrorZPtr contents;
4923    /**
4924     * Whether this CResult_NoneSemanticErrorZ represents a success state.
4925     */
4926    bool result_ok;
4927 } LDKCResult_NoneSemanticErrorZ;
4928
4929 /**
4930  * The contents of CResult_InvoiceSemanticErrorZ
4931  */
4932 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
4933    /**
4934     * A pointer to the contents in the success state.
4935     * Reading from this pointer when `result_ok` is not set is undefined.
4936     */
4937    struct LDKInvoice *result;
4938    /**
4939     * A pointer to the contents in the error state.
4940     * Reading from this pointer when `result_ok` is set is undefined.
4941     */
4942    enum LDKSemanticError *err;
4943 } LDKCResult_InvoiceSemanticErrorZPtr;
4944
4945 /**
4946  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
4947  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
4948  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4949  */
4950 typedef struct LDKCResult_InvoiceSemanticErrorZ {
4951    /**
4952     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
4953     * `err` or `result` depending on the state of `result_ok`.
4954     */
4955    union LDKCResult_InvoiceSemanticErrorZPtr contents;
4956    /**
4957     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
4958     */
4959    bool result_ok;
4960 } LDKCResult_InvoiceSemanticErrorZ;
4961
4962
4963
4964 /**
4965  * Description string
4966  *
4967  * # Invariants
4968  * The description can be at most 639 __bytes__ long
4969  */
4970 typedef struct MUST_USE_STRUCT LDKDescription {
4971    /**
4972     * A pointer to the opaque Rust object.
4973     * Nearly everywhere, inner must be non-null, however in places where
4974     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4975     */
4976    LDKnativeDescription *inner;
4977    /**
4978     * Indicates that this is the only struct which contains the same pointer.
4979     * Rust functions which take ownership of an object provided via an argument require
4980     * this to be true and invalidate the object pointed to by inner.
4981     */
4982    bool is_owned;
4983 } LDKDescription;
4984
4985 /**
4986  * The contents of CResult_DescriptionCreationErrorZ
4987  */
4988 typedef union LDKCResult_DescriptionCreationErrorZPtr {
4989    /**
4990     * A pointer to the contents in the success state.
4991     * Reading from this pointer when `result_ok` is not set is undefined.
4992     */
4993    struct LDKDescription *result;
4994    /**
4995     * A pointer to the contents in the error state.
4996     * Reading from this pointer when `result_ok` is set is undefined.
4997     */
4998    enum LDKCreationError *err;
4999 } LDKCResult_DescriptionCreationErrorZPtr;
5000
5001 /**
5002  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5003  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5004  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5005  */
5006 typedef struct LDKCResult_DescriptionCreationErrorZ {
5007    /**
5008     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5009     * `err` or `result` depending on the state of `result_ok`.
5010     */
5011    union LDKCResult_DescriptionCreationErrorZPtr contents;
5012    /**
5013     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5014     */
5015    bool result_ok;
5016 } LDKCResult_DescriptionCreationErrorZ;
5017
5018
5019
5020 /**
5021  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5022  * expires
5023  *
5024  * # Invariants
5025  * The number of seconds this expiry time represents has to be in the range
5026  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5027  * timestamp
5028  */
5029 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5030    /**
5031     * A pointer to the opaque Rust object.
5032     * Nearly everywhere, inner must be non-null, however in places where
5033     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5034     */
5035    LDKnativeExpiryTime *inner;
5036    /**
5037     * Indicates that this is the only struct which contains the same pointer.
5038     * Rust functions which take ownership of an object provided via an argument require
5039     * this to be true and invalidate the object pointed to by inner.
5040     */
5041    bool is_owned;
5042 } LDKExpiryTime;
5043
5044 /**
5045  * The contents of CResult_ExpiryTimeCreationErrorZ
5046  */
5047 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5048    /**
5049     * A pointer to the contents in the success state.
5050     * Reading from this pointer when `result_ok` is not set is undefined.
5051     */
5052    struct LDKExpiryTime *result;
5053    /**
5054     * A pointer to the contents in the error state.
5055     * Reading from this pointer when `result_ok` is set is undefined.
5056     */
5057    enum LDKCreationError *err;
5058 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5059
5060 /**
5061  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5062  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5063  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5064  */
5065 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5066    /**
5067     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5068     * `err` or `result` depending on the state of `result_ok`.
5069     */
5070    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5071    /**
5072     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5073     */
5074    bool result_ok;
5075 } LDKCResult_ExpiryTimeCreationErrorZ;
5076
5077 /**
5078  * The contents of CResult_PrivateRouteCreationErrorZ
5079  */
5080 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5081    /**
5082     * A pointer to the contents in the success state.
5083     * Reading from this pointer when `result_ok` is not set is undefined.
5084     */
5085    struct LDKPrivateRoute *result;
5086    /**
5087     * A pointer to the contents in the error state.
5088     * Reading from this pointer when `result_ok` is set is undefined.
5089     */
5090    enum LDKCreationError *err;
5091 } LDKCResult_PrivateRouteCreationErrorZPtr;
5092
5093 /**
5094  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5095  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5096  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5097  */
5098 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5099    /**
5100     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5101     * `err` or `result` depending on the state of `result_ok`.
5102     */
5103    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5104    /**
5105     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5106     */
5107    bool result_ok;
5108 } LDKCResult_PrivateRouteCreationErrorZ;
5109
5110 /**
5111  * The contents of CResult_StringErrorZ
5112  */
5113 typedef union LDKCResult_StringErrorZPtr {
5114    /**
5115     * A pointer to the contents in the success state.
5116     * Reading from this pointer when `result_ok` is not set is undefined.
5117     */
5118    struct LDKStr *result;
5119    /**
5120     * A pointer to the contents in the error state.
5121     * Reading from this pointer when `result_ok` is set is undefined.
5122     */
5123    enum LDKSecp256k1Error *err;
5124 } LDKCResult_StringErrorZPtr;
5125
5126 /**
5127  * A CResult_StringErrorZ represents the result of a fallible operation,
5128  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5130  */
5131 typedef struct LDKCResult_StringErrorZ {
5132    /**
5133     * The contents of this CResult_StringErrorZ, accessible via either
5134     * `err` or `result` depending on the state of `result_ok`.
5135     */
5136    union LDKCResult_StringErrorZPtr contents;
5137    /**
5138     * Whether this CResult_StringErrorZ represents a success state.
5139     */
5140    bool result_ok;
5141 } LDKCResult_StringErrorZ;
5142
5143 /**
5144  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5145  */
5146 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5147    /**
5148     * A pointer to the contents in the success state.
5149     * Reading from this pointer when `result_ok` is not set is undefined.
5150     */
5151    struct LDKChannelMonitorUpdate *result;
5152    /**
5153     * A pointer to the contents in the error state.
5154     * Reading from this pointer when `result_ok` is set is undefined.
5155     */
5156    struct LDKDecodeError *err;
5157 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5158
5159 /**
5160  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5161  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5162  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5163  */
5164 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5165    /**
5166     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5167     * `err` or `result` depending on the state of `result_ok`.
5168     */
5169    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5170    /**
5171     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5172     */
5173    bool result_ok;
5174 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5175
5176 /**
5177  * The contents of CResult_HTLCUpdateDecodeErrorZ
5178  */
5179 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
5180    /**
5181     * A pointer to the contents in the success state.
5182     * Reading from this pointer when `result_ok` is not set is undefined.
5183     */
5184    struct LDKHTLCUpdate *result;
5185    /**
5186     * A pointer to the contents in the error state.
5187     * Reading from this pointer when `result_ok` is set is undefined.
5188     */
5189    struct LDKDecodeError *err;
5190 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5191
5192 /**
5193  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5194  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5195  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5196  */
5197 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5198    /**
5199     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5200     * `err` or `result` depending on the state of `result_ok`.
5201     */
5202    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5203    /**
5204     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5205     */
5206    bool result_ok;
5207 } LDKCResult_HTLCUpdateDecodeErrorZ;
5208
5209
5210
5211 /**
5212  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5213  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5214  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5215  * corrupted.
5216  * Contains a developer-readable error message.
5217  */
5218 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5219    /**
5220     * A pointer to the opaque Rust object.
5221     * Nearly everywhere, inner must be non-null, however in places where
5222     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5223     */
5224    LDKnativeMonitorUpdateError *inner;
5225    /**
5226     * Indicates that this is the only struct which contains the same pointer.
5227     * Rust functions which take ownership of an object provided via an argument require
5228     * this to be true and invalidate the object pointed to by inner.
5229     */
5230    bool is_owned;
5231 } LDKMonitorUpdateError;
5232
5233 /**
5234  * The contents of CResult_NoneMonitorUpdateErrorZ
5235  */
5236 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5237    /**
5238     * Note that this value is always NULL, as there are no contents in the OK variant
5239     */
5240    void *result;
5241    /**
5242     * A pointer to the contents in the error state.
5243     * Reading from this pointer when `result_ok` is set is undefined.
5244     */
5245    struct LDKMonitorUpdateError *err;
5246 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5247
5248 /**
5249  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5250  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5251  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5252  */
5253 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5254    /**
5255     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5256     * `err` or `result` depending on the state of `result_ok`.
5257     */
5258    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5259    /**
5260     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5261     */
5262    bool result_ok;
5263 } LDKCResult_NoneMonitorUpdateErrorZ;
5264
5265 /**
5266  * A tuple of 2 elements. See the individual fields for the types contained.
5267  */
5268 typedef struct LDKC2Tuple_OutPointScriptZ {
5269    /**
5270     * The element at position 0
5271     */
5272    struct LDKOutPoint a;
5273    /**
5274     * The element at position 1
5275     */
5276    struct LDKCVec_u8Z b;
5277 } LDKC2Tuple_OutPointScriptZ;
5278
5279 /**
5280  * A tuple of 2 elements. See the individual fields for the types contained.
5281  */
5282 typedef struct LDKC2Tuple_u32ScriptZ {
5283    /**
5284     * The element at position 0
5285     */
5286    uint32_t a;
5287    /**
5288     * The element at position 1
5289     */
5290    struct LDKCVec_u8Z b;
5291 } LDKC2Tuple_u32ScriptZ;
5292
5293 /**
5294  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5295  * This corresponds to std::vector in C++
5296  */
5297 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5298    /**
5299     * The elements in the array.
5300     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5301     */
5302    struct LDKC2Tuple_u32ScriptZ *data;
5303    /**
5304     * The number of elements pointed to by `data`.
5305     */
5306    uintptr_t datalen;
5307 } LDKCVec_C2Tuple_u32ScriptZZ;
5308
5309 /**
5310  * A tuple of 2 elements. See the individual fields for the types contained.
5311  */
5312 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5313    /**
5314     * The element at position 0
5315     */
5316    struct LDKThirtyTwoBytes a;
5317    /**
5318     * The element at position 1
5319     */
5320    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5321 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5322
5323 /**
5324  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5325  * This corresponds to std::vector in C++
5326  */
5327 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5328    /**
5329     * The elements in the array.
5330     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5331     */
5332    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5333    /**
5334     * The number of elements pointed to by `data`.
5335     */
5336    uintptr_t datalen;
5337 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5338
5339 /**
5340  * An Event which you should probably take some action in response to.
5341  *
5342  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
5343  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
5344  * written as it makes no sense to respond to it after reconnecting to peers).
5345  */
5346 typedef enum LDKEvent_Tag {
5347    /**
5348     * Used to indicate that the client should generate a funding transaction with the given
5349     * parameters and then call ChannelManager::funding_transaction_generated.
5350     * Generated in ChannelManager message handling.
5351     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
5352     * counterparty can steal your funds!
5353     */
5354    LDKEvent_FundingGenerationReady,
5355    /**
5356     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
5357     * ChannelManager::claim_funds to get it....
5358     * Note that if the preimage is not known or the amount paid is incorrect, you should call
5359     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
5360     * network congestion.
5361     * The amount paid should be considered 'incorrect' when it is less than or more than twice
5362     * the amount expected.
5363     * If you fail to call either ChannelManager::claim_funds or
5364     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
5365     * automatically failed.
5366     */
5367    LDKEvent_PaymentReceived,
5368    /**
5369     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
5370     * and we got back the payment preimage for it).
5371     */
5372    LDKEvent_PaymentSent,
5373    /**
5374     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
5375     * something. You may wish to retry with a different route.
5376     */
5377    LDKEvent_PaymentFailed,
5378    /**
5379     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
5380     * time in the future.
5381     */
5382    LDKEvent_PendingHTLCsForwardable,
5383    /**
5384     * Used to indicate that an output which you should know how to spend was confirmed on chain
5385     * and is now spendable.
5386     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
5387     * counterparty spending them due to some kind of timeout. Thus, you need to store them
5388     * somewhere and spend them when you create on-chain transactions.
5389     */
5390    LDKEvent_SpendableOutputs,
5391    /**
5392     * Must be last for serialization purposes
5393     */
5394    LDKEvent_Sentinel,
5395 } LDKEvent_Tag;
5396
5397 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
5398    /**
5399     * The random channel_id we picked which you'll need to pass into
5400     * ChannelManager::funding_transaction_generated.
5401     */
5402    struct LDKThirtyTwoBytes temporary_channel_id;
5403    /**
5404     * The value, in satoshis, that the output should have.
5405     */
5406    uint64_t channel_value_satoshis;
5407    /**
5408     * The script which should be used in the transaction output.
5409     */
5410    struct LDKCVec_u8Z output_script;
5411    /**
5412     * The value passed in to ChannelManager::create_channel
5413     */
5414    uint64_t user_channel_id;
5415 } LDKEvent_LDKFundingGenerationReady_Body;
5416
5417 typedef struct LDKEvent_LDKPaymentReceived_Body {
5418    /**
5419     * The hash for which the preimage should be handed to the ChannelManager.
5420     */
5421    struct LDKThirtyTwoBytes payment_hash;
5422    /**
5423     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5424     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5425     * [`ChannelManager::claim_funds`].
5426     *
5427     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5428     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5429     */
5430    struct LDKThirtyTwoBytes payment_preimage;
5431    /**
5432     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5433     * number of deanonymization attacks during the routing process.
5434     * It is provided here for your reference, however its accuracy is enforced directly by
5435     * [`ChannelManager`] using the values you previously provided to
5436     * [`ChannelManager::create_inbound_payment`] or
5437     * [`ChannelManager::create_inbound_payment_for_hash`].
5438     *
5439     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5440     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5441     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5442     */
5443    struct LDKThirtyTwoBytes payment_secret;
5444    /**
5445     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
5446     * compare this to the expected value before accepting the payment (as otherwise you are
5447     * providing proof-of-payment for less than the value you expected!).
5448     */
5449    uint64_t amt;
5450    /**
5451     * This is the `user_payment_id` which was provided to
5452     * [`ChannelManager::create_inbound_payment_for_hash`] or
5453     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5454     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5455     * metadata stored elsewhere.
5456     *
5457     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5458     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5459     */
5460    uint64_t user_payment_id;
5461 } LDKEvent_LDKPaymentReceived_Body;
5462
5463 typedef struct LDKEvent_LDKPaymentSent_Body {
5464    /**
5465     * The preimage to the hash given to ChannelManager::send_payment.
5466     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
5467     * store it somehow!
5468     */
5469    struct LDKThirtyTwoBytes payment_preimage;
5470 } LDKEvent_LDKPaymentSent_Body;
5471
5472 typedef struct LDKEvent_LDKPaymentFailed_Body {
5473    /**
5474     * The hash which was given to ChannelManager::send_payment.
5475     */
5476    struct LDKThirtyTwoBytes payment_hash;
5477    /**
5478     * Indicates the payment was rejected for some reason by the recipient. This implies that
5479     * the payment has failed, not just the route in question. If this is not set, you may
5480     * retry the payment via a different route.
5481     */
5482    bool rejected_by_dest;
5483 } LDKEvent_LDKPaymentFailed_Body;
5484
5485 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
5486    /**
5487     * The minimum amount of time that should be waited prior to calling
5488     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
5489     * you should wait a random amount of time in roughly the range (now + time_forwardable,
5490     * now + 5*time_forwardable).
5491     */
5492    uint64_t time_forwardable;
5493 } LDKEvent_LDKPendingHTLCsForwardable_Body;
5494
5495 typedef struct LDKEvent_LDKSpendableOutputs_Body {
5496    /**
5497     * The outputs which you should store as spendable by you.
5498     */
5499    struct LDKCVec_SpendableOutputDescriptorZ outputs;
5500 } LDKEvent_LDKSpendableOutputs_Body;
5501
5502 typedef struct MUST_USE_STRUCT LDKEvent {
5503    LDKEvent_Tag tag;
5504    union {
5505       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
5506       LDKEvent_LDKPaymentReceived_Body payment_received;
5507       LDKEvent_LDKPaymentSent_Body payment_sent;
5508       LDKEvent_LDKPaymentFailed_Body payment_failed;
5509       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
5510       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
5511    };
5512 } LDKEvent;
5513
5514 /**
5515  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
5516  * This corresponds to std::vector in C++
5517  */
5518 typedef struct LDKCVec_EventZ {
5519    /**
5520     * The elements in the array.
5521     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5522     */
5523    struct LDKEvent *data;
5524    /**
5525     * The number of elements pointed to by `data`.
5526     */
5527    uintptr_t datalen;
5528 } LDKCVec_EventZ;
5529
5530 /**
5531  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
5532  * This corresponds to std::vector in C++
5533  */
5534 typedef struct LDKCVec_TransactionZ {
5535    /**
5536     * The elements in the array.
5537     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5538     */
5539    struct LDKTransaction *data;
5540    /**
5541     * The number of elements pointed to by `data`.
5542     */
5543    uintptr_t datalen;
5544 } LDKCVec_TransactionZ;
5545
5546 /**
5547  * A tuple of 2 elements. See the individual fields for the types contained.
5548  */
5549 typedef struct LDKC2Tuple_u32TxOutZ {
5550    /**
5551     * The element at position 0
5552     */
5553    uint32_t a;
5554    /**
5555     * The element at position 1
5556     */
5557    struct LDKTxOut b;
5558 } LDKC2Tuple_u32TxOutZ;
5559
5560 /**
5561  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
5562  * This corresponds to std::vector in C++
5563  */
5564 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
5565    /**
5566     * The elements in the array.
5567     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5568     */
5569    struct LDKC2Tuple_u32TxOutZ *data;
5570    /**
5571     * The number of elements pointed to by `data`.
5572     */
5573    uintptr_t datalen;
5574 } LDKCVec_C2Tuple_u32TxOutZZ;
5575
5576 /**
5577  * A tuple of 2 elements. See the individual fields for the types contained.
5578  */
5579 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
5580    /**
5581     * The element at position 0
5582     */
5583    struct LDKThirtyTwoBytes a;
5584    /**
5585     * The element at position 1
5586     */
5587    struct LDKCVec_C2Tuple_u32TxOutZZ b;
5588 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
5589
5590 /**
5591  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
5592  * This corresponds to std::vector in C++
5593  */
5594 typedef struct LDKCVec_TransactionOutputsZ {
5595    /**
5596     * The elements in the array.
5597     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5598     */
5599    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
5600    /**
5601     * The number of elements pointed to by `data`.
5602     */
5603    uintptr_t datalen;
5604 } LDKCVec_TransactionOutputsZ;
5605
5606 /**
5607  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
5608  */
5609 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
5610    /**
5611     * A pointer to the contents in the success state.
5612     * Reading from this pointer when `result_ok` is not set is undefined.
5613     */
5614    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
5615    /**
5616     * A pointer to the contents in the error state.
5617     * Reading from this pointer when `result_ok` is set is undefined.
5618     */
5619    struct LDKDecodeError *err;
5620 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
5621
5622 /**
5623  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
5624  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5625  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5626  */
5627 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
5628    /**
5629     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
5630     * `err` or `result` depending on the state of `result_ok`.
5631     */
5632    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
5633    /**
5634     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
5635     */
5636    bool result_ok;
5637 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
5638
5639 /**
5640  * The contents of CResult_boolLightningErrorZ
5641  */
5642 typedef union LDKCResult_boolLightningErrorZPtr {
5643    /**
5644     * A pointer to the contents in the success state.
5645     * Reading from this pointer when `result_ok` is not set is undefined.
5646     */
5647    bool *result;
5648    /**
5649     * A pointer to the contents in the error state.
5650     * Reading from this pointer when `result_ok` is set is undefined.
5651     */
5652    struct LDKLightningError *err;
5653 } LDKCResult_boolLightningErrorZPtr;
5654
5655 /**
5656  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5657  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5658  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5659  */
5660 typedef struct LDKCResult_boolLightningErrorZ {
5661    /**
5662     * The contents of this CResult_boolLightningErrorZ, accessible via either
5663     * `err` or `result` depending on the state of `result_ok`.
5664     */
5665    union LDKCResult_boolLightningErrorZPtr contents;
5666    /**
5667     * Whether this CResult_boolLightningErrorZ represents a success state.
5668     */
5669    bool result_ok;
5670 } LDKCResult_boolLightningErrorZ;
5671
5672 /**
5673  * A tuple of 3 elements. See the individual fields for the types contained.
5674  */
5675 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5676    /**
5677     * The element at position 0
5678     */
5679    struct LDKChannelAnnouncement a;
5680    /**
5681     * The element at position 1
5682     */
5683    struct LDKChannelUpdate b;
5684    /**
5685     * The element at position 2
5686     */
5687    struct LDKChannelUpdate c;
5688 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5689
5690 /**
5691  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5692  * This corresponds to std::vector in C++
5693  */
5694 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5695    /**
5696     * The elements in the array.
5697     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5698     */
5699    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5700    /**
5701     * The number of elements pointed to by `data`.
5702     */
5703    uintptr_t datalen;
5704 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5705
5706 /**
5707  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5708  * This corresponds to std::vector in C++
5709  */
5710 typedef struct LDKCVec_NodeAnnouncementZ {
5711    /**
5712     * The elements in the array.
5713     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5714     */
5715    struct LDKNodeAnnouncement *data;
5716    /**
5717     * The number of elements pointed to by `data`.
5718     */
5719    uintptr_t datalen;
5720 } LDKCVec_NodeAnnouncementZ;
5721
5722 /**
5723  * The contents of CResult_NoneLightningErrorZ
5724  */
5725 typedef union LDKCResult_NoneLightningErrorZPtr {
5726    /**
5727     * Note that this value is always NULL, as there are no contents in the OK variant
5728     */
5729    void *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 LDKLightningError *err;
5735 } LDKCResult_NoneLightningErrorZPtr;
5736
5737 /**
5738  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5739  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5740  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5741  */
5742 typedef struct LDKCResult_NoneLightningErrorZ {
5743    /**
5744     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5745     * `err` or `result` depending on the state of `result_ok`.
5746     */
5747    union LDKCResult_NoneLightningErrorZPtr contents;
5748    /**
5749     * Whether this CResult_NoneLightningErrorZ represents a success state.
5750     */
5751    bool result_ok;
5752 } LDKCResult_NoneLightningErrorZ;
5753
5754 /**
5755  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
5756  * This corresponds to std::vector in C++
5757  */
5758 typedef struct LDKCVec_PublicKeyZ {
5759    /**
5760     * The elements in the array.
5761     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5762     */
5763    struct LDKPublicKey *data;
5764    /**
5765     * The number of elements pointed to by `data`.
5766     */
5767    uintptr_t datalen;
5768 } LDKCVec_PublicKeyZ;
5769
5770
5771
5772 /**
5773  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
5774  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
5775  * descriptor.
5776  */
5777 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
5778    /**
5779     * A pointer to the opaque Rust object.
5780     * Nearly everywhere, inner must be non-null, however in places where
5781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5782     */
5783    LDKnativePeerHandleError *inner;
5784    /**
5785     * Indicates that this is the only struct which contains the same pointer.
5786     * Rust functions which take ownership of an object provided via an argument require
5787     * this to be true and invalidate the object pointed to by inner.
5788     */
5789    bool is_owned;
5790 } LDKPeerHandleError;
5791
5792 /**
5793  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
5794  */
5795 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
5796    /**
5797     * A pointer to the contents in the success state.
5798     * Reading from this pointer when `result_ok` is not set is undefined.
5799     */
5800    struct LDKCVec_u8Z *result;
5801    /**
5802     * A pointer to the contents in the error state.
5803     * Reading from this pointer when `result_ok` is set is undefined.
5804     */
5805    struct LDKPeerHandleError *err;
5806 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
5807
5808 /**
5809  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
5810  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5811  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5812  */
5813 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
5814    /**
5815     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
5816     * `err` or `result` depending on the state of `result_ok`.
5817     */
5818    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
5819    /**
5820     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
5821     */
5822    bool result_ok;
5823 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
5824
5825 /**
5826  * The contents of CResult_NonePeerHandleErrorZ
5827  */
5828 typedef union LDKCResult_NonePeerHandleErrorZPtr {
5829    /**
5830     * Note that this value is always NULL, as there are no contents in the OK variant
5831     */
5832    void *result;
5833    /**
5834     * A pointer to the contents in the error state.
5835     * Reading from this pointer when `result_ok` is set is undefined.
5836     */
5837    struct LDKPeerHandleError *err;
5838 } LDKCResult_NonePeerHandleErrorZPtr;
5839
5840 /**
5841  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
5842  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5843  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5844  */
5845 typedef struct LDKCResult_NonePeerHandleErrorZ {
5846    /**
5847     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
5848     * `err` or `result` depending on the state of `result_ok`.
5849     */
5850    union LDKCResult_NonePeerHandleErrorZPtr contents;
5851    /**
5852     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
5853     */
5854    bool result_ok;
5855 } LDKCResult_NonePeerHandleErrorZ;
5856
5857 /**
5858  * The contents of CResult_boolPeerHandleErrorZ
5859  */
5860 typedef union LDKCResult_boolPeerHandleErrorZPtr {
5861    /**
5862     * A pointer to the contents in the success state.
5863     * Reading from this pointer when `result_ok` is not set is undefined.
5864     */
5865    bool *result;
5866    /**
5867     * A pointer to the contents in the error state.
5868     * Reading from this pointer when `result_ok` is set is undefined.
5869     */
5870    struct LDKPeerHandleError *err;
5871 } LDKCResult_boolPeerHandleErrorZPtr;
5872
5873 /**
5874  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
5875  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5876  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5877  */
5878 typedef struct LDKCResult_boolPeerHandleErrorZ {
5879    /**
5880     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
5881     * `err` or `result` depending on the state of `result_ok`.
5882     */
5883    union LDKCResult_boolPeerHandleErrorZPtr contents;
5884    /**
5885     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
5886     */
5887    bool result_ok;
5888 } LDKCResult_boolPeerHandleErrorZ;
5889
5890
5891
5892 /**
5893  * Details about one direction of a channel. Received
5894  * within a channel update.
5895  */
5896 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
5897    /**
5898     * A pointer to the opaque Rust object.
5899     * Nearly everywhere, inner must be non-null, however in places where
5900     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5901     */
5902    LDKnativeDirectionalChannelInfo *inner;
5903    /**
5904     * Indicates that this is the only struct which contains the same pointer.
5905     * Rust functions which take ownership of an object provided via an argument require
5906     * this to be true and invalidate the object pointed to by inner.
5907     */
5908    bool is_owned;
5909 } LDKDirectionalChannelInfo;
5910
5911 /**
5912  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
5913  */
5914 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
5915    /**
5916     * A pointer to the contents in the success state.
5917     * Reading from this pointer when `result_ok` is not set is undefined.
5918     */
5919    struct LDKDirectionalChannelInfo *result;
5920    /**
5921     * A pointer to the contents in the error state.
5922     * Reading from this pointer when `result_ok` is set is undefined.
5923     */
5924    struct LDKDecodeError *err;
5925 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
5926
5927 /**
5928  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
5929  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5930  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5931  */
5932 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
5933    /**
5934     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
5935     * `err` or `result` depending on the state of `result_ok`.
5936     */
5937    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
5938    /**
5939     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
5940     */
5941    bool result_ok;
5942 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
5943
5944
5945
5946 /**
5947  * Details about a channel (both directions).
5948  * Received within a channel announcement.
5949  */
5950 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5951    /**
5952     * A pointer to the opaque Rust object.
5953     * Nearly everywhere, inner must be non-null, however in places where
5954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5955     */
5956    LDKnativeChannelInfo *inner;
5957    /**
5958     * Indicates that this is the only struct which contains the same pointer.
5959     * Rust functions which take ownership of an object provided via an argument require
5960     * this to be true and invalidate the object pointed to by inner.
5961     */
5962    bool is_owned;
5963 } LDKChannelInfo;
5964
5965 /**
5966  * The contents of CResult_ChannelInfoDecodeErrorZ
5967  */
5968 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5969    /**
5970     * A pointer to the contents in the success state.
5971     * Reading from this pointer when `result_ok` is not set is undefined.
5972     */
5973    struct LDKChannelInfo *result;
5974    /**
5975     * A pointer to the contents in the error state.
5976     * Reading from this pointer when `result_ok` is set is undefined.
5977     */
5978    struct LDKDecodeError *err;
5979 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5980
5981 /**
5982  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5983  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5985  */
5986 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5987    /**
5988     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5989     * `err` or `result` depending on the state of `result_ok`.
5990     */
5991    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5992    /**
5993     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5994     */
5995    bool result_ok;
5996 } LDKCResult_ChannelInfoDecodeErrorZ;
5997
5998
5999
6000 /**
6001  * Fees for routing via a given channel or a node
6002  */
6003 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6004    /**
6005     * A pointer to the opaque Rust object.
6006     * Nearly everywhere, inner must be non-null, however in places where
6007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6008     */
6009    LDKnativeRoutingFees *inner;
6010    /**
6011     * Indicates that this is the only struct which contains the same pointer.
6012     * Rust functions which take ownership of an object provided via an argument require
6013     * this to be true and invalidate the object pointed to by inner.
6014     */
6015    bool is_owned;
6016 } LDKRoutingFees;
6017
6018 /**
6019  * The contents of CResult_RoutingFeesDecodeErrorZ
6020  */
6021 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6022    /**
6023     * A pointer to the contents in the success state.
6024     * Reading from this pointer when `result_ok` is not set is undefined.
6025     */
6026    struct LDKRoutingFees *result;
6027    /**
6028     * A pointer to the contents in the error state.
6029     * Reading from this pointer when `result_ok` is set is undefined.
6030     */
6031    struct LDKDecodeError *err;
6032 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6033
6034 /**
6035  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6036  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6038  */
6039 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6040    /**
6041     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6042     * `err` or `result` depending on the state of `result_ok`.
6043     */
6044    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6045    /**
6046     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6047     */
6048    bool result_ok;
6049 } LDKCResult_RoutingFeesDecodeErrorZ;
6050
6051
6052
6053 /**
6054  * Information received in the latest node_announcement from this node.
6055  */
6056 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6057    /**
6058     * A pointer to the opaque Rust object.
6059     * Nearly everywhere, inner must be non-null, however in places where
6060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6061     */
6062    LDKnativeNodeAnnouncementInfo *inner;
6063    /**
6064     * Indicates that this is the only struct which contains the same pointer.
6065     * Rust functions which take ownership of an object provided via an argument require
6066     * this to be true and invalidate the object pointed to by inner.
6067     */
6068    bool is_owned;
6069 } LDKNodeAnnouncementInfo;
6070
6071 /**
6072  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6073  */
6074 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6075    /**
6076     * A pointer to the contents in the success state.
6077     * Reading from this pointer when `result_ok` is not set is undefined.
6078     */
6079    struct LDKNodeAnnouncementInfo *result;
6080    /**
6081     * A pointer to the contents in the error state.
6082     * Reading from this pointer when `result_ok` is set is undefined.
6083     */
6084    struct LDKDecodeError *err;
6085 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6086
6087 /**
6088  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6089  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6091  */
6092 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6093    /**
6094     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6095     * `err` or `result` depending on the state of `result_ok`.
6096     */
6097    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6098    /**
6099     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6100     */
6101    bool result_ok;
6102 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6103
6104 /**
6105  * A dynamically-allocated array of u64s of arbitrary size.
6106  * This corresponds to std::vector in C++
6107  */
6108 typedef struct LDKCVec_u64Z {
6109    /**
6110     * The elements in the array.
6111     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6112     */
6113    uint64_t *data;
6114    /**
6115     * The number of elements pointed to by `data`.
6116     */
6117    uintptr_t datalen;
6118 } LDKCVec_u64Z;
6119
6120
6121
6122 /**
6123  * Details about a node in the network, known from the network announcement.
6124  */
6125 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6126    /**
6127     * A pointer to the opaque Rust object.
6128     * Nearly everywhere, inner must be non-null, however in places where
6129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6130     */
6131    LDKnativeNodeInfo *inner;
6132    /**
6133     * Indicates that this is the only struct which contains the same pointer.
6134     * Rust functions which take ownership of an object provided via an argument require
6135     * this to be true and invalidate the object pointed to by inner.
6136     */
6137    bool is_owned;
6138 } LDKNodeInfo;
6139
6140 /**
6141  * The contents of CResult_NodeInfoDecodeErrorZ
6142  */
6143 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6144    /**
6145     * A pointer to the contents in the success state.
6146     * Reading from this pointer when `result_ok` is not set is undefined.
6147     */
6148    struct LDKNodeInfo *result;
6149    /**
6150     * A pointer to the contents in the error state.
6151     * Reading from this pointer when `result_ok` is set is undefined.
6152     */
6153    struct LDKDecodeError *err;
6154 } LDKCResult_NodeInfoDecodeErrorZPtr;
6155
6156 /**
6157  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6158  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6160  */
6161 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6162    /**
6163     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6164     * `err` or `result` depending on the state of `result_ok`.
6165     */
6166    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6167    /**
6168     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6169     */
6170    bool result_ok;
6171 } LDKCResult_NodeInfoDecodeErrorZ;
6172
6173
6174
6175 /**
6176  * Represents the network as nodes and channels between them
6177  */
6178 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
6179    /**
6180     * A pointer to the opaque Rust object.
6181     * Nearly everywhere, inner must be non-null, however in places where
6182     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6183     */
6184    LDKnativeNetworkGraph *inner;
6185    /**
6186     * Indicates that this is the only struct which contains the same pointer.
6187     * Rust functions which take ownership of an object provided via an argument require
6188     * this to be true and invalidate the object pointed to by inner.
6189     */
6190    bool is_owned;
6191 } LDKNetworkGraph;
6192
6193 /**
6194  * The contents of CResult_NetworkGraphDecodeErrorZ
6195  */
6196 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6197    /**
6198     * A pointer to the contents in the success state.
6199     * Reading from this pointer when `result_ok` is not set is undefined.
6200     */
6201    struct LDKNetworkGraph *result;
6202    /**
6203     * A pointer to the contents in the error state.
6204     * Reading from this pointer when `result_ok` is set is undefined.
6205     */
6206    struct LDKDecodeError *err;
6207 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6208
6209 /**
6210  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6211  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6212  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6213  */
6214 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6215    /**
6216     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6217     * `err` or `result` depending on the state of `result_ok`.
6218     */
6219    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6220    /**
6221     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6222     */
6223    bool result_ok;
6224 } LDKCResult_NetworkGraphDecodeErrorZ;
6225
6226 /**
6227  * The contents of CResult_NetAddressu8Z
6228  */
6229 typedef union LDKCResult_NetAddressu8ZPtr {
6230    /**
6231     * A pointer to the contents in the success state.
6232     * Reading from this pointer when `result_ok` is not set is undefined.
6233     */
6234    struct LDKNetAddress *result;
6235    /**
6236     * A pointer to the contents in the error state.
6237     * Reading from this pointer when `result_ok` is set is undefined.
6238     */
6239    uint8_t *err;
6240 } LDKCResult_NetAddressu8ZPtr;
6241
6242 /**
6243  * A CResult_NetAddressu8Z represents the result of a fallible operation,
6244  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
6245  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6246  */
6247 typedef struct LDKCResult_NetAddressu8Z {
6248    /**
6249     * The contents of this CResult_NetAddressu8Z, accessible via either
6250     * `err` or `result` depending on the state of `result_ok`.
6251     */
6252    union LDKCResult_NetAddressu8ZPtr contents;
6253    /**
6254     * Whether this CResult_NetAddressu8Z represents a success state.
6255     */
6256    bool result_ok;
6257 } LDKCResult_NetAddressu8Z;
6258
6259 /**
6260  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
6261  */
6262 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
6263    /**
6264     * A pointer to the contents in the success state.
6265     * Reading from this pointer when `result_ok` is not set is undefined.
6266     */
6267    struct LDKCResult_NetAddressu8Z *result;
6268    /**
6269     * A pointer to the contents in the error state.
6270     * Reading from this pointer when `result_ok` is set is undefined.
6271     */
6272    struct LDKDecodeError *err;
6273 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
6274
6275 /**
6276  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
6277  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
6278  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6279  */
6280 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
6281    /**
6282     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
6283     * `err` or `result` depending on the state of `result_ok`.
6284     */
6285    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
6286    /**
6287     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
6288     */
6289    bool result_ok;
6290 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
6291
6292 /**
6293  * The contents of CResult_NetAddressDecodeErrorZ
6294  */
6295 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
6296    /**
6297     * A pointer to the contents in the success state.
6298     * Reading from this pointer when `result_ok` is not set is undefined.
6299     */
6300    struct LDKNetAddress *result;
6301    /**
6302     * A pointer to the contents in the error state.
6303     * Reading from this pointer when `result_ok` is set is undefined.
6304     */
6305    struct LDKDecodeError *err;
6306 } LDKCResult_NetAddressDecodeErrorZPtr;
6307
6308 /**
6309  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
6310  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
6311  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6312  */
6313 typedef struct LDKCResult_NetAddressDecodeErrorZ {
6314    /**
6315     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
6316     * `err` or `result` depending on the state of `result_ok`.
6317     */
6318    union LDKCResult_NetAddressDecodeErrorZPtr contents;
6319    /**
6320     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
6321     */
6322    bool result_ok;
6323 } LDKCResult_NetAddressDecodeErrorZ;
6324
6325
6326
6327 /**
6328  * An update_add_htlc message to be sent or received from a peer
6329  */
6330 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
6331    /**
6332     * A pointer to the opaque Rust object.
6333     * Nearly everywhere, inner must be non-null, however in places where
6334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6335     */
6336    LDKnativeUpdateAddHTLC *inner;
6337    /**
6338     * Indicates that this is the only struct which contains the same pointer.
6339     * Rust functions which take ownership of an object provided via an argument require
6340     * this to be true and invalidate the object pointed to by inner.
6341     */
6342    bool is_owned;
6343 } LDKUpdateAddHTLC;
6344
6345 /**
6346  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6347  * This corresponds to std::vector in C++
6348  */
6349 typedef struct LDKCVec_UpdateAddHTLCZ {
6350    /**
6351     * The elements in the array.
6352     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6353     */
6354    struct LDKUpdateAddHTLC *data;
6355    /**
6356     * The number of elements pointed to by `data`.
6357     */
6358    uintptr_t datalen;
6359 } LDKCVec_UpdateAddHTLCZ;
6360
6361
6362
6363 /**
6364  * An update_fulfill_htlc message to be sent or received from a peer
6365  */
6366 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
6367    /**
6368     * A pointer to the opaque Rust object.
6369     * Nearly everywhere, inner must be non-null, however in places where
6370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6371     */
6372    LDKnativeUpdateFulfillHTLC *inner;
6373    /**
6374     * Indicates that this is the only struct which contains the same pointer.
6375     * Rust functions which take ownership of an object provided via an argument require
6376     * this to be true and invalidate the object pointed to by inner.
6377     */
6378    bool is_owned;
6379 } LDKUpdateFulfillHTLC;
6380
6381 /**
6382  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6383  * This corresponds to std::vector in C++
6384  */
6385 typedef struct LDKCVec_UpdateFulfillHTLCZ {
6386    /**
6387     * The elements in the array.
6388     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6389     */
6390    struct LDKUpdateFulfillHTLC *data;
6391    /**
6392     * The number of elements pointed to by `data`.
6393     */
6394    uintptr_t datalen;
6395 } LDKCVec_UpdateFulfillHTLCZ;
6396
6397
6398
6399 /**
6400  * An update_fail_htlc message to be sent or received from a peer
6401  */
6402 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
6403    /**
6404     * A pointer to the opaque Rust object.
6405     * Nearly everywhere, inner must be non-null, however in places where
6406     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6407     */
6408    LDKnativeUpdateFailHTLC *inner;
6409    /**
6410     * Indicates that this is the only struct which contains the same pointer.
6411     * Rust functions which take ownership of an object provided via an argument require
6412     * this to be true and invalidate the object pointed to by inner.
6413     */
6414    bool is_owned;
6415 } LDKUpdateFailHTLC;
6416
6417 /**
6418  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6419  * This corresponds to std::vector in C++
6420  */
6421 typedef struct LDKCVec_UpdateFailHTLCZ {
6422    /**
6423     * The elements in the array.
6424     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6425     */
6426    struct LDKUpdateFailHTLC *data;
6427    /**
6428     * The number of elements pointed to by `data`.
6429     */
6430    uintptr_t datalen;
6431 } LDKCVec_UpdateFailHTLCZ;
6432
6433
6434
6435 /**
6436  * An update_fail_malformed_htlc message to be sent or received from a peer
6437  */
6438 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
6439    /**
6440     * A pointer to the opaque Rust object.
6441     * Nearly everywhere, inner must be non-null, however in places where
6442     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6443     */
6444    LDKnativeUpdateFailMalformedHTLC *inner;
6445    /**
6446     * Indicates that this is the only struct which contains the same pointer.
6447     * Rust functions which take ownership of an object provided via an argument require
6448     * this to be true and invalidate the object pointed to by inner.
6449     */
6450    bool is_owned;
6451 } LDKUpdateFailMalformedHTLC;
6452
6453 /**
6454  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6455  * This corresponds to std::vector in C++
6456  */
6457 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
6458    /**
6459     * The elements in the array.
6460     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6461     */
6462    struct LDKUpdateFailMalformedHTLC *data;
6463    /**
6464     * The number of elements pointed to by `data`.
6465     */
6466    uintptr_t datalen;
6467 } LDKCVec_UpdateFailMalformedHTLCZ;
6468
6469 /**
6470  * The contents of CResult_AcceptChannelDecodeErrorZ
6471  */
6472 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
6473    /**
6474     * A pointer to the contents in the success state.
6475     * Reading from this pointer when `result_ok` is not set is undefined.
6476     */
6477    struct LDKAcceptChannel *result;
6478    /**
6479     * A pointer to the contents in the error state.
6480     * Reading from this pointer when `result_ok` is set is undefined.
6481     */
6482    struct LDKDecodeError *err;
6483 } LDKCResult_AcceptChannelDecodeErrorZPtr;
6484
6485 /**
6486  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6487  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6488  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6489  */
6490 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
6491    /**
6492     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6493     * `err` or `result` depending on the state of `result_ok`.
6494     */
6495    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
6496    /**
6497     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6498     */
6499    bool result_ok;
6500 } LDKCResult_AcceptChannelDecodeErrorZ;
6501
6502 /**
6503  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6504  */
6505 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
6506    /**
6507     * A pointer to the contents in the success state.
6508     * Reading from this pointer when `result_ok` is not set is undefined.
6509     */
6510    struct LDKAnnouncementSignatures *result;
6511    /**
6512     * A pointer to the contents in the error state.
6513     * Reading from this pointer when `result_ok` is set is undefined.
6514     */
6515    struct LDKDecodeError *err;
6516 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
6517
6518 /**
6519  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6520  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6521  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6522  */
6523 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
6524    /**
6525     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6526     * `err` or `result` depending on the state of `result_ok`.
6527     */
6528    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
6529    /**
6530     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6531     */
6532    bool result_ok;
6533 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
6534
6535 /**
6536  * The contents of CResult_ChannelReestablishDecodeErrorZ
6537  */
6538 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
6539    /**
6540     * A pointer to the contents in the success state.
6541     * Reading from this pointer when `result_ok` is not set is undefined.
6542     */
6543    struct LDKChannelReestablish *result;
6544    /**
6545     * A pointer to the contents in the error state.
6546     * Reading from this pointer when `result_ok` is set is undefined.
6547     */
6548    struct LDKDecodeError *err;
6549 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
6550
6551 /**
6552  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6553  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6555  */
6556 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
6557    /**
6558     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6559     * `err` or `result` depending on the state of `result_ok`.
6560     */
6561    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
6562    /**
6563     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6564     */
6565    bool result_ok;
6566 } LDKCResult_ChannelReestablishDecodeErrorZ;
6567
6568 /**
6569  * The contents of CResult_ClosingSignedDecodeErrorZ
6570  */
6571 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
6572    /**
6573     * A pointer to the contents in the success state.
6574     * Reading from this pointer when `result_ok` is not set is undefined.
6575     */
6576    struct LDKClosingSigned *result;
6577    /**
6578     * A pointer to the contents in the error state.
6579     * Reading from this pointer when `result_ok` is set is undefined.
6580     */
6581    struct LDKDecodeError *err;
6582 } LDKCResult_ClosingSignedDecodeErrorZPtr;
6583
6584 /**
6585  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6586  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6587  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6588  */
6589 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
6590    /**
6591     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6592     * `err` or `result` depending on the state of `result_ok`.
6593     */
6594    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
6595    /**
6596     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6597     */
6598    bool result_ok;
6599 } LDKCResult_ClosingSignedDecodeErrorZ;
6600
6601
6602
6603 /**
6604  * A commitment_signed message to be sent or received from a peer
6605  */
6606 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
6607    /**
6608     * A pointer to the opaque Rust object.
6609     * Nearly everywhere, inner must be non-null, however in places where
6610     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6611     */
6612    LDKnativeCommitmentSigned *inner;
6613    /**
6614     * Indicates that this is the only struct which contains the same pointer.
6615     * Rust functions which take ownership of an object provided via an argument require
6616     * this to be true and invalidate the object pointed to by inner.
6617     */
6618    bool is_owned;
6619 } LDKCommitmentSigned;
6620
6621 /**
6622  * The contents of CResult_CommitmentSignedDecodeErrorZ
6623  */
6624 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
6625    /**
6626     * A pointer to the contents in the success state.
6627     * Reading from this pointer when `result_ok` is not set is undefined.
6628     */
6629    struct LDKCommitmentSigned *result;
6630    /**
6631     * A pointer to the contents in the error state.
6632     * Reading from this pointer when `result_ok` is set is undefined.
6633     */
6634    struct LDKDecodeError *err;
6635 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
6636
6637 /**
6638  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6639  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6640  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6641  */
6642 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
6643    /**
6644     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6645     * `err` or `result` depending on the state of `result_ok`.
6646     */
6647    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
6648    /**
6649     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6650     */
6651    bool result_ok;
6652 } LDKCResult_CommitmentSignedDecodeErrorZ;
6653
6654 /**
6655  * The contents of CResult_FundingCreatedDecodeErrorZ
6656  */
6657 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
6658    /**
6659     * A pointer to the contents in the success state.
6660     * Reading from this pointer when `result_ok` is not set is undefined.
6661     */
6662    struct LDKFundingCreated *result;
6663    /**
6664     * A pointer to the contents in the error state.
6665     * Reading from this pointer when `result_ok` is set is undefined.
6666     */
6667    struct LDKDecodeError *err;
6668 } LDKCResult_FundingCreatedDecodeErrorZPtr;
6669
6670 /**
6671  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6672  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6673  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6674  */
6675 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
6676    /**
6677     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6678     * `err` or `result` depending on the state of `result_ok`.
6679     */
6680    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
6681    /**
6682     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6683     */
6684    bool result_ok;
6685 } LDKCResult_FundingCreatedDecodeErrorZ;
6686
6687 /**
6688  * The contents of CResult_FundingSignedDecodeErrorZ
6689  */
6690 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
6691    /**
6692     * A pointer to the contents in the success state.
6693     * Reading from this pointer when `result_ok` is not set is undefined.
6694     */
6695    struct LDKFundingSigned *result;
6696    /**
6697     * A pointer to the contents in the error state.
6698     * Reading from this pointer when `result_ok` is set is undefined.
6699     */
6700    struct LDKDecodeError *err;
6701 } LDKCResult_FundingSignedDecodeErrorZPtr;
6702
6703 /**
6704  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6705  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6706  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6707  */
6708 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
6709    /**
6710     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6711     * `err` or `result` depending on the state of `result_ok`.
6712     */
6713    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
6714    /**
6715     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6716     */
6717    bool result_ok;
6718 } LDKCResult_FundingSignedDecodeErrorZ;
6719
6720 /**
6721  * The contents of CResult_FundingLockedDecodeErrorZ
6722  */
6723 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
6724    /**
6725     * A pointer to the contents in the success state.
6726     * Reading from this pointer when `result_ok` is not set is undefined.
6727     */
6728    struct LDKFundingLocked *result;
6729    /**
6730     * A pointer to the contents in the error state.
6731     * Reading from this pointer when `result_ok` is set is undefined.
6732     */
6733    struct LDKDecodeError *err;
6734 } LDKCResult_FundingLockedDecodeErrorZPtr;
6735
6736 /**
6737  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6738  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6739  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6740  */
6741 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
6742    /**
6743     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6744     * `err` or `result` depending on the state of `result_ok`.
6745     */
6746    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
6747    /**
6748     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6749     */
6750    bool result_ok;
6751 } LDKCResult_FundingLockedDecodeErrorZ;
6752
6753
6754
6755 /**
6756  * An init message to be sent or received from a peer
6757  */
6758 typedef struct MUST_USE_STRUCT LDKInit {
6759    /**
6760     * A pointer to the opaque Rust object.
6761     * Nearly everywhere, inner must be non-null, however in places where
6762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6763     */
6764    LDKnativeInit *inner;
6765    /**
6766     * Indicates that this is the only struct which contains the same pointer.
6767     * Rust functions which take ownership of an object provided via an argument require
6768     * this to be true and invalidate the object pointed to by inner.
6769     */
6770    bool is_owned;
6771 } LDKInit;
6772
6773 /**
6774  * The contents of CResult_InitDecodeErrorZ
6775  */
6776 typedef union LDKCResult_InitDecodeErrorZPtr {
6777    /**
6778     * A pointer to the contents in the success state.
6779     * Reading from this pointer when `result_ok` is not set is undefined.
6780     */
6781    struct LDKInit *result;
6782    /**
6783     * A pointer to the contents in the error state.
6784     * Reading from this pointer when `result_ok` is set is undefined.
6785     */
6786    struct LDKDecodeError *err;
6787 } LDKCResult_InitDecodeErrorZPtr;
6788
6789 /**
6790  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6791  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793  */
6794 typedef struct LDKCResult_InitDecodeErrorZ {
6795    /**
6796     * The contents of this CResult_InitDecodeErrorZ, accessible via either
6797     * `err` or `result` depending on the state of `result_ok`.
6798     */
6799    union LDKCResult_InitDecodeErrorZPtr contents;
6800    /**
6801     * Whether this CResult_InitDecodeErrorZ represents a success state.
6802     */
6803    bool result_ok;
6804 } LDKCResult_InitDecodeErrorZ;
6805
6806 /**
6807  * The contents of CResult_OpenChannelDecodeErrorZ
6808  */
6809 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
6810    /**
6811     * A pointer to the contents in the success state.
6812     * Reading from this pointer when `result_ok` is not set is undefined.
6813     */
6814    struct LDKOpenChannel *result;
6815    /**
6816     * A pointer to the contents in the error state.
6817     * Reading from this pointer when `result_ok` is set is undefined.
6818     */
6819    struct LDKDecodeError *err;
6820 } LDKCResult_OpenChannelDecodeErrorZPtr;
6821
6822 /**
6823  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6824  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6825  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6826  */
6827 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
6828    /**
6829     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6830     * `err` or `result` depending on the state of `result_ok`.
6831     */
6832    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
6833    /**
6834     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6835     */
6836    bool result_ok;
6837 } LDKCResult_OpenChannelDecodeErrorZ;
6838
6839 /**
6840  * The contents of CResult_RevokeAndACKDecodeErrorZ
6841  */
6842 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
6843    /**
6844     * A pointer to the contents in the success state.
6845     * Reading from this pointer when `result_ok` is not set is undefined.
6846     */
6847    struct LDKRevokeAndACK *result;
6848    /**
6849     * A pointer to the contents in the error state.
6850     * Reading from this pointer when `result_ok` is set is undefined.
6851     */
6852    struct LDKDecodeError *err;
6853 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
6854
6855 /**
6856  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6857  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
6858  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6859  */
6860 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
6861    /**
6862     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6863     * `err` or `result` depending on the state of `result_ok`.
6864     */
6865    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
6866    /**
6867     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6868     */
6869    bool result_ok;
6870 } LDKCResult_RevokeAndACKDecodeErrorZ;
6871
6872 /**
6873  * The contents of CResult_ShutdownDecodeErrorZ
6874  */
6875 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
6876    /**
6877     * A pointer to the contents in the success state.
6878     * Reading from this pointer when `result_ok` is not set is undefined.
6879     */
6880    struct LDKShutdown *result;
6881    /**
6882     * A pointer to the contents in the error state.
6883     * Reading from this pointer when `result_ok` is set is undefined.
6884     */
6885    struct LDKDecodeError *err;
6886 } LDKCResult_ShutdownDecodeErrorZPtr;
6887
6888 /**
6889  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
6890  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
6891  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6892  */
6893 typedef struct LDKCResult_ShutdownDecodeErrorZ {
6894    /**
6895     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6896     * `err` or `result` depending on the state of `result_ok`.
6897     */
6898    union LDKCResult_ShutdownDecodeErrorZPtr contents;
6899    /**
6900     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6901     */
6902    bool result_ok;
6903 } LDKCResult_ShutdownDecodeErrorZ;
6904
6905 /**
6906  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
6907  */
6908 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
6909    /**
6910     * A pointer to the contents in the success state.
6911     * Reading from this pointer when `result_ok` is not set is undefined.
6912     */
6913    struct LDKUpdateFailHTLC *result;
6914    /**
6915     * A pointer to the contents in the error state.
6916     * Reading from this pointer when `result_ok` is set is undefined.
6917     */
6918    struct LDKDecodeError *err;
6919 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
6920
6921 /**
6922  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6923  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6924  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6925  */
6926 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
6927    /**
6928     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6929     * `err` or `result` depending on the state of `result_ok`.
6930     */
6931    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
6932    /**
6933     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6934     */
6935    bool result_ok;
6936 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
6937
6938 /**
6939  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
6940  */
6941 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6942    /**
6943     * A pointer to the contents in the success state.
6944     * Reading from this pointer when `result_ok` is not set is undefined.
6945     */
6946    struct LDKUpdateFailMalformedHTLC *result;
6947    /**
6948     * A pointer to the contents in the error state.
6949     * Reading from this pointer when `result_ok` is set is undefined.
6950     */
6951    struct LDKDecodeError *err;
6952 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
6953
6954 /**
6955  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
6956  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6957  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6958  */
6959 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
6960    /**
6961     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
6962     * `err` or `result` depending on the state of `result_ok`.
6963     */
6964    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
6965    /**
6966     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
6967     */
6968    bool result_ok;
6969 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
6970
6971
6972
6973 /**
6974  * An update_fee message to be sent or received from a peer
6975  */
6976 typedef struct MUST_USE_STRUCT LDKUpdateFee {
6977    /**
6978     * A pointer to the opaque Rust object.
6979     * Nearly everywhere, inner must be non-null, however in places where
6980     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6981     */
6982    LDKnativeUpdateFee *inner;
6983    /**
6984     * Indicates that this is the only struct which contains the same pointer.
6985     * Rust functions which take ownership of an object provided via an argument require
6986     * this to be true and invalidate the object pointed to by inner.
6987     */
6988    bool is_owned;
6989 } LDKUpdateFee;
6990
6991 /**
6992  * The contents of CResult_UpdateFeeDecodeErrorZ
6993  */
6994 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
6995    /**
6996     * A pointer to the contents in the success state.
6997     * Reading from this pointer when `result_ok` is not set is undefined.
6998     */
6999    struct LDKUpdateFee *result;
7000    /**
7001     * A pointer to the contents in the error state.
7002     * Reading from this pointer when `result_ok` is set is undefined.
7003     */
7004    struct LDKDecodeError *err;
7005 } LDKCResult_UpdateFeeDecodeErrorZPtr;
7006
7007 /**
7008  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7009  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7010  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7011  */
7012 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
7013    /**
7014     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7015     * `err` or `result` depending on the state of `result_ok`.
7016     */
7017    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
7018    /**
7019     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7020     */
7021    bool result_ok;
7022 } LDKCResult_UpdateFeeDecodeErrorZ;
7023
7024 /**
7025  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7026  */
7027 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
7028    /**
7029     * A pointer to the contents in the success state.
7030     * Reading from this pointer when `result_ok` is not set is undefined.
7031     */
7032    struct LDKUpdateFulfillHTLC *result;
7033    /**
7034     * A pointer to the contents in the error state.
7035     * Reading from this pointer when `result_ok` is set is undefined.
7036     */
7037    struct LDKDecodeError *err;
7038 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
7039
7040 /**
7041  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7042  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7043  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7044  */
7045 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
7046    /**
7047     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7048     * `err` or `result` depending on the state of `result_ok`.
7049     */
7050    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
7051    /**
7052     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7053     */
7054    bool result_ok;
7055 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
7056
7057 /**
7058  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
7059  */
7060 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
7061    /**
7062     * A pointer to the contents in the success state.
7063     * Reading from this pointer when `result_ok` is not set is undefined.
7064     */
7065    struct LDKUpdateAddHTLC *result;
7066    /**
7067     * A pointer to the contents in the error state.
7068     * Reading from this pointer when `result_ok` is set is undefined.
7069     */
7070    struct LDKDecodeError *err;
7071 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
7072
7073 /**
7074  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7075  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7076  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7077  */
7078 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
7079    /**
7080     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7081     * `err` or `result` depending on the state of `result_ok`.
7082     */
7083    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
7084    /**
7085     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7086     */
7087    bool result_ok;
7088 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
7089
7090
7091
7092 /**
7093  * A ping message to be sent or received from a peer
7094  */
7095 typedef struct MUST_USE_STRUCT LDKPing {
7096    /**
7097     * A pointer to the opaque Rust object.
7098     * Nearly everywhere, inner must be non-null, however in places where
7099     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7100     */
7101    LDKnativePing *inner;
7102    /**
7103     * Indicates that this is the only struct which contains the same pointer.
7104     * Rust functions which take ownership of an object provided via an argument require
7105     * this to be true and invalidate the object pointed to by inner.
7106     */
7107    bool is_owned;
7108 } LDKPing;
7109
7110 /**
7111  * The contents of CResult_PingDecodeErrorZ
7112  */
7113 typedef union LDKCResult_PingDecodeErrorZPtr {
7114    /**
7115     * A pointer to the contents in the success state.
7116     * Reading from this pointer when `result_ok` is not set is undefined.
7117     */
7118    struct LDKPing *result;
7119    /**
7120     * A pointer to the contents in the error state.
7121     * Reading from this pointer when `result_ok` is set is undefined.
7122     */
7123    struct LDKDecodeError *err;
7124 } LDKCResult_PingDecodeErrorZPtr;
7125
7126 /**
7127  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7128  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7130  */
7131 typedef struct LDKCResult_PingDecodeErrorZ {
7132    /**
7133     * The contents of this CResult_PingDecodeErrorZ, accessible via either
7134     * `err` or `result` depending on the state of `result_ok`.
7135     */
7136    union LDKCResult_PingDecodeErrorZPtr contents;
7137    /**
7138     * Whether this CResult_PingDecodeErrorZ represents a success state.
7139     */
7140    bool result_ok;
7141 } LDKCResult_PingDecodeErrorZ;
7142
7143
7144
7145 /**
7146  * A pong message to be sent or received from a peer
7147  */
7148 typedef struct MUST_USE_STRUCT LDKPong {
7149    /**
7150     * A pointer to the opaque Rust object.
7151     * Nearly everywhere, inner must be non-null, however in places where
7152     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7153     */
7154    LDKnativePong *inner;
7155    /**
7156     * Indicates that this is the only struct which contains the same pointer.
7157     * Rust functions which take ownership of an object provided via an argument require
7158     * this to be true and invalidate the object pointed to by inner.
7159     */
7160    bool is_owned;
7161 } LDKPong;
7162
7163 /**
7164  * The contents of CResult_PongDecodeErrorZ
7165  */
7166 typedef union LDKCResult_PongDecodeErrorZPtr {
7167    /**
7168     * A pointer to the contents in the success state.
7169     * Reading from this pointer when `result_ok` is not set is undefined.
7170     */
7171    struct LDKPong *result;
7172    /**
7173     * A pointer to the contents in the error state.
7174     * Reading from this pointer when `result_ok` is set is undefined.
7175     */
7176    struct LDKDecodeError *err;
7177 } LDKCResult_PongDecodeErrorZPtr;
7178
7179 /**
7180  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7181  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7182  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7183  */
7184 typedef struct LDKCResult_PongDecodeErrorZ {
7185    /**
7186     * The contents of this CResult_PongDecodeErrorZ, accessible via either
7187     * `err` or `result` depending on the state of `result_ok`.
7188     */
7189    union LDKCResult_PongDecodeErrorZPtr contents;
7190    /**
7191     * Whether this CResult_PongDecodeErrorZ represents a success state.
7192     */
7193    bool result_ok;
7194 } LDKCResult_PongDecodeErrorZ;
7195
7196 /**
7197  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7198  */
7199 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7200    /**
7201     * A pointer to the contents in the success state.
7202     * Reading from this pointer when `result_ok` is not set is undefined.
7203     */
7204    struct LDKUnsignedChannelAnnouncement *result;
7205    /**
7206     * A pointer to the contents in the error state.
7207     * Reading from this pointer when `result_ok` is set is undefined.
7208     */
7209    struct LDKDecodeError *err;
7210 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
7211
7212 /**
7213  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7214  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7215  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7216  */
7217 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
7218    /**
7219     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7220     * `err` or `result` depending on the state of `result_ok`.
7221     */
7222    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
7223    /**
7224     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7225     */
7226    bool result_ok;
7227 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
7228
7229 /**
7230  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
7231  */
7232 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
7233    /**
7234     * A pointer to the contents in the success state.
7235     * Reading from this pointer when `result_ok` is not set is undefined.
7236     */
7237    struct LDKChannelAnnouncement *result;
7238    /**
7239     * A pointer to the contents in the error state.
7240     * Reading from this pointer when `result_ok` is set is undefined.
7241     */
7242    struct LDKDecodeError *err;
7243 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
7244
7245 /**
7246  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7247  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7248  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7249  */
7250 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
7251    /**
7252     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7253     * `err` or `result` depending on the state of `result_ok`.
7254     */
7255    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
7256    /**
7257     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7258     */
7259    bool result_ok;
7260 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
7261
7262
7263
7264 /**
7265  * The unsigned part of a channel_update
7266  */
7267 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
7268    /**
7269     * A pointer to the opaque Rust object.
7270     * Nearly everywhere, inner must be non-null, however in places where
7271     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7272     */
7273    LDKnativeUnsignedChannelUpdate *inner;
7274    /**
7275     * Indicates that this is the only struct which contains the same pointer.
7276     * Rust functions which take ownership of an object provided via an argument require
7277     * this to be true and invalidate the object pointed to by inner.
7278     */
7279    bool is_owned;
7280 } LDKUnsignedChannelUpdate;
7281
7282 /**
7283  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7284  */
7285 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
7286    /**
7287     * A pointer to the contents in the success state.
7288     * Reading from this pointer when `result_ok` is not set is undefined.
7289     */
7290    struct LDKUnsignedChannelUpdate *result;
7291    /**
7292     * A pointer to the contents in the error state.
7293     * Reading from this pointer when `result_ok` is set is undefined.
7294     */
7295    struct LDKDecodeError *err;
7296 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
7297
7298 /**
7299  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7300  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7302  */
7303 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
7304    /**
7305     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7306     * `err` or `result` depending on the state of `result_ok`.
7307     */
7308    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
7309    /**
7310     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7311     */
7312    bool result_ok;
7313 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
7314
7315 /**
7316  * The contents of CResult_ChannelUpdateDecodeErrorZ
7317  */
7318 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
7319    /**
7320     * A pointer to the contents in the success state.
7321     * Reading from this pointer when `result_ok` is not set is undefined.
7322     */
7323    struct LDKChannelUpdate *result;
7324    /**
7325     * A pointer to the contents in the error state.
7326     * Reading from this pointer when `result_ok` is set is undefined.
7327     */
7328    struct LDKDecodeError *err;
7329 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
7330
7331 /**
7332  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7333  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7334  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7335  */
7336 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
7337    /**
7338     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7339     * `err` or `result` depending on the state of `result_ok`.
7340     */
7341    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
7342    /**
7343     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7344     */
7345    bool result_ok;
7346 } LDKCResult_ChannelUpdateDecodeErrorZ;
7347
7348 /**
7349  * The contents of CResult_ErrorMessageDecodeErrorZ
7350  */
7351 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
7352    /**
7353     * A pointer to the contents in the success state.
7354     * Reading from this pointer when `result_ok` is not set is undefined.
7355     */
7356    struct LDKErrorMessage *result;
7357    /**
7358     * A pointer to the contents in the error state.
7359     * Reading from this pointer when `result_ok` is set is undefined.
7360     */
7361    struct LDKDecodeError *err;
7362 } LDKCResult_ErrorMessageDecodeErrorZPtr;
7363
7364 /**
7365  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7366  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7368  */
7369 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
7370    /**
7371     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7372     * `err` or `result` depending on the state of `result_ok`.
7373     */
7374    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
7375    /**
7376     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7377     */
7378    bool result_ok;
7379 } LDKCResult_ErrorMessageDecodeErrorZ;
7380
7381
7382
7383 /**
7384  * The unsigned part of a node_announcement
7385  */
7386 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
7387    /**
7388     * A pointer to the opaque Rust object.
7389     * Nearly everywhere, inner must be non-null, however in places where
7390     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7391     */
7392    LDKnativeUnsignedNodeAnnouncement *inner;
7393    /**
7394     * Indicates that this is the only struct which contains the same pointer.
7395     * Rust functions which take ownership of an object provided via an argument require
7396     * this to be true and invalidate the object pointed to by inner.
7397     */
7398    bool is_owned;
7399 } LDKUnsignedNodeAnnouncement;
7400
7401 /**
7402  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7403  */
7404 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7405    /**
7406     * A pointer to the contents in the success state.
7407     * Reading from this pointer when `result_ok` is not set is undefined.
7408     */
7409    struct LDKUnsignedNodeAnnouncement *result;
7410    /**
7411     * A pointer to the contents in the error state.
7412     * Reading from this pointer when `result_ok` is set is undefined.
7413     */
7414    struct LDKDecodeError *err;
7415 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
7416
7417 /**
7418  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7419  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7420  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7421  */
7422 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
7423    /**
7424     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7425     * `err` or `result` depending on the state of `result_ok`.
7426     */
7427    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
7428    /**
7429     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7430     */
7431    bool result_ok;
7432 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
7433
7434 /**
7435  * The contents of CResult_NodeAnnouncementDecodeErrorZ
7436  */
7437 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
7438    /**
7439     * A pointer to the contents in the success state.
7440     * Reading from this pointer when `result_ok` is not set is undefined.
7441     */
7442    struct LDKNodeAnnouncement *result;
7443    /**
7444     * A pointer to the contents in the error state.
7445     * Reading from this pointer when `result_ok` is set is undefined.
7446     */
7447    struct LDKDecodeError *err;
7448 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
7449
7450 /**
7451  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7452  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7453  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7454  */
7455 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
7456    /**
7457     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7458     * `err` or `result` depending on the state of `result_ok`.
7459     */
7460    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
7461    /**
7462     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7463     */
7464    bool result_ok;
7465 } LDKCResult_NodeAnnouncementDecodeErrorZ;
7466
7467 /**
7468  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7469  */
7470 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
7471    /**
7472     * A pointer to the contents in the success state.
7473     * Reading from this pointer when `result_ok` is not set is undefined.
7474     */
7475    struct LDKQueryShortChannelIds *result;
7476    /**
7477     * A pointer to the contents in the error state.
7478     * Reading from this pointer when `result_ok` is set is undefined.
7479     */
7480    struct LDKDecodeError *err;
7481 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
7482
7483 /**
7484  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7485  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7486  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7487  */
7488 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
7489    /**
7490     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7491     * `err` or `result` depending on the state of `result_ok`.
7492     */
7493    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
7494    /**
7495     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7496     */
7497    bool result_ok;
7498 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
7499
7500
7501
7502 /**
7503  * A reply_short_channel_ids_end message is sent as a reply to a
7504  * query_short_channel_ids message. The query recipient makes a best
7505  * effort to respond based on their local network view which may not be
7506  * a perfect view of the network.
7507  */
7508 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
7509    /**
7510     * A pointer to the opaque Rust object.
7511     * Nearly everywhere, inner must be non-null, however in places where
7512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7513     */
7514    LDKnativeReplyShortChannelIdsEnd *inner;
7515    /**
7516     * Indicates that this is the only struct which contains the same pointer.
7517     * Rust functions which take ownership of an object provided via an argument require
7518     * this to be true and invalidate the object pointed to by inner.
7519     */
7520    bool is_owned;
7521 } LDKReplyShortChannelIdsEnd;
7522
7523 /**
7524  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7525  */
7526 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7527    /**
7528     * A pointer to the contents in the success state.
7529     * Reading from this pointer when `result_ok` is not set is undefined.
7530     */
7531    struct LDKReplyShortChannelIdsEnd *result;
7532    /**
7533     * A pointer to the contents in the error state.
7534     * Reading from this pointer when `result_ok` is set is undefined.
7535     */
7536    struct LDKDecodeError *err;
7537 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
7538
7539 /**
7540  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7541  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7543  */
7544 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
7545    /**
7546     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7547     * `err` or `result` depending on the state of `result_ok`.
7548     */
7549    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
7550    /**
7551     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7552     */
7553    bool result_ok;
7554 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
7555
7556 /**
7557  * The contents of CResult_QueryChannelRangeDecodeErrorZ
7558  */
7559 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
7560    /**
7561     * A pointer to the contents in the success state.
7562     * Reading from this pointer when `result_ok` is not set is undefined.
7563     */
7564    struct LDKQueryChannelRange *result;
7565    /**
7566     * A pointer to the contents in the error state.
7567     * Reading from this pointer when `result_ok` is set is undefined.
7568     */
7569    struct LDKDecodeError *err;
7570 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
7571
7572 /**
7573  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7574  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7576  */
7577 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
7578    /**
7579     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7580     * `err` or `result` depending on the state of `result_ok`.
7581     */
7582    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
7583    /**
7584     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7585     */
7586    bool result_ok;
7587 } LDKCResult_QueryChannelRangeDecodeErrorZ;
7588
7589 /**
7590  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
7591  */
7592 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
7593    /**
7594     * A pointer to the contents in the success state.
7595     * Reading from this pointer when `result_ok` is not set is undefined.
7596     */
7597    struct LDKReplyChannelRange *result;
7598    /**
7599     * A pointer to the contents in the error state.
7600     * Reading from this pointer when `result_ok` is set is undefined.
7601     */
7602    struct LDKDecodeError *err;
7603 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
7604
7605 /**
7606  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7607  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7608  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7609  */
7610 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
7611    /**
7612     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7613     * `err` or `result` depending on the state of `result_ok`.
7614     */
7615    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
7616    /**
7617     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7618     */
7619    bool result_ok;
7620 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
7621
7622
7623
7624 /**
7625  * A gossip_timestamp_filter message is used by a node to request
7626  * gossip relay for messages in the requested time range when the
7627  * gossip_queries feature has been negotiated.
7628  */
7629 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
7630    /**
7631     * A pointer to the opaque Rust object.
7632     * Nearly everywhere, inner must be non-null, however in places where
7633     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7634     */
7635    LDKnativeGossipTimestampFilter *inner;
7636    /**
7637     * Indicates that this is the only struct which contains the same pointer.
7638     * Rust functions which take ownership of an object provided via an argument require
7639     * this to be true and invalidate the object pointed to by inner.
7640     */
7641    bool is_owned;
7642 } LDKGossipTimestampFilter;
7643
7644 /**
7645  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
7646  */
7647 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
7648    /**
7649     * A pointer to the contents in the success state.
7650     * Reading from this pointer when `result_ok` is not set is undefined.
7651     */
7652    struct LDKGossipTimestampFilter *result;
7653    /**
7654     * A pointer to the contents in the error state.
7655     * Reading from this pointer when `result_ok` is set is undefined.
7656     */
7657    struct LDKDecodeError *err;
7658 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
7659
7660 /**
7661  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7662  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7664  */
7665 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
7666    /**
7667     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7668     * `err` or `result` depending on the state of `result_ok`.
7669     */
7670    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
7671    /**
7672     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7673     */
7674    bool result_ok;
7675 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
7676
7677 /**
7678  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
7679  * may occur.
7680  */
7681 typedef enum LDKSignOrCreationError_Tag {
7682    /**
7683     * An error occurred during signing
7684     */
7685    LDKSignOrCreationError_SignError,
7686    /**
7687     * An error occurred while building the transaction
7688     */
7689    LDKSignOrCreationError_CreationError,
7690    /**
7691     * Must be last for serialization purposes
7692     */
7693    LDKSignOrCreationError_Sentinel,
7694 } LDKSignOrCreationError_Tag;
7695
7696 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
7697    LDKSignOrCreationError_Tag tag;
7698    union {
7699       struct {
7700          enum LDKCreationError creation_error;
7701       };
7702    };
7703 } LDKSignOrCreationError;
7704
7705 /**
7706  * The contents of CResult_InvoiceSignOrCreationErrorZ
7707  */
7708 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
7709    /**
7710     * A pointer to the contents in the success state.
7711     * Reading from this pointer when `result_ok` is not set is undefined.
7712     */
7713    struct LDKInvoice *result;
7714    /**
7715     * A pointer to the contents in the error state.
7716     * Reading from this pointer when `result_ok` is set is undefined.
7717     */
7718    struct LDKSignOrCreationError *err;
7719 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
7720
7721 /**
7722  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
7723  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
7724  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7725  */
7726 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
7727    /**
7728     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
7729     * `err` or `result` depending on the state of `result_ok`.
7730     */
7731    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
7732    /**
7733     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
7734     */
7735    bool result_ok;
7736 } LDKCResult_InvoiceSignOrCreationErrorZ;
7737
7738 /**
7739  * A trait indicating an object may generate message send events
7740  */
7741 typedef struct LDKMessageSendEventsProvider {
7742    /**
7743     * An opaque pointer which is passed to your function implementations as an argument.
7744     * This has no meaning in the LDK, and can be NULL or any other value.
7745     */
7746    void *this_arg;
7747    /**
7748     * Gets the list of pending events which were generated by previous actions, clearing the list
7749     * in the process.
7750     */
7751    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7752    /**
7753     * Frees any resources associated with this object given its this_arg pointer.
7754     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7755     */
7756    void (*free)(void *this_arg);
7757 } LDKMessageSendEventsProvider;
7758
7759 /**
7760  * A trait implemented for objects handling events from [`EventsProvider`].
7761  */
7762 typedef struct LDKEventHandler {
7763    /**
7764     * An opaque pointer which is passed to your function implementations as an argument.
7765     * This has no meaning in the LDK, and can be NULL or any other value.
7766     */
7767    void *this_arg;
7768    /**
7769     * Handles the given [`Event`].
7770     *
7771     * See [`EventsProvider`] for details that must be considered when implementing this method.
7772     */
7773    void (*handle_event)(const void *this_arg, struct LDKEvent event);
7774    /**
7775     * Frees any resources associated with this object given its this_arg pointer.
7776     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7777     */
7778    void (*free)(void *this_arg);
7779 } LDKEventHandler;
7780
7781 /**
7782  * A trait indicating an object may generate events.
7783  *
7784  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
7785  *
7786  * # Requirements
7787  *
7788  * See [`process_pending_events`] for requirements around event processing.
7789  *
7790  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
7791  * event since the last invocation. The handler must either act upon the event immediately
7792  * or preserve it for later handling.
7793  *
7794  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
7795  * consult the provider's documentation on the implication of processing events and how a handler
7796  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
7797  * [`ChainMonitor::process_pending_events`]).
7798  *
7799  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
7800  * own type(s).
7801  *
7802  * [`process_pending_events`]: Self::process_pending_events
7803  * [`handle_event`]: EventHandler::handle_event
7804  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
7805  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
7806  */
7807 typedef struct LDKEventsProvider {
7808    /**
7809     * An opaque pointer which is passed to your function implementations as an argument.
7810     * This has no meaning in the LDK, and can be NULL or any other value.
7811     */
7812    void *this_arg;
7813    /**
7814     * Processes any events generated since the last call using the given event handler.
7815     *
7816     * Subsequent calls must only process new events. However, handlers must be capable of handling
7817     * duplicate events across process restarts. This may occur if the provider was recovered from
7818     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
7819     */
7820    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
7821    /**
7822     * Frees any resources associated with this object given its this_arg pointer.
7823     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7824     */
7825    void (*free)(void *this_arg);
7826 } LDKEventsProvider;
7827
7828
7829
7830 /**
7831  * Configuration we set when applicable.
7832  *
7833  * Default::default() provides sane defaults.
7834  */
7835 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7836    /**
7837     * A pointer to the opaque Rust object.
7838     * Nearly everywhere, inner must be non-null, however in places where
7839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7840     */
7841    LDKnativeChannelHandshakeConfig *inner;
7842    /**
7843     * Indicates that this is the only struct which contains the same pointer.
7844     * Rust functions which take ownership of an object provided via an argument require
7845     * this to be true and invalidate the object pointed to by inner.
7846     */
7847    bool is_owned;
7848 } LDKChannelHandshakeConfig;
7849
7850
7851
7852 /**
7853  * Optional channel limits which are applied during channel creation.
7854  *
7855  * These limits are only applied to our counterparty's limits, not our own.
7856  *
7857  * Use 0/<type>::max_value() as appropriate to skip checking.
7858  *
7859  * Provides sane defaults for most configurations.
7860  *
7861  * Most additional limits are disabled except those with which specify a default in individual
7862  * field documentation. Note that this may result in barely-usable channels, but since they
7863  * are applied mostly only to incoming channels that's not much of a problem.
7864  */
7865 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7866    /**
7867     * A pointer to the opaque Rust object.
7868     * Nearly everywhere, inner must be non-null, however in places where
7869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7870     */
7871    LDKnativeChannelHandshakeLimits *inner;
7872    /**
7873     * Indicates that this is the only struct which contains the same pointer.
7874     * Rust functions which take ownership of an object provided via an argument require
7875     * this to be true and invalidate the object pointed to by inner.
7876     */
7877    bool is_owned;
7878 } LDKChannelHandshakeLimits;
7879
7880
7881
7882 /**
7883  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7884  *
7885  * Default::default() provides sane defaults for most configurations
7886  * (but currently with 0 relay fees!)
7887  */
7888 typedef struct MUST_USE_STRUCT LDKUserConfig {
7889    /**
7890     * A pointer to the opaque Rust object.
7891     * Nearly everywhere, inner must be non-null, however in places where
7892     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7893     */
7894    LDKnativeUserConfig *inner;
7895    /**
7896     * Indicates that this is the only struct which contains the same pointer.
7897     * Rust functions which take ownership of an object provided via an argument require
7898     * this to be true and invalidate the object pointed to by inner.
7899     */
7900    bool is_owned;
7901 } LDKUserConfig;
7902
7903 /**
7904  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7905  * UTXOs.
7906  */
7907 typedef struct LDKAccess {
7908    /**
7909     * An opaque pointer which is passed to your function implementations as an argument.
7910     * This has no meaning in the LDK, and can be NULL or any other value.
7911     */
7912    void *this_arg;
7913    /**
7914     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7915     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7916     * is unknown.
7917     *
7918     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7919     */
7920    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7921    /**
7922     * Frees any resources associated with this object given its this_arg pointer.
7923     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7924     */
7925    void (*free)(void *this_arg);
7926 } LDKAccess;
7927
7928 /**
7929  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7930  * chain.
7931  *
7932  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7933  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7934  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7935  * when needed.
7936  */
7937 typedef struct LDKListen {
7938    /**
7939     * An opaque pointer which is passed to your function implementations as an argument.
7940     * This has no meaning in the LDK, and can be NULL or any other value.
7941     */
7942    void *this_arg;
7943    /**
7944     * Notifies the listener that a block was added at the given height.
7945     */
7946    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7947    /**
7948     * Notifies the listener that a block was removed at the given height.
7949     */
7950    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7951    /**
7952     * Frees any resources associated with this object given its this_arg pointer.
7953     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7954     */
7955    void (*free)(void *this_arg);
7956 } LDKListen;
7957
7958 /**
7959  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7960  * unconfirmed during a chain reorganization.
7961  *
7962  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7963  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7964  * related to registered transactions and outputs. Upon notification, it would pass along the
7965  * matching transactions using this interface.
7966  *
7967  * # Use
7968  *
7969  * The intended use is as follows:
7970  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7971  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7972  *   that has been reorganized out of the chain.
7973  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7974  *
7975  * # Order
7976  *
7977  * Clients must call these methods in chain order. Specifically:
7978  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7979  *   block.
7980  * - Dependent transactions within the same block must be given in topological order, possibly in
7981  *   separate calls.
7982  * - Unconfirmed transactions must be given after the original confirmations and before any
7983  *   reconfirmation.
7984  *
7985  * See individual method documentation for further details.
7986  *
7987  * [`transactions_confirmed`]: Self::transactions_confirmed
7988  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7989  * [`best_block_updated`]: Self::best_block_updated
7990  * [`get_relevant_txids`]: Self::get_relevant_txids
7991  */
7992 typedef struct LDKConfirm {
7993    /**
7994     * An opaque pointer which is passed to your function implementations as an argument.
7995     * This has no meaning in the LDK, and can be NULL or any other value.
7996     */
7997    void *this_arg;
7998    /**
7999     * Processes transactions confirmed in a block with a given header and height.
8000     *
8001     * Should be called for any transactions registered by [`Filter::register_tx`] or any
8002     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
8003     * appearing in the same block do not need to be included in the same call; instead, multiple
8004     * calls with additional transactions may be made so long as they are made in [chain order].
8005     *
8006     * May be called before or after [`best_block_updated`] for the corresponding block. However,
8007     * in the event of a chain reorganization, it must not be called with a `header` that is no
8008     * longer in the chain as of the last call to [`best_block_updated`].
8009     *
8010     * [chain order]: Confirm#Order
8011     * [`best_block_updated`]: Self::best_block_updated
8012     */
8013    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
8014    /**
8015     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
8016     *
8017     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
8018     * reorganized out of the best chain. Once called, the given transaction should not be returned
8019     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
8020     *
8021     * [`get_relevant_txids`]: Self::get_relevant_txids
8022     * [`transactions_confirmed`]: Self::transactions_confirmed
8023     */
8024    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
8025    /**
8026     * Processes an update to the best header connected at the given height.
8027     *
8028     * Should be called when a new header is available but may be skipped for intermediary blocks
8029     * if they become available at the same time.
8030     */
8031    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8032    /**
8033     * Returns transactions that should be monitored for reorganization out of the chain.
8034     *
8035     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
8036     * confirmations to be safe from a chain reorganization. Should not include any transactions
8037     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
8038     *
8039     * May be called to determine the subset of transactions that must still be monitored for
8040     * reorganization. Will be idempotent between calls but may change as a result of calls to the
8041     * other interface methods. Thus, this is useful to determine which transactions may need to be
8042     * given to [`transaction_unconfirmed`].
8043     *
8044     * [`transactions_confirmed`]: Self::transactions_confirmed
8045     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8046     */
8047    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
8048    /**
8049     * Frees any resources associated with this object given its this_arg pointer.
8050     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8051     */
8052    void (*free)(void *this_arg);
8053 } LDKConfirm;
8054
8055
8056
8057 /**
8058  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8059  *
8060  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8061  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8062  * the return value of [`Filter::register_output`].
8063  *
8064  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8065  * may have been spent there. See [`Filter::register_output`] for details.
8066  *
8067  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8068  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8069  */
8070 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8071    /**
8072     * A pointer to the opaque Rust object.
8073     * Nearly everywhere, inner must be non-null, however in places where
8074     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8075     */
8076    LDKnativeWatchedOutput *inner;
8077    /**
8078     * Indicates that this is the only struct which contains the same pointer.
8079     * Rust functions which take ownership of an object provided via an argument require
8080     * this to be true and invalidate the object pointed to by inner.
8081     */
8082    bool is_owned;
8083 } LDKWatchedOutput;
8084
8085 /**
8086  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8087  * channels.
8088  *
8089  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8090  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8091  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8092  * receiving full blocks from a chain source, any further filtering is unnecessary.
8093  *
8094  * After an output has been registered, subsequent block retrievals from the chain source must not
8095  * exclude any transactions matching the new criteria nor any in-block descendants of such
8096  * transactions.
8097  *
8098  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8099  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8100  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8101  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8102  *
8103  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8104  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8105  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8106  */
8107 typedef struct LDKFilter {
8108    /**
8109     * An opaque pointer which is passed to your function implementations as an argument.
8110     * This has no meaning in the LDK, and can be NULL or any other value.
8111     */
8112    void *this_arg;
8113    /**
8114     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8115     * a spending condition.
8116     */
8117    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8118    /**
8119     * Registers interest in spends of a transaction output.
8120     *
8121     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8122     * output that is found in the corresponding block along with its index.
8123     *
8124     * This return value is useful for Electrum clients in order to supply in-block descendant
8125     * transactions which otherwise were not included. This is not necessary for other clients if
8126     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8127     * full block).
8128     */
8129    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8130    /**
8131     * Frees any resources associated with this object given its this_arg pointer.
8132     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8133     */
8134    void (*free)(void *this_arg);
8135 } LDKFilter;
8136
8137 /**
8138  * `Persist` defines behavior for persisting channel monitors: this could mean
8139  * writing once to disk, and/or uploading to one or more backup services.
8140  *
8141  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8142  * to disk/backups. And, on every update, you **must** persist either the
8143  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8144  * of situations such as revoking a transaction, then crashing before this
8145  * revocation can be persisted, then unintentionally broadcasting a revoked
8146  * transaction and losing money. This is a risk because previous channel states
8147  * are toxic, so it's important that whatever channel state is persisted is
8148  * kept up-to-date.
8149  */
8150 typedef struct LDKPersist {
8151    /**
8152     * An opaque pointer which is passed to your function implementations as an argument.
8153     * This has no meaning in the LDK, and can be NULL or any other value.
8154     */
8155    void *this_arg;
8156    /**
8157     * Persist a new channel's data. The data can be stored any way you want, but
8158     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8159     * it is up to you to maintain a correct mapping between the outpoint and the
8160     * stored channel data). Note that you **must** persist every new monitor to
8161     * disk. See the `Persist` trait documentation for more details.
8162     *
8163     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8164     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8165     */
8166    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8167    /**
8168     * Update one channel's data. The provided `ChannelMonitor` has already
8169     * applied the given update.
8170     *
8171     * Note that on every update, you **must** persist either the
8172     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8173     * the `Persist` trait documentation for more details.
8174     *
8175     * If an implementer chooses to persist the updates only, they need to make
8176     * sure that all the updates are applied to the `ChannelMonitors` *before*
8177     * the set of channel monitors is given to the `ChannelManager`
8178     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8179     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8180     * persisted, then there is no need to persist individual updates.
8181     *
8182     * Note that there could be a performance tradeoff between persisting complete
8183     * channel monitors on every update vs. persisting only updates and applying
8184     * them in batches. The size of each monitor grows `O(number of state updates)`
8185     * whereas updates are small and `O(1)`.
8186     *
8187     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8188     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8189     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8190     */
8191    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);
8192    /**
8193     * Frees any resources associated with this object given its this_arg pointer.
8194     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8195     */
8196    void (*free)(void *this_arg);
8197 } LDKPersist;
8198
8199
8200
8201 /**
8202  * An implementation of [`chain::Watch`] for monitoring channels.
8203  *
8204  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8205  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8206  * or used independently to monitor channels remotely. See the [module-level documentation] for
8207  * details.
8208  *
8209  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8210  * [module-level documentation]: crate::chain::chainmonitor
8211  */
8212 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8213    /**
8214     * A pointer to the opaque Rust object.
8215     * Nearly everywhere, inner must be non-null, however in places where
8216     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8217     */
8218    LDKnativeChainMonitor *inner;
8219    /**
8220     * Indicates that this is the only struct which contains the same pointer.
8221     * Rust functions which take ownership of an object provided via an argument require
8222     * this to be true and invalidate the object pointed to by inner.
8223     */
8224    bool is_owned;
8225 } LDKChainMonitor;
8226
8227
8228
8229 /**
8230  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8231  * and derives keys from that.
8232  *
8233  * Your node_id is seed/0'
8234  * ChannelMonitor closes may use seed/1'
8235  * Cooperative closes may use seed/2'
8236  * The two close keys may be needed to claim on-chain funds!
8237  */
8238 typedef struct MUST_USE_STRUCT LDKKeysManager {
8239    /**
8240     * A pointer to the opaque Rust object.
8241     * Nearly everywhere, inner must be non-null, however in places where
8242     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8243     */
8244    LDKnativeKeysManager *inner;
8245    /**
8246     * Indicates that this is the only struct which contains the same pointer.
8247     * Rust functions which take ownership of an object provided via an argument require
8248     * this to be true and invalidate the object pointed to by inner.
8249     */
8250    bool is_owned;
8251 } LDKKeysManager;
8252
8253
8254
8255 /**
8256  * Chain-related parameters used to construct a new `ChannelManager`.
8257  *
8258  * Typically, the block-specific parameters are derived from the best block hash for the network,
8259  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8260  * are not needed when deserializing a previously constructed `ChannelManager`.
8261  */
8262 typedef struct MUST_USE_STRUCT LDKChainParameters {
8263    /**
8264     * A pointer to the opaque Rust object.
8265     * Nearly everywhere, inner must be non-null, however in places where
8266     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8267     */
8268    LDKnativeChainParameters *inner;
8269    /**
8270     * Indicates that this is the only struct which contains the same pointer.
8271     * Rust functions which take ownership of an object provided via an argument require
8272     * this to be true and invalidate the object pointed to by inner.
8273     */
8274    bool is_owned;
8275 } LDKChainParameters;
8276
8277
8278
8279 /**
8280  * The best known block as identified by its hash and height.
8281  */
8282 typedef struct MUST_USE_STRUCT LDKBestBlock {
8283    /**
8284     * A pointer to the opaque Rust object.
8285     * Nearly everywhere, inner must be non-null, however in places where
8286     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8287     */
8288    LDKnativeBestBlock *inner;
8289    /**
8290     * Indicates that this is the only struct which contains the same pointer.
8291     * Rust functions which take ownership of an object provided via an argument require
8292     * this to be true and invalidate the object pointed to by inner.
8293     */
8294    bool is_owned;
8295 } LDKBestBlock;
8296
8297 /**
8298  * A 3-byte byte array.
8299  */
8300 typedef struct LDKThreeBytes {
8301    /**
8302     * The three bytes
8303     */
8304    uint8_t data[3];
8305 } LDKThreeBytes;
8306
8307 /**
8308  * A trait to describe an object which can receive channel messages.
8309  *
8310  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8311  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8312  */
8313 typedef struct LDKChannelMessageHandler {
8314    /**
8315     * An opaque pointer which is passed to your function implementations as an argument.
8316     * This has no meaning in the LDK, and can be NULL or any other value.
8317     */
8318    void *this_arg;
8319    /**
8320     * Handle an incoming open_channel message from the given peer.
8321     */
8322    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8323    /**
8324     * Handle an incoming accept_channel message from the given peer.
8325     */
8326    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8327    /**
8328     * Handle an incoming funding_created message from the given peer.
8329     */
8330    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8331    /**
8332     * Handle an incoming funding_signed message from the given peer.
8333     */
8334    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8335    /**
8336     * Handle an incoming funding_locked message from the given peer.
8337     */
8338    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8339    /**
8340     * Handle an incoming shutdown message from the given peer.
8341     */
8342    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);
8343    /**
8344     * Handle an incoming closing_signed message from the given peer.
8345     */
8346    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8347    /**
8348     * Handle an incoming update_add_htlc message from the given peer.
8349     */
8350    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8351    /**
8352     * Handle an incoming update_fulfill_htlc message from the given peer.
8353     */
8354    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8355    /**
8356     * Handle an incoming update_fail_htlc message from the given peer.
8357     */
8358    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8359    /**
8360     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8361     */
8362    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8363    /**
8364     * Handle an incoming commitment_signed message from the given peer.
8365     */
8366    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8367    /**
8368     * Handle an incoming revoke_and_ack message from the given peer.
8369     */
8370    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8371    /**
8372     * Handle an incoming update_fee message from the given peer.
8373     */
8374    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8375    /**
8376     * Handle an incoming announcement_signatures message from the given peer.
8377     */
8378    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8379    /**
8380     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8381     * is believed to be possible in the future (eg they're sending us messages we don't
8382     * understand or indicate they require unknown feature bits), no_connection_possible is set
8383     * and any outstanding channels should be failed.
8384     */
8385    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8386    /**
8387     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8388     */
8389    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8390    /**
8391     * Handle an incoming channel_reestablish message from the given peer.
8392     */
8393    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8394    /**
8395     * Handle an incoming channel update from the given peer.
8396     */
8397    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8398    /**
8399     * Handle an incoming error message from the given peer.
8400     */
8401    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8402    /**
8403     * Implementation of MessageSendEventsProvider for this object.
8404     */
8405    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8406    /**
8407     * Frees any resources associated with this object given its this_arg pointer.
8408     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8409     */
8410    void (*free)(void *this_arg);
8411 } LDKChannelMessageHandler;
8412
8413
8414
8415 /**
8416  * Arguments for the creation of a ChannelManager that are not deserialized.
8417  *
8418  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8419  * is:
8420  * 1) Deserialize all stored ChannelMonitors.
8421  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8422  *    <(BlockHash, ChannelManager)>::read(reader, args)
8423  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8424  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8425  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8426  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8427  *    ChannelMonitor::get_funding_txo().
8428  * 4) Reconnect blocks on your ChannelMonitors.
8429  * 5) Disconnect/connect blocks on the ChannelManager.
8430  * 6) Move the ChannelMonitors into your local chain::Watch.
8431  *
8432  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8433  * call any other methods on the newly-deserialized ChannelManager.
8434  *
8435  * Note that because some channels may be closed during deserialization, it is critical that you
8436  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8437  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8438  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8439  * not force-close the same channels but consider them live), you may end up revoking a state for
8440  * which you've already broadcasted the transaction.
8441  */
8442 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8443    /**
8444     * A pointer to the opaque Rust object.
8445     * Nearly everywhere, inner must be non-null, however in places where
8446     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8447     */
8448    LDKnativeChannelManagerReadArgs *inner;
8449    /**
8450     * Indicates that this is the only struct which contains the same pointer.
8451     * Rust functions which take ownership of an object provided via an argument require
8452     * this to be true and invalidate the object pointed to by inner.
8453     */
8454    bool is_owned;
8455 } LDKChannelManagerReadArgs;
8456
8457
8458
8459 /**
8460  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8461  * This is used to convince the recipient that the channel is at a certain commitment
8462  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8463  * and even later commitments may have been revoked.
8464  */
8465 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8466    /**
8467     * A pointer to the opaque Rust object.
8468     * Nearly everywhere, inner must be non-null, however in places where
8469     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8470     */
8471    LDKnativeDataLossProtect *inner;
8472    /**
8473     * Indicates that this is the only struct which contains the same pointer.
8474     * Rust functions which take ownership of an object provided via an argument require
8475     * this to be true and invalidate the object pointed to by inner.
8476     */
8477    bool is_owned;
8478 } LDKDataLossProtect;
8479
8480 /**
8481  * A trait to describe an object which can receive routing messages.
8482  *
8483  * # Implementor DoS Warnings
8484  *
8485  * For `gossip_queries` messages there are potential DoS vectors when handling
8486  * inbound queries. Implementors using an on-disk network graph should be aware of
8487  * repeated disk I/O for queries accessing different parts of the network graph.
8488  */
8489 typedef struct LDKRoutingMessageHandler {
8490    /**
8491     * An opaque pointer which is passed to your function implementations as an argument.
8492     * This has no meaning in the LDK, and can be NULL or any other value.
8493     */
8494    void *this_arg;
8495    /**
8496     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8497     * false or returning an Err otherwise.
8498     */
8499    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8500    /**
8501     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8502     * or returning an Err otherwise.
8503     */
8504    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8505    /**
8506     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8507     * false or returning an Err otherwise.
8508     */
8509    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8510    /**
8511     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8512     */
8513    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8514    /**
8515     * Gets a subset of the channel announcements and updates required to dump our routing table
8516     * to a remote node, starting at the short_channel_id indicated by starting_point and
8517     * including the batch_amount entries immediately higher in numerical value than starting_point.
8518     */
8519    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8520    /**
8521     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8522     * starting at the node *after* the provided publickey and including batch_amount entries
8523     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8524     * If None is provided for starting_point, we start at the first node.
8525     */
8526    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8527    /**
8528     * Called when a connection is established with a peer. This can be used to
8529     * perform routing table synchronization using a strategy defined by the
8530     * implementor.
8531     */
8532    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8533    /**
8534     * Handles the reply of a query we initiated to learn about channels
8535     * for a given range of blocks. We can expect to receive one or more
8536     * replies to a single query.
8537     */
8538    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8539    /**
8540     * Handles the reply of a query we initiated asking for routing gossip
8541     * messages for a list of channels. We should receive this message when
8542     * a node has completed its best effort to send us the pertaining routing
8543     * gossip messages.
8544     */
8545    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8546    /**
8547     * Handles when a peer asks us to send a list of short_channel_ids
8548     * for the requested range of blocks.
8549     */
8550    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8551    /**
8552     * Handles when a peer asks us to send routing gossip messages for a
8553     * list of short_channel_ids.
8554     */
8555    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8556    /**
8557     * Implementation of MessageSendEventsProvider for this object.
8558     */
8559    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8560    /**
8561     * Frees any resources associated with this object given its this_arg pointer.
8562     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8563     */
8564    void (*free)(void *this_arg);
8565 } LDKRoutingMessageHandler;
8566
8567
8568
8569 /**
8570  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8571  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8572  */
8573 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8574    /**
8575     * A pointer to the opaque Rust object.
8576     * Nearly everywhere, inner must be non-null, however in places where
8577     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8578     */
8579    LDKnativeIgnoringMessageHandler *inner;
8580    /**
8581     * Indicates that this is the only struct which contains the same pointer.
8582     * Rust functions which take ownership of an object provided via an argument require
8583     * this to be true and invalidate the object pointed to by inner.
8584     */
8585    bool is_owned;
8586 } LDKIgnoringMessageHandler;
8587
8588
8589
8590 /**
8591  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8592  * You can provide one of these as the route_handler in a MessageHandler.
8593  */
8594 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8595    /**
8596     * A pointer to the opaque Rust object.
8597     * Nearly everywhere, inner must be non-null, however in places where
8598     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8599     */
8600    LDKnativeErroringMessageHandler *inner;
8601    /**
8602     * Indicates that this is the only struct which contains the same pointer.
8603     * Rust functions which take ownership of an object provided via an argument require
8604     * this to be true and invalidate the object pointed to by inner.
8605     */
8606    bool is_owned;
8607 } LDKErroringMessageHandler;
8608
8609
8610
8611 /**
8612  * Provides references to trait impls which handle different types of messages.
8613  */
8614 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8615    /**
8616     * A pointer to the opaque Rust object.
8617     * Nearly everywhere, inner must be non-null, however in places where
8618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8619     */
8620    LDKnativeMessageHandler *inner;
8621    /**
8622     * Indicates that this is the only struct which contains the same pointer.
8623     * Rust functions which take ownership of an object provided via an argument require
8624     * this to be true and invalidate the object pointed to by inner.
8625     */
8626    bool is_owned;
8627 } LDKMessageHandler;
8628
8629 /**
8630  * Provides an object which can be used to send data to and which uniquely identifies a connection
8631  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8632  * implement Hash to meet the PeerManager API.
8633  *
8634  * For efficiency, Clone should be relatively cheap for this type.
8635  *
8636  * You probably want to just extend an int and put a file descriptor in a struct and implement
8637  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8638  * be careful to ensure you don't have races whereby you might register a new connection with an
8639  * fd which is the same as a previous one which has yet to be removed via
8640  * PeerManager::socket_disconnected().
8641  */
8642 typedef struct LDKSocketDescriptor {
8643    /**
8644     * An opaque pointer which is passed to your function implementations as an argument.
8645     * This has no meaning in the LDK, and can be NULL or any other value.
8646     */
8647    void *this_arg;
8648    /**
8649     * Attempts to send some data from the given slice to the peer.
8650     *
8651     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8652     * Note that in the disconnected case, socket_disconnected must still fire and further write
8653     * attempts may occur until that time.
8654     *
8655     * If the returned size is smaller than data.len(), a write_available event must
8656     * trigger the next time more data can be written. Additionally, until the a send_data event
8657     * completes fully, no further read_events should trigger on the same peer!
8658     *
8659     * If a read_event on this descriptor had previously returned true (indicating that read
8660     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8661     * indicating that read events on this descriptor should resume. A resume_read of false does
8662     * *not* imply that further read events should be paused.
8663     */
8664    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8665    /**
8666     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8667     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8668     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8669     * though races may occur whereby disconnect_socket is called after a call to
8670     * socket_disconnected but prior to socket_disconnected returning.
8671     */
8672    void (*disconnect_socket)(void *this_arg);
8673    /**
8674     * Checks if two objects are equal given this object's this_arg pointer and another object.
8675     */
8676    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8677    /**
8678     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8679     * This is used, for example, for inclusion of this object in a hash map.
8680     */
8681    uint64_t (*hash)(const void *this_arg);
8682    /**
8683     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8684     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8685     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8686     */
8687    void *(*clone)(const void *this_arg);
8688    /**
8689     * Frees any resources associated with this object given its this_arg pointer.
8690     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8691     */
8692    void (*free)(void *this_arg);
8693 } LDKSocketDescriptor;
8694
8695
8696
8697 /**
8698  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8699  * events into messages which it passes on to its MessageHandlers.
8700  *
8701  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8702  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8703  * essentially you should default to using a SimpleRefPeerManager, and use a
8704  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8705  * you're using lightning-net-tokio.
8706  */
8707 typedef struct MUST_USE_STRUCT LDKPeerManager {
8708    /**
8709     * A pointer to the opaque Rust object.
8710     * Nearly everywhere, inner must be non-null, however in places where
8711     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8712     */
8713    LDKnativePeerManager *inner;
8714    /**
8715     * Indicates that this is the only struct which contains the same pointer.
8716     * Rust functions which take ownership of an object provided via an argument require
8717     * this to be true and invalidate the object pointed to by inner.
8718     */
8719    bool is_owned;
8720 } LDKPeerManager;
8721
8722
8723
8724 /**
8725  * Static channel fields used to build transactions given per-commitment fields, organized by
8726  * broadcaster/countersignatory.
8727  *
8728  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8729  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8730  */
8731 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8732    /**
8733     * A pointer to the opaque Rust object.
8734     * Nearly everywhere, inner must be non-null, however in places where
8735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8736     */
8737    LDKnativeDirectedChannelTransactionParameters *inner;
8738    /**
8739     * Indicates that this is the only struct which contains the same pointer.
8740     * Rust functions which take ownership of an object provided via an argument require
8741     * this to be true and invalidate the object pointed to by inner.
8742     */
8743    bool is_owned;
8744 } LDKDirectedChannelTransactionParameters;
8745
8746
8747
8748 /**
8749  * A channel descriptor for a hop along a payment path.
8750  */
8751 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
8752    /**
8753     * A pointer to the opaque Rust object.
8754     * Nearly everywhere, inner must be non-null, however in places where
8755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8756     */
8757    LDKnativeRouteHintHop *inner;
8758    /**
8759     * Indicates that this is the only struct which contains the same pointer.
8760     * Rust functions which take ownership of an object provided via an argument require
8761     * this to be true and invalidate the object pointed to by inner.
8762     */
8763    bool is_owned;
8764 } LDKRouteHintHop;
8765
8766
8767
8768 /**
8769  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8770  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8771  * the C bindings, as it can be done directly in Rust code.
8772  */
8773 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8774    /**
8775     * A pointer to the opaque Rust object.
8776     * Nearly everywhere, inner must be non-null, however in places where
8777     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8778     */
8779    LDKnativeLockedNetworkGraph *inner;
8780    /**
8781     * Indicates that this is the only struct which contains the same pointer.
8782     * Rust functions which take ownership of an object provided via an argument require
8783     * this to be true and invalidate the object pointed to by inner.
8784     */
8785    bool is_owned;
8786 } LDKLockedNetworkGraph;
8787
8788
8789
8790 /**
8791  * Receives and validates network updates from peers,
8792  * stores authentic and relevant data as a network graph.
8793  * This network graph is then used for routing payments.
8794  * Provides interface to help with initial routing sync by
8795  * serving historical announcements.
8796  */
8797 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8798    /**
8799     * A pointer to the opaque Rust object.
8800     * Nearly everywhere, inner must be non-null, however in places where
8801     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8802     */
8803    LDKnativeNetGraphMsgHandler *inner;
8804    /**
8805     * Indicates that this is the only struct which contains the same pointer.
8806     * Rust functions which take ownership of an object provided via an argument require
8807     * this to be true and invalidate the object pointed to by inner.
8808     */
8809    bool is_owned;
8810 } LDKNetGraphMsgHandler;
8811
8812
8813
8814 /**
8815  * FilesystemPersister persists channel data on disk, where each channel's
8816  * data is stored in a file named after its funding outpoint.
8817  *
8818  * Warning: this module does the best it can with calls to persist data, but it
8819  * can only guarantee that the data is passed to the drive. It is up to the
8820  * drive manufacturers to do the actual persistence properly, which they often
8821  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8822  * user to validate their entire storage stack, to ensure the writes are
8823  * persistent.
8824  * Corollary: especially when dealing with larger amounts of money, it is best
8825  * practice to have multiple channel data backups and not rely only on one
8826  * FilesystemPersister.
8827  */
8828 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8829    /**
8830     * A pointer to the opaque Rust object.
8831     * Nearly everywhere, inner must be non-null, however in places where
8832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8833     */
8834    LDKnativeFilesystemPersister *inner;
8835    /**
8836     * Indicates that this is the only struct which contains the same pointer.
8837     * Rust functions which take ownership of an object provided via an argument require
8838     * this to be true and invalidate the object pointed to by inner.
8839     */
8840    bool is_owned;
8841 } LDKFilesystemPersister;
8842
8843
8844
8845 /**
8846  * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
8847  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
8848  * responsibilities are:
8849  * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
8850  *   writing it to disk/backups by invoking the callback given to it at startup.
8851  *   ChannelManager persistence should be done in the background.
8852  * * Calling `ChannelManager::timer_tick_occurred()` and
8853  *   `PeerManager::timer_tick_occurred()` every minute (can be done in the
8854  *   background).
8855  *
8856  * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
8857  * then there is a risk of channels force-closing on startup when the manager realizes it's
8858  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
8859  * for unilateral chain closure fees are at risk.
8860  */
8861 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
8862    /**
8863     * A pointer to the opaque Rust object.
8864     * Nearly everywhere, inner must be non-null, however in places where
8865     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8866     */
8867    LDKnativeBackgroundProcessor *inner;
8868    /**
8869     * Indicates that this is the only struct which contains the same pointer.
8870     * Rust functions which take ownership of an object provided via an argument require
8871     * this to be true and invalidate the object pointed to by inner.
8872     */
8873    bool is_owned;
8874 } LDKBackgroundProcessor;
8875
8876 /**
8877  * Trait which handles persisting a [`ChannelManager`] to disk.
8878  *
8879  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8880  */
8881 typedef struct LDKChannelManagerPersister {
8882    /**
8883     * An opaque pointer which is passed to your function implementations as an argument.
8884     * This has no meaning in the LDK, and can be NULL or any other value.
8885     */
8886    void *this_arg;
8887    /**
8888     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
8889     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
8890     *
8891     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8892     */
8893    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
8894    /**
8895     * Frees any resources associated with this object given its this_arg pointer.
8896     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8897     */
8898    void (*free)(void *this_arg);
8899 } LDKChannelManagerPersister;
8900
8901
8902
8903 /**
8904  * Data of the `RawInvoice` that is encoded in the data part
8905  */
8906 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8907    /**
8908     * A pointer to the opaque Rust object.
8909     * Nearly everywhere, inner must be non-null, however in places where
8910     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8911     */
8912    LDKnativeRawDataPart *inner;
8913    /**
8914     * Indicates that this is the only struct which contains the same pointer.
8915     * Rust functions which take ownership of an object provided via an argument require
8916     * this to be true and invalidate the object pointed to by inner.
8917     */
8918    bool is_owned;
8919 } LDKRawDataPart;
8920
8921
8922
8923 /**
8924  * SHA-256 hash
8925  */
8926 typedef struct MUST_USE_STRUCT LDKSha256 {
8927    /**
8928     * A pointer to the opaque Rust object.
8929     * Nearly everywhere, inner must be non-null, however in places where
8930     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8931     */
8932    LDKnativeSha256 *inner;
8933    /**
8934     * Indicates that this is the only struct which contains the same pointer.
8935     * Rust functions which take ownership of an object provided via an argument require
8936     * this to be true and invalidate the object pointed to by inner.
8937     */
8938    bool is_owned;
8939 } LDKSha256;
8940
8941
8942
8943 /**
8944  * `min_final_cltv_expiry` to use for the last HTLC in the route
8945  */
8946 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8947    /**
8948     * A pointer to the opaque Rust object.
8949     * Nearly everywhere, inner must be non-null, however in places where
8950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8951     */
8952    LDKnativeMinFinalCltvExpiry *inner;
8953    /**
8954     * Indicates that this is the only struct which contains the same pointer.
8955     * Rust functions which take ownership of an object provided via an argument require
8956     * this to be true and invalidate the object pointed to by inner.
8957     */
8958    bool is_owned;
8959 } LDKMinFinalCltvExpiry;
8960
8961 /**
8962  * Integer in the range `0..32`
8963  */
8964 typedef struct LDKu5 {
8965    uint8_t _0;
8966 } LDKu5;
8967
8968 /**
8969  * A 20-byte byte array.
8970  */
8971 typedef struct LDKTwentyBytes {
8972    /**
8973     * The twenty bytes
8974     */
8975    uint8_t data[20];
8976 } LDKTwentyBytes;
8977
8978 /**
8979  * Fallback address in case no LN payment is possible
8980  */
8981 typedef enum LDKFallback_Tag {
8982    LDKFallback_SegWitProgram,
8983    LDKFallback_PubKeyHash,
8984    LDKFallback_ScriptHash,
8985    /**
8986     * Must be last for serialization purposes
8987     */
8988    LDKFallback_Sentinel,
8989 } LDKFallback_Tag;
8990
8991 typedef struct LDKFallback_LDKSegWitProgram_Body {
8992    struct LDKu5 version;
8993    struct LDKCVec_u8Z program;
8994 } LDKFallback_LDKSegWitProgram_Body;
8995
8996 typedef struct MUST_USE_STRUCT LDKFallback {
8997    LDKFallback_Tag tag;
8998    union {
8999       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
9000       struct {
9001          struct LDKTwentyBytes pub_key_hash;
9002       };
9003       struct {
9004          struct LDKTwentyBytes script_hash;
9005       };
9006    };
9007 } LDKFallback;
9008
9009 extern const uintptr_t MAX_BUF_SIZE;
9010
9011 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
9012
9013 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
9014
9015 extern const uint32_t ANTI_REORG_DELAY;
9016
9017 extern const uint16_t BREAKDOWN_TIMEOUT;
9018
9019 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
9020
9021 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
9022
9023 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
9024
9025 extern const uint8_t TAG_PAYMENT_HASH;
9026
9027 extern const uint8_t TAG_DESCRIPTION;
9028
9029 extern const uint8_t TAG_PAYEE_PUB_KEY;
9030
9031 extern const uint8_t TAG_DESCRIPTION_HASH;
9032
9033 extern const uint8_t TAG_EXPIRY_TIME;
9034
9035 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
9036
9037 extern const uint8_t TAG_FALLBACK;
9038
9039 extern const uint8_t TAG_PRIVATE_ROUTE;
9040
9041 extern const uint8_t TAG_PAYMENT_SECRET;
9042
9043 extern const uint8_t TAG_FEATURES;
9044
9045 struct LDKStr _ldk_get_compiled_version(void);
9046
9047 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
9048
9049 /**
9050  * Frees the data buffer, if data_is_owned is set and datalen > 0.
9051  */
9052 void Transaction_free(struct LDKTransaction _res);
9053
9054 /**
9055  * Frees the data pointed to by script_pubkey.
9056  */
9057 void TxOut_free(struct LDKTxOut _res);
9058
9059 /**
9060  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
9061  */
9062 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
9063
9064 /**
9065  * Frees the data buffer, if chars_is_owned is set and len > 0.
9066  */
9067 void Str_free(struct LDKStr _res);
9068
9069 /**
9070  * Creates a new CResult_SecretKeyErrorZ in the success state.
9071  */
9072 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9073
9074 /**
9075  * Creates a new CResult_SecretKeyErrorZ in the error state.
9076  */
9077 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9078
9079 /**
9080  * Frees any resources used by the CResult_SecretKeyErrorZ.
9081  */
9082 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9083
9084 /**
9085  * Creates a new CResult_PublicKeyErrorZ in the success state.
9086  */
9087 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9088
9089 /**
9090  * Creates a new CResult_PublicKeyErrorZ in the error state.
9091  */
9092 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9093
9094 /**
9095  * Frees any resources used by the CResult_PublicKeyErrorZ.
9096  */
9097 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9098
9099 /**
9100  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
9101  * but with all dynamically-allocated buffers duplicated in new buffers.
9102  */
9103 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
9104
9105 /**
9106  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9107  */
9108 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9109
9110 /**
9111  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9112  */
9113 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9114
9115 /**
9116  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9117  */
9118 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9119
9120 /**
9121  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9122  * but with all dynamically-allocated buffers duplicated in new buffers.
9123  */
9124 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9125
9126 /**
9127  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9128  */
9129 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9130
9131 /**
9132  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9133  */
9134 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9135
9136 /**
9137  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9138  */
9139 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9140
9141 /**
9142  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9143  * but with all dynamically-allocated buffers duplicated in new buffers.
9144  */
9145 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9146
9147 /**
9148  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9149  */
9150 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9151
9152 /**
9153  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9154  */
9155 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9156
9157 /**
9158  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9159  */
9160 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9161
9162 /**
9163  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
9164  * but with all dynamically-allocated buffers duplicated in new buffers.
9165  */
9166 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
9167
9168 /**
9169  * Constructs a new COption_u32Z containing a u32
9170  */
9171 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9172
9173 /**
9174  * Constructs a new COption_u32Z containing nothing
9175  */
9176 struct LDKCOption_u32Z COption_u32Z_none(void);
9177
9178 /**
9179  * Frees any resources associated with the u32, if we are in the Some state
9180  */
9181 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9182
9183 /**
9184  * Creates a new COption_u32Z which has the same data as `orig`
9185  * but with all dynamically-allocated buffers duplicated in new buffers.
9186  */
9187 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9188
9189 /**
9190  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9191  */
9192 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9193
9194 /**
9195  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9196  */
9197 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9198
9199 /**
9200  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9201  */
9202 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9203
9204 /**
9205  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9206  * but with all dynamically-allocated buffers duplicated in new buffers.
9207  */
9208 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9209
9210 /**
9211  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9212  */
9213 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9214
9215 /**
9216  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9217  */
9218 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9219
9220 /**
9221  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9222  */
9223 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9224
9225 /**
9226  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9227  * but with all dynamically-allocated buffers duplicated in new buffers.
9228  */
9229 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9230
9231 /**
9232  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9233  */
9234 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9235
9236 /**
9237  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9238  */
9239 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9240
9241 /**
9242  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9243  */
9244 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9245
9246 /**
9247  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9248  * but with all dynamically-allocated buffers duplicated in new buffers.
9249  */
9250 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9251
9252 /**
9253  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9254  */
9255 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9256
9257 /**
9258  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9259  */
9260 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9261
9262 /**
9263  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9264  */
9265 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9266
9267 /**
9268  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9269  */
9270 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9271
9272 /**
9273  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9274  * but with all dynamically-allocated buffers duplicated in new buffers.
9275  */
9276 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9277
9278 /**
9279  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9280  */
9281 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9282
9283 /**
9284  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9285  */
9286 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9287
9288 /**
9289  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9290  */
9291 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9292
9293 /**
9294  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9295  * but with all dynamically-allocated buffers duplicated in new buffers.
9296  */
9297 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9298
9299 /**
9300  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9301  */
9302 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9303
9304 /**
9305  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9306  */
9307 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9308
9309 /**
9310  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9311  */
9312 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9313
9314 /**
9315  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9316  * but with all dynamically-allocated buffers duplicated in new buffers.
9317  */
9318 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9319
9320 /**
9321  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9322  */
9323 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9324
9325 /**
9326  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9327  */
9328 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9329
9330 /**
9331  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9332  */
9333 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9334
9335 /**
9336  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9337  */
9338 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9339
9340 /**
9341  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9342  */
9343 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9344
9345 /**
9346  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9347  */
9348 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9349
9350 /**
9351  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9352  * but with all dynamically-allocated buffers duplicated in new buffers.
9353  */
9354 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9355
9356 /**
9357  * Creates a new CResult_NoneErrorZ in the success state.
9358  */
9359 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9360
9361 /**
9362  * Creates a new CResult_NoneErrorZ in the error state.
9363  */
9364 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9365
9366 /**
9367  * Frees any resources used by the CResult_NoneErrorZ.
9368  */
9369 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9370
9371 /**
9372  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
9373  * but with all dynamically-allocated buffers duplicated in new buffers.
9374  */
9375 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
9376
9377 /**
9378  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9379  */
9380 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9381
9382 /**
9383  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9384  */
9385 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9386
9387 /**
9388  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9389  */
9390 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9391
9392 /**
9393  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9394  * but with all dynamically-allocated buffers duplicated in new buffers.
9395  */
9396 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9397
9398 /**
9399  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9400  */
9401 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9402
9403 /**
9404  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9405  */
9406 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9407
9408 /**
9409  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9410  */
9411 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9412
9413 /**
9414  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9415  */
9416 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9417
9418 /**
9419  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9420  */
9421 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9422
9423 /**
9424  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9425  * but with all dynamically-allocated buffers duplicated in new buffers.
9426  */
9427 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9428
9429 /**
9430  * Constructs a new COption_u64Z containing a u64
9431  */
9432 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9433
9434 /**
9435  * Constructs a new COption_u64Z containing nothing
9436  */
9437 struct LDKCOption_u64Z COption_u64Z_none(void);
9438
9439 /**
9440  * Frees any resources associated with the u64, if we are in the Some state
9441  */
9442 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9443
9444 /**
9445  * Creates a new COption_u64Z which has the same data as `orig`
9446  * but with all dynamically-allocated buffers duplicated in new buffers.
9447  */
9448 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9449
9450 /**
9451  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9452  */
9453 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9454
9455 /**
9456  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9457  */
9458 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9459
9460 /**
9461  * Creates a new CResult_RouteLightningErrorZ in the success state.
9462  */
9463 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9464
9465 /**
9466  * Creates a new CResult_RouteLightningErrorZ in the error state.
9467  */
9468 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9469
9470 /**
9471  * Frees any resources used by the CResult_RouteLightningErrorZ.
9472  */
9473 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9474
9475 /**
9476  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9477  * but with all dynamically-allocated buffers duplicated in new buffers.
9478  */
9479 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9480
9481 /**
9482  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9483  */
9484 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9485
9486 /**
9487  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9488  */
9489 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9490
9491 /**
9492  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9493  */
9494 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9495
9496 /**
9497  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9498  * but with all dynamically-allocated buffers duplicated in new buffers.
9499  */
9500 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9501
9502 /**
9503  * Creates a new tuple which has the same data as `orig`
9504  * but with all dynamically-allocated buffers duplicated in new buffers.
9505  */
9506 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
9507
9508 /**
9509  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9510  */
9511 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9512
9513 /**
9514  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9515  */
9516 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9517
9518 /**
9519  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9520  */
9521 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9522
9523 /**
9524  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9525  */
9526 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9527
9528 /**
9529  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9530  */
9531 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9532
9533 /**
9534  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9535  */
9536 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9537
9538 /**
9539  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9540  */
9541 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9542
9543 /**
9544  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9545  * but with all dynamically-allocated buffers duplicated in new buffers.
9546  */
9547 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9548
9549 /**
9550  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9551  */
9552 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9553
9554 /**
9555  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9556  */
9557 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9558
9559 /**
9560  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9561  */
9562 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9563
9564 /**
9565  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9566  */
9567 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9568
9569 /**
9570  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
9571  * but with all dynamically-allocated buffers duplicated in new buffers.
9572  */
9573 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
9574
9575 /**
9576  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9577  */
9578 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9579
9580 /**
9581  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9582  */
9583 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9584
9585 /**
9586  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9587  */
9588 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9589
9590 /**
9591  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9592  */
9593 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9594
9595 /**
9596  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9597  */
9598 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9599
9600 /**
9601  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9602  */
9603 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9604
9605 /**
9606  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9607  */
9608 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9609
9610 /**
9611  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9612  */
9613 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9614
9615 /**
9616  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
9617  */
9618 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
9619
9620 /**
9621  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
9622  */
9623 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9624
9625 /**
9626  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
9627  */
9628 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
9629
9630 /**
9631  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
9632  */
9633 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
9634
9635 /**
9636  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
9637  */
9638 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9639
9640 /**
9641  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
9642  */
9643 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
9644
9645 /**
9646  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9647  */
9648 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
9649
9650 /**
9651  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9652  */
9653 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9654
9655 /**
9656  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9657  */
9658 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
9659
9660 /**
9661  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9662  * but with all dynamically-allocated buffers duplicated in new buffers.
9663  */
9664 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9665
9666 /**
9667  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9668  */
9669 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
9670
9671 /**
9672  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9673  */
9674 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9675
9676 /**
9677  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9678  */
9679 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
9680
9681 /**
9682  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9683  * but with all dynamically-allocated buffers duplicated in new buffers.
9684  */
9685 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9686
9687 /**
9688  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9689  */
9690 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9691
9692 /**
9693  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9694  */
9695 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9696
9697 /**
9698  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9699  */
9700 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9701
9702 /**
9703  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9704  * but with all dynamically-allocated buffers duplicated in new buffers.
9705  */
9706 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9707
9708 /**
9709  * Creates a new tuple which has the same data as `orig`
9710  * but with all dynamically-allocated buffers duplicated in new buffers.
9711  */
9712 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9713
9714 /**
9715  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9716  */
9717 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9718
9719 /**
9720  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9721  */
9722 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9723
9724 /**
9725  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9726  */
9727 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9728
9729 /**
9730  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9731  */
9732 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9733
9734 /**
9735  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9736  */
9737 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9738
9739 /**
9740  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9741  * but with all dynamically-allocated buffers duplicated in new buffers.
9742  */
9743 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9744
9745 /**
9746  * Creates a new CResult_SignatureNoneZ in the success state.
9747  */
9748 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9749
9750 /**
9751  * Creates a new CResult_SignatureNoneZ in the error state.
9752  */
9753 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9754
9755 /**
9756  * Frees any resources used by the CResult_SignatureNoneZ.
9757  */
9758 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9759
9760 /**
9761  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9762  * but with all dynamically-allocated buffers duplicated in new buffers.
9763  */
9764 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9765
9766 /**
9767  * Creates a new CResult_SignDecodeErrorZ in the success state.
9768  */
9769 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9770
9771 /**
9772  * Creates a new CResult_SignDecodeErrorZ in the error state.
9773  */
9774 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9775
9776 /**
9777  * Frees any resources used by the CResult_SignDecodeErrorZ.
9778  */
9779 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9780
9781 /**
9782  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9783  * but with all dynamically-allocated buffers duplicated in new buffers.
9784  */
9785 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9786
9787 /**
9788  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9789  */
9790 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9791
9792 /**
9793  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9794  */
9795 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
9796
9797 /**
9798  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9799  */
9800 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
9801
9802 /**
9803  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9804  */
9805 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
9806
9807 /**
9808  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9809  * but with all dynamically-allocated buffers duplicated in new buffers.
9810  */
9811 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
9812
9813 /**
9814  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9815  */
9816 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9817
9818 /**
9819  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9820  */
9821 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9822
9823 /**
9824  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9825  */
9826 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9827
9828 /**
9829  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9830  */
9831 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9832
9833 /**
9834  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9835  * but with all dynamically-allocated buffers duplicated in new buffers.
9836  */
9837 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9838
9839 /**
9840  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9841  */
9842 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9843
9844 /**
9845  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9846  */
9847 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9848
9849 /**
9850  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9851  */
9852 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9853
9854 /**
9855  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9856  * but with all dynamically-allocated buffers duplicated in new buffers.
9857  */
9858 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9859
9860 /**
9861  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9862  */
9863 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9864
9865 /**
9866  * Creates a new CResult_TransactionNoneZ in the success state.
9867  */
9868 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9869
9870 /**
9871  * Creates a new CResult_TransactionNoneZ in the error state.
9872  */
9873 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9874
9875 /**
9876  * Frees any resources used by the CResult_TransactionNoneZ.
9877  */
9878 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9879
9880 /**
9881  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
9882  * but with all dynamically-allocated buffers duplicated in new buffers.
9883  */
9884 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
9885
9886 /**
9887  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9888  */
9889 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9890
9891 /**
9892  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9893  */
9894 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9895
9896 /**
9897  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9898  */
9899 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9900
9901 /**
9902  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9903  */
9904 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9905
9906 /**
9907  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9908  */
9909 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9910
9911 /**
9912  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9913  */
9914 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9915
9916 /**
9917  * Creates a new CResult_NoneAPIErrorZ in the success state.
9918  */
9919 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9920
9921 /**
9922  * Creates a new CResult_NoneAPIErrorZ in the error state.
9923  */
9924 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9925
9926 /**
9927  * Frees any resources used by the CResult_NoneAPIErrorZ.
9928  */
9929 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9930
9931 /**
9932  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9933  * but with all dynamically-allocated buffers duplicated in new buffers.
9934  */
9935 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9936
9937 /**
9938  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9939  */
9940 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9941
9942 /**
9943  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9944  */
9945 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9946
9947 /**
9948  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9949  */
9950 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9951
9952 /**
9953  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9954  */
9955 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9956
9957 /**
9958  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9959  */
9960 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9961
9962 /**
9963  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9964  * but with all dynamically-allocated buffers duplicated in new buffers.
9965  */
9966 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9967
9968 /**
9969  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9970  */
9971 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9972
9973 /**
9974  * Creates a new tuple which has the same data as `orig`
9975  * but with all dynamically-allocated buffers duplicated in new buffers.
9976  */
9977 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
9978
9979 /**
9980  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9981  */
9982 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
9983
9984 /**
9985  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9986  */
9987 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
9988
9989 /**
9990  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9991  */
9992 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
9993
9994 /**
9995  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9996  */
9997 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
9998
9999 /**
10000  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10001  */
10002 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
10003
10004 /**
10005  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
10006  * but with all dynamically-allocated buffers duplicated in new buffers.
10007  */
10008 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
10009
10010 /**
10011  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10012  */
10013 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
10014
10015 /**
10016  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10017  */
10018 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
10019
10020 /**
10021  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10022  */
10023 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
10024
10025 /**
10026  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10027  */
10028 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10029
10030 /**
10031  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10032  */
10033 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10034
10035 /**
10036  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10037  */
10038 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10039
10040 /**
10041  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10042  */
10043 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
10044
10045 /**
10046  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10047  */
10048 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
10049
10050 /**
10051  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10052  */
10053 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
10054
10055 /**
10056  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10057  * but with all dynamically-allocated buffers duplicated in new buffers.
10058  */
10059 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
10060
10061 /**
10062  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
10063  */
10064 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
10065
10066 /**
10067  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
10068  */
10069 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
10070
10071 /**
10072  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
10073  */
10074 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
10075
10076 /**
10077  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10078  * but with all dynamically-allocated buffers duplicated in new buffers.
10079  */
10080 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
10081
10082 /**
10083  * Creates a new CResult_SiPrefixNoneZ in the success state.
10084  */
10085 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
10086
10087 /**
10088  * Creates a new CResult_SiPrefixNoneZ in the error state.
10089  */
10090 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
10091
10092 /**
10093  * Frees any resources used by the CResult_SiPrefixNoneZ.
10094  */
10095 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
10096
10097 /**
10098  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
10099  * but with all dynamically-allocated buffers duplicated in new buffers.
10100  */
10101 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
10102
10103 /**
10104  * Creates a new CResult_InvoiceNoneZ in the success state.
10105  */
10106 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
10107
10108 /**
10109  * Creates a new CResult_InvoiceNoneZ in the error state.
10110  */
10111 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
10112
10113 /**
10114  * Frees any resources used by the CResult_InvoiceNoneZ.
10115  */
10116 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
10117
10118 /**
10119  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
10120  * but with all dynamically-allocated buffers duplicated in new buffers.
10121  */
10122 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
10123
10124 /**
10125  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
10126  */
10127 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
10128
10129 /**
10130  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
10131  */
10132 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
10133
10134 /**
10135  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
10136  */
10137 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
10138
10139 /**
10140  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
10141  * but with all dynamically-allocated buffers duplicated in new buffers.
10142  */
10143 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
10144
10145 /**
10146  * Creates a new tuple which has the same data as `orig`
10147  * but with all dynamically-allocated buffers duplicated in new buffers.
10148  */
10149 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
10150
10151 /**
10152  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10153  */
10154 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
10155
10156 /**
10157  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10158  */
10159 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
10160
10161 /**
10162  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
10163  */
10164 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
10165
10166 /**
10167  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
10168  */
10169 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
10170
10171 /**
10172  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
10173  */
10174 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
10175
10176 /**
10177  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10178  * but with all dynamically-allocated buffers duplicated in new buffers.
10179  */
10180 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
10181
10182 /**
10183  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10184  */
10185 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
10186
10187 /**
10188  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10189  */
10190 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
10191
10192 /**
10193  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10194  */
10195 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
10196
10197 /**
10198  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10199  */
10200 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
10201
10202 /**
10203  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10204  * but with all dynamically-allocated buffers duplicated in new buffers.
10205  */
10206 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
10207
10208 /**
10209  * Creates a new CResult_NoneSemanticErrorZ in the success state.
10210  */
10211 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
10212
10213 /**
10214  * Creates a new CResult_NoneSemanticErrorZ in the error state.
10215  */
10216 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
10217
10218 /**
10219  * Frees any resources used by the CResult_NoneSemanticErrorZ.
10220  */
10221 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
10222
10223 /**
10224  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10225  * but with all dynamically-allocated buffers duplicated in new buffers.
10226  */
10227 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
10228
10229 /**
10230  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10231  */
10232 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
10233
10234 /**
10235  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10236  */
10237 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
10238
10239 /**
10240  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10241  */
10242 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
10243
10244 /**
10245  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10246  * but with all dynamically-allocated buffers duplicated in new buffers.
10247  */
10248 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
10249
10250 /**
10251  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
10252  */
10253 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
10254
10255 /**
10256  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
10257  */
10258 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
10259
10260 /**
10261  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
10262  */
10263 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
10264
10265 /**
10266  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10267  * but with all dynamically-allocated buffers duplicated in new buffers.
10268  */
10269 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
10270
10271 /**
10272  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
10273  */
10274 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
10275
10276 /**
10277  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
10278  */
10279 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
10280
10281 /**
10282  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
10283  */
10284 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
10285
10286 /**
10287  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
10288  * but with all dynamically-allocated buffers duplicated in new buffers.
10289  */
10290 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
10291
10292 /**
10293  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10294  */
10295 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
10296
10297 /**
10298  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10299  */
10300 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
10301
10302 /**
10303  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10304  */
10305 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
10306
10307 /**
10308  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10309  * but with all dynamically-allocated buffers duplicated in new buffers.
10310  */
10311 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
10312
10313 /**
10314  * Creates a new CResult_StringErrorZ in the success state.
10315  */
10316 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
10317
10318 /**
10319  * Creates a new CResult_StringErrorZ in the error state.
10320  */
10321 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
10322
10323 /**
10324  * Frees any resources used by the CResult_StringErrorZ.
10325  */
10326 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
10327
10328 /**
10329  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10330  */
10331 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
10332
10333 /**
10334  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10335  */
10336 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10337
10338 /**
10339  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10340  */
10341 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
10342
10343 /**
10344  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10345  * but with all dynamically-allocated buffers duplicated in new buffers.
10346  */
10347 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
10348
10349 /**
10350  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10351  */
10352 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
10353
10354 /**
10355  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10356  */
10357 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10358
10359 /**
10360  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10361  */
10362 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
10363
10364 /**
10365  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10366  * but with all dynamically-allocated buffers duplicated in new buffers.
10367  */
10368 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
10369
10370 /**
10371  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
10372  */
10373 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
10374
10375 /**
10376  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
10377  */
10378 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
10379
10380 /**
10381  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
10382  */
10383 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
10384
10385 /**
10386  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
10387  * but with all dynamically-allocated buffers duplicated in new buffers.
10388  */
10389 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
10390
10391 /**
10392  * Creates a new tuple which has the same data as `orig`
10393  * but with all dynamically-allocated buffers duplicated in new buffers.
10394  */
10395 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
10396
10397 /**
10398  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10399  */
10400 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
10401
10402 /**
10403  * Frees any resources used by the C2Tuple_OutPointScriptZ.
10404  */
10405 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
10406
10407 /**
10408  * Creates a new tuple which has the same data as `orig`
10409  * but with all dynamically-allocated buffers duplicated in new buffers.
10410  */
10411 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
10412
10413 /**
10414  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
10415  */
10416 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
10417
10418 /**
10419  * Frees any resources used by the C2Tuple_u32ScriptZ.
10420  */
10421 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
10422
10423 /**
10424  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10425  */
10426 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
10427
10428 /**
10429  * Creates a new tuple which has the same data as `orig`
10430  * but with all dynamically-allocated buffers duplicated in new buffers.
10431  */
10432 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
10433
10434 /**
10435  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10436  */
10437 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
10438
10439 /**
10440  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10441  */
10442 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
10443
10444 /**
10445  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10446  */
10447 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
10448
10449 /**
10450  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10451  */
10452 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
10453
10454 /**
10455  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10456  */
10457 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
10458
10459 /**
10460  * Creates a new tuple which has the same data as `orig`
10461  * but with all dynamically-allocated buffers duplicated in new buffers.
10462  */
10463 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
10464
10465 /**
10466  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
10467  */
10468 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
10469
10470 /**
10471  * Frees any resources used by the C2Tuple_u32TxOutZ.
10472  */
10473 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
10474
10475 /**
10476  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10477  */
10478 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
10479
10480 /**
10481  * Creates a new tuple which has the same data as `orig`
10482  * but with all dynamically-allocated buffers duplicated in new buffers.
10483  */
10484 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
10485
10486 /**
10487  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10488  */
10489 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
10490
10491 /**
10492  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10493  */
10494 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
10495
10496 /**
10497  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10498  */
10499 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
10500
10501 /**
10502  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10503  */
10504 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
10505
10506 /**
10507  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10508  */
10509 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
10510
10511 /**
10512  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10513  */
10514 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
10515
10516 /**
10517  * Creates a new CResult_boolLightningErrorZ in the success state.
10518  */
10519 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
10520
10521 /**
10522  * Creates a new CResult_boolLightningErrorZ in the error state.
10523  */
10524 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
10525
10526 /**
10527  * Frees any resources used by the CResult_boolLightningErrorZ.
10528  */
10529 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
10530
10531 /**
10532  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10533  * but with all dynamically-allocated buffers duplicated in new buffers.
10534  */
10535 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
10536
10537 /**
10538  * Creates a new tuple which has the same data as `orig`
10539  * but with all dynamically-allocated buffers duplicated in new buffers.
10540  */
10541 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
10542
10543 /**
10544  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10545  */
10546 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
10547
10548 /**
10549  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10550  */
10551 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
10552
10553 /**
10554  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10555  */
10556 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
10557
10558 /**
10559  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10560  */
10561 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
10562
10563 /**
10564  * Creates a new CResult_NoneLightningErrorZ in the success state.
10565  */
10566 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
10567
10568 /**
10569  * Creates a new CResult_NoneLightningErrorZ in the error state.
10570  */
10571 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
10572
10573 /**
10574  * Frees any resources used by the CResult_NoneLightningErrorZ.
10575  */
10576 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
10577
10578 /**
10579  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10580  * but with all dynamically-allocated buffers duplicated in new buffers.
10581  */
10582 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
10583
10584 /**
10585  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10586  */
10587 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
10588
10589 /**
10590  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10591  */
10592 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
10593
10594 /**
10595  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10596  */
10597 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10598
10599 /**
10600  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10601  */
10602 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
10603
10604 /**
10605  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10606  * but with all dynamically-allocated buffers duplicated in new buffers.
10607  */
10608 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
10609
10610 /**
10611  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
10612  */
10613 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
10614
10615 /**
10616  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
10617  */
10618 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
10619
10620 /**
10621  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
10622  */
10623 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
10624
10625 /**
10626  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10627  * but with all dynamically-allocated buffers duplicated in new buffers.
10628  */
10629 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
10630
10631 /**
10632  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
10633  */
10634 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
10635
10636 /**
10637  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
10638  */
10639 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10640
10641 /**
10642  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
10643  */
10644 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
10645
10646 /**
10647  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10648  * but with all dynamically-allocated buffers duplicated in new buffers.
10649  */
10650 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
10651
10652 /**
10653  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10654  */
10655 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
10656
10657 /**
10658  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10659  */
10660 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10661
10662 /**
10663  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10664  */
10665 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
10666
10667 /**
10668  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10669  * but with all dynamically-allocated buffers duplicated in new buffers.
10670  */
10671 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10672
10673 /**
10674  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10675  */
10676 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
10677
10678 /**
10679  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10680  */
10681 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10682
10683 /**
10684  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10685  */
10686 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
10687
10688 /**
10689  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10690  * but with all dynamically-allocated buffers duplicated in new buffers.
10691  */
10692 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10693
10694 /**
10695  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10696  */
10697 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
10698
10699 /**
10700  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10701  */
10702 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
10703
10704 /**
10705  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10706  */
10707 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
10708
10709 /**
10710  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10711  * but with all dynamically-allocated buffers duplicated in new buffers.
10712  */
10713 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10714
10715 /**
10716  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10717  */
10718 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10719
10720 /**
10721  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10722  */
10723 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10724
10725 /**
10726  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10727  */
10728 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10729
10730 /**
10731  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10732  * but with all dynamically-allocated buffers duplicated in new buffers.
10733  */
10734 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10735
10736 /**
10737  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10738  */
10739 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10740
10741 /**
10742  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10743  */
10744 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10745
10746 /**
10747  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10748  */
10749 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10750
10751 /**
10752  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10753  */
10754 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10755
10756 /**
10757  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10758  * but with all dynamically-allocated buffers duplicated in new buffers.
10759  */
10760 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10761
10762 /**
10763  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10764  */
10765 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10766
10767 /**
10768  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10769  */
10770 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10771
10772 /**
10773  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10774  */
10775 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10776
10777 /**
10778  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10779  * but with all dynamically-allocated buffers duplicated in new buffers.
10780  */
10781 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10782
10783 /**
10784  * Creates a new CResult_NetAddressu8Z in the success state.
10785  */
10786 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10787
10788 /**
10789  * Creates a new CResult_NetAddressu8Z in the error state.
10790  */
10791 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10792
10793 /**
10794  * Frees any resources used by the CResult_NetAddressu8Z.
10795  */
10796 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10797
10798 /**
10799  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10800  * but with all dynamically-allocated buffers duplicated in new buffers.
10801  */
10802 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10803
10804 /**
10805  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10806  */
10807 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10808
10809 /**
10810  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10811  */
10812 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10813
10814 /**
10815  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10816  */
10817 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10818
10819 /**
10820  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10821  * but with all dynamically-allocated buffers duplicated in new buffers.
10822  */
10823 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10824
10825 /**
10826  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10827  */
10828 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
10829
10830 /**
10831  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10832  */
10833 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
10834
10835 /**
10836  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10837  */
10838 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
10839
10840 /**
10841  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10842  * but with all dynamically-allocated buffers duplicated in new buffers.
10843  */
10844 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
10845
10846 /**
10847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10848  */
10849 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10850
10851 /**
10852  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10853  */
10854 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10855
10856 /**
10857  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10858  */
10859 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10860
10861 /**
10862  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10863  */
10864 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10865
10866 /**
10867  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10868  */
10869 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10870
10871 /**
10872  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10873  */
10874 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10875
10876 /**
10877  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10878  */
10879 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10880
10881 /**
10882  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10883  * but with all dynamically-allocated buffers duplicated in new buffers.
10884  */
10885 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10886
10887 /**
10888  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10889  */
10890 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10891
10892 /**
10893  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10894  */
10895 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10896
10897 /**
10898  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10899  */
10900 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10901
10902 /**
10903  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10904  * but with all dynamically-allocated buffers duplicated in new buffers.
10905  */
10906 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10907
10908 /**
10909  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10910  */
10911 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10912
10913 /**
10914  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10915  */
10916 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10917
10918 /**
10919  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10920  */
10921 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10922
10923 /**
10924  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10925  * but with all dynamically-allocated buffers duplicated in new buffers.
10926  */
10927 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10928
10929 /**
10930  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10931  */
10932 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10933
10934 /**
10935  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10936  */
10937 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10938
10939 /**
10940  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10941  */
10942 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10943
10944 /**
10945  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10946  * but with all dynamically-allocated buffers duplicated in new buffers.
10947  */
10948 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10949
10950 /**
10951  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10952  */
10953 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10954
10955 /**
10956  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10957  */
10958 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10959
10960 /**
10961  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10962  */
10963 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10964
10965 /**
10966  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10967  * but with all dynamically-allocated buffers duplicated in new buffers.
10968  */
10969 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10970
10971 /**
10972  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10973  */
10974 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10975
10976 /**
10977  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10978  */
10979 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10980
10981 /**
10982  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10983  */
10984 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10985
10986 /**
10987  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10988  * but with all dynamically-allocated buffers duplicated in new buffers.
10989  */
10990 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10991
10992 /**
10993  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10994  */
10995 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10996
10997 /**
10998  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10999  */
11000 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
11001
11002 /**
11003  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11004  */
11005 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
11006
11007 /**
11008  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11009  * but with all dynamically-allocated buffers duplicated in new buffers.
11010  */
11011 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
11012
11013 /**
11014  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11015  */
11016 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
11017
11018 /**
11019  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11020  */
11021 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
11022
11023 /**
11024  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11025  */
11026 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
11027
11028 /**
11029  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11030  * but with all dynamically-allocated buffers duplicated in new buffers.
11031  */
11032 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
11033
11034 /**
11035  * Creates a new CResult_InitDecodeErrorZ in the success state.
11036  */
11037 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
11038
11039 /**
11040  * Creates a new CResult_InitDecodeErrorZ in the error state.
11041  */
11042 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
11043
11044 /**
11045  * Frees any resources used by the CResult_InitDecodeErrorZ.
11046  */
11047 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
11048
11049 /**
11050  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11051  * but with all dynamically-allocated buffers duplicated in new buffers.
11052  */
11053 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
11054
11055 /**
11056  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11057  */
11058 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
11059
11060 /**
11061  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11062  */
11063 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
11064
11065 /**
11066  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11067  */
11068 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
11069
11070 /**
11071  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11072  * but with all dynamically-allocated buffers duplicated in new buffers.
11073  */
11074 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
11075
11076 /**
11077  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11078  */
11079 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
11080
11081 /**
11082  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11083  */
11084 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
11085
11086 /**
11087  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11088  */
11089 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
11090
11091 /**
11092  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11093  * but with all dynamically-allocated buffers duplicated in new buffers.
11094  */
11095 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
11096
11097 /**
11098  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11099  */
11100 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
11101
11102 /**
11103  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11104  */
11105 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
11106
11107 /**
11108  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11109  */
11110 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
11111
11112 /**
11113  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11114  * but with all dynamically-allocated buffers duplicated in new buffers.
11115  */
11116 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
11117
11118 /**
11119  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11120  */
11121 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
11122
11123 /**
11124  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11125  */
11126 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11127
11128 /**
11129  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11130  */
11131 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
11132
11133 /**
11134  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11135  * but with all dynamically-allocated buffers duplicated in new buffers.
11136  */
11137 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
11138
11139 /**
11140  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11141  */
11142 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
11143
11144 /**
11145  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11146  */
11147 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11148
11149 /**
11150  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11151  */
11152 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
11153
11154 /**
11155  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11156  * but with all dynamically-allocated buffers duplicated in new buffers.
11157  */
11158 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
11159
11160 /**
11161  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11162  */
11163 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
11164
11165 /**
11166  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11167  */
11168 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
11169
11170 /**
11171  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11172  */
11173 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
11174
11175 /**
11176  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11177  * but with all dynamically-allocated buffers duplicated in new buffers.
11178  */
11179 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
11180
11181 /**
11182  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11183  */
11184 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
11185
11186 /**
11187  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11188  */
11189 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11190
11191 /**
11192  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11193  */
11194 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
11195
11196 /**
11197  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11198  * but with all dynamically-allocated buffers duplicated in new buffers.
11199  */
11200 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
11201
11202 /**
11203  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11204  */
11205 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
11206
11207 /**
11208  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11209  */
11210 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11211
11212 /**
11213  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11214  */
11215 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
11216
11217 /**
11218  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11219  * but with all dynamically-allocated buffers duplicated in new buffers.
11220  */
11221 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
11222
11223 /**
11224  * Creates a new CResult_PingDecodeErrorZ in the success state.
11225  */
11226 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
11227
11228 /**
11229  * Creates a new CResult_PingDecodeErrorZ in the error state.
11230  */
11231 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
11232
11233 /**
11234  * Frees any resources used by the CResult_PingDecodeErrorZ.
11235  */
11236 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
11237
11238 /**
11239  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11240  * but with all dynamically-allocated buffers duplicated in new buffers.
11241  */
11242 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
11243
11244 /**
11245  * Creates a new CResult_PongDecodeErrorZ in the success state.
11246  */
11247 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
11248
11249 /**
11250  * Creates a new CResult_PongDecodeErrorZ in the error state.
11251  */
11252 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
11253
11254 /**
11255  * Frees any resources used by the CResult_PongDecodeErrorZ.
11256  */
11257 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
11258
11259 /**
11260  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11261  * but with all dynamically-allocated buffers duplicated in new buffers.
11262  */
11263 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
11264
11265 /**
11266  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11267  */
11268 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
11269
11270 /**
11271  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11272  */
11273 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11274
11275 /**
11276  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11277  */
11278 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
11279
11280 /**
11281  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11282  * but with all dynamically-allocated buffers duplicated in new buffers.
11283  */
11284 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11285
11286 /**
11287  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11288  */
11289 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
11290
11291 /**
11292  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11293  */
11294 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11295
11296 /**
11297  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11298  */
11299 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
11300
11301 /**
11302  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11303  * but with all dynamically-allocated buffers duplicated in new buffers.
11304  */
11305 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11306
11307 /**
11308  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11309  */
11310 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
11311
11312 /**
11313  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11314  */
11315 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11316
11317 /**
11318  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11319  */
11320 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
11321
11322 /**
11323  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11324  * but with all dynamically-allocated buffers duplicated in new buffers.
11325  */
11326 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11327
11328 /**
11329  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11330  */
11331 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
11332
11333 /**
11334  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11335  */
11336 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11337
11338 /**
11339  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11340  */
11341 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
11342
11343 /**
11344  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11345  * but with all dynamically-allocated buffers duplicated in new buffers.
11346  */
11347 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11348
11349 /**
11350  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11351  */
11352 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
11353
11354 /**
11355  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11356  */
11357 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
11358
11359 /**
11360  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11361  */
11362 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
11363
11364 /**
11365  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11366  * but with all dynamically-allocated buffers duplicated in new buffers.
11367  */
11368 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
11369
11370 /**
11371  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11372  */
11373 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
11374
11375 /**
11376  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11377  */
11378 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11379
11380 /**
11381  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11382  */
11383 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
11384
11385 /**
11386  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11387  * but with all dynamically-allocated buffers duplicated in new buffers.
11388  */
11389 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11390
11391 /**
11392  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11393  */
11394 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
11395
11396 /**
11397  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11398  */
11399 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11400
11401 /**
11402  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11403  */
11404 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
11405
11406 /**
11407  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11408  * but with all dynamically-allocated buffers duplicated in new buffers.
11409  */
11410 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11411
11412 /**
11413  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11414  */
11415 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
11416
11417 /**
11418  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11419  */
11420 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
11421
11422 /**
11423  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11424  */
11425 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
11426
11427 /**
11428  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11429  * but with all dynamically-allocated buffers duplicated in new buffers.
11430  */
11431 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
11432
11433 /**
11434  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11435  */
11436 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
11437
11438 /**
11439  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11440  */
11441 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
11442
11443 /**
11444  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11445  */
11446 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
11447
11448 /**
11449  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11450  * but with all dynamically-allocated buffers duplicated in new buffers.
11451  */
11452 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
11453
11454 /**
11455  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11456  */
11457 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
11458
11459 /**
11460  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11461  */
11462 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11463
11464 /**
11465  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11466  */
11467 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
11468
11469 /**
11470  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11471  * but with all dynamically-allocated buffers duplicated in new buffers.
11472  */
11473 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11474
11475 /**
11476  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11477  */
11478 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
11479
11480 /**
11481  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11482  */
11483 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11484
11485 /**
11486  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11487  */
11488 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
11489
11490 /**
11491  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11492  * but with all dynamically-allocated buffers duplicated in new buffers.
11493  */
11494 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11495
11496 /**
11497  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11498  */
11499 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
11500
11501 /**
11502  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11503  */
11504 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
11505
11506 /**
11507  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11508  */
11509 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
11510
11511 /**
11512  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11513  * but with all dynamically-allocated buffers duplicated in new buffers.
11514  */
11515 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
11516
11517 /**
11518  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11519  */
11520 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
11521
11522 /**
11523  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11524  */
11525 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
11526
11527 /**
11528  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11529  */
11530 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
11531
11532 /**
11533  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11534  * but with all dynamically-allocated buffers duplicated in new buffers.
11535  */
11536 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
11537
11538 /**
11539  * Frees any resources used by the Event
11540  */
11541 void Event_free(struct LDKEvent this_ptr);
11542
11543 /**
11544  * Creates a copy of the Event
11545  */
11546 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11547
11548 /**
11549  * Serialize the Event object into a byte array which can be read by Event_read
11550  */
11551 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11552
11553 /**
11554  * Frees any resources used by the MessageSendEvent
11555  */
11556 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11557
11558 /**
11559  * Creates a copy of the MessageSendEvent
11560  */
11561 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11562
11563 /**
11564  * Calls the free function if one is set
11565  */
11566 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11567
11568 /**
11569  * Calls the free function if one is set
11570  */
11571 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11572
11573 /**
11574  * Calls the free function if one is set
11575  */
11576 void EventHandler_free(struct LDKEventHandler this_ptr);
11577
11578 /**
11579  * Frees any resources used by the APIError
11580  */
11581 void APIError_free(struct LDKAPIError this_ptr);
11582
11583 /**
11584  * Creates a copy of the APIError
11585  */
11586 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11587
11588 /**
11589  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11590  * 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.
11591  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11592  */
11593 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11594
11595 /**
11596  * Recovers the PublicKey of the signer of the message given the message and the signature.
11597  */
11598 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11599
11600 /**
11601  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11602  * and the PublicKey.
11603  */
11604 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11605
11606 /**
11607  * Creates a copy of the Level
11608  */
11609 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11610
11611 /**
11612  * Checks if two Levels contain equal inner contents.
11613  * This ignores pointers and is_owned flags and looks at the values in fields.
11614  */
11615 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11616
11617 /**
11618  * Checks if two Levels contain equal inner contents.
11619  */
11620 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11621
11622 /**
11623  * Returns the most verbose logging level.
11624  */
11625 MUST_USE_RES enum LDKLevel Level_max(void);
11626
11627 /**
11628  * Calls the free function if one is set
11629  */
11630 void Logger_free(struct LDKLogger this_ptr);
11631
11632 /**
11633  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11634  */
11635 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11636
11637 /**
11638  * Confirmations we will wait for before considering the channel locked in.
11639  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11640  * equivalent limit applied to outbound channels).
11641  *
11642  * Default value: 6.
11643  */
11644 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11645
11646 /**
11647  * Confirmations we will wait for before considering the channel locked in.
11648  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11649  * equivalent limit applied to outbound channels).
11650  *
11651  * Default value: 6.
11652  */
11653 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11654
11655 /**
11656  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11657  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11658  * transaction).
11659  *
11660  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11661  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11662  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11663  * possibly with time in between to RBF the spending transaction).
11664  *
11665  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11666  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11667  * our channel.
11668  *
11669  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11670  * can tweak config to ask for more security, not less.
11671  */
11672 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11673
11674 /**
11675  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11676  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11677  * transaction).
11678  *
11679  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11680  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11681  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11682  * possibly with time in between to RBF the spending transaction).
11683  *
11684  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11685  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11686  * our channel.
11687  *
11688  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11689  * can tweak config to ask for more security, not less.
11690  */
11691 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11692
11693 /**
11694  * Set to the smallest value HTLC we will accept to process.
11695  *
11696  * This value is sent to our counterparty on channel-open and we close the channel any time
11697  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11698  *
11699  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11700  * by the protocol.
11701  */
11702 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11703
11704 /**
11705  * Set to the smallest value HTLC we will accept to process.
11706  *
11707  * This value is sent to our counterparty on channel-open and we close the channel any time
11708  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11709  *
11710  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11711  * by the protocol.
11712  */
11713 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11714
11715 /**
11716  * Constructs a new ChannelHandshakeConfig given each field
11717  */
11718 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);
11719
11720 /**
11721  * Creates a copy of the ChannelHandshakeConfig
11722  */
11723 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11724
11725 /**
11726  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11727  */
11728 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11729
11730 /**
11731  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11732  */
11733 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11734
11735 /**
11736  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11737  * only applies to inbound channels.
11738  *
11739  * Default value: 0.
11740  */
11741 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11742
11743 /**
11744  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11745  * only applies to inbound channels.
11746  *
11747  * Default value: 0.
11748  */
11749 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11750
11751 /**
11752  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11753  * you to limit the maximum minimum-size they can require.
11754  *
11755  * Default value: u64::max_value.
11756  */
11757 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11758
11759 /**
11760  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11761  * you to limit the maximum minimum-size they can require.
11762  *
11763  * Default value: u64::max_value.
11764  */
11765 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11766
11767 /**
11768  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11769  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11770  *
11771  * Default value: 0.
11772  */
11773 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11774
11775 /**
11776  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11777  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11778  *
11779  * Default value: 0.
11780  */
11781 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11782
11783 /**
11784  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11785  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11786  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11787  *
11788  * Default value: u64::max_value.
11789  */
11790 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11791
11792 /**
11793  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11794  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11795  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11796  *
11797  * Default value: u64::max_value.
11798  */
11799 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11800
11801 /**
11802  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11803  * time. This allows you to set a minimum such value.
11804  *
11805  * Default value: 0.
11806  */
11807 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11808
11809 /**
11810  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11811  * time. This allows you to set a minimum such value.
11812  *
11813  * Default value: 0.
11814  */
11815 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11816
11817 /**
11818  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11819  * certain number of blocks, specified by the node which is not the funder (as the funder can
11820  * assume they aren't going to double-spend themselves).
11821  * This config allows you to set a limit on the maximum amount of time to wait.
11822  *
11823  * Default value: 144, or roughly one day and only applies to outbound channels.
11824  */
11825 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11826
11827 /**
11828  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11829  * certain number of blocks, specified by the node which is not the funder (as the funder can
11830  * assume they aren't going to double-spend themselves).
11831  * This config allows you to set a limit on the maximum amount of time to wait.
11832  *
11833  * Default value: 144, or roughly one day and only applies to outbound channels.
11834  */
11835 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11836
11837 /**
11838  * Set to force the incoming channel to match our announced channel preference in
11839  * ChannelConfig.
11840  *
11841  * Default value: true, to make the default that no announced channels are possible (which is
11842  * appropriate for any nodes which are not online very reliably).
11843  */
11844 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11845
11846 /**
11847  * Set to force the incoming channel to match our announced channel preference in
11848  * ChannelConfig.
11849  *
11850  * Default value: true, to make the default that no announced channels are possible (which is
11851  * appropriate for any nodes which are not online very reliably).
11852  */
11853 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11854
11855 /**
11856  * Set to the amount of time we're willing to wait to claim money back to us.
11857  *
11858  * Not checking this value would be a security issue, as our peer would be able to set it to
11859  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11860  *
11861  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11862  * reduce the loss of having useless locked funds (if your peer accepts)
11863  */
11864 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11865
11866 /**
11867  * Set to the amount of time we're willing to wait to claim money back to us.
11868  *
11869  * Not checking this value would be a security issue, as our peer would be able to set it to
11870  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11871  *
11872  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11873  * reduce the loss of having useless locked funds (if your peer accepts)
11874  */
11875 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11876
11877 /**
11878  * Constructs a new ChannelHandshakeLimits given each field
11879  */
11880 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);
11881
11882 /**
11883  * Creates a copy of the ChannelHandshakeLimits
11884  */
11885 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11886
11887 /**
11888  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11889  */
11890 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11891
11892 /**
11893  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11894  */
11895 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11896
11897 /**
11898  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11899  * This may be allowed to change at runtime in a later update, however doing so must result in
11900  * update messages sent to notify all nodes of our updated relay fee.
11901  *
11902  * Default value: 0.
11903  */
11904 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11905
11906 /**
11907  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11908  * This may be allowed to change at runtime in a later update, however doing so must result in
11909  * update messages sent to notify all nodes of our updated relay fee.
11910  *
11911  * Default value: 0.
11912  */
11913 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11914
11915 /**
11916  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11917  * the channel this config applies to.
11918  *
11919  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11920  * HTLC balance when a channel appears on-chain whereas
11921  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11922  * (non-HTLC-encumbered) balance.
11923  *
11924  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11925  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11926  * commitment transaction at least once per this many blocks (minus some margin to allow us
11927  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11928  * the spending transaction).
11929  *
11930  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11931  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11932  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11933  *
11934  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11935  */
11936 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11937
11938 /**
11939  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11940  * the channel this config applies to.
11941  *
11942  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11943  * HTLC balance when a channel appears on-chain whereas
11944  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11945  * (non-HTLC-encumbered) balance.
11946  *
11947  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11948  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11949  * commitment transaction at least once per this many blocks (minus some margin to allow us
11950  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11951  * the spending transaction).
11952  *
11953  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11954  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11955  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11956  *
11957  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11958  */
11959 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11960
11961 /**
11962  * Set to announce the channel publicly and notify all nodes that they can route via this
11963  * channel.
11964  *
11965  * This should only be set to true for nodes which expect to be online reliably.
11966  *
11967  * As the node which funds a channel picks this value this will only apply for new outbound
11968  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11969  *
11970  * This cannot be changed after the initial channel handshake.
11971  *
11972  * Default value: false.
11973  */
11974 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11975
11976 /**
11977  * Set to announce the channel publicly and notify all nodes that they can route via this
11978  * channel.
11979  *
11980  * This should only be set to true for nodes which expect to be online reliably.
11981  *
11982  * As the node which funds a channel picks this value this will only apply for new outbound
11983  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11984  *
11985  * This cannot be changed after the initial channel handshake.
11986  *
11987  * Default value: false.
11988  */
11989 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11990
11991 /**
11992  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11993  * supports it, they will then enforce the mutual-close output to us matches what we provided
11994  * at intialization, preventing us from closing to an alternate pubkey.
11995  *
11996  * This is set to true by default to provide a slight increase in security, though ultimately
11997  * any attacker who is able to take control of a channel can just as easily send the funds via
11998  * lightning payments, so we never require that our counterparties support this option.
11999  *
12000  * This cannot be changed after a channel has been initialized.
12001  *
12002  * Default value: true.
12003  */
12004 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12005
12006 /**
12007  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
12008  * supports it, they will then enforce the mutual-close output to us matches what we provided
12009  * at intialization, preventing us from closing to an alternate pubkey.
12010  *
12011  * This is set to true by default to provide a slight increase in security, though ultimately
12012  * any attacker who is able to take control of a channel can just as easily send the funds via
12013  * lightning payments, so we never require that our counterparties support this option.
12014  *
12015  * This cannot be changed after a channel has been initialized.
12016  *
12017  * Default value: true.
12018  */
12019 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12020
12021 /**
12022  * Constructs a new ChannelConfig given each field
12023  */
12024 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
12025
12026 /**
12027  * Creates a copy of the ChannelConfig
12028  */
12029 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
12030
12031 /**
12032  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
12033  */
12034 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
12035
12036 /**
12037  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
12038  */
12039 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
12040
12041 /**
12042  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
12043  */
12044 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
12045
12046 /**
12047  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
12048  */
12049 void UserConfig_free(struct LDKUserConfig this_obj);
12050
12051 /**
12052  * Channel config that we propose to our counterparty.
12053  */
12054 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12055
12056 /**
12057  * Channel config that we propose to our counterparty.
12058  */
12059 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
12060
12061 /**
12062  * Limits applied to our counterparty's proposed channel config settings.
12063  */
12064 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12065
12066 /**
12067  * Limits applied to our counterparty's proposed channel config settings.
12068  */
12069 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
12070
12071 /**
12072  * Channel config which affects behavior during channel lifetime.
12073  */
12074 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12075
12076 /**
12077  * Channel config which affects behavior during channel lifetime.
12078  */
12079 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
12080
12081 /**
12082  * Constructs a new UserConfig given each field
12083  */
12084 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);
12085
12086 /**
12087  * Creates a copy of the UserConfig
12088  */
12089 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
12090
12091 /**
12092  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
12093  */
12094 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
12095
12096 /**
12097  * Creates a copy of the AccessError
12098  */
12099 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
12100
12101 /**
12102  * Calls the free function if one is set
12103  */
12104 void Access_free(struct LDKAccess this_ptr);
12105
12106 /**
12107  * Calls the free function if one is set
12108  */
12109 void Listen_free(struct LDKListen this_ptr);
12110
12111 /**
12112  * Calls the free function if one is set
12113  */
12114 void Confirm_free(struct LDKConfirm this_ptr);
12115
12116 /**
12117  * Calls the free function if one is set
12118  */
12119 void Watch_free(struct LDKWatch this_ptr);
12120
12121 /**
12122  * Calls the free function if one is set
12123  */
12124 void Filter_free(struct LDKFilter this_ptr);
12125
12126 /**
12127  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
12128  */
12129 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
12130
12131 /**
12132  * First block where the transaction output may have been spent.
12133  */
12134 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12135
12136 /**
12137  * First block where the transaction output may have been spent.
12138  */
12139 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12140
12141 /**
12142  * Outpoint identifying the transaction output.
12143  */
12144 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12145
12146 /**
12147  * Outpoint identifying the transaction output.
12148  */
12149 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12150
12151 /**
12152  * Spending condition of the transaction output.
12153  */
12154 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12155
12156 /**
12157  * Spending condition of the transaction output.
12158  */
12159 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12160
12161 /**
12162  * Constructs a new WatchedOutput given each field
12163  */
12164 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
12165
12166 /**
12167  * Creates a copy of the WatchedOutput
12168  */
12169 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
12170
12171 /**
12172  * Checks if two WatchedOutputs contain equal inner contents.
12173  */
12174 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
12175
12176 /**
12177  * Calls the free function if one is set
12178  */
12179 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
12180
12181 /**
12182  * Creates a copy of the ConfirmationTarget
12183  */
12184 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
12185
12186 /**
12187  * Calls the free function if one is set
12188  */
12189 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
12190
12191 /**
12192  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
12193  */
12194 void ChainMonitor_free(struct LDKChainMonitor this_obj);
12195
12196 /**
12197  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
12198  *
12199  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
12200  * will call back to it indicating transactions and outputs of interest. This allows clients to
12201  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
12202  * always need to fetch full blocks absent another means for determining which blocks contain
12203  * transactions relevant to the watched channels.
12204  */
12205 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
12206
12207 /**
12208  * Constructs a new Listen which calls the relevant methods on this_arg.
12209  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12210  */
12211 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12212
12213 /**
12214  * Constructs a new Confirm which calls the relevant methods on this_arg.
12215  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12216  */
12217 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12218
12219 /**
12220  * Constructs a new Watch which calls the relevant methods on this_arg.
12221  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
12222  */
12223 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12224
12225 /**
12226  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12227  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12228  */
12229 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12230
12231 /**
12232  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
12233  */
12234 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
12235
12236 /**
12237  * The sequence number of this update. Updates *must* be replayed in-order according to this
12238  * sequence number (and updates may panic if they are not). The update_id values are strictly
12239  * increasing and increase by one for each new update, with one exception specified below.
12240  *
12241  * This sequence number is also used to track up to which points updates which returned
12242  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12243  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12244  *
12245  * The only instance where update_id values are not strictly increasing is the case where we
12246  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12247  * its docs for more details.
12248  */
12249 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
12250
12251 /**
12252  * The sequence number of this update. Updates *must* be replayed in-order according to this
12253  * sequence number (and updates may panic if they are not). The update_id values are strictly
12254  * increasing and increase by one for each new update, with one exception specified below.
12255  *
12256  * This sequence number is also used to track up to which points updates which returned
12257  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12258  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12259  *
12260  * The only instance where update_id values are not strictly increasing is the case where we
12261  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12262  * its docs for more details.
12263  */
12264 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
12265
12266 /**
12267  * Creates a copy of the ChannelMonitorUpdate
12268  */
12269 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
12270
12271 /**
12272  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
12273  */
12274 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
12275
12276 /**
12277  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
12278  */
12279 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
12280
12281 /**
12282  * Creates a copy of the ChannelMonitorUpdateErr
12283  */
12284 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
12285
12286 /**
12287  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
12288  */
12289 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
12290
12291 /**
12292  * Creates a copy of the MonitorUpdateError
12293  */
12294 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
12295
12296 /**
12297  * Frees any resources used by the MonitorEvent
12298  */
12299 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
12300
12301 /**
12302  * Creates a copy of the MonitorEvent
12303  */
12304 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
12305
12306 /**
12307  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
12308  */
12309 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
12310
12311 /**
12312  * Creates a copy of the HTLCUpdate
12313  */
12314 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
12315
12316 /**
12317  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
12318  */
12319 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
12320
12321 /**
12322  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
12323  */
12324 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
12325
12326 /**
12327  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12328  */
12329 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12330
12331 /**
12332  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12333  */
12334 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12335
12336 /**
12337  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12338  * itself.
12339  *
12340  * panics if the given update is not the next update by update_id.
12341  */
12342 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);
12343
12344 /**
12345  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12346  * ChannelMonitor.
12347  */
12348 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12349
12350 /**
12351  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12352  */
12353 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12354
12355 /**
12356  * Gets a list of txids, with their output scripts (in the order they appear in the
12357  * transaction), which we must learn about spends of via block_connected().
12358  */
12359 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12360
12361 /**
12362  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12363  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12364  * have been registered.
12365  */
12366 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12367
12368 /**
12369  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12370  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12371  */
12372 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12373
12374 /**
12375  * Gets the list of pending events which were generated by previous actions, clearing the list
12376  * in the process.
12377  *
12378  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12379  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12380  * no internal locking in ChannelMonitors.
12381  */
12382 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12383
12384 /**
12385  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12386  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12387  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12388  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12389  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12390  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12391  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12392  * out-of-band the other node operator to coordinate with him if option is available to you.
12393  * In any-case, choice is up to the user.
12394  */
12395 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);
12396
12397 /**
12398  * Processes transactions in a newly connected block, which may result in any of the following:
12399  * - update the monitor's state against resolved HTLCs
12400  * - punish the counterparty in the case of seeing a revoked commitment transaction
12401  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12402  * - detect settled outputs for later spending
12403  * - schedule and bump any in-flight claims
12404  *
12405  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12406  * [`get_outputs_to_watch`].
12407  *
12408  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12409  */
12410 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);
12411
12412 /**
12413  * Determines if the disconnected block contained any transactions of interest and updates
12414  * appropriately.
12415  */
12416 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);
12417
12418 /**
12419  * Processes transactions confirmed in a block with the given header and height, returning new
12420  * outputs to watch. See [`block_connected`] for details.
12421  *
12422  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12423  * blocks. See [`chain::Confirm`] for calling expectations.
12424  *
12425  * [`block_connected`]: Self::block_connected
12426  */
12427 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);
12428
12429 /**
12430  * Processes a transaction that was reorganized out of the chain.
12431  *
12432  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12433  * than blocks. See [`chain::Confirm`] for calling expectations.
12434  *
12435  * [`block_disconnected`]: Self::block_disconnected
12436  */
12437 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);
12438
12439 /**
12440  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12441  * [`block_connected`] for details.
12442  *
12443  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12444  * blocks. See [`chain::Confirm`] for calling expectations.
12445  *
12446  * [`block_connected`]: Self::block_connected
12447  */
12448 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);
12449
12450 /**
12451  * Returns the set of txids that should be monitored for re-organization out of the chain.
12452  */
12453 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12454
12455 /**
12456  * Calls the free function if one is set
12457  */
12458 void Persist_free(struct LDKPersist this_ptr);
12459
12460 /**
12461  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12462  */
12463 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12464
12465 /**
12466  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12467  */
12468 void OutPoint_free(struct LDKOutPoint this_obj);
12469
12470 /**
12471  * The referenced transaction's txid.
12472  */
12473 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12474
12475 /**
12476  * The referenced transaction's txid.
12477  */
12478 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12479
12480 /**
12481  * The index of the referenced output in its transaction's vout.
12482  */
12483 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12484
12485 /**
12486  * The index of the referenced output in its transaction's vout.
12487  */
12488 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12489
12490 /**
12491  * Constructs a new OutPoint given each field
12492  */
12493 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12494
12495 /**
12496  * Creates a copy of the OutPoint
12497  */
12498 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12499
12500 /**
12501  * Checks if two OutPoints contain equal inner contents.
12502  * This ignores pointers and is_owned flags and looks at the values in fields.
12503  * Two objects with NULL inner values will be considered "equal" here.
12504  */
12505 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12506
12507 /**
12508  * Checks if two OutPoints contain equal inner contents.
12509  */
12510 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12511
12512 /**
12513  * Convert an `OutPoint` to a lightning channel id.
12514  */
12515 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12516
12517 /**
12518  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12519  */
12520 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12521
12522 /**
12523  * Read a OutPoint from a byte array, created by OutPoint_write
12524  */
12525 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12526
12527 /**
12528  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12529  */
12530 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12531
12532 /**
12533  * The outpoint which is spendable
12534  */
12535 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12536
12537 /**
12538  * The outpoint which is spendable
12539  */
12540 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12541
12542 /**
12543  * Per commitment point to derive delayed_payment_key by key holder
12544  */
12545 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12546
12547 /**
12548  * Per commitment point to derive delayed_payment_key by key holder
12549  */
12550 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12551
12552 /**
12553  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12554  * the witness_script.
12555  */
12556 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12557
12558 /**
12559  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12560  * the witness_script.
12561  */
12562 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12563
12564 /**
12565  * The output which is referenced by the given outpoint
12566  */
12567 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12568
12569 /**
12570  * The revocation point specific to the commitment transaction which was broadcast. Used to
12571  * derive the witnessScript for this output.
12572  */
12573 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12574
12575 /**
12576  * The revocation point specific to the commitment transaction which was broadcast. Used to
12577  * derive the witnessScript for this output.
12578  */
12579 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12580
12581 /**
12582  * Arbitrary identification information returned by a call to
12583  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12584  * the channel to spend the output.
12585  */
12586 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12587
12588 /**
12589  * Arbitrary identification information returned by a call to
12590  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12591  * the channel to spend the output.
12592  */
12593 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12594
12595 /**
12596  * The value of the channel which this output originated from, possibly indirectly.
12597  */
12598 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12599
12600 /**
12601  * The value of the channel which this output originated from, possibly indirectly.
12602  */
12603 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12604
12605 /**
12606  * Constructs a new DelayedPaymentOutputDescriptor given each field
12607  */
12608 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);
12609
12610 /**
12611  * Creates a copy of the DelayedPaymentOutputDescriptor
12612  */
12613 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12614
12615 /**
12616  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
12617  */
12618 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
12619
12620 /**
12621  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
12622  */
12623 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
12624
12625 /**
12626  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12627  */
12628 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12629
12630 /**
12631  * The outpoint which is spendable
12632  */
12633 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12634
12635 /**
12636  * The outpoint which is spendable
12637  */
12638 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12639
12640 /**
12641  * The output which is referenced by the given outpoint
12642  */
12643 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12644
12645 /**
12646  * Arbitrary identification information returned by a call to
12647  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12648  * the channel to spend the output.
12649  */
12650 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12651
12652 /**
12653  * Arbitrary identification information returned by a call to
12654  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12655  * the channel to spend the output.
12656  */
12657 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12658
12659 /**
12660  * The value of the channel which this transactions spends.
12661  */
12662 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12663
12664 /**
12665  * The value of the channel which this transactions spends.
12666  */
12667 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12668
12669 /**
12670  * Constructs a new StaticPaymentOutputDescriptor given each field
12671  */
12672 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);
12673
12674 /**
12675  * Creates a copy of the StaticPaymentOutputDescriptor
12676  */
12677 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12678
12679 /**
12680  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
12681  */
12682 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
12683
12684 /**
12685  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
12686  */
12687 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
12688
12689 /**
12690  * Frees any resources used by the SpendableOutputDescriptor
12691  */
12692 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12693
12694 /**
12695  * Creates a copy of the SpendableOutputDescriptor
12696  */
12697 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12698
12699 /**
12700  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12701  */
12702 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12703
12704 /**
12705  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12706  */
12707 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12708
12709 /**
12710  * Calls the free function if one is set
12711  */
12712 void BaseSign_free(struct LDKBaseSign this_ptr);
12713
12714 /**
12715  * Creates a copy of a Sign
12716  */
12717 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12718
12719 /**
12720  * Calls the free function if one is set
12721  */
12722 void Sign_free(struct LDKSign this_ptr);
12723
12724 /**
12725  * Calls the free function if one is set
12726  */
12727 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12728
12729 /**
12730  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12731  */
12732 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12733
12734 /**
12735  * Private key of anchor tx
12736  */
12737 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12738
12739 /**
12740  * Private key of anchor tx
12741  */
12742 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12743
12744 /**
12745  * Holder secret key for blinded revocation pubkey
12746  */
12747 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12748
12749 /**
12750  * Holder secret key for blinded revocation pubkey
12751  */
12752 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12753
12754 /**
12755  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12756  */
12757 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12758
12759 /**
12760  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12761  */
12762 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12763
12764 /**
12765  * Holder secret key used in HTLC tx
12766  */
12767 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12768
12769 /**
12770  * Holder secret key used in HTLC tx
12771  */
12772 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12773
12774 /**
12775  * Holder htlc secret key used in commitment tx htlc outputs
12776  */
12777 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12778
12779 /**
12780  * Holder htlc secret key used in commitment tx htlc outputs
12781  */
12782 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12783
12784 /**
12785  * Commitment seed
12786  */
12787 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12788
12789 /**
12790  * Commitment seed
12791  */
12792 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12793
12794 /**
12795  * Creates a copy of the InMemorySigner
12796  */
12797 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12798
12799 /**
12800  * Create a new InMemorySigner
12801  */
12802 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);
12803
12804 /**
12805  * Counterparty pubkeys.
12806  * Will panic if ready_channel wasn't called.
12807  */
12808 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12809
12810 /**
12811  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12812  * transactions, ie the amount of time that we have to wait to recover our funds if we
12813  * broadcast a transaction.
12814  * Will panic if ready_channel wasn't called.
12815  */
12816 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12817
12818 /**
12819  * The contest_delay value specified by us and applied on transactions broadcastable
12820  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12821  * if they broadcast a transaction.
12822  * Will panic if ready_channel wasn't called.
12823  */
12824 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12825
12826 /**
12827  * Whether the holder is the initiator
12828  * Will panic if ready_channel wasn't called.
12829  */
12830 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12831
12832 /**
12833  * Funding outpoint
12834  * Will panic if ready_channel wasn't called.
12835  */
12836 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12837
12838 /**
12839  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12840  * building transactions.
12841  *
12842  * Will panic if ready_channel wasn't called.
12843  */
12844 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12845
12846 /**
12847  * Sign the single input of spend_tx at index `input_idx` which spends the output
12848  * described by descriptor, returning the witness stack for the input.
12849  *
12850  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12851  * or is not spending the outpoint described by `descriptor.outpoint`.
12852  */
12853 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);
12854
12855 /**
12856  * Sign the single input of spend_tx at index `input_idx` which spends the output
12857  * described by descriptor, returning the witness stack for the input.
12858  *
12859  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12860  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12861  * sequence set to `descriptor.to_self_delay`.
12862  */
12863 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);
12864
12865 /**
12866  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12867  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12868  */
12869 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12870
12871 /**
12872  * Constructs a new Sign which calls the relevant methods on this_arg.
12873  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12874  */
12875 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12876
12877 /**
12878  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12879  */
12880 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12881
12882 /**
12883  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12884  */
12885 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12886
12887 /**
12888  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12889  */
12890 void KeysManager_free(struct LDKKeysManager this_obj);
12891
12892 /**
12893  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12894  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12895  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12896  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12897  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12898  * simply use the current time (with very high precision).
12899  *
12900  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12901  * obviously, starting_time should be unique every time you reload the library - it is only
12902  * used to generate new ephemeral key data (which will be stored by the individual channel if
12903  * necessary).
12904  *
12905  * Note that the seed is required to recover certain on-chain funds independent of
12906  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12907  * channel, and some on-chain during-closing funds.
12908  *
12909  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12910  * versions. Once the library is more fully supported, the docs will be updated to include a
12911  * detailed description of the guarantee.
12912  */
12913 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12914
12915 /**
12916  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12917  *
12918  * Key derivation parameters are accessible through a per-channel secrets
12919  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12920  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12921  */
12922 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]);
12923
12924 /**
12925  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12926  * output to the given change destination (if sufficient change value remains). The
12927  * transaction will have a feerate, at least, of the given value.
12928  *
12929  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12930  * if a descriptor was duplicated.
12931  *
12932  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12933  *
12934  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12935  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12936  */
12937 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);
12938
12939 /**
12940  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12941  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12942  */
12943 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12944
12945 /**
12946  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12947  */
12948 void ChannelManager_free(struct LDKChannelManager this_obj);
12949
12950 /**
12951  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12952  */
12953 void ChainParameters_free(struct LDKChainParameters this_obj);
12954
12955 /**
12956  * The network for determining the `chain_hash` in Lightning messages.
12957  */
12958 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12959
12960 /**
12961  * The network for determining the `chain_hash` in Lightning messages.
12962  */
12963 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12964
12965 /**
12966  * The hash and height of the latest block successfully connected.
12967  *
12968  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12969  */
12970 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12971
12972 /**
12973  * The hash and height of the latest block successfully connected.
12974  *
12975  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12976  */
12977 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12978
12979 /**
12980  * Constructs a new ChainParameters given each field
12981  */
12982 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12983
12984 /**
12985  * Creates a copy of the ChainParameters
12986  */
12987 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
12988
12989 /**
12990  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12991  */
12992 void BestBlock_free(struct LDKBestBlock this_obj);
12993
12994 /**
12995  * Creates a copy of the BestBlock
12996  */
12997 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12998
12999 /**
13000  * Returns the best block from the genesis of the given network.
13001  */
13002 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
13003
13004 /**
13005  * Returns the best block as identified by the given block hash and height.
13006  */
13007 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
13008
13009 /**
13010  * Returns the best block hash.
13011  */
13012 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
13013
13014 /**
13015  * Returns the best block height.
13016  */
13017 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
13018
13019 /**
13020  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
13021  */
13022 void ChannelDetails_free(struct LDKChannelDetails this_obj);
13023
13024 /**
13025  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13026  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13027  * Note that this means this value is *not* persistent - it can change once during the
13028  * lifetime of the channel.
13029  */
13030 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
13031
13032 /**
13033  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13034  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13035  * Note that this means this value is *not* persistent - it can change once during the
13036  * lifetime of the channel.
13037  */
13038 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13039
13040 /**
13041  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13042  * our counterparty already.
13043  *
13044  * Note that, if this has been set, `channel_id` will be equivalent to
13045  * `funding_txo.unwrap().to_channel_id()`.
13046  */
13047 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13048
13049 /**
13050  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13051  * our counterparty already.
13052  *
13053  * Note that, if this has been set, `channel_id` will be equivalent to
13054  * `funding_txo.unwrap().to_channel_id()`.
13055  */
13056 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13057
13058 /**
13059  * The position of the funding transaction in the chain. None if the funding transaction has
13060  * not yet been confirmed and the channel fully opened.
13061  */
13062 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13063
13064 /**
13065  * The position of the funding transaction in the chain. None if the funding transaction has
13066  * not yet been confirmed and the channel fully opened.
13067  */
13068 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
13069
13070 /**
13071  * The node_id of our counterparty
13072  */
13073 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13074
13075 /**
13076  * The node_id of our counterparty
13077  */
13078 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13079
13080 /**
13081  * The Features the channel counterparty provided upon last connection.
13082  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13083  * many routing-relevant features are present in the init context.
13084  */
13085 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13086
13087 /**
13088  * The Features the channel counterparty provided upon last connection.
13089  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13090  * many routing-relevant features are present in the init context.
13091  */
13092 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13093
13094 /**
13095  * The value, in satoshis, of this channel as appears in the funding output
13096  */
13097 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13098
13099 /**
13100  * The value, in satoshis, of this channel as appears in the funding output
13101  */
13102 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13103
13104 /**
13105  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13106  */
13107 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13108
13109 /**
13110  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13111  */
13112 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13113
13114 /**
13115  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13116  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13117  * available for inclusion in new outbound HTLCs). This further does not include any pending
13118  * outgoing HTLCs which are awaiting some other resolution to be sent.
13119  */
13120 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13121
13122 /**
13123  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13124  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13125  * available for inclusion in new outbound HTLCs). This further does not include any pending
13126  * outgoing HTLCs which are awaiting some other resolution to be sent.
13127  */
13128 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13129
13130 /**
13131  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13132  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13133  * available for inclusion in new inbound HTLCs).
13134  * Note that there are some corner cases not fully handled here, so the actual available
13135  * inbound capacity may be slightly higher than this.
13136  */
13137 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13138
13139 /**
13140  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13141  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13142  * available for inclusion in new inbound HTLCs).
13143  * Note that there are some corner cases not fully handled here, so the actual available
13144  * inbound capacity may be slightly higher than this.
13145  */
13146 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13147
13148 /**
13149  * True if the channel was initiated (and thus funded) by us.
13150  */
13151 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13152
13153 /**
13154  * True if the channel was initiated (and thus funded) by us.
13155  */
13156 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13157
13158 /**
13159  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13160  * channel is not currently being shut down. `funding_locked` message exchange implies the
13161  * required confirmation count has been reached (and we were connected to the peer at some
13162  * point after the funding transaction received enough confirmations).
13163  */
13164 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13165
13166 /**
13167  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13168  * channel is not currently being shut down. `funding_locked` message exchange implies the
13169  * required confirmation count has been reached (and we were connected to the peer at some
13170  * point after the funding transaction received enough confirmations).
13171  */
13172 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13173
13174 /**
13175  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13176  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13177  * channel is not currently negotiating a shutdown.
13178  *
13179  * This is a strict superset of `is_funding_locked`.
13180  */
13181 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13182
13183 /**
13184  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13185  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13186  * channel is not currently negotiating a shutdown.
13187  *
13188  * This is a strict superset of `is_funding_locked`.
13189  */
13190 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13191
13192 /**
13193  * True if this channel is (or will be) publicly-announced.
13194  */
13195 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13196
13197 /**
13198  * True if this channel is (or will be) publicly-announced.
13199  */
13200 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13201
13202 /**
13203  * Creates a copy of the ChannelDetails
13204  */
13205 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
13206
13207 /**
13208  * Frees any resources used by the PaymentSendFailure
13209  */
13210 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
13211
13212 /**
13213  * Creates a copy of the PaymentSendFailure
13214  */
13215 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
13216
13217 /**
13218  * Constructs a new ChannelManager to hold several channels and route between them.
13219  *
13220  * This is the main \"logic hub\" for all channel-related actions, and implements
13221  * ChannelMessageHandler.
13222  *
13223  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
13224  *
13225  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
13226  *
13227  * Users need to notify the new ChannelManager when a new block is connected or
13228  * disconnected using its `block_connected` and `block_disconnected` methods, starting
13229  * from after `params.latest_hash`.
13230  */
13231 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);
13232
13233 /**
13234  * Gets the current configuration applied to all new channels,  as
13235  */
13236 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
13237
13238 /**
13239  * Creates a new outbound channel to the given remote node and with the given value.
13240  *
13241  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
13242  * tracking of which events correspond with which create_channel call. Note that the
13243  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
13244  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
13245  * otherwise ignored.
13246  *
13247  * If successful, will generate a SendOpenChannel message event, so you should probably poll
13248  * PeerManager::process_events afterwards.
13249  *
13250  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
13251  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
13252  */
13253 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);
13254
13255 /**
13256  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
13257  * more information.
13258  */
13259 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13260
13261 /**
13262  * Gets the list of usable channels, in random order. Useful as an argument to
13263  * get_route to ensure non-announced channels are used.
13264  *
13265  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
13266  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
13267  * are.
13268  */
13269 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13270
13271 /**
13272  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
13273  * will be accepted on the given channel, and after additional timeout/the closing of all
13274  * pending HTLCs, the channel will be closed on chain.
13275  *
13276  * May generate a SendShutdown message event on success, which should be relayed.
13277  */
13278 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13279
13280 /**
13281  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
13282  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
13283  */
13284 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13285
13286 /**
13287  * Force close all channels, immediately broadcasting the latest local commitment transaction
13288  * for each to the chain and rejecting new HTLCs on each.
13289  */
13290 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13291
13292 /**
13293  * Sends a payment along a given route.
13294  *
13295  * Value parameters are provided via the last hop in route, see documentation for RouteHop
13296  * fields for more info.
13297  *
13298  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
13299  * payment), we don't do anything to stop you! We always try to ensure that if the provided
13300  * next hop knows the preimage to payment_hash they can claim an additional amount as
13301  * specified in the last hop in the route! Thus, you should probably do your own
13302  * payment_preimage tracking (which you should already be doing as they represent \"proof of
13303  * payment\") and prevent double-sends yourself.
13304  *
13305  * May generate SendHTLCs message(s) event on success, which should be relayed.
13306  *
13307  * Each path may have a different return value, and PaymentSendValue may return a Vec with
13308  * each entry matching the corresponding-index entry in the route paths, see
13309  * PaymentSendFailure for more info.
13310  *
13311  * In general, a path may raise:
13312  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
13313  *    node public key) is specified.
13314  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
13315  *    (including due to previous monitor update failure or new permanent monitor update
13316  *    failure).
13317  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
13318  *    relevant updates.
13319  *
13320  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
13321  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
13322  * different route unless you intend to pay twice!
13323  *
13324  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
13325  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
13326  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
13327  * must not contain multiple paths as multi-path payments require a recipient-provided
13328  * payment_secret.
13329  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
13330  * bit set (either as required or as available). If multiple paths are present in the Route,
13331  * we assume the invoice had the basic_mpp feature set.
13332  */
13333 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);
13334
13335 /**
13336  * Call this upon creation of a funding transaction for the given channel.
13337  *
13338  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
13339  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
13340  *
13341  * Panics if a funding transaction has already been provided for this channel.
13342  *
13343  * May panic if the output found in the funding transaction is duplicative with some other
13344  * channel (note that this should be trivially prevented by using unique funding transaction
13345  * keys per-channel).
13346  *
13347  * Do NOT broadcast the funding transaction yourself. When we have safely received our
13348  * counterparty's signature the funding transaction will automatically be broadcast via the
13349  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
13350  *
13351  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13352  * not currently support replacing a funding transaction on an existing channel. Instead,
13353  * create a new channel with a conflicting funding transaction.
13354  *
13355  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13356  */
13357 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);
13358
13359 /**
13360  * Regenerates channel_announcements and generates a signed node_announcement from the given
13361  * arguments, providing them in corresponding events via
13362  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13363  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13364  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13365  * our network addresses.
13366  *
13367  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13368  * node to humans. They carry no in-protocol meaning.
13369  *
13370  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13371  * accepts incoming connections. These will be included in the node_announcement, publicly
13372  * tying these addresses together and to this node. If you wish to preserve user privacy,
13373  * addresses should likely contain only Tor Onion addresses.
13374  *
13375  * Panics if `addresses` is absurdly large (more than 500).
13376  *
13377  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13378  */
13379 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13380
13381 /**
13382  * Processes HTLCs which are pending waiting on random forward delay.
13383  *
13384  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13385  * Will likely generate further events.
13386  */
13387 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13388
13389 /**
13390  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13391  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13392  * to inform the network about the uselessness of these channels.
13393  *
13394  * This method handles all the details, and must be called roughly once per minute.
13395  *
13396  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13397  */
13398 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13399
13400 /**
13401  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13402  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13403  * along the path (including in our own channel on which we received it).
13404  * Returns false if no payment was found to fail backwards, true if the process of failing the
13405  * HTLC backwards has been started.
13406  */
13407 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13408
13409 /**
13410  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13411  * generating message events for the net layer to claim the payment, if possible. Thus, you
13412  * should probably kick the net layer to go send messages if this returns true!
13413  *
13414  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13415  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13416  * event matches your expectation. If you fail to do so and call this method, you may provide
13417  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13418  *
13419  * May panic if called except in response to a PaymentReceived event.
13420  *
13421  * [`create_inbound_payment`]: Self::create_inbound_payment
13422  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13423  */
13424 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13425
13426 /**
13427  * Gets the node_id held by this ChannelManager
13428  */
13429 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13430
13431 /**
13432  * Restores a single, given channel to normal operation after a
13433  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13434  * operation.
13435  *
13436  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13437  * fully committed in every copy of the given channels' ChannelMonitors.
13438  *
13439  * Note that there is no effect to calling with a highest_applied_update_id other than the
13440  * current latest ChannelMonitorUpdate and one call to this function after multiple
13441  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13442  * exists largely only to prevent races between this and concurrent update_monitor calls.
13443  *
13444  * Thus, the anticipated use is, at a high level:
13445  *  1) You register a chain::Watch with this ChannelManager,
13446  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13447  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13448  *     any time it cannot do so instantly,
13449  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13450  *  4) once all remote copies are updated, you call this function with the update_id that
13451  *     completed, and once it is the latest the Channel will be re-enabled.
13452  */
13453 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);
13454
13455 /**
13456  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13457  * to pay us.
13458  *
13459  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13460  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13461  *
13462  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13463  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13464  * passed directly to [`claim_funds`].
13465  *
13466  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13467  *
13468  * [`claim_funds`]: Self::claim_funds
13469  * [`PaymentReceived`]: events::Event::PaymentReceived
13470  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13471  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13472  */
13473 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);
13474
13475 /**
13476  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13477  * stored external to LDK.
13478  *
13479  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13480  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13481  * the `min_value_msat` provided here, if one is provided.
13482  *
13483  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13484  * method may return an Err if another payment with the same payment_hash is still pending.
13485  *
13486  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
13487  * allow tracking of which events correspond with which calls to this and
13488  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13489  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13490  * with invoice metadata stored elsewhere.
13491  *
13492  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13493  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13494  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13495  * sender \"proof-of-payment\" unless they have paid the required amount.
13496  *
13497  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13498  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13499  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13500  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13501  * invoices when no timeout is set.
13502  *
13503  * Note that we use block header time to time-out pending inbound payments (with some margin
13504  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13505  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13506  * If you need exact expiry semantics, you should enforce them upon receipt of
13507  * [`PaymentReceived`].
13508  *
13509  * Pending inbound payments are stored in memory and in serialized versions of this
13510  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13511  * space is limited, you may wish to rate-limit inbound payment creation.
13512  *
13513  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13514  *
13515  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13516  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13517  *
13518  * [`create_inbound_payment`]: Self::create_inbound_payment
13519  * [`PaymentReceived`]: events::Event::PaymentReceived
13520  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
13521  */
13522 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);
13523
13524 /**
13525  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13526  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13527  */
13528 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13529
13530 /**
13531  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13532  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13533  */
13534 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13535
13536 /**
13537  * Constructs a new Listen which calls the relevant methods on this_arg.
13538  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13539  */
13540 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13541
13542 /**
13543  * Constructs a new Confirm which calls the relevant methods on this_arg.
13544  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13545  */
13546 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13547
13548 /**
13549  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13550  * indicating whether persistence is necessary. Only one listener on
13551  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13552  * up.
13553  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13554  */
13555 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13556
13557 /**
13558  * Blocks until ChannelManager needs to be persisted. Only one listener on
13559  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13560  * up.
13561  */
13562 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13563
13564 /**
13565  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13566  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13567  */
13568 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13569
13570 /**
13571  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13572  */
13573 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13574
13575 /**
13576  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13577  */
13578 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13579
13580 /**
13581  * The keys provider which will give us relevant keys. Some keys will be loaded during
13582  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13583  * signing data.
13584  */
13585 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13586
13587 /**
13588  * The keys provider which will give us relevant keys. Some keys will be loaded during
13589  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13590  * signing data.
13591  */
13592 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13593
13594 /**
13595  * The fee_estimator for use in the ChannelManager in the future.
13596  *
13597  * No calls to the FeeEstimator will be made during deserialization.
13598  */
13599 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13600
13601 /**
13602  * The fee_estimator for use in the ChannelManager in the future.
13603  *
13604  * No calls to the FeeEstimator will be made during deserialization.
13605  */
13606 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13607
13608 /**
13609  * The chain::Watch for use in the ChannelManager in the future.
13610  *
13611  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13612  * you have deserialized ChannelMonitors separately and will add them to your
13613  * chain::Watch after deserializing this ChannelManager.
13614  */
13615 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13616
13617 /**
13618  * The chain::Watch for use in the ChannelManager in the future.
13619  *
13620  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13621  * you have deserialized ChannelMonitors separately and will add them to your
13622  * chain::Watch after deserializing this ChannelManager.
13623  */
13624 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13625
13626 /**
13627  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13628  * used to broadcast the latest local commitment transactions of channels which must be
13629  * force-closed during deserialization.
13630  */
13631 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13632
13633 /**
13634  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13635  * used to broadcast the latest local commitment transactions of channels which must be
13636  * force-closed during deserialization.
13637  */
13638 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13639
13640 /**
13641  * The Logger for use in the ChannelManager and which may be used to log information during
13642  * deserialization.
13643  */
13644 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13645
13646 /**
13647  * The Logger for use in the ChannelManager and which may be used to log information during
13648  * deserialization.
13649  */
13650 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13651
13652 /**
13653  * Default settings used for new channels. Any existing channels will continue to use the
13654  * runtime settings which were stored when the ChannelManager was serialized.
13655  */
13656 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13657
13658 /**
13659  * Default settings used for new channels. Any existing channels will continue to use the
13660  * runtime settings which were stored when the ChannelManager was serialized.
13661  */
13662 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13663
13664 /**
13665  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13666  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13667  * populate a HashMap directly from C.
13668  */
13669 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);
13670
13671 /**
13672  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13673  */
13674 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13675
13676 /**
13677  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13678  */
13679 void DecodeError_free(struct LDKDecodeError this_obj);
13680
13681 /**
13682  * Creates a copy of the DecodeError
13683  */
13684 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13685
13686 /**
13687  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13688  */
13689 void Init_free(struct LDKInit this_obj);
13690
13691 /**
13692  * The relevant features which the sender supports
13693  */
13694 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13695
13696 /**
13697  * The relevant features which the sender supports
13698  */
13699 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13700
13701 /**
13702  * Constructs a new Init given each field
13703  */
13704 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13705
13706 /**
13707  * Creates a copy of the Init
13708  */
13709 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13710
13711 /**
13712  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13713  */
13714 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13715
13716 /**
13717  * The channel ID involved in the error
13718  */
13719 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13720
13721 /**
13722  * The channel ID involved in the error
13723  */
13724 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13725
13726 /**
13727  * A possibly human-readable error description.
13728  * The string should be sanitized before it is used (e.g. emitted to logs
13729  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13730  * vulnerability in the terminal emulator or the logging subsystem.
13731  */
13732 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13733
13734 /**
13735  * A possibly human-readable error description.
13736  * The string should be sanitized before it is used (e.g. emitted to logs
13737  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13738  * vulnerability in the terminal emulator or the logging subsystem.
13739  */
13740 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13741
13742 /**
13743  * Constructs a new ErrorMessage given each field
13744  */
13745 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13746
13747 /**
13748  * Creates a copy of the ErrorMessage
13749  */
13750 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13751
13752 /**
13753  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13754  */
13755 void Ping_free(struct LDKPing this_obj);
13756
13757 /**
13758  * The desired response length
13759  */
13760 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13761
13762 /**
13763  * The desired response length
13764  */
13765 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13766
13767 /**
13768  * The ping packet size.
13769  * This field is not sent on the wire. byteslen zeros are sent.
13770  */
13771 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13772
13773 /**
13774  * The ping packet size.
13775  * This field is not sent on the wire. byteslen zeros are sent.
13776  */
13777 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13778
13779 /**
13780  * Constructs a new Ping given each field
13781  */
13782 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13783
13784 /**
13785  * Creates a copy of the Ping
13786  */
13787 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13788
13789 /**
13790  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13791  */
13792 void Pong_free(struct LDKPong this_obj);
13793
13794 /**
13795  * The pong packet size.
13796  * This field is not sent on the wire. byteslen zeros are sent.
13797  */
13798 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13799
13800 /**
13801  * The pong packet size.
13802  * This field is not sent on the wire. byteslen zeros are sent.
13803  */
13804 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13805
13806 /**
13807  * Constructs a new Pong given each field
13808  */
13809 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13810
13811 /**
13812  * Creates a copy of the Pong
13813  */
13814 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13815
13816 /**
13817  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13818  */
13819 void OpenChannel_free(struct LDKOpenChannel this_obj);
13820
13821 /**
13822  * The genesis hash of the blockchain where the channel is to be opened
13823  */
13824 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13825
13826 /**
13827  * The genesis hash of the blockchain where the channel is to be opened
13828  */
13829 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13830
13831 /**
13832  * A temporary channel ID, until the funding outpoint is announced
13833  */
13834 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13835
13836 /**
13837  * A temporary channel ID, until the funding outpoint is announced
13838  */
13839 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13840
13841 /**
13842  * The channel value
13843  */
13844 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13845
13846 /**
13847  * The channel value
13848  */
13849 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13850
13851 /**
13852  * The amount to push to the counterparty as part of the open, in milli-satoshi
13853  */
13854 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13855
13856 /**
13857  * The amount to push to the counterparty as part of the open, in milli-satoshi
13858  */
13859 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13860
13861 /**
13862  * The threshold below which outputs on transactions broadcast by sender will be omitted
13863  */
13864 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13865
13866 /**
13867  * The threshold below which outputs on transactions broadcast by sender will be omitted
13868  */
13869 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13870
13871 /**
13872  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13873  */
13874 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13875
13876 /**
13877  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13878  */
13879 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13880
13881 /**
13882  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13883  */
13884 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13885
13886 /**
13887  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13888  */
13889 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13890
13891 /**
13892  * The minimum HTLC size incoming to sender, in milli-satoshi
13893  */
13894 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13895
13896 /**
13897  * The minimum HTLC size incoming to sender, in milli-satoshi
13898  */
13899 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13900
13901 /**
13902  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13903  */
13904 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13905
13906 /**
13907  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13908  */
13909 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13910
13911 /**
13912  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13913  */
13914 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13915
13916 /**
13917  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13918  */
13919 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13920
13921 /**
13922  * The maximum number of inbound HTLCs towards sender
13923  */
13924 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13925
13926 /**
13927  * The maximum number of inbound HTLCs towards sender
13928  */
13929 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13930
13931 /**
13932  * The sender's key controlling the funding transaction
13933  */
13934 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13935
13936 /**
13937  * The sender's key controlling the funding transaction
13938  */
13939 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13940
13941 /**
13942  * Used to derive a revocation key for transactions broadcast by counterparty
13943  */
13944 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13945
13946 /**
13947  * Used to derive a revocation key for transactions broadcast by counterparty
13948  */
13949 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13950
13951 /**
13952  * A payment key to sender for transactions broadcast by counterparty
13953  */
13954 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13955
13956 /**
13957  * A payment key to sender for transactions broadcast by counterparty
13958  */
13959 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13960
13961 /**
13962  * Used to derive a payment key to sender for transactions broadcast by sender
13963  */
13964 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13965
13966 /**
13967  * Used to derive a payment key to sender for transactions broadcast by sender
13968  */
13969 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13970
13971 /**
13972  * Used to derive an HTLC payment key to sender
13973  */
13974 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13975
13976 /**
13977  * Used to derive an HTLC payment key to sender
13978  */
13979 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13980
13981 /**
13982  * The first to-be-broadcast-by-sender transaction's per commitment point
13983  */
13984 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13985
13986 /**
13987  * The first to-be-broadcast-by-sender transaction's per commitment point
13988  */
13989 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13990
13991 /**
13992  * Channel flags
13993  */
13994 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13995
13996 /**
13997  * Channel flags
13998  */
13999 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
14000
14001 /**
14002  * Creates a copy of the OpenChannel
14003  */
14004 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
14005
14006 /**
14007  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
14008  */
14009 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
14010
14011 /**
14012  * A temporary channel ID, until the funding outpoint is announced
14013  */
14014 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
14015
14016 /**
14017  * A temporary channel ID, until the funding outpoint is announced
14018  */
14019 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14020
14021 /**
14022  * The threshold below which outputs on transactions broadcast by sender will be omitted
14023  */
14024 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * The threshold below which outputs on transactions broadcast by sender will be omitted
14028  */
14029 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14030
14031 /**
14032  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14033  */
14034 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14035
14036 /**
14037  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14038  */
14039 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14040
14041 /**
14042  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14043  */
14044 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14045
14046 /**
14047  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14048  */
14049 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14050
14051 /**
14052  * The minimum HTLC size incoming to sender, in milli-satoshi
14053  */
14054 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14055
14056 /**
14057  * The minimum HTLC size incoming to sender, in milli-satoshi
14058  */
14059 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14060
14061 /**
14062  * Minimum depth of the funding transaction before the channel is considered open
14063  */
14064 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14065
14066 /**
14067  * Minimum depth of the funding transaction before the channel is considered open
14068  */
14069 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
14070
14071 /**
14072  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14073  */
14074 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14075
14076 /**
14077  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14078  */
14079 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14080
14081 /**
14082  * The maximum number of inbound HTLCs towards sender
14083  */
14084 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14085
14086 /**
14087  * The maximum number of inbound HTLCs towards sender
14088  */
14089 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14090
14091 /**
14092  * The sender's key controlling the funding transaction
14093  */
14094 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14095
14096 /**
14097  * The sender's key controlling the funding transaction
14098  */
14099 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14100
14101 /**
14102  * Used to derive a revocation key for transactions broadcast by counterparty
14103  */
14104 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14105
14106 /**
14107  * Used to derive a revocation key for transactions broadcast by counterparty
14108  */
14109 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14110
14111 /**
14112  * A payment key to sender for transactions broadcast by counterparty
14113  */
14114 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14115
14116 /**
14117  * A payment key to sender for transactions broadcast by counterparty
14118  */
14119 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14120
14121 /**
14122  * Used to derive a payment key to sender for transactions broadcast by sender
14123  */
14124 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14125
14126 /**
14127  * Used to derive a payment key to sender for transactions broadcast by sender
14128  */
14129 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14130
14131 /**
14132  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14133  */
14134 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14135
14136 /**
14137  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14138  */
14139 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14140
14141 /**
14142  * The first to-be-broadcast-by-sender transaction's per commitment point
14143  */
14144 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14145
14146 /**
14147  * The first to-be-broadcast-by-sender transaction's per commitment point
14148  */
14149 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14150
14151 /**
14152  * Creates a copy of the AcceptChannel
14153  */
14154 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
14155
14156 /**
14157  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
14158  */
14159 void FundingCreated_free(struct LDKFundingCreated this_obj);
14160
14161 /**
14162  * A temporary channel ID, until the funding is established
14163  */
14164 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14165
14166 /**
14167  * A temporary channel ID, until the funding is established
14168  */
14169 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14170
14171 /**
14172  * The funding transaction ID
14173  */
14174 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14175
14176 /**
14177  * The funding transaction ID
14178  */
14179 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14180
14181 /**
14182  * The specific output index funding this channel
14183  */
14184 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14185
14186 /**
14187  * The specific output index funding this channel
14188  */
14189 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
14190
14191 /**
14192  * The signature of the channel initiator (funder) on the funding transaction
14193  */
14194 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14195
14196 /**
14197  * The signature of the channel initiator (funder) on the funding transaction
14198  */
14199 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
14200
14201 /**
14202  * Constructs a new FundingCreated given each field
14203  */
14204 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);
14205
14206 /**
14207  * Creates a copy of the FundingCreated
14208  */
14209 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
14210
14211 /**
14212  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
14213  */
14214 void FundingSigned_free(struct LDKFundingSigned this_obj);
14215
14216 /**
14217  * The channel ID
14218  */
14219 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
14220
14221 /**
14222  * The channel ID
14223  */
14224 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14225
14226 /**
14227  * The signature of the channel acceptor (fundee) on the funding transaction
14228  */
14229 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
14230
14231 /**
14232  * The signature of the channel acceptor (fundee) on the funding transaction
14233  */
14234 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14235
14236 /**
14237  * Constructs a new FundingSigned given each field
14238  */
14239 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
14240
14241 /**
14242  * Creates a copy of the FundingSigned
14243  */
14244 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
14245
14246 /**
14247  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
14248  */
14249 void FundingLocked_free(struct LDKFundingLocked this_obj);
14250
14251 /**
14252  * The channel ID
14253  */
14254 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
14255
14256 /**
14257  * The channel ID
14258  */
14259 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14260
14261 /**
14262  * The per-commitment point of the second commitment transaction
14263  */
14264 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
14265
14266 /**
14267  * The per-commitment point of the second commitment transaction
14268  */
14269 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14270
14271 /**
14272  * Constructs a new FundingLocked given each field
14273  */
14274 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
14275
14276 /**
14277  * Creates a copy of the FundingLocked
14278  */
14279 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
14280
14281 /**
14282  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
14283  */
14284 void Shutdown_free(struct LDKShutdown this_obj);
14285
14286 /**
14287  * The channel ID
14288  */
14289 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
14290
14291 /**
14292  * The channel ID
14293  */
14294 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14295
14296 /**
14297  * The destination of this peer's funds on closing.
14298  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14299  */
14300 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
14301
14302 /**
14303  * The destination of this peer's funds on closing.
14304  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14305  */
14306 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14307
14308 /**
14309  * Constructs a new Shutdown given each field
14310  */
14311 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
14312
14313 /**
14314  * Creates a copy of the Shutdown
14315  */
14316 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
14317
14318 /**
14319  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
14320  */
14321 void ClosingSigned_free(struct LDKClosingSigned this_obj);
14322
14323 /**
14324  * The channel ID
14325  */
14326 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
14327
14328 /**
14329  * The channel ID
14330  */
14331 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14332
14333 /**
14334  * The proposed total fee for the closing transaction
14335  */
14336 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14337
14338 /**
14339  * The proposed total fee for the closing transaction
14340  */
14341 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
14342
14343 /**
14344  * A signature on the closing transaction
14345  */
14346 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14347
14348 /**
14349  * A signature on the closing transaction
14350  */
14351 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14352
14353 /**
14354  * Constructs a new ClosingSigned given each field
14355  */
14356 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14357
14358 /**
14359  * Creates a copy of the ClosingSigned
14360  */
14361 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14362
14363 /**
14364  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14365  */
14366 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14367
14368 /**
14369  * The channel ID
14370  */
14371 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14372
14373 /**
14374  * The channel ID
14375  */
14376 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14377
14378 /**
14379  * The HTLC ID
14380  */
14381 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14382
14383 /**
14384  * The HTLC ID
14385  */
14386 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14387
14388 /**
14389  * The HTLC value in milli-satoshi
14390  */
14391 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14392
14393 /**
14394  * The HTLC value in milli-satoshi
14395  */
14396 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14397
14398 /**
14399  * The payment hash, the pre-image of which controls HTLC redemption
14400  */
14401 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14402
14403 /**
14404  * The payment hash, the pre-image of which controls HTLC redemption
14405  */
14406 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14407
14408 /**
14409  * The expiry height of the HTLC
14410  */
14411 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14412
14413 /**
14414  * The expiry height of the HTLC
14415  */
14416 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14417
14418 /**
14419  * Creates a copy of the UpdateAddHTLC
14420  */
14421 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14422
14423 /**
14424  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14425  */
14426 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14427
14428 /**
14429  * The channel ID
14430  */
14431 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14432
14433 /**
14434  * The channel ID
14435  */
14436 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14437
14438 /**
14439  * The HTLC ID
14440  */
14441 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14442
14443 /**
14444  * The HTLC ID
14445  */
14446 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14447
14448 /**
14449  * The pre-image of the payment hash, allowing HTLC redemption
14450  */
14451 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14452
14453 /**
14454  * The pre-image of the payment hash, allowing HTLC redemption
14455  */
14456 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14457
14458 /**
14459  * Constructs a new UpdateFulfillHTLC given each field
14460  */
14461 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14462
14463 /**
14464  * Creates a copy of the UpdateFulfillHTLC
14465  */
14466 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14467
14468 /**
14469  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14470  */
14471 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14472
14473 /**
14474  * The channel ID
14475  */
14476 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14477
14478 /**
14479  * The channel ID
14480  */
14481 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14482
14483 /**
14484  * The HTLC ID
14485  */
14486 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14487
14488 /**
14489  * The HTLC ID
14490  */
14491 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14492
14493 /**
14494  * Creates a copy of the UpdateFailHTLC
14495  */
14496 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14497
14498 /**
14499  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14500  */
14501 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14502
14503 /**
14504  * The channel ID
14505  */
14506 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14507
14508 /**
14509  * The channel ID
14510  */
14511 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14512
14513 /**
14514  * The HTLC ID
14515  */
14516 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14517
14518 /**
14519  * The HTLC ID
14520  */
14521 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14522
14523 /**
14524  * The failure code
14525  */
14526 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14527
14528 /**
14529  * The failure code
14530  */
14531 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14532
14533 /**
14534  * Creates a copy of the UpdateFailMalformedHTLC
14535  */
14536 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14537
14538 /**
14539  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14540  */
14541 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14542
14543 /**
14544  * The channel ID
14545  */
14546 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14547
14548 /**
14549  * The channel ID
14550  */
14551 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14552
14553 /**
14554  * A signature on the commitment transaction
14555  */
14556 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14557
14558 /**
14559  * A signature on the commitment transaction
14560  */
14561 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14562
14563 /**
14564  * Signatures on the HTLC transactions
14565  */
14566 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14567
14568 /**
14569  * Constructs a new CommitmentSigned given each field
14570  */
14571 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14572
14573 /**
14574  * Creates a copy of the CommitmentSigned
14575  */
14576 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14577
14578 /**
14579  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14580  */
14581 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14582
14583 /**
14584  * The channel ID
14585  */
14586 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14587
14588 /**
14589  * The channel ID
14590  */
14591 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14592
14593 /**
14594  * The secret corresponding to the per-commitment point
14595  */
14596 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14597
14598 /**
14599  * The secret corresponding to the per-commitment point
14600  */
14601 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14602
14603 /**
14604  * The next sender-broadcast commitment transaction's per-commitment point
14605  */
14606 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14607
14608 /**
14609  * The next sender-broadcast commitment transaction's per-commitment point
14610  */
14611 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14612
14613 /**
14614  * Constructs a new RevokeAndACK given each field
14615  */
14616 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);
14617
14618 /**
14619  * Creates a copy of the RevokeAndACK
14620  */
14621 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14622
14623 /**
14624  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14625  */
14626 void UpdateFee_free(struct LDKUpdateFee this_obj);
14627
14628 /**
14629  * The channel ID
14630  */
14631 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14632
14633 /**
14634  * The channel ID
14635  */
14636 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14637
14638 /**
14639  * Fee rate per 1000-weight of the transaction
14640  */
14641 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14642
14643 /**
14644  * Fee rate per 1000-weight of the transaction
14645  */
14646 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14647
14648 /**
14649  * Constructs a new UpdateFee given each field
14650  */
14651 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14652
14653 /**
14654  * Creates a copy of the UpdateFee
14655  */
14656 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14657
14658 /**
14659  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14660  */
14661 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14662
14663 /**
14664  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14665  * belonging to the recipient
14666  */
14667 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14668
14669 /**
14670  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14671  * belonging to the recipient
14672  */
14673 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14674
14675 /**
14676  * The sender's per-commitment point for their current commitment transaction
14677  */
14678 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14679
14680 /**
14681  * The sender's per-commitment point for their current commitment transaction
14682  */
14683 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14684
14685 /**
14686  * Constructs a new DataLossProtect given each field
14687  */
14688 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14689
14690 /**
14691  * Creates a copy of the DataLossProtect
14692  */
14693 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14694
14695 /**
14696  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14697  */
14698 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14699
14700 /**
14701  * The channel ID
14702  */
14703 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14704
14705 /**
14706  * The channel ID
14707  */
14708 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14709
14710 /**
14711  * The next commitment number for the sender
14712  */
14713 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14714
14715 /**
14716  * The next commitment number for the sender
14717  */
14718 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14719
14720 /**
14721  * The next commitment number for the recipient
14722  */
14723 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14724
14725 /**
14726  * The next commitment number for the recipient
14727  */
14728 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14729
14730 /**
14731  * Creates a copy of the ChannelReestablish
14732  */
14733 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14734
14735 /**
14736  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14737  */
14738 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14739
14740 /**
14741  * The channel ID
14742  */
14743 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14744
14745 /**
14746  * The channel ID
14747  */
14748 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14749
14750 /**
14751  * The short channel ID
14752  */
14753 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14754
14755 /**
14756  * The short channel ID
14757  */
14758 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14759
14760 /**
14761  * A signature by the node key
14762  */
14763 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14764
14765 /**
14766  * A signature by the node key
14767  */
14768 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14769
14770 /**
14771  * A signature by the funding key
14772  */
14773 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14774
14775 /**
14776  * A signature by the funding key
14777  */
14778 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14779
14780 /**
14781  * Constructs a new AnnouncementSignatures given each field
14782  */
14783 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);
14784
14785 /**
14786  * Creates a copy of the AnnouncementSignatures
14787  */
14788 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14789
14790 /**
14791  * Frees any resources used by the NetAddress
14792  */
14793 void NetAddress_free(struct LDKNetAddress this_ptr);
14794
14795 /**
14796  * Creates a copy of the NetAddress
14797  */
14798 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14799
14800 /**
14801  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14802  */
14803 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14804
14805 /**
14806  * Read a Result from a byte array, created by Result_write
14807  */
14808 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14809
14810 /**
14811  * Read a NetAddress from a byte array, created by NetAddress_write
14812  */
14813 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
14814
14815 /**
14816  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14817  */
14818 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14819
14820 /**
14821  * The advertised features
14822  */
14823 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14824
14825 /**
14826  * The advertised features
14827  */
14828 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14829
14830 /**
14831  * A strictly monotonic announcement counter, with gaps allowed
14832  */
14833 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14834
14835 /**
14836  * A strictly monotonic announcement counter, with gaps allowed
14837  */
14838 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14839
14840 /**
14841  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14842  * to this node).
14843  */
14844 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14845
14846 /**
14847  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14848  * to this node).
14849  */
14850 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14851
14852 /**
14853  * An RGB color for UI purposes
14854  */
14855 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14856
14857 /**
14858  * An RGB color for UI purposes
14859  */
14860 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14861
14862 /**
14863  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14864  * of uniqueness.
14865  */
14866 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14867
14868 /**
14869  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14870  * of uniqueness.
14871  */
14872 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14873
14874 /**
14875  * List of addresses on which this node is reachable
14876  */
14877 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14878
14879 /**
14880  * Creates a copy of the UnsignedNodeAnnouncement
14881  */
14882 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14883
14884 /**
14885  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14886  */
14887 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14888
14889 /**
14890  * The signature by the node key
14891  */
14892 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14893
14894 /**
14895  * The signature by the node key
14896  */
14897 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14898
14899 /**
14900  * The actual content of the announcement
14901  */
14902 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14903
14904 /**
14905  * The actual content of the announcement
14906  */
14907 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14908
14909 /**
14910  * Constructs a new NodeAnnouncement given each field
14911  */
14912 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14913
14914 /**
14915  * Creates a copy of the NodeAnnouncement
14916  */
14917 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14918
14919 /**
14920  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14921  */
14922 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14923
14924 /**
14925  * The advertised channel features
14926  */
14927 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14928
14929 /**
14930  * The advertised channel features
14931  */
14932 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14933
14934 /**
14935  * The genesis hash of the blockchain where the channel is to be opened
14936  */
14937 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14938
14939 /**
14940  * The genesis hash of the blockchain where the channel is to be opened
14941  */
14942 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14943
14944 /**
14945  * The short channel ID
14946  */
14947 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14948
14949 /**
14950  * The short channel ID
14951  */
14952 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14953
14954 /**
14955  * One of the two node_ids which are endpoints of this channel
14956  */
14957 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14958
14959 /**
14960  * One of the two node_ids which are endpoints of this channel
14961  */
14962 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14963
14964 /**
14965  * The other of the two node_ids which are endpoints of this channel
14966  */
14967 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14968
14969 /**
14970  * The other of the two node_ids which are endpoints of this channel
14971  */
14972 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14973
14974 /**
14975  * The funding key for the first node
14976  */
14977 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14978
14979 /**
14980  * The funding key for the first node
14981  */
14982 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14983
14984 /**
14985  * The funding key for the second node
14986  */
14987 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14988
14989 /**
14990  * The funding key for the second node
14991  */
14992 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14993
14994 /**
14995  * Creates a copy of the UnsignedChannelAnnouncement
14996  */
14997 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14998
14999 /**
15000  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
15001  */
15002 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
15003
15004 /**
15005  * Authentication of the announcement by the first public node
15006  */
15007 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15008
15009 /**
15010  * Authentication of the announcement by the first public node
15011  */
15012 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15013
15014 /**
15015  * Authentication of the announcement by the second public node
15016  */
15017 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15018
15019 /**
15020  * Authentication of the announcement by the second public node
15021  */
15022 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15023
15024 /**
15025  * Proof of funding UTXO ownership by the first public node
15026  */
15027 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15028
15029 /**
15030  * Proof of funding UTXO ownership by the first public node
15031  */
15032 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15033
15034 /**
15035  * Proof of funding UTXO ownership by the second public node
15036  */
15037 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15038
15039 /**
15040  * Proof of funding UTXO ownership by the second public node
15041  */
15042 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15043
15044 /**
15045  * The actual announcement
15046  */
15047 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15048
15049 /**
15050  * The actual announcement
15051  */
15052 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
15053
15054 /**
15055  * Constructs a new ChannelAnnouncement given each field
15056  */
15057 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);
15058
15059 /**
15060  * Creates a copy of the ChannelAnnouncement
15061  */
15062 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
15063
15064 /**
15065  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
15066  */
15067 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
15068
15069 /**
15070  * The genesis hash of the blockchain where the channel is to be opened
15071  */
15072 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
15073
15074 /**
15075  * The genesis hash of the blockchain where the channel is to be opened
15076  */
15077 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15078
15079 /**
15080  * The short channel ID
15081  */
15082 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15083
15084 /**
15085  * The short channel ID
15086  */
15087 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15088
15089 /**
15090  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15091  */
15092 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15093
15094 /**
15095  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15096  */
15097 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15098
15099 /**
15100  * Channel flags
15101  */
15102 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15103
15104 /**
15105  * Channel flags
15106  */
15107 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
15108
15109 /**
15110  * The number of blocks such that if:
15111  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15112  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15113  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15114  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15115  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15116  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15117  * constructing the route.
15118  */
15119 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15120
15121 /**
15122  * The number of blocks such that if:
15123  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15124  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15125  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15126  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15127  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15128  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15129  * constructing the route.
15130  */
15131 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
15132
15133 /**
15134  * The minimum HTLC size incoming to sender, in milli-satoshi
15135  */
15136 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15137
15138 /**
15139  * The minimum HTLC size incoming to sender, in milli-satoshi
15140  */
15141 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15142
15143 /**
15144  * The base HTLC fee charged by sender, in milli-satoshi
15145  */
15146 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15147
15148 /**
15149  * The base HTLC fee charged by sender, in milli-satoshi
15150  */
15151 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15152
15153 /**
15154  * The amount to fee multiplier, in micro-satoshi
15155  */
15156 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15157
15158 /**
15159  * The amount to fee multiplier, in micro-satoshi
15160  */
15161 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15162
15163 /**
15164  * Creates a copy of the UnsignedChannelUpdate
15165  */
15166 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
15167
15168 /**
15169  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
15170  */
15171 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
15172
15173 /**
15174  * A signature of the channel update
15175  */
15176 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15177
15178 /**
15179  * A signature of the channel update
15180  */
15181 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
15182
15183 /**
15184  * The actual channel update
15185  */
15186 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15187
15188 /**
15189  * The actual channel update
15190  */
15191 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
15192
15193 /**
15194  * Constructs a new ChannelUpdate given each field
15195  */
15196 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
15197
15198 /**
15199  * Creates a copy of the ChannelUpdate
15200  */
15201 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
15202
15203 /**
15204  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
15205  */
15206 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
15207
15208 /**
15209  * The genesis hash of the blockchain being queried
15210  */
15211 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
15212
15213 /**
15214  * The genesis hash of the blockchain being queried
15215  */
15216 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15217
15218 /**
15219  * The height of the first block for the channel UTXOs being queried
15220  */
15221 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15222
15223 /**
15224  * The height of the first block for the channel UTXOs being queried
15225  */
15226 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15227
15228 /**
15229  * The number of blocks to include in the query results
15230  */
15231 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15232
15233 /**
15234  * The number of blocks to include in the query results
15235  */
15236 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15237
15238 /**
15239  * Constructs a new QueryChannelRange given each field
15240  */
15241 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
15242
15243 /**
15244  * Creates a copy of the QueryChannelRange
15245  */
15246 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
15247
15248 /**
15249  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
15250  */
15251 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
15252
15253 /**
15254  * The genesis hash of the blockchain being queried
15255  */
15256 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
15257
15258 /**
15259  * The genesis hash of the blockchain being queried
15260  */
15261 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15262
15263 /**
15264  * The height of the first block in the range of the reply
15265  */
15266 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15267
15268 /**
15269  * The height of the first block in the range of the reply
15270  */
15271 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15272
15273 /**
15274  * The number of blocks included in the range of the reply
15275  */
15276 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15277
15278 /**
15279  * The number of blocks included in the range of the reply
15280  */
15281 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15282
15283 /**
15284  * True when this is the final reply for a query
15285  */
15286 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15287
15288 /**
15289  * True when this is the final reply for a query
15290  */
15291 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
15292
15293 /**
15294  * The short_channel_ids in the channel range
15295  */
15296 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15297
15298 /**
15299  * Constructs a new ReplyChannelRange given each field
15300  */
15301 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);
15302
15303 /**
15304  * Creates a copy of the ReplyChannelRange
15305  */
15306 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
15307
15308 /**
15309  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
15310  */
15311 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
15312
15313 /**
15314  * The genesis hash of the blockchain being queried
15315  */
15316 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
15317
15318 /**
15319  * The genesis hash of the blockchain being queried
15320  */
15321 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15322
15323 /**
15324  * The short_channel_ids that are being queried
15325  */
15326 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15327
15328 /**
15329  * Constructs a new QueryShortChannelIds given each field
15330  */
15331 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
15332
15333 /**
15334  * Creates a copy of the QueryShortChannelIds
15335  */
15336 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
15337
15338 /**
15339  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
15340  */
15341 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
15342
15343 /**
15344  * The genesis hash of the blockchain that was queried
15345  */
15346 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
15347
15348 /**
15349  * The genesis hash of the blockchain that was queried
15350  */
15351 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15352
15353 /**
15354  * Indicates if the query recipient maintains up-to-date channel
15355  * information for the chain_hash
15356  */
15357 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15358
15359 /**
15360  * Indicates if the query recipient maintains up-to-date channel
15361  * information for the chain_hash
15362  */
15363 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15364
15365 /**
15366  * Constructs a new ReplyShortChannelIdsEnd given each field
15367  */
15368 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15369
15370 /**
15371  * Creates a copy of the ReplyShortChannelIdsEnd
15372  */
15373 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15374
15375 /**
15376  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15377  */
15378 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15379
15380 /**
15381  * The genesis hash of the blockchain for channel and node information
15382  */
15383 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15384
15385 /**
15386  * The genesis hash of the blockchain for channel and node information
15387  */
15388 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15389
15390 /**
15391  * The starting unix timestamp
15392  */
15393 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15394
15395 /**
15396  * The starting unix timestamp
15397  */
15398 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15399
15400 /**
15401  * The range of information in seconds
15402  */
15403 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15404
15405 /**
15406  * The range of information in seconds
15407  */
15408 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15409
15410 /**
15411  * Constructs a new GossipTimestampFilter given each field
15412  */
15413 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15414
15415 /**
15416  * Creates a copy of the GossipTimestampFilter
15417  */
15418 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15419
15420 /**
15421  * Frees any resources used by the ErrorAction
15422  */
15423 void ErrorAction_free(struct LDKErrorAction this_ptr);
15424
15425 /**
15426  * Creates a copy of the ErrorAction
15427  */
15428 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15429
15430 /**
15431  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15432  */
15433 void LightningError_free(struct LDKLightningError this_obj);
15434
15435 /**
15436  * A human-readable message describing the error
15437  */
15438 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15439
15440 /**
15441  * A human-readable message describing the error
15442  */
15443 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15444
15445 /**
15446  * The action which should be taken against the offending peer.
15447  */
15448 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15449
15450 /**
15451  * The action which should be taken against the offending peer.
15452  */
15453 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15454
15455 /**
15456  * Constructs a new LightningError given each field
15457  */
15458 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15459
15460 /**
15461  * Creates a copy of the LightningError
15462  */
15463 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15464
15465 /**
15466  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15467  */
15468 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15469
15470 /**
15471  * update_add_htlc messages which should be sent
15472  */
15473 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15474
15475 /**
15476  * update_fulfill_htlc messages which should be sent
15477  */
15478 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15479
15480 /**
15481  * update_fail_htlc messages which should be sent
15482  */
15483 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15484
15485 /**
15486  * update_fail_malformed_htlc messages which should be sent
15487  */
15488 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15489
15490 /**
15491  * An update_fee message which should be sent
15492  */
15493 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15494
15495 /**
15496  * An update_fee message which should be sent
15497  */
15498 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15499
15500 /**
15501  * Finally, the commitment_signed message which should be sent
15502  */
15503 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15504
15505 /**
15506  * Finally, the commitment_signed message which should be sent
15507  */
15508 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15509
15510 /**
15511  * Constructs a new CommitmentUpdate given each field
15512  */
15513 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);
15514
15515 /**
15516  * Creates a copy of the CommitmentUpdate
15517  */
15518 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15519
15520 /**
15521  * Frees any resources used by the HTLCFailChannelUpdate
15522  */
15523 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15524
15525 /**
15526  * Creates a copy of the HTLCFailChannelUpdate
15527  */
15528 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15529
15530 /**
15531  * Calls the free function if one is set
15532  */
15533 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15534
15535 /**
15536  * Calls the free function if one is set
15537  */
15538 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15539
15540 /**
15541  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15542  */
15543 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15544
15545 /**
15546  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15547  */
15548 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15549
15550 /**
15551  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15552  */
15553 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15554
15555 /**
15556  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15557  */
15558 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15559
15560 /**
15561  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15562  */
15563 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15564
15565 /**
15566  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15567  */
15568 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15569
15570 /**
15571  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15572  */
15573 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15574
15575 /**
15576  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15577  */
15578 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15579
15580 /**
15581  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15582  */
15583 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15584
15585 /**
15586  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15587  */
15588 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15589
15590 /**
15591  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15592  */
15593 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15594
15595 /**
15596  * Read a FundingCreated from a byte array, created by FundingCreated_write
15597  */
15598 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15599
15600 /**
15601  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15602  */
15603 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15604
15605 /**
15606  * Read a FundingSigned from a byte array, created by FundingSigned_write
15607  */
15608 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15609
15610 /**
15611  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15612  */
15613 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15614
15615 /**
15616  * Read a FundingLocked from a byte array, created by FundingLocked_write
15617  */
15618 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15619
15620 /**
15621  * Serialize the Init object into a byte array which can be read by Init_read
15622  */
15623 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15624
15625 /**
15626  * Read a Init from a byte array, created by Init_write
15627  */
15628 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15629
15630 /**
15631  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15632  */
15633 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15634
15635 /**
15636  * Read a OpenChannel from a byte array, created by OpenChannel_write
15637  */
15638 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15639
15640 /**
15641  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15642  */
15643 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15644
15645 /**
15646  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15647  */
15648 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15649
15650 /**
15651  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15652  */
15653 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15654
15655 /**
15656  * Read a Shutdown from a byte array, created by Shutdown_write
15657  */
15658 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15659
15660 /**
15661  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15662  */
15663 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15664
15665 /**
15666  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15667  */
15668 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15669
15670 /**
15671  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15672  */
15673 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15674
15675 /**
15676  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15677  */
15678 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15679
15680 /**
15681  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15682  */
15683 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15684
15685 /**
15686  * Read a UpdateFee from a byte array, created by UpdateFee_write
15687  */
15688 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15689
15690 /**
15691  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15692  */
15693 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15694
15695 /**
15696  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15697  */
15698 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15699
15700 /**
15701  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15702  */
15703 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15704
15705 /**
15706  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15707  */
15708 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15709
15710 /**
15711  * Serialize the Ping object into a byte array which can be read by Ping_read
15712  */
15713 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15714
15715 /**
15716  * Read a Ping from a byte array, created by Ping_write
15717  */
15718 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15719
15720 /**
15721  * Serialize the Pong object into a byte array which can be read by Pong_read
15722  */
15723 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15724
15725 /**
15726  * Read a Pong from a byte array, created by Pong_write
15727  */
15728 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15729
15730 /**
15731  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15732  */
15733 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15734
15735 /**
15736  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15737  */
15738 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15739
15740 /**
15741  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15742  */
15743 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15744
15745 /**
15746  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15747  */
15748 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15749
15750 /**
15751  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15752  */
15753 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15754
15755 /**
15756  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15757  */
15758 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15759
15760 /**
15761  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15762  */
15763 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15764
15765 /**
15766  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15767  */
15768 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15769
15770 /**
15771  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15772  */
15773 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15774
15775 /**
15776  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15777  */
15778 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15779
15780 /**
15781  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15782  */
15783 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15784
15785 /**
15786  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15787  */
15788 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15789
15790 /**
15791  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15792  */
15793 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15794
15795 /**
15796  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15797  */
15798 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15799
15800 /**
15801  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15802  */
15803 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15804
15805 /**
15806  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15807  */
15808 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15809
15810 /**
15811  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15812  */
15813 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15814
15815 /**
15816  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15817  */
15818 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15819
15820 /**
15821  *\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
15822  */
15823 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15824
15825 /**
15826  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15827  */
15828 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15829
15830 /**
15831  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15832  */
15833 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15834
15835 /**
15836  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15837  */
15838 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15839
15840 /**
15841  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15842  */
15843 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15844
15845 /**
15846  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15847  */
15848 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15849
15850 /**
15851  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15852  */
15853 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15854
15855 /**
15856  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15857  */
15858 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15859
15860 /**
15861  * Constructs a new IgnoringMessageHandler given each field
15862  */
15863 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15864
15865 /**
15866  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15867  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15868  */
15869 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15870
15871 /**
15872  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15873  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15874  */
15875 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15876
15877 /**
15878  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15879  */
15880 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15881
15882 /**
15883  * Constructs a new ErroringMessageHandler
15884  */
15885 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15886
15887 /**
15888  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15889  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15890  */
15891 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15892
15893 /**
15894  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15895  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15896  */
15897 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15898
15899 /**
15900  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15901  */
15902 void MessageHandler_free(struct LDKMessageHandler this_obj);
15903
15904 /**
15905  * A message handler which handles messages specific to channels. Usually this is just a
15906  * ChannelManager object or a ErroringMessageHandler.
15907  */
15908 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15909
15910 /**
15911  * A message handler which handles messages specific to channels. Usually this is just a
15912  * ChannelManager object or a ErroringMessageHandler.
15913  */
15914 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15915
15916 /**
15917  * A message handler which handles messages updating our knowledge of the network channel
15918  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15919  */
15920 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15921
15922 /**
15923  * A message handler which handles messages updating our knowledge of the network channel
15924  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15925  */
15926 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15927
15928 /**
15929  * Constructs a new MessageHandler given each field
15930  */
15931 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15932
15933 /**
15934  * Creates a copy of a SocketDescriptor
15935  */
15936 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15937
15938 /**
15939  * Calls the free function if one is set
15940  */
15941 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15942
15943 /**
15944  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15945  */
15946 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15947
15948 /**
15949  * Used to indicate that we probably can't make any future connections to this peer, implying
15950  * we should go ahead and force-close any channels we have with it.
15951  */
15952 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15953
15954 /**
15955  * Used to indicate that we probably can't make any future connections to this peer, implying
15956  * we should go ahead and force-close any channels we have with it.
15957  */
15958 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15959
15960 /**
15961  * Constructs a new PeerHandleError given each field
15962  */
15963 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15964
15965 /**
15966  * Creates a copy of the PeerHandleError
15967  */
15968 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15969
15970 /**
15971  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15972  */
15973 void PeerManager_free(struct LDKPeerManager this_obj);
15974
15975 /**
15976  * Constructs a new PeerManager with the given message handlers and node_id secret key
15977  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15978  * cryptographically secure random bytes.
15979  */
15980 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);
15981
15982 /**
15983  * Get the list of node ids for peers which have completed the initial handshake.
15984  *
15985  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15986  * new_outbound_connection, however entries will only appear once the initial handshake has
15987  * completed and we are sure the remote peer has the private key for the given node_id.
15988  */
15989 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15990
15991 /**
15992  * Indicates a new outbound connection has been established to a node with the given node_id.
15993  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15994  * descriptor but must disconnect the connection immediately.
15995  *
15996  * Returns a small number of bytes to send to the remote node (currently always 50).
15997  *
15998  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15999  * socket_disconnected().
16000  */
16001 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);
16002
16003 /**
16004  * Indicates a new inbound connection has been established.
16005  *
16006  * May refuse the connection by returning an Err, but will never write bytes to the remote end
16007  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
16008  * call socket_disconnected for the new descriptor but must disconnect the connection
16009  * immediately.
16010  *
16011  * Panics if descriptor is duplicative with some other descriptor which has not yet had
16012  * socket_disconnected called.
16013  */
16014 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
16015
16016 /**
16017  * Indicates that there is room to write data to the given socket descriptor.
16018  *
16019  * May return an Err to indicate that the connection should be closed.
16020  *
16021  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
16022  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
16023  * invariants around calling write_buffer_space_avail in case a write did not fully complete
16024  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
16025  * here isn't sufficient! Panics if the descriptor was not previously registered in a
16026  * new_\\*_connection event.
16027  */
16028 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16029
16030 /**
16031  * Indicates that data was read from the given socket descriptor.
16032  *
16033  * May return an Err to indicate that the connection should be closed.
16034  *
16035  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
16036  * Thus, however, you almost certainly want to call process_events() after any read_event to
16037  * generate send_data calls to handle responses.
16038  *
16039  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
16040  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
16041  *
16042  * Panics if the descriptor was not previously registered in a new_*_connection event.
16043  */
16044 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);
16045
16046 /**
16047  * Checks for any events generated by our handlers and processes them. Includes sending most
16048  * response messages as well as messages generated by calls to handler functions directly (eg
16049  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
16050  */
16051 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
16052
16053 /**
16054  * Indicates that the given socket descriptor's connection is now closed.
16055  *
16056  * This must only be called if the socket has been disconnected by the peer or your own
16057  * decision to disconnect it and must NOT be called in any case where other parts of this
16058  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
16059  * the peer.
16060  *
16061  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
16062  */
16063 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16064
16065 /**
16066  * Disconnect a peer given its node id.
16067  *
16068  * Set no_connection_possible to true to prevent any further connection with this peer,
16069  * force-closing any channels we have with it.
16070  *
16071  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
16072  * so be careful about reentrancy issues.
16073  */
16074 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
16075
16076 /**
16077  * This function should be called roughly once every 30 seconds.
16078  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
16079  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
16080  */
16081 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
16082
16083 /**
16084  * Build the commitment secret from the seed and the commitment number
16085  */
16086 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
16087
16088 /**
16089  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
16090  * from the base secret and the per_commitment_point.
16091  *
16092  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16093  * generated (ie our own).
16094  */
16095 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
16096
16097 /**
16098  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
16099  * from the base point and the per_commitment_key. This is the public equivalent of
16100  * derive_private_key - using only public keys to derive a public key instead of private keys.
16101  *
16102  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16103  * generated (ie our own).
16104  */
16105 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
16106
16107 /**
16108  * Derives a per-commitment-transaction revocation key from its constituent parts.
16109  *
16110  * Only the cheating participant owns a valid witness to propagate a revoked
16111  * commitment transaction, thus per_commitment_secret always come from cheater
16112  * and revocation_base_secret always come from punisher, which is the broadcaster
16113  * of the transaction spending with this key knowledge.
16114  *
16115  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16116  * generated (ie our own).
16117  */
16118 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
16119
16120 /**
16121  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
16122  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
16123  * public key instead of private keys.
16124  *
16125  * Only the cheating participant owns a valid witness to propagate a revoked
16126  * commitment transaction, thus per_commitment_point always come from cheater
16127  * and revocation_base_point always come from punisher, which is the broadcaster
16128  * of the transaction spending with this key knowledge.
16129  *
16130  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16131  * generated (ie our own).
16132  */
16133 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
16134
16135 /**
16136  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
16137  */
16138 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
16139
16140 /**
16141  * The broadcaster's per-commitment public key which was used to derive the other keys.
16142  */
16143 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16144
16145 /**
16146  * The broadcaster's per-commitment public key which was used to derive the other keys.
16147  */
16148 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16149
16150 /**
16151  * The revocation key which is used to allow the broadcaster of the commitment
16152  * transaction to provide their counterparty the ability to punish them if they broadcast
16153  * an old state.
16154  */
16155 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16156
16157 /**
16158  * The revocation key which is used to allow the broadcaster of the commitment
16159  * transaction to provide their counterparty the ability to punish them if they broadcast
16160  * an old state.
16161  */
16162 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16163
16164 /**
16165  * Broadcaster's HTLC Key
16166  */
16167 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16168
16169 /**
16170  * Broadcaster's HTLC Key
16171  */
16172 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16173
16174 /**
16175  * Countersignatory's HTLC Key
16176  */
16177 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16178
16179 /**
16180  * Countersignatory's HTLC Key
16181  */
16182 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16183
16184 /**
16185  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16186  */
16187 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16188
16189 /**
16190  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16191  */
16192 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16193
16194 /**
16195  * Constructs a new TxCreationKeys given each field
16196  */
16197 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);
16198
16199 /**
16200  * Creates a copy of the TxCreationKeys
16201  */
16202 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
16203
16204 /**
16205  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
16206  */
16207 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
16208
16209 /**
16210  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
16211  */
16212 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
16213
16214 /**
16215  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
16216  */
16217 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
16218
16219 /**
16220  * The public key which is used to sign all commitment transactions, as it appears in the
16221  * on-chain channel lock-in 2-of-2 multisig output.
16222  */
16223 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16224
16225 /**
16226  * The public key which is used to sign all commitment transactions, as it appears in the
16227  * on-chain channel lock-in 2-of-2 multisig output.
16228  */
16229 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16230
16231 /**
16232  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16233  * revocation keys. This is combined with the per-commitment-secret generated by the
16234  * counterparty to create a secret which the counterparty can reveal to revoke previous
16235  * states.
16236  */
16237 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16238
16239 /**
16240  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16241  * revocation keys. This is combined with the per-commitment-secret generated by the
16242  * counterparty to create a secret which the counterparty can reveal to revoke previous
16243  * states.
16244  */
16245 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16246
16247 /**
16248  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16249  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16250  * static across every commitment transaction.
16251  */
16252 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16253
16254 /**
16255  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16256  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16257  * static across every commitment transaction.
16258  */
16259 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16260
16261 /**
16262  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16263  * public key which receives non-HTLC-encumbered funds which are only available for spending
16264  * after some delay (or can be claimed via the revocation path).
16265  */
16266 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16267
16268 /**
16269  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16270  * public key which receives non-HTLC-encumbered funds which are only available for spending
16271  * after some delay (or can be claimed via the revocation path).
16272  */
16273 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16274
16275 /**
16276  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16277  * which is used to encumber HTLC-in-flight outputs.
16278  */
16279 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16280
16281 /**
16282  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16283  * which is used to encumber HTLC-in-flight outputs.
16284  */
16285 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16286
16287 /**
16288  * Constructs a new ChannelPublicKeys given each field
16289  */
16290 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);
16291
16292 /**
16293  * Creates a copy of the ChannelPublicKeys
16294  */
16295 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
16296
16297 /**
16298  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
16299  */
16300 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
16301
16302 /**
16303  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
16304  */
16305 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
16306
16307 /**
16308  * Create per-state keys from channel base points and the per-commitment point.
16309  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16310  */
16311 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);
16312
16313 /**
16314  * Generate per-state keys from channel static keys.
16315  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16316  */
16317 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);
16318
16319 /**
16320  * A script either spendable by the revocation
16321  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
16322  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
16323  */
16324 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
16325
16326 /**
16327  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
16328  */
16329 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
16330
16331 /**
16332  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16333  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16334  * need to compare this value to whether the commitment transaction in question is that of
16335  * the counterparty or our own.
16336  */
16337 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16338
16339 /**
16340  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16341  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16342  * need to compare this value to whether the commitment transaction in question is that of
16343  * the counterparty or our own.
16344  */
16345 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
16346
16347 /**
16348  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16349  * this divided by 1000.
16350  */
16351 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16352
16353 /**
16354  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16355  * this divided by 1000.
16356  */
16357 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16358
16359 /**
16360  * The CLTV lock-time at which this HTLC expires.
16361  */
16362 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16363
16364 /**
16365  * The CLTV lock-time at which this HTLC expires.
16366  */
16367 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16368
16369 /**
16370  * The hash of the preimage which unlocks this HTLC.
16371  */
16372 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16373
16374 /**
16375  * The hash of the preimage which unlocks this HTLC.
16376  */
16377 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16378
16379 /**
16380  * The position within the commitment transactions' outputs. This may be None if the value is
16381  * below the dust limit (in which case no output appears in the commitment transaction and the
16382  * value is spent to additional transaction fees).
16383  */
16384 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16385
16386 /**
16387  * The position within the commitment transactions' outputs. This may be None if the value is
16388  * below the dust limit (in which case no output appears in the commitment transaction and the
16389  * value is spent to additional transaction fees).
16390  */
16391 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16392
16393 /**
16394  * Constructs a new HTLCOutputInCommitment given each field
16395  */
16396 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);
16397
16398 /**
16399  * Creates a copy of the HTLCOutputInCommitment
16400  */
16401 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16402
16403 /**
16404  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16405  */
16406 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16407
16408 /**
16409  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16410  */
16411 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16412
16413 /**
16414  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16415  * does not need to have its previous_output_index filled.
16416  */
16417 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16418
16419 /**
16420  * Gets the redeemscript for a funding output from the two funding public keys.
16421  * Note that the order of funding public keys does not matter.
16422  */
16423 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16424
16425 /**
16426  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
16427  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
16428  * transaction which needs signing, and can be used to construct an HTLC transaction which is
16429  * broadcastable given a counterparty HTLC signature.
16430  *
16431  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
16432  * commitment transaction).
16433  */
16434 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);
16435
16436 /**
16437  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16438  */
16439 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16440
16441 /**
16442  * Holder public keys
16443  */
16444 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16445
16446 /**
16447  * Holder public keys
16448  */
16449 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16450
16451 /**
16452  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16453  */
16454 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16455
16456 /**
16457  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16458  */
16459 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16460
16461 /**
16462  * Whether the holder is the initiator of this channel.
16463  * This is an input to the commitment number obscure factor computation.
16464  */
16465 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16466
16467 /**
16468  * Whether the holder is the initiator of this channel.
16469  * This is an input to the commitment number obscure factor computation.
16470  */
16471 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16472
16473 /**
16474  * The late-bound counterparty channel transaction parameters.
16475  * These parameters are populated at the point in the protocol where the counterparty provides them.
16476  */
16477 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16478
16479 /**
16480  * The late-bound counterparty channel transaction parameters.
16481  * These parameters are populated at the point in the protocol where the counterparty provides them.
16482  */
16483 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16484
16485 /**
16486  * The late-bound funding outpoint
16487  */
16488 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16489
16490 /**
16491  * The late-bound funding outpoint
16492  */
16493 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16494
16495 /**
16496  * Constructs a new ChannelTransactionParameters given each field
16497  */
16498 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);
16499
16500 /**
16501  * Creates a copy of the ChannelTransactionParameters
16502  */
16503 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16504
16505 /**
16506  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16507  */
16508 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16509
16510 /**
16511  * Counter-party public keys
16512  */
16513 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16514
16515 /**
16516  * Counter-party public keys
16517  */
16518 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16519
16520 /**
16521  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16522  */
16523 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16524
16525 /**
16526  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16527  */
16528 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16529
16530 /**
16531  * Constructs a new CounterpartyChannelTransactionParameters given each field
16532  */
16533 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
16534
16535 /**
16536  * Creates a copy of the CounterpartyChannelTransactionParameters
16537  */
16538 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16539
16540 /**
16541  * Whether the late bound parameters are populated.
16542  */
16543 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16544
16545 /**
16546  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16547  * given that the holder is the broadcaster.
16548  *
16549  * self.is_populated() must be true before calling this function.
16550  */
16551 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16552
16553 /**
16554  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16555  * given that the counterparty is the broadcaster.
16556  *
16557  * self.is_populated() must be true before calling this function.
16558  */
16559 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16560
16561 /**
16562  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16563  */
16564 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16565
16566 /**
16567  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16568  */
16569 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16570
16571 /**
16572  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16573  */
16574 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16575
16576 /**
16577  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16578  */
16579 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16580
16581 /**
16582  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16583  */
16584 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16585
16586 /**
16587  * Get the channel pubkeys for the broadcaster
16588  */
16589 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16590
16591 /**
16592  * Get the channel pubkeys for the countersignatory
16593  */
16594 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16595
16596 /**
16597  * Get the contest delay applicable to the transactions.
16598  * Note that the contest delay was selected by the countersignatory.
16599  */
16600 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16601
16602 /**
16603  * Whether the channel is outbound from the broadcaster.
16604  *
16605  * The boolean representing the side that initiated the channel is
16606  * an input to the commitment number obscure factor computation.
16607  */
16608 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16609
16610 /**
16611  * The funding outpoint
16612  */
16613 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16614
16615 /**
16616  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16617  */
16618 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16619
16620 /**
16621  * Our counterparty's signature for the transaction
16622  */
16623 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16624
16625 /**
16626  * Our counterparty's signature for the transaction
16627  */
16628 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16629
16630 /**
16631  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16632  */
16633 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16634
16635 /**
16636  * Creates a copy of the HolderCommitmentTransaction
16637  */
16638 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16639
16640 /**
16641  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16642  */
16643 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16644
16645 /**
16646  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16647  */
16648 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16649
16650 /**
16651  * Create a new holder transaction with the given counterparty signatures.
16652  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16653  */
16654 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);
16655
16656 /**
16657  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16658  */
16659 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16660
16661 /**
16662  * The commitment transaction
16663  */
16664 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16665
16666 /**
16667  * The commitment transaction
16668  */
16669 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16670
16671 /**
16672  * The txid for the commitment transaction.
16673  *
16674  * This is provided as a performance optimization, instead of calling transaction.txid()
16675  * multiple times.
16676  */
16677 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16678
16679 /**
16680  * The txid for the commitment transaction.
16681  *
16682  * This is provided as a performance optimization, instead of calling transaction.txid()
16683  * multiple times.
16684  */
16685 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16686
16687 /**
16688  * Constructs a new BuiltCommitmentTransaction given each field
16689  */
16690 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16691
16692 /**
16693  * Creates a copy of the BuiltCommitmentTransaction
16694  */
16695 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16696
16697 /**
16698  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16699  */
16700 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16701
16702 /**
16703  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16704  */
16705 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16706
16707 /**
16708  * Get the SIGHASH_ALL sighash value of the transaction.
16709  *
16710  * This can be used to verify a signature.
16711  */
16712 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);
16713
16714 /**
16715  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16716  * because we are about to broadcast a holder transaction.
16717  */
16718 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);
16719
16720 /**
16721  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16722  */
16723 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16724
16725 /**
16726  * Creates a copy of the CommitmentTransaction
16727  */
16728 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16729
16730 /**
16731  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16732  */
16733 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16734
16735 /**
16736  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16737  */
16738 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16739
16740 /**
16741  * The backwards-counting commitment number
16742  */
16743 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16744
16745 /**
16746  * The value to be sent to the broadcaster
16747  */
16748 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16749
16750 /**
16751  * The value to be sent to the counterparty
16752  */
16753 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16754
16755 /**
16756  * The feerate paid per 1000-weight-unit in this commitment transaction.
16757  */
16758 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16759
16760 /**
16761  * Trust our pre-built transaction and derived transaction creation public keys.
16762  *
16763  * Applies a wrapper which allows access to these fields.
16764  *
16765  * This should only be used if you fully trust the builder of this object.  It should not
16766  *\tbe used by an external signer - instead use the verify function.
16767  */
16768 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16769
16770 /**
16771  * Verify our pre-built transaction and derived transaction creation public keys.
16772  *
16773  * Applies a wrapper which allows access to these fields.
16774  *
16775  * An external validating signer must call this method before signing
16776  * or using the built transaction.
16777  */
16778 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);
16779
16780 /**
16781  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16782  */
16783 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16784
16785 /**
16786  * The transaction ID of the built Bitcoin transaction
16787  */
16788 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16789
16790 /**
16791  * The pre-built Bitcoin commitment transaction
16792  */
16793 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16794
16795 /**
16796  * The pre-calculated transaction creation public keys.
16797  */
16798 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16799
16800 /**
16801  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16802  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16803  *
16804  * The returned Vec has one entry for each HTLC, and in the same order.
16805  */
16806 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);
16807
16808 /**
16809  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
16810  * shared secret first. This prevents on-chain observers from discovering how many commitment
16811  * transactions occurred in a channel before it was closed.
16812  *
16813  * This function gets the shared secret from relevant channel public keys and can be used to
16814  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
16815  */
16816 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16817
16818 /**
16819  * Checks if two InitFeaturess contain equal inner contents.
16820  * This ignores pointers and is_owned flags and looks at the values in fields.
16821  * Two objects with NULL inner values will be considered "equal" here.
16822  */
16823 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
16824
16825 /**
16826  * Checks if two NodeFeaturess contain equal inner contents.
16827  * This ignores pointers and is_owned flags and looks at the values in fields.
16828  * Two objects with NULL inner values will be considered "equal" here.
16829  */
16830 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
16831
16832 /**
16833  * Checks if two ChannelFeaturess contain equal inner contents.
16834  * This ignores pointers and is_owned flags and looks at the values in fields.
16835  * Two objects with NULL inner values will be considered "equal" here.
16836  */
16837 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
16838
16839 /**
16840  * Checks if two InvoiceFeaturess contain equal inner contents.
16841  * This ignores pointers and is_owned flags and looks at the values in fields.
16842  * Two objects with NULL inner values will be considered "equal" here.
16843  */
16844 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
16845
16846 /**
16847  * Creates a copy of the InitFeatures
16848  */
16849 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16850
16851 /**
16852  * Creates a copy of the NodeFeatures
16853  */
16854 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16855
16856 /**
16857  * Creates a copy of the ChannelFeatures
16858  */
16859 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16860
16861 /**
16862  * Creates a copy of the InvoiceFeatures
16863  */
16864 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16865
16866 /**
16867  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16868  */
16869 void InitFeatures_free(struct LDKInitFeatures this_obj);
16870
16871 /**
16872  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16873  */
16874 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16875
16876 /**
16877  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16878  */
16879 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16880
16881 /**
16882  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16883  */
16884 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16885
16886 /**
16887  * Create a blank Features with no features set
16888  */
16889 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16890
16891 /**
16892  * Creates a Features with the bits set which are known by the implementation
16893  */
16894 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16895
16896 /**
16897  * Create a blank Features with no features set
16898  */
16899 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16900
16901 /**
16902  * Creates a Features with the bits set which are known by the implementation
16903  */
16904 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16905
16906 /**
16907  * Create a blank Features with no features set
16908  */
16909 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16910
16911 /**
16912  * Creates a Features with the bits set which are known by the implementation
16913  */
16914 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16915
16916 /**
16917  * Create a blank Features with no features set
16918  */
16919 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16920
16921 /**
16922  * Creates a Features with the bits set which are known by the implementation
16923  */
16924 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16925
16926 /**
16927  * Returns whether the `payment_secret` feature is supported.
16928  */
16929 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
16930
16931 /**
16932  * Returns whether the `payment_secret` feature is supported.
16933  */
16934 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
16935
16936 /**
16937  * Returns whether the `payment_secret` feature is supported.
16938  */
16939 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
16940
16941 /**
16942  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16943  */
16944 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16945
16946 /**
16947  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16948  */
16949 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16950
16951 /**
16952  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16953  */
16954 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16955
16956 /**
16957  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16958  */
16959 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16960
16961 /**
16962  * Read a InitFeatures from a byte array, created by InitFeatures_write
16963  */
16964 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16965
16966 /**
16967  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16968  */
16969 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16970
16971 /**
16972  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16973  */
16974 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16975
16976 /**
16977  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16978  */
16979 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16980
16981 /**
16982  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16983  */
16984 void RouteHop_free(struct LDKRouteHop this_obj);
16985
16986 /**
16987  * The node_id of the node at this hop.
16988  */
16989 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16990
16991 /**
16992  * The node_id of the node at this hop.
16993  */
16994 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16995
16996 /**
16997  * The node_announcement features of the node at this hop. For the last hop, these may be
16998  * amended to match the features present in the invoice this node generated.
16999  */
17000 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17001
17002 /**
17003  * The node_announcement features of the node at this hop. For the last hop, these may be
17004  * amended to match the features present in the invoice this node generated.
17005  */
17006 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17007
17008 /**
17009  * The channel that should be used from the previous hop to reach this node.
17010  */
17011 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17012
17013 /**
17014  * The channel that should be used from the previous hop to reach this node.
17015  */
17016 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
17017
17018 /**
17019  * The channel_announcement features of the channel that should be used from the previous hop
17020  * to reach this node.
17021  */
17022 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17023
17024 /**
17025  * The channel_announcement features of the channel that should be used from the previous hop
17026  * to reach this node.
17027  */
17028 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17029
17030 /**
17031  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17032  * For the last hop, this should be the full value of the payment (might be more than
17033  * requested if we had to match htlc_minimum_msat).
17034  */
17035 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17036
17037 /**
17038  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17039  * For the last hop, this should be the full value of the payment (might be more than
17040  * requested if we had to match htlc_minimum_msat).
17041  */
17042 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
17043
17044 /**
17045  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17046  * expected at the destination, in excess of the current block height.
17047  */
17048 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17049
17050 /**
17051  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17052  * expected at the destination, in excess of the current block height.
17053  */
17054 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
17055
17056 /**
17057  * Constructs a new RouteHop given each field
17058  */
17059 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);
17060
17061 /**
17062  * Creates a copy of the RouteHop
17063  */
17064 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
17065
17066 /**
17067  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
17068  */
17069 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
17070
17071 /**
17072  * Read a RouteHop from a byte array, created by RouteHop_write
17073  */
17074 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
17075
17076 /**
17077  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
17078  */
17079 void Route_free(struct LDKRoute this_obj);
17080
17081 /**
17082  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
17083  * last RouteHop in each path must be the same.
17084  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
17085  * destination. Thus, this must always be at least length one. While the maximum length of any
17086  * given path is variable, keeping the length of any path to less than 20 should currently
17087  * ensure it is viable.
17088  */
17089 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
17090
17091 /**
17092  * Constructs a new Route given each field
17093  */
17094 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
17095
17096 /**
17097  * Creates a copy of the Route
17098  */
17099 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
17100
17101 /**
17102  * Serialize the Route object into a byte array which can be read by Route_read
17103  */
17104 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
17105
17106 /**
17107  * Read a Route from a byte array, created by Route_write
17108  */
17109 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
17110
17111 /**
17112  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17113  */
17114 void RouteHint_free(struct LDKRouteHint this_obj);
17115
17116 /**
17117  * Checks if two RouteHints contain equal inner contents.
17118  * This ignores pointers and is_owned flags and looks at the values in fields.
17119  * Two objects with NULL inner values will be considered "equal" here.
17120  */
17121 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
17122
17123 /**
17124  * Creates a copy of the RouteHint
17125  */
17126 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17127
17128 /**
17129  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
17130  */
17131 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
17132
17133 /**
17134  * The node_id of the non-target end of the route
17135  */
17136 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17137
17138 /**
17139  * The node_id of the non-target end of the route
17140  */
17141 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17142
17143 /**
17144  * The short_channel_id of this channel
17145  */
17146 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17147
17148 /**
17149  * The short_channel_id of this channel
17150  */
17151 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
17152
17153 /**
17154  * The fees which must be paid to use this channel
17155  */
17156 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17157
17158 /**
17159  * The fees which must be paid to use this channel
17160  */
17161 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17162
17163 /**
17164  * The difference in CLTV values between this node and the next node.
17165  */
17166 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17167
17168 /**
17169  * The difference in CLTV values between this node and the next node.
17170  */
17171 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
17172
17173 /**
17174  * The minimum value, in msat, which must be relayed to the next hop.
17175  */
17176 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17177
17178 /**
17179  * The minimum value, in msat, which must be relayed to the next hop.
17180  */
17181 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17182
17183 /**
17184  * The maximum value in msat available for routing with a single HTLC.
17185  */
17186 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17187
17188 /**
17189  * The maximum value in msat available for routing with a single HTLC.
17190  */
17191 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17192
17193 /**
17194  * Constructs a new RouteHintHop given each field
17195  */
17196 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);
17197
17198 /**
17199  * Checks if two RouteHintHops contain equal inner contents.
17200  * This ignores pointers and is_owned flags and looks at the values in fields.
17201  * Two objects with NULL inner values will be considered "equal" here.
17202  */
17203 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
17204
17205 /**
17206  * Creates a copy of the RouteHintHop
17207  */
17208 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
17209
17210 /**
17211  * Gets a route from us (payer) to the given target node (payee).
17212  *
17213  * If the payee provided features in their invoice, they should be provided via payee_features.
17214  * Without this, MPP will only be used if the payee's features are available in the network graph.
17215  *
17216  * Private routing paths between a public node and the target may be included in `last_hops`.
17217  * Currently, only the last hop in each path is considered.
17218  *
17219  * If some channels aren't announced, it may be useful to fill in a first_hops with the
17220  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
17221  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
17222  * in first_hops will be used.
17223  *
17224  * Panics if first_hops contains channels without short_channel_ids
17225  * (ChannelManager::list_usable_channels will never include such channels).
17226  *
17227  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
17228  * equal), however the enabled/disabled bit on such channels as well as the
17229  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
17230  */
17231 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);
17232
17233 /**
17234  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
17235  */
17236 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
17237
17238 /**
17239  * Creates a copy of the NetworkGraph
17240  */
17241 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
17242
17243 /**
17244  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
17245  */
17246 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
17247
17248 /**
17249  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
17250  */
17251 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
17252
17253 /**
17254  * Creates a new tracker of the actual state of the network of channels and nodes,
17255  * assuming a fresh network graph.
17256  * Chain monitor is used to make sure announced channels exist on-chain,
17257  * channel data is correct, and that the announcement is signed with
17258  * channel owners' keys.
17259  */
17260 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
17261
17262 /**
17263  * Creates a new tracker of the actual state of the network of channels and nodes,
17264  * assuming an existing Network Graph.
17265  */
17266 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
17267
17268 /**
17269  * Adds a provider used to check new announcements. Does not affect
17270  * existing announcements unless they are updated.
17271  * Add, update or remove the provider would replace the current one.
17272  */
17273 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
17274
17275 /**
17276  * Take a read lock on the network_graph and return it in the C-bindings
17277  * newtype helper. This is likely only useful when called via the C
17278  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
17279  * yourself.
17280  */
17281 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17282
17283 /**
17284  * Get a reference to the NetworkGraph which this read-lock contains.
17285  */
17286 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
17287
17288 /**
17289  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17290  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17291  */
17292 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17293
17294 /**
17295  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17296  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17297  */
17298 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17299
17300 /**
17301  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
17302  */
17303 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
17304
17305 /**
17306  * When the last update to the channel direction was issued.
17307  * Value is opaque, as set in the announcement.
17308  */
17309 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17310
17311 /**
17312  * When the last update to the channel direction was issued.
17313  * Value is opaque, as set in the announcement.
17314  */
17315 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
17316
17317 /**
17318  * Whether the channel can be currently used for payments (in this one direction).
17319  */
17320 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17321
17322 /**
17323  * Whether the channel can be currently used for payments (in this one direction).
17324  */
17325 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
17326
17327 /**
17328  * The difference in CLTV values that you must have when routing through this channel.
17329  */
17330 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17331
17332 /**
17333  * The difference in CLTV values that you must have when routing through this channel.
17334  */
17335 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
17336
17337 /**
17338  * The minimum value, which must be relayed to the next hop via the channel
17339  */
17340 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17341
17342 /**
17343  * The minimum value, which must be relayed to the next hop via the channel
17344  */
17345 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
17346
17347 /**
17348  * The maximum value which may be relayed to the next hop via the channel.
17349  */
17350 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17351
17352 /**
17353  * The maximum value which may be relayed to the next hop via the channel.
17354  */
17355 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17356
17357 /**
17358  * Fees charged when the channel is used for routing
17359  */
17360 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17361
17362 /**
17363  * Fees charged when the channel is used for routing
17364  */
17365 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17366
17367 /**
17368  * Most recent update for the channel received from the network
17369  * Mostly redundant with the data we store in fields explicitly.
17370  * Everything else is useful only for sending out for initial routing sync.
17371  * Not stored if contains excess data to prevent DoS.
17372  */
17373 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17374
17375 /**
17376  * Most recent update for the channel received from the network
17377  * Mostly redundant with the data we store in fields explicitly.
17378  * Everything else is useful only for sending out for initial routing sync.
17379  * Not stored if contains excess data to prevent DoS.
17380  */
17381 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
17382
17383 /**
17384  * Constructs a new DirectionalChannelInfo given each field
17385  */
17386 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);
17387
17388 /**
17389  * Creates a copy of the DirectionalChannelInfo
17390  */
17391 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17392
17393 /**
17394  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17395  */
17396 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17397
17398 /**
17399  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17400  */
17401 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17402
17403 /**
17404  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17405  */
17406 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17407
17408 /**
17409  * Protocol features of a channel communicated during its announcement
17410  */
17411 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17412
17413 /**
17414  * Protocol features of a channel communicated during its announcement
17415  */
17416 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17417
17418 /**
17419  * Source node of the first direction of a channel
17420  */
17421 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17422
17423 /**
17424  * Source node of the first direction of a channel
17425  */
17426 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17427
17428 /**
17429  * Details about the first direction of a channel
17430  */
17431 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17432
17433 /**
17434  * Details about the first direction of a channel
17435  */
17436 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17437
17438 /**
17439  * Source node of the second direction of a channel
17440  */
17441 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17442
17443 /**
17444  * Source node of the second direction of a channel
17445  */
17446 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17447
17448 /**
17449  * Details about the second direction of a channel
17450  */
17451 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17452
17453 /**
17454  * Details about the second direction of a channel
17455  */
17456 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17457
17458 /**
17459  * The channel capacity as seen on-chain, if chain lookup is available.
17460  */
17461 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17462
17463 /**
17464  * The channel capacity as seen on-chain, if chain lookup is available.
17465  */
17466 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17467
17468 /**
17469  * An initial announcement of the channel
17470  * Mostly redundant with the data we store in fields explicitly.
17471  * Everything else is useful only for sending out for initial routing sync.
17472  * Not stored if contains excess data to prevent DoS.
17473  */
17474 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17475
17476 /**
17477  * An initial announcement of the channel
17478  * Mostly redundant with the data we store in fields explicitly.
17479  * Everything else is useful only for sending out for initial routing sync.
17480  * Not stored if contains excess data to prevent DoS.
17481  */
17482 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17483
17484 /**
17485  * Constructs a new ChannelInfo given each field
17486  */
17487 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);
17488
17489 /**
17490  * Creates a copy of the ChannelInfo
17491  */
17492 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17493
17494 /**
17495  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17496  */
17497 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17498
17499 /**
17500  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17501  */
17502 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17503
17504 /**
17505  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
17506  */
17507 void RoutingFees_free(struct LDKRoutingFees this_obj);
17508
17509 /**
17510  * Flat routing fee in satoshis
17511  */
17512 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17513
17514 /**
17515  * Flat routing fee in satoshis
17516  */
17517 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17518
17519 /**
17520  * Liquidity-based routing fee in millionths of a routed amount.
17521  * In other words, 10000 is 1%.
17522  */
17523 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17524
17525 /**
17526  * Liquidity-based routing fee in millionths of a routed amount.
17527  * In other words, 10000 is 1%.
17528  */
17529 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17530
17531 /**
17532  * Constructs a new RoutingFees given each field
17533  */
17534 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
17535
17536 /**
17537  * Checks if two RoutingFeess contain equal inner contents.
17538  * This ignores pointers and is_owned flags and looks at the values in fields.
17539  * Two objects with NULL inner values will be considered "equal" here.
17540  */
17541 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
17542
17543 /**
17544  * Creates a copy of the RoutingFees
17545  */
17546 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
17547
17548 /**
17549  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
17550  */
17551 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
17552
17553 /**
17554  * Read a RoutingFees from a byte array, created by RoutingFees_write
17555  */
17556 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
17557
17558 /**
17559  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
17560  */
17561 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
17562
17563 /**
17564  * Protocol features the node announced support for
17565  */
17566 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17567
17568 /**
17569  * Protocol features the node announced support for
17570  */
17571 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17572
17573 /**
17574  * When the last known update to the node state was issued.
17575  * Value is opaque, as set in the announcement.
17576  */
17577 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17578
17579 /**
17580  * When the last known update to the node state was issued.
17581  * Value is opaque, as set in the announcement.
17582  */
17583 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
17584
17585 /**
17586  * Color assigned to the node
17587  */
17588 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
17589
17590 /**
17591  * Color assigned to the node
17592  */
17593 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17594
17595 /**
17596  * Moniker assigned to the node.
17597  * May be invalid or malicious (eg control chars),
17598  * should not be exposed to the user.
17599  */
17600 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
17601
17602 /**
17603  * Moniker assigned to the node.
17604  * May be invalid or malicious (eg control chars),
17605  * should not be exposed to the user.
17606  */
17607 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17608
17609 /**
17610  * Internet-level addresses via which one can connect to the node
17611  */
17612 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17613
17614 /**
17615  * An initial announcement of the node
17616  * Mostly redundant with the data we store in fields explicitly.
17617  * Everything else is useful only for sending out for initial routing sync.
17618  * Not stored if contains excess data to prevent DoS.
17619  */
17620 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17621
17622 /**
17623  * An initial announcement of the node
17624  * Mostly redundant with the data we store in fields explicitly.
17625  * Everything else is useful only for sending out for initial routing sync.
17626  * Not stored if contains excess data to prevent DoS.
17627  */
17628 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17629
17630 /**
17631  * Constructs a new NodeAnnouncementInfo given each field
17632  */
17633 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);
17634
17635 /**
17636  * Creates a copy of the NodeAnnouncementInfo
17637  */
17638 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17639
17640 /**
17641  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17642  */
17643 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17644
17645 /**
17646  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17647  */
17648 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17649
17650 /**
17651  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17652  */
17653 void NodeInfo_free(struct LDKNodeInfo this_obj);
17654
17655 /**
17656  * All valid channels a node has announced
17657  */
17658 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17659
17660 /**
17661  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17662  * The two fields (flat and proportional fee) are independent,
17663  * meaning they don't have to refer to the same channel.
17664  */
17665 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17666
17667 /**
17668  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17669  * The two fields (flat and proportional fee) are independent,
17670  * meaning they don't have to refer to the same channel.
17671  */
17672 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17673
17674 /**
17675  * More information about a node from node_announcement.
17676  * Optional because we store a Node entry after learning about it from
17677  * a channel announcement, but before receiving a node announcement.
17678  */
17679 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17680
17681 /**
17682  * More information about a node from node_announcement.
17683  * Optional because we store a Node entry after learning about it from
17684  * a channel announcement, but before receiving a node announcement.
17685  */
17686 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17687
17688 /**
17689  * Constructs a new NodeInfo given each field
17690  */
17691 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17692
17693 /**
17694  * Creates a copy of the NodeInfo
17695  */
17696 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17697
17698 /**
17699  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17700  */
17701 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17702
17703 /**
17704  * Read a NodeInfo from a byte array, created by NodeInfo_write
17705  */
17706 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17707
17708 /**
17709  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17710  */
17711 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17712
17713 /**
17714  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17715  */
17716 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17717
17718 /**
17719  * Creates a new, empty, network graph.
17720  */
17721 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17722
17723 /**
17724  * For an already known node (from channel announcements), update its stored properties from a
17725  * given node announcement.
17726  *
17727  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17728  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17729  * routing messages from a source using a protocol other than the lightning P2P protocol.
17730  */
17731 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17732
17733 /**
17734  * For an already known node (from channel announcements), update its stored properties from a
17735  * given node announcement without verifying the associated signatures. Because we aren't
17736  * given the associated signatures here we cannot relay the node announcement to any of our
17737  * peers.
17738  */
17739 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17740
17741 /**
17742  * Store or update channel info from a channel announcement.
17743  *
17744  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17745  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17746  * routing messages from a source using a protocol other than the lightning P2P protocol.
17747  *
17748  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17749  * the corresponding UTXO exists on chain and is correctly-formatted.
17750  */
17751 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);
17752
17753 /**
17754  * Store or update channel info from a channel announcement without verifying the associated
17755  * signatures. Because we aren't given the associated signatures here we cannot relay the
17756  * channel announcement to any of our peers.
17757  *
17758  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17759  * the corresponding UTXO exists on chain and is correctly-formatted.
17760  */
17761 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);
17762
17763 /**
17764  * Close a channel if a corresponding HTLC fail was sent.
17765  * If permanent, removes a channel from the local storage.
17766  * May cause the removal of nodes too, if this was their last channel.
17767  * If not permanent, makes channels unavailable for routing.
17768  */
17769 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17770
17771 /**
17772  * For an already known (from announcement) channel, update info about one of the directions
17773  * of the channel.
17774  *
17775  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17776  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17777  * routing messages from a source using a protocol other than the lightning P2P protocol.
17778  */
17779 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17780
17781 /**
17782  * For an already known (from announcement) channel, update info about one of the directions
17783  * of the channel without verifying the associated signatures. Because we aren't given the
17784  * associated signatures here we cannot relay the channel update to any of our peers.
17785  */
17786 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17787
17788 /**
17789  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17790  */
17791 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17792
17793 /**
17794  * Initialize a new FilesystemPersister and set the path to the individual channels'
17795  * files.
17796  */
17797 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17798
17799 /**
17800  * Get the directory which was provided when this persister was initialized.
17801  */
17802 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17803
17804 /**
17805  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17806  * initialization, within a file called \"manager\".
17807  */
17808 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17809
17810 /**
17811  * Read `ChannelMonitor`s from disk.
17812  */
17813 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17814
17815 /**
17816  * Constructs a new Persist which calls the relevant methods on this_arg.
17817  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17818  */
17819 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17820
17821 /**
17822  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
17823  */
17824 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
17825
17826 /**
17827  * Calls the free function if one is set
17828  */
17829 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
17830
17831 /**
17832  * Start a background thread that takes care of responsibilities enumerated in the top-level
17833  * documentation.
17834  *
17835  * If `persist_manager` returns an error, then this thread will return said error (and
17836  * `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
17837  * wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
17838  * returned, or implement `persist_manager` such that an error is never returned to the
17839  * `BackgroundProcessor`
17840  *
17841  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
17842  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
17843  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
17844  * provided implementation.
17845  *
17846  * [`thread_handle`]: BackgroundProcessor::thread_handle
17847  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
17848  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
17849  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
17850  */
17851 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);
17852
17853 /**
17854  * Stop `BackgroundProcessor`'s thread.
17855  */
17856 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
17857
17858 /**
17859  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17860  *
17861  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17862  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17863  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17864  * since this check is fast we recommend to do it anyway.
17865  *
17866  * If this function fails this is considered a bug. Please open an issue describing your
17867  * platform and stating your current system time.
17868  *
17869  * # Panics
17870  * If the check fails this function panics. By calling this function on startup you ensure that
17871  * this wont happen at an arbitrary later point in time.
17872  */
17873 void check_platform(void);
17874
17875 /**
17876  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17877  */
17878 void Invoice_free(struct LDKInvoice this_obj);
17879
17880 /**
17881  * Checks if two Invoices contain equal inner contents.
17882  * This ignores pointers and is_owned flags and looks at the values in fields.
17883  * Two objects with NULL inner values will be considered "equal" here.
17884  */
17885 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
17886
17887 /**
17888  * Creates a copy of the Invoice
17889  */
17890 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17891
17892 /**
17893  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17894  */
17895 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17896
17897 /**
17898  * Checks if two SignedRawInvoices contain equal inner contents.
17899  * This ignores pointers and is_owned flags and looks at the values in fields.
17900  * Two objects with NULL inner values will be considered "equal" here.
17901  */
17902 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
17903
17904 /**
17905  * Creates a copy of the SignedRawInvoice
17906  */
17907 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17908
17909 /**
17910  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17911  */
17912 void RawInvoice_free(struct LDKRawInvoice this_obj);
17913
17914 /**
17915  * data part
17916  */
17917 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17918
17919 /**
17920  * data part
17921  */
17922 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17923
17924 /**
17925  * Checks if two RawInvoices contain equal inner contents.
17926  * This ignores pointers and is_owned flags and looks at the values in fields.
17927  * Two objects with NULL inner values will be considered "equal" here.
17928  */
17929 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
17930
17931 /**
17932  * Creates a copy of the RawInvoice
17933  */
17934 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17935
17936 /**
17937  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17938  */
17939 void RawDataPart_free(struct LDKRawDataPart this_obj);
17940
17941 /**
17942  * generation time of the invoice
17943  */
17944 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17945
17946 /**
17947  * generation time of the invoice
17948  */
17949 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17950
17951 /**
17952  * Checks if two RawDataParts contain equal inner contents.
17953  * This ignores pointers and is_owned flags and looks at the values in fields.
17954  * Two objects with NULL inner values will be considered "equal" here.
17955  */
17956 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
17957
17958 /**
17959  * Creates a copy of the RawDataPart
17960  */
17961 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17962
17963 /**
17964  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17965  */
17966 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17967
17968 /**
17969  * Checks if two PositiveTimestamps contain equal inner contents.
17970  * This ignores pointers and is_owned flags and looks at the values in fields.
17971  * Two objects with NULL inner values will be considered "equal" here.
17972  */
17973 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
17974
17975 /**
17976  * Creates a copy of the PositiveTimestamp
17977  */
17978 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17979
17980 /**
17981  * Creates a copy of the SiPrefix
17982  */
17983 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17984
17985 /**
17986  * Checks if two SiPrefixs contain equal inner contents.
17987  * This ignores pointers and is_owned flags and looks at the values in fields.
17988  */
17989 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
17990
17991 /**
17992  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17993  * This is effectively 10^12 * the prefix multiplier
17994  */
17995 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17996
17997 /**
17998  * Creates a copy of the Currency
17999  */
18000 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
18001
18002 /**
18003  * Checks if two Currencys contain equal inner contents.
18004  * This ignores pointers and is_owned flags and looks at the values in fields.
18005  */
18006 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
18007
18008 /**
18009  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
18010  */
18011 void Sha256_free(struct LDKSha256 this_obj);
18012
18013 /**
18014  * Checks if two Sha256s contain equal inner contents.
18015  * This ignores pointers and is_owned flags and looks at the values in fields.
18016  * Two objects with NULL inner values will be considered "equal" here.
18017  */
18018 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
18019
18020 /**
18021  * Creates a copy of the Sha256
18022  */
18023 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
18024
18025 /**
18026  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
18027  */
18028 void Description_free(struct LDKDescription this_obj);
18029
18030 /**
18031  * Checks if two Descriptions 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 Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
18036
18037 /**
18038  * Creates a copy of the Description
18039  */
18040 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
18041
18042 /**
18043  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
18044  */
18045 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
18046
18047 /**
18048  * Checks if two PayeePubKeys contain equal inner contents.
18049  * This ignores pointers and is_owned flags and looks at the values in fields.
18050  * Two objects with NULL inner values will be considered "equal" here.
18051  */
18052 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
18053
18054 /**
18055  * Creates a copy of the PayeePubKey
18056  */
18057 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
18058
18059 /**
18060  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
18061  */
18062 void ExpiryTime_free(struct LDKExpiryTime this_obj);
18063
18064 /**
18065  * Checks if two ExpiryTimes contain equal inner contents.
18066  * This ignores pointers and is_owned flags and looks at the values in fields.
18067  * Two objects with NULL inner values will be considered "equal" here.
18068  */
18069 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
18070
18071 /**
18072  * Creates a copy of the ExpiryTime
18073  */
18074 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
18075
18076 /**
18077  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
18078  */
18079 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
18080
18081 /**
18082  * Checks if two MinFinalCltvExpirys contain equal inner contents.
18083  * This ignores pointers and is_owned flags and looks at the values in fields.
18084  * Two objects with NULL inner values will be considered "equal" here.
18085  */
18086 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
18087
18088 /**
18089  * Creates a copy of the MinFinalCltvExpiry
18090  */
18091 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
18092
18093 /**
18094  * Frees any resources used by the Fallback
18095  */
18096 void Fallback_free(struct LDKFallback this_ptr);
18097
18098 /**
18099  * Creates a copy of the Fallback
18100  */
18101 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
18102
18103 /**
18104  * Checks if two Fallbacks contain equal inner contents.
18105  * This ignores pointers and is_owned flags and looks at the values in fields.
18106  */
18107 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
18108
18109 /**
18110  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
18111  */
18112 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
18113
18114 /**
18115  * Checks if two InvoiceSignatures contain equal inner contents.
18116  * This ignores pointers and is_owned flags and looks at the values in fields.
18117  * Two objects with NULL inner values will be considered "equal" here.
18118  */
18119 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
18120
18121 /**
18122  * Creates a copy of the InvoiceSignature
18123  */
18124 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
18125
18126 /**
18127  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
18128  */
18129 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
18130
18131 /**
18132  * Checks if two PrivateRoutes contain equal inner contents.
18133  * This ignores pointers and is_owned flags and looks at the values in fields.
18134  * Two objects with NULL inner values will be considered "equal" here.
18135  */
18136 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
18137
18138 /**
18139  * Creates a copy of the PrivateRoute
18140  */
18141 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
18142
18143 /**
18144  * Disassembles the `SignedRawInvoice` into its three parts:
18145  *  1. raw invoice
18146  *  2. hash of the raw invoice
18147  *  3. signature
18148  */
18149 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
18150
18151 /**
18152  * The `RawInvoice` which was signed.
18153  */
18154 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18155
18156 /**
18157  * The hash of the `RawInvoice` that was signed.
18158  */
18159 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
18160
18161 /**
18162  * InvoiceSignature for the invoice.
18163  */
18164 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18165
18166 /**
18167  * Recovers the public key used for signing the invoice from the recoverable signature.
18168  */
18169 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18170
18171 /**
18172  * Checks if the signature is valid for the included payee public key or if none exists if it's
18173  * valid for the recovered signature (which should always be true?).
18174  */
18175 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18176
18177 /**
18178  * Calculate the hash of the encoded `RawInvoice`
18179  */
18180 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18181
18182 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18183
18184 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18185
18186 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18187
18188 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18189
18190 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18191
18192 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18193
18194 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18195
18196 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18197
18198 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18199
18200 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18201
18202 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18203
18204 /**
18205  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
18206  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18207  * `CreationError::TimestampOutOfBounds`.
18208  */
18209 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
18210
18211 /**
18212  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
18213  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18214  * `CreationError::TimestampOutOfBounds`.
18215  */
18216 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
18217
18218 /**
18219  * Returns the UNIX timestamp representing the stored time
18220  */
18221 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18222
18223 /**
18224  * Returns a reference to the internal `SystemTime` time representation
18225  */
18226 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18227
18228 /**
18229  * Transform the `Invoice` into it's unchecked version
18230  */
18231 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
18232
18233 /**
18234  * Check that the invoice is signed correctly and that key recovery works
18235  */
18236 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
18237
18238 /**
18239  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
18240  * ```
18241  * use lightning_invoice::*;
18242  *
18243  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
18244  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
18245  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
18246  * \tky03ylcqca784w\";
18247  *
18248  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
18249  *
18250  * assert!(Invoice::from_signed(signed).is_ok());
18251  * ```
18252  */
18253 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
18254
18255 /**
18256  * Returns the `Invoice`'s timestamp (should equal it's creation time)
18257  */
18258 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
18259
18260 /**
18261  * Returns the hash to which we will receive the preimage on completion of the payment
18262  */
18263 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
18264
18265 /**
18266  * Get the payee's public key if one was included in the invoice
18267  */
18268 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18269
18270 /**
18271  * Get the payment secret if one was included in the invoice
18272  */
18273 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
18274
18275 /**
18276  * Get the invoice features if they were included in the invoice
18277  */
18278 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
18279
18280 /**
18281  * Recover the payee's public key (only to be used if none was included in the invoice)
18282  */
18283 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18284
18285 /**
18286  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
18287  */
18288 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
18289
18290 /**
18291  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
18292  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
18293  */
18294 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
18295
18296 /**
18297  * Returns a list of all routes included in the invoice
18298  */
18299 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
18300
18301 /**
18302  * Returns a list of all routes included in the invoice as the underlying hints
18303  */
18304 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
18305
18306 /**
18307  * Returns the currency for which the invoice was issued
18308  */
18309 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
18310
18311 /**
18312  * Returns the amount if specified in the invoice as pico <currency>.
18313  */
18314 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
18315
18316 /**
18317  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
18318  * returns `CreationError::DescriptionTooLong` otherwise
18319  *
18320  * Please note that single characters may use more than one byte due to UTF8 encoding.
18321  */
18322 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
18323
18324 /**
18325  * Returns the underlying description `String`
18326  */
18327 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
18328
18329 /**
18330  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
18331  * overflow on adding the `EpiryTime` to it then this function will return a
18332  * `CreationError::ExpiryTimeOutOfBounds`.
18333  */
18334 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
18335
18336 /**
18337  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
18338  * would overflow on adding the `EpiryTime` to it then this function will return a
18339  * `CreationError::ExpiryTimeOutOfBounds`.
18340  */
18341 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
18342
18343 /**
18344  * Returns the expiry time in seconds
18345  */
18346 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18347
18348 /**
18349  * Returns a reference to the underlying `Duration` (=expiry time)
18350  */
18351 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18352
18353 /**
18354  * Creates a new (partial) route from a list of hops
18355  */
18356 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
18357
18358 /**
18359  * Returns the underlying list of hops
18360  */
18361 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
18362
18363 /**
18364  * Creates a copy of the CreationError
18365  */
18366 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
18367
18368 /**
18369  * Checks if two CreationErrors contain equal inner contents.
18370  * This ignores pointers and is_owned flags and looks at the values in fields.
18371  */
18372 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
18373
18374 /**
18375  * Get the string representation of a CreationError object
18376  */
18377 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
18378
18379 /**
18380  * Creates a copy of the SemanticError
18381  */
18382 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
18383
18384 /**
18385  * Checks if two SemanticErrors contain equal inner contents.
18386  * This ignores pointers and is_owned flags and looks at the values in fields.
18387  */
18388 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
18389
18390 /**
18391  * Get the string representation of a SemanticError object
18392  */
18393 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
18394
18395 /**
18396  * Frees any resources used by the SignOrCreationError
18397  */
18398 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
18399
18400 /**
18401  * Creates a copy of the SignOrCreationError
18402  */
18403 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
18404
18405 /**
18406  * Checks if two SignOrCreationErrors contain equal inner contents.
18407  * This ignores pointers and is_owned flags and looks at the values in fields.
18408  */
18409 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
18410
18411 /**
18412  * Get the string representation of a SignOrCreationError object
18413  */
18414 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
18415
18416 /**
18417  * Utility to construct an invoice. Generally, unless you want to do something like a custom
18418  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
18419  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
18420  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
18421  * that the payment secret is valid when the invoice is paid.
18422  */
18423 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);
18424
18425 /**
18426  * Read a SiPrefix object from a string
18427  */
18428 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
18429
18430 /**
18431  * Read a Invoice object from a string
18432  */
18433 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18434
18435 /**
18436  * Read a SignedRawInvoice object from a string
18437  */
18438 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18439
18440 /**
18441  * Get the string representation of a Invoice object
18442  */
18443 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18444
18445 /**
18446  * Get the string representation of a SignedRawInvoice object
18447  */
18448 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18449
18450 /**
18451  * Get the string representation of a Currency object
18452  */
18453 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18454
18455 /**
18456  * Get the string representation of a SiPrefix object
18457  */
18458 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18459
18460 #endif /* LDK_C_BINDINGS_H */
18461
18462 #include <ldk_ver.h>