Merge pull request #27 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <ldk_rust_types.h>
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Bitcoin signet
172     */
173    LDKCurrency_Signet,
174    /**
175     * Must be last for serialization purposes
176     */
177    LDKCurrency_Sentinel,
178 } LDKCurrency;
179
180 /**
181  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
182  */
183 typedef enum LDKIOError {
184    LDKIOError_NotFound,
185    LDKIOError_PermissionDenied,
186    LDKIOError_ConnectionRefused,
187    LDKIOError_ConnectionReset,
188    LDKIOError_ConnectionAborted,
189    LDKIOError_NotConnected,
190    LDKIOError_AddrInUse,
191    LDKIOError_AddrNotAvailable,
192    LDKIOError_BrokenPipe,
193    LDKIOError_AlreadyExists,
194    LDKIOError_WouldBlock,
195    LDKIOError_InvalidInput,
196    LDKIOError_InvalidData,
197    LDKIOError_TimedOut,
198    LDKIOError_WriteZero,
199    LDKIOError_Interrupted,
200    LDKIOError_Other,
201    LDKIOError_UnexpectedEof,
202    /**
203     * Must be last for serialization purposes
204     */
205    LDKIOError_Sentinel,
206 } LDKIOError;
207
208 /**
209  * An enum representing the available verbosity levels of the logger.
210  */
211 typedef enum LDKLevel {
212    /**
213     *Designates 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 channel descriptor which provides a last-hop route to get_route
1429  */
1430 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
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    LDKnativeRouteHintHop *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 } LDKRouteHintHop;
1444
1445 /**
1446  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1447  * This corresponds to std::vector in C++
1448  */
1449 typedef struct LDKCVec_RouteHintHopZ {
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 LDKRouteHintHop *data;
1455    /**
1456     * The number of elements pointed to by `data`.
1457     */
1458    uintptr_t datalen;
1459 } LDKCVec_RouteHintHopZ;
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 LDKRouteHint {
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    LDKnativeRouteHint *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 } LDKRouteHint;
4822
4823 /**
4824  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
4825  * This corresponds to std::vector in C++
4826  */
4827 typedef struct LDKCVec_RouteHintZ {
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 LDKRouteHint *data;
4833    /**
4834     * The number of elements pointed to by `data`.
4835     */
4836    uintptr_t datalen;
4837 } LDKCVec_RouteHintZ;
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_RouteHintCreationErrorZ
5079  */
5080 typedef union LDKCResult_RouteHintCreationErrorZPtr {
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 LDKRouteHint *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_RouteHintCreationErrorZPtr;
5092
5093 /**
5094  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
5095  * containing a crate::lightning_invoice::RouteHint 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_RouteHintCreationErrorZ {
5099    /**
5100     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
5101     * `err` or `result` depending on the state of `result_ok`.
5102     */
5103    union LDKCResult_RouteHintCreationErrorZPtr contents;
5104    /**
5105     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
5106     */
5107    bool result_ok;
5108 } LDKCResult_RouteHintCreationErrorZ;
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 simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8750  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8751  * the C bindings, as it can be done directly in Rust code.
8752  */
8753 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8754    /**
8755     * A pointer to the opaque Rust object.
8756     * Nearly everywhere, inner must be non-null, however in places where
8757     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8758     */
8759    LDKnativeLockedNetworkGraph *inner;
8760    /**
8761     * Indicates that this is the only struct which contains the same pointer.
8762     * Rust functions which take ownership of an object provided via an argument require
8763     * this to be true and invalidate the object pointed to by inner.
8764     */
8765    bool is_owned;
8766 } LDKLockedNetworkGraph;
8767
8768
8769
8770 /**
8771  * Receives and validates network updates from peers,
8772  * stores authentic and relevant data as a network graph.
8773  * This network graph is then used for routing payments.
8774  * Provides interface to help with initial routing sync by
8775  * serving historical announcements.
8776  */
8777 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8778    /**
8779     * A pointer to the opaque Rust object.
8780     * Nearly everywhere, inner must be non-null, however in places where
8781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8782     */
8783    LDKnativeNetGraphMsgHandler *inner;
8784    /**
8785     * Indicates that this is the only struct which contains the same pointer.
8786     * Rust functions which take ownership of an object provided via an argument require
8787     * this to be true and invalidate the object pointed to by inner.
8788     */
8789    bool is_owned;
8790 } LDKNetGraphMsgHandler;
8791
8792
8793
8794 /**
8795  * FilesystemPersister persists channel data on disk, where each channel's
8796  * data is stored in a file named after its funding outpoint.
8797  *
8798  * Warning: this module does the best it can with calls to persist data, but it
8799  * can only guarantee that the data is passed to the drive. It is up to the
8800  * drive manufacturers to do the actual persistence properly, which they often
8801  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8802  * user to validate their entire storage stack, to ensure the writes are
8803  * persistent.
8804  * Corollary: especially when dealing with larger amounts of money, it is best
8805  * practice to have multiple channel data backups and not rely only on one
8806  * FilesystemPersister.
8807  */
8808 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8809    /**
8810     * A pointer to the opaque Rust object.
8811     * Nearly everywhere, inner must be non-null, however in places where
8812     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8813     */
8814    LDKnativeFilesystemPersister *inner;
8815    /**
8816     * Indicates that this is the only struct which contains the same pointer.
8817     * Rust functions which take ownership of an object provided via an argument require
8818     * this to be true and invalidate the object pointed to by inner.
8819     */
8820    bool is_owned;
8821 } LDKFilesystemPersister;
8822
8823
8824
8825 /**
8826  * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
8827  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
8828  * responsibilities are:
8829  * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
8830  *   writing it to disk/backups by invoking the callback given to it at startup.
8831  *   ChannelManager persistence should be done in the background.
8832  * * Calling `ChannelManager::timer_tick_occurred()` and
8833  *   `PeerManager::timer_tick_occurred()` every minute (can be done in the
8834  *   background).
8835  *
8836  * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
8837  * then there is a risk of channels force-closing on startup when the manager realizes it's
8838  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
8839  * for unilateral chain closure fees are at risk.
8840  */
8841 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
8842    /**
8843     * A pointer to the opaque Rust object.
8844     * Nearly everywhere, inner must be non-null, however in places where
8845     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8846     */
8847    LDKnativeBackgroundProcessor *inner;
8848    /**
8849     * Indicates that this is the only struct which contains the same pointer.
8850     * Rust functions which take ownership of an object provided via an argument require
8851     * this to be true and invalidate the object pointed to by inner.
8852     */
8853    bool is_owned;
8854 } LDKBackgroundProcessor;
8855
8856 /**
8857  * Trait which handles persisting a [`ChannelManager`] to disk.
8858  *
8859  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8860  */
8861 typedef struct LDKChannelManagerPersister {
8862    /**
8863     * An opaque pointer which is passed to your function implementations as an argument.
8864     * This has no meaning in the LDK, and can be NULL or any other value.
8865     */
8866    void *this_arg;
8867    /**
8868     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
8869     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
8870     *
8871     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8872     */
8873    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
8874    /**
8875     * Frees any resources associated with this object given its this_arg pointer.
8876     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8877     */
8878    void (*free)(void *this_arg);
8879 } LDKChannelManagerPersister;
8880
8881
8882
8883 /**
8884  * Data of the `RawInvoice` that is encoded in the data part
8885  */
8886 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8887    /**
8888     * A pointer to the opaque Rust object.
8889     * Nearly everywhere, inner must be non-null, however in places where
8890     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8891     */
8892    LDKnativeRawDataPart *inner;
8893    /**
8894     * Indicates that this is the only struct which contains the same pointer.
8895     * Rust functions which take ownership of an object provided via an argument require
8896     * this to be true and invalidate the object pointed to by inner.
8897     */
8898    bool is_owned;
8899 } LDKRawDataPart;
8900
8901
8902
8903 /**
8904  * SHA-256 hash
8905  */
8906 typedef struct MUST_USE_STRUCT LDKSha256 {
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    LDKnativeSha256 *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 } LDKSha256;
8920
8921
8922
8923 /**
8924  * `min_final_cltv_expiry` to use for the last HTLC in the route
8925  */
8926 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
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    LDKnativeMinFinalCltvExpiry *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 } LDKMinFinalCltvExpiry;
8940
8941 /**
8942  * Integer in the range `0..32`
8943  */
8944 typedef struct LDKu5 {
8945    uint8_t _0;
8946 } LDKu5;
8947
8948 /**
8949  * A 20-byte byte array.
8950  */
8951 typedef struct LDKTwentyBytes {
8952    /**
8953     * The twenty bytes
8954     */
8955    uint8_t data[20];
8956 } LDKTwentyBytes;
8957
8958 /**
8959  * Fallback address in case no LN payment is possible
8960  */
8961 typedef enum LDKFallback_Tag {
8962    LDKFallback_SegWitProgram,
8963    LDKFallback_PubKeyHash,
8964    LDKFallback_ScriptHash,
8965    /**
8966     * Must be last for serialization purposes
8967     */
8968    LDKFallback_Sentinel,
8969 } LDKFallback_Tag;
8970
8971 typedef struct LDKFallback_LDKSegWitProgram_Body {
8972    struct LDKu5 version;
8973    struct LDKCVec_u8Z program;
8974 } LDKFallback_LDKSegWitProgram_Body;
8975
8976 typedef struct MUST_USE_STRUCT LDKFallback {
8977    LDKFallback_Tag tag;
8978    union {
8979       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8980       struct {
8981          struct LDKTwentyBytes pub_key_hash;
8982       };
8983       struct {
8984          struct LDKTwentyBytes script_hash;
8985       };
8986    };
8987 } LDKFallback;
8988
8989 extern const uintptr_t MAX_BUF_SIZE;
8990
8991 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8992
8993 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8994
8995 extern const uint32_t ANTI_REORG_DELAY;
8996
8997 extern const uint16_t BREAKDOWN_TIMEOUT;
8998
8999 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
9000
9001 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
9002
9003 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
9004
9005 extern const uint8_t TAG_PAYMENT_HASH;
9006
9007 extern const uint8_t TAG_DESCRIPTION;
9008
9009 extern const uint8_t TAG_PAYEE_PUB_KEY;
9010
9011 extern const uint8_t TAG_DESCRIPTION_HASH;
9012
9013 extern const uint8_t TAG_EXPIRY_TIME;
9014
9015 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
9016
9017 extern const uint8_t TAG_FALLBACK;
9018
9019 extern const uint8_t TAG_ROUTE;
9020
9021 extern const uint8_t TAG_PAYMENT_SECRET;
9022
9023 extern const uint8_t TAG_FEATURES;
9024
9025 struct LDKStr _ldk_get_compiled_version(void);
9026
9027 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
9028
9029 /**
9030  * Frees the data buffer, if data_is_owned is set and datalen > 0.
9031  */
9032 void Transaction_free(struct LDKTransaction _res);
9033
9034 /**
9035  * Frees the data pointed to by script_pubkey.
9036  */
9037 void TxOut_free(struct LDKTxOut _res);
9038
9039 /**
9040  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
9041  */
9042 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
9043
9044 /**
9045  * Frees the data buffer, if chars_is_owned is set and len > 0.
9046  */
9047 void Str_free(struct LDKStr _res);
9048
9049 /**
9050  * Creates a new CResult_SecretKeyErrorZ in the success state.
9051  */
9052 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9053
9054 /**
9055  * Creates a new CResult_SecretKeyErrorZ in the error state.
9056  */
9057 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9058
9059 /**
9060  * Frees any resources used by the CResult_SecretKeyErrorZ.
9061  */
9062 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9063
9064 /**
9065  * Creates a new CResult_PublicKeyErrorZ in the success state.
9066  */
9067 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9068
9069 /**
9070  * Creates a new CResult_PublicKeyErrorZ in the error state.
9071  */
9072 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9073
9074 /**
9075  * Frees any resources used by the CResult_PublicKeyErrorZ.
9076  */
9077 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9078
9079 /**
9080  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
9081  * but with all dynamically-allocated buffers duplicated in new buffers.
9082  */
9083 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
9084
9085 /**
9086  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9087  */
9088 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9089
9090 /**
9091  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9092  */
9093 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9094
9095 /**
9096  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9097  */
9098 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9099
9100 /**
9101  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9102  * but with all dynamically-allocated buffers duplicated in new buffers.
9103  */
9104 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9105
9106 /**
9107  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9108  */
9109 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9110
9111 /**
9112  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9113  */
9114 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9115
9116 /**
9117  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9118  */
9119 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9120
9121 /**
9122  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9123  * but with all dynamically-allocated buffers duplicated in new buffers.
9124  */
9125 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9126
9127 /**
9128  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9129  */
9130 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9131
9132 /**
9133  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9134  */
9135 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9136
9137 /**
9138  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9139  */
9140 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9141
9142 /**
9143  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
9144  * but with all dynamically-allocated buffers duplicated in new buffers.
9145  */
9146 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
9147
9148 /**
9149  * Constructs a new COption_u32Z containing a u32
9150  */
9151 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9152
9153 /**
9154  * Constructs a new COption_u32Z containing nothing
9155  */
9156 struct LDKCOption_u32Z COption_u32Z_none(void);
9157
9158 /**
9159  * Frees any resources associated with the u32, if we are in the Some state
9160  */
9161 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9162
9163 /**
9164  * Creates a new COption_u32Z which has the same data as `orig`
9165  * but with all dynamically-allocated buffers duplicated in new buffers.
9166  */
9167 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9168
9169 /**
9170  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9171  */
9172 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9173
9174 /**
9175  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9176  */
9177 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9178
9179 /**
9180  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9181  */
9182 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9183
9184 /**
9185  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9186  * but with all dynamically-allocated buffers duplicated in new buffers.
9187  */
9188 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9189
9190 /**
9191  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9192  */
9193 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9194
9195 /**
9196  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9197  */
9198 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9199
9200 /**
9201  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9202  */
9203 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9204
9205 /**
9206  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9207  * but with all dynamically-allocated buffers duplicated in new buffers.
9208  */
9209 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9210
9211 /**
9212  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9213  */
9214 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9215
9216 /**
9217  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9218  */
9219 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9220
9221 /**
9222  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9223  */
9224 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9225
9226 /**
9227  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9228  * but with all dynamically-allocated buffers duplicated in new buffers.
9229  */
9230 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9231
9232 /**
9233  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9234  */
9235 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9236
9237 /**
9238  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9239  */
9240 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9241
9242 /**
9243  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9244  */
9245 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9246
9247 /**
9248  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9249  */
9250 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9251
9252 /**
9253  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9254  * but with all dynamically-allocated buffers duplicated in new buffers.
9255  */
9256 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9257
9258 /**
9259  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9260  */
9261 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9262
9263 /**
9264  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9265  */
9266 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9267
9268 /**
9269  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9270  */
9271 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9272
9273 /**
9274  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9275  * but with all dynamically-allocated buffers duplicated in new buffers.
9276  */
9277 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9278
9279 /**
9280  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9281  */
9282 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9283
9284 /**
9285  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9286  */
9287 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9288
9289 /**
9290  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9291  */
9292 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9293
9294 /**
9295  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9296  * but with all dynamically-allocated buffers duplicated in new buffers.
9297  */
9298 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9299
9300 /**
9301  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9302  */
9303 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9304
9305 /**
9306  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9307  */
9308 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9309
9310 /**
9311  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9312  */
9313 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9314
9315 /**
9316  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9317  */
9318 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9319
9320 /**
9321  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9322  */
9323 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9324
9325 /**
9326  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9327  */
9328 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9329
9330 /**
9331  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9332  * but with all dynamically-allocated buffers duplicated in new buffers.
9333  */
9334 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9335
9336 /**
9337  * Creates a new CResult_NoneErrorZ in the success state.
9338  */
9339 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9340
9341 /**
9342  * Creates a new CResult_NoneErrorZ in the error state.
9343  */
9344 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9345
9346 /**
9347  * Frees any resources used by the CResult_NoneErrorZ.
9348  */
9349 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9350
9351 /**
9352  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
9353  * but with all dynamically-allocated buffers duplicated in new buffers.
9354  */
9355 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
9356
9357 /**
9358  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9359  */
9360 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9361
9362 /**
9363  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9364  */
9365 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9366
9367 /**
9368  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9369  */
9370 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9371
9372 /**
9373  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9374  * but with all dynamically-allocated buffers duplicated in new buffers.
9375  */
9376 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9377
9378 /**
9379  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9380  */
9381 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9382
9383 /**
9384  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9385  */
9386 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9387
9388 /**
9389  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9390  */
9391 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9392
9393 /**
9394  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9395  */
9396 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9397
9398 /**
9399  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9400  */
9401 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9402
9403 /**
9404  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9405  * but with all dynamically-allocated buffers duplicated in new buffers.
9406  */
9407 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9408
9409 /**
9410  * Constructs a new COption_u64Z containing a u64
9411  */
9412 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9413
9414 /**
9415  * Constructs a new COption_u64Z containing nothing
9416  */
9417 struct LDKCOption_u64Z COption_u64Z_none(void);
9418
9419 /**
9420  * Frees any resources associated with the u64, if we are in the Some state
9421  */
9422 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9423
9424 /**
9425  * Creates a new COption_u64Z which has the same data as `orig`
9426  * but with all dynamically-allocated buffers duplicated in new buffers.
9427  */
9428 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9429
9430 /**
9431  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9432  */
9433 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9434
9435 /**
9436  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9437  */
9438 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9439
9440 /**
9441  * Creates a new CResult_RouteLightningErrorZ in the success state.
9442  */
9443 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9444
9445 /**
9446  * Creates a new CResult_RouteLightningErrorZ in the error state.
9447  */
9448 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9449
9450 /**
9451  * Frees any resources used by the CResult_RouteLightningErrorZ.
9452  */
9453 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9454
9455 /**
9456  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9457  * but with all dynamically-allocated buffers duplicated in new buffers.
9458  */
9459 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9460
9461 /**
9462  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9463  */
9464 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9465
9466 /**
9467  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9468  */
9469 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9470
9471 /**
9472  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9473  */
9474 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9475
9476 /**
9477  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9478  * but with all dynamically-allocated buffers duplicated in new buffers.
9479  */
9480 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9481
9482 /**
9483  * Creates a new tuple which has the same data as `orig`
9484  * but with all dynamically-allocated buffers duplicated in new buffers.
9485  */
9486 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
9487
9488 /**
9489  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9490  */
9491 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9492
9493 /**
9494  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9495  */
9496 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9497
9498 /**
9499  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9500  */
9501 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9502
9503 /**
9504  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9505  */
9506 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9507
9508 /**
9509  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9510  */
9511 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9512
9513 /**
9514  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9515  */
9516 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9517
9518 /**
9519  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9520  */
9521 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9522
9523 /**
9524  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9525  * but with all dynamically-allocated buffers duplicated in new buffers.
9526  */
9527 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9528
9529 /**
9530  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9531  */
9532 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9533
9534 /**
9535  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9536  */
9537 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9538
9539 /**
9540  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9541  */
9542 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9543
9544 /**
9545  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9546  */
9547 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9548
9549 /**
9550  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
9551  * but with all dynamically-allocated buffers duplicated in new buffers.
9552  */
9553 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
9554
9555 /**
9556  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9557  */
9558 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9559
9560 /**
9561  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9562  */
9563 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9564
9565 /**
9566  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9567  */
9568 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9569
9570 /**
9571  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9572  */
9573 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9574
9575 /**
9576  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9577  */
9578 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9579
9580 /**
9581  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9582  */
9583 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9584
9585 /**
9586  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9587  */
9588 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9589
9590 /**
9591  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9592  */
9593 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9594
9595 /**
9596  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
9597  */
9598 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
9599
9600 /**
9601  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
9602  */
9603 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9604
9605 /**
9606  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
9607  */
9608 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
9609
9610 /**
9611  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
9612  */
9613 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
9614
9615 /**
9616  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
9617  */
9618 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9619
9620 /**
9621  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
9622  */
9623 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
9624
9625 /**
9626  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9627  */
9628 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
9629
9630 /**
9631  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9632  */
9633 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9634
9635 /**
9636  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9637  */
9638 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
9639
9640 /**
9641  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9642  * but with all dynamically-allocated buffers duplicated in new buffers.
9643  */
9644 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9645
9646 /**
9647  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9648  */
9649 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
9650
9651 /**
9652  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9653  */
9654 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9655
9656 /**
9657  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9658  */
9659 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
9660
9661 /**
9662  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9663  * but with all dynamically-allocated buffers duplicated in new buffers.
9664  */
9665 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9666
9667 /**
9668  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9669  */
9670 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9671
9672 /**
9673  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9674  */
9675 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9676
9677 /**
9678  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9679  */
9680 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9681
9682 /**
9683  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9684  * but with all dynamically-allocated buffers duplicated in new buffers.
9685  */
9686 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9687
9688 /**
9689  * Creates a new tuple which has the same data as `orig`
9690  * but with all dynamically-allocated buffers duplicated in new buffers.
9691  */
9692 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9693
9694 /**
9695  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9696  */
9697 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9698
9699 /**
9700  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9701  */
9702 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9703
9704 /**
9705  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9706  */
9707 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9708
9709 /**
9710  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9711  */
9712 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9713
9714 /**
9715  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9716  */
9717 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9718
9719 /**
9720  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9721  * but with all dynamically-allocated buffers duplicated in new buffers.
9722  */
9723 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9724
9725 /**
9726  * Creates a new CResult_SignatureNoneZ in the success state.
9727  */
9728 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9729
9730 /**
9731  * Creates a new CResult_SignatureNoneZ in the error state.
9732  */
9733 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9734
9735 /**
9736  * Frees any resources used by the CResult_SignatureNoneZ.
9737  */
9738 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9739
9740 /**
9741  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9742  * but with all dynamically-allocated buffers duplicated in new buffers.
9743  */
9744 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9745
9746 /**
9747  * Creates a new CResult_SignDecodeErrorZ in the success state.
9748  */
9749 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9750
9751 /**
9752  * Creates a new CResult_SignDecodeErrorZ in the error state.
9753  */
9754 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9755
9756 /**
9757  * Frees any resources used by the CResult_SignDecodeErrorZ.
9758  */
9759 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9760
9761 /**
9762  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9763  * but with all dynamically-allocated buffers duplicated in new buffers.
9764  */
9765 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9766
9767 /**
9768  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9769  */
9770 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9771
9772 /**
9773  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9774  */
9775 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
9776
9777 /**
9778  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9779  */
9780 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
9781
9782 /**
9783  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9784  */
9785 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
9786
9787 /**
9788  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9789  * but with all dynamically-allocated buffers duplicated in new buffers.
9790  */
9791 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
9792
9793 /**
9794  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9795  */
9796 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9797
9798 /**
9799  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9800  */
9801 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9802
9803 /**
9804  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9805  */
9806 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9807
9808 /**
9809  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9810  */
9811 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9812
9813 /**
9814  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9815  * but with all dynamically-allocated buffers duplicated in new buffers.
9816  */
9817 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9818
9819 /**
9820  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9821  */
9822 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9823
9824 /**
9825  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9826  */
9827 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9828
9829 /**
9830  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9831  */
9832 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9833
9834 /**
9835  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9836  * but with all dynamically-allocated buffers duplicated in new buffers.
9837  */
9838 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9839
9840 /**
9841  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9842  */
9843 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9844
9845 /**
9846  * Creates a new CResult_TransactionNoneZ in the success state.
9847  */
9848 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9849
9850 /**
9851  * Creates a new CResult_TransactionNoneZ in the error state.
9852  */
9853 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9854
9855 /**
9856  * Frees any resources used by the CResult_TransactionNoneZ.
9857  */
9858 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9859
9860 /**
9861  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
9862  * but with all dynamically-allocated buffers duplicated in new buffers.
9863  */
9864 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
9865
9866 /**
9867  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9868  */
9869 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9870
9871 /**
9872  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9873  */
9874 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9875
9876 /**
9877  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9878  */
9879 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9880
9881 /**
9882  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9883  */
9884 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9885
9886 /**
9887  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9888  */
9889 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9890
9891 /**
9892  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9893  */
9894 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9895
9896 /**
9897  * Creates a new CResult_NoneAPIErrorZ in the success state.
9898  */
9899 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9900
9901 /**
9902  * Creates a new CResult_NoneAPIErrorZ in the error state.
9903  */
9904 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9905
9906 /**
9907  * Frees any resources used by the CResult_NoneAPIErrorZ.
9908  */
9909 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9910
9911 /**
9912  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9913  * but with all dynamically-allocated buffers duplicated in new buffers.
9914  */
9915 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9916
9917 /**
9918  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9919  */
9920 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9921
9922 /**
9923  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9924  */
9925 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9926
9927 /**
9928  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9929  */
9930 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9931
9932 /**
9933  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9934  */
9935 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9936
9937 /**
9938  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9939  */
9940 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9941
9942 /**
9943  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9944  * but with all dynamically-allocated buffers duplicated in new buffers.
9945  */
9946 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9947
9948 /**
9949  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9950  */
9951 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9952
9953 /**
9954  * Creates a new tuple which has the same data as `orig`
9955  * but with all dynamically-allocated buffers duplicated in new buffers.
9956  */
9957 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
9958
9959 /**
9960  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9961  */
9962 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
9963
9964 /**
9965  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9966  */
9967 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
9968
9969 /**
9970  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9971  */
9972 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
9973
9974 /**
9975  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9976  */
9977 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
9978
9979 /**
9980  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9981  */
9982 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
9983
9984 /**
9985  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9986  * but with all dynamically-allocated buffers duplicated in new buffers.
9987  */
9988 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
9989
9990 /**
9991  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9992  */
9993 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9994
9995 /**
9996  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9997  */
9998 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9999
10000 /**
10001  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10002  */
10003 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
10004
10005 /**
10006  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10007  */
10008 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10009
10010 /**
10011  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10012  */
10013 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10014
10015 /**
10016  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10017  */
10018 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10019
10020 /**
10021  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10022  */
10023 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
10024
10025 /**
10026  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10027  */
10028 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
10029
10030 /**
10031  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10032  */
10033 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
10034
10035 /**
10036  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10037  * but with all dynamically-allocated buffers duplicated in new buffers.
10038  */
10039 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
10040
10041 /**
10042  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
10043  */
10044 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
10045
10046 /**
10047  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
10048  */
10049 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
10050
10051 /**
10052  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
10053  */
10054 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
10055
10056 /**
10057  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10058  * but with all dynamically-allocated buffers duplicated in new buffers.
10059  */
10060 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
10061
10062 /**
10063  * Creates a new CResult_SiPrefixNoneZ in the success state.
10064  */
10065 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
10066
10067 /**
10068  * Creates a new CResult_SiPrefixNoneZ in the error state.
10069  */
10070 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
10071
10072 /**
10073  * Frees any resources used by the CResult_SiPrefixNoneZ.
10074  */
10075 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
10076
10077 /**
10078  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
10079  * but with all dynamically-allocated buffers duplicated in new buffers.
10080  */
10081 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
10082
10083 /**
10084  * Creates a new CResult_InvoiceNoneZ in the success state.
10085  */
10086 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
10087
10088 /**
10089  * Creates a new CResult_InvoiceNoneZ in the error state.
10090  */
10091 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
10092
10093 /**
10094  * Frees any resources used by the CResult_InvoiceNoneZ.
10095  */
10096 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
10097
10098 /**
10099  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
10100  * but with all dynamically-allocated buffers duplicated in new buffers.
10101  */
10102 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
10103
10104 /**
10105  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
10106  */
10107 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
10108
10109 /**
10110  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
10111  */
10112 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
10113
10114 /**
10115  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
10116  */
10117 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
10118
10119 /**
10120  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
10121  * but with all dynamically-allocated buffers duplicated in new buffers.
10122  */
10123 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
10124
10125 /**
10126  * Creates a new tuple which has the same data as `orig`
10127  * but with all dynamically-allocated buffers duplicated in new buffers.
10128  */
10129 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
10130
10131 /**
10132  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10133  */
10134 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
10135
10136 /**
10137  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10138  */
10139 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
10140
10141 /**
10142  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
10143  */
10144 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
10145
10146 /**
10147  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
10148  */
10149 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
10150
10151 /**
10152  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
10153  */
10154 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
10155
10156 /**
10157  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10158  * but with all dynamically-allocated buffers duplicated in new buffers.
10159  */
10160 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
10161
10162 /**
10163  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10164  */
10165 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
10166
10167 /**
10168  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10169  */
10170 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
10171
10172 /**
10173  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10174  */
10175 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
10176
10177 /**
10178  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10179  */
10180 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
10181
10182 /**
10183  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10184  * but with all dynamically-allocated buffers duplicated in new buffers.
10185  */
10186 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
10187
10188 /**
10189  * Creates a new CResult_NoneSemanticErrorZ in the success state.
10190  */
10191 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
10192
10193 /**
10194  * Creates a new CResult_NoneSemanticErrorZ in the error state.
10195  */
10196 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
10197
10198 /**
10199  * Frees any resources used by the CResult_NoneSemanticErrorZ.
10200  */
10201 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
10202
10203 /**
10204  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10205  * but with all dynamically-allocated buffers duplicated in new buffers.
10206  */
10207 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
10208
10209 /**
10210  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10211  */
10212 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
10213
10214 /**
10215  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10216  */
10217 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
10218
10219 /**
10220  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10221  */
10222 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
10223
10224 /**
10225  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10226  * but with all dynamically-allocated buffers duplicated in new buffers.
10227  */
10228 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
10229
10230 /**
10231  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
10232  */
10233 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
10234
10235 /**
10236  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
10237  */
10238 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
10239
10240 /**
10241  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
10242  */
10243 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
10244
10245 /**
10246  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10247  * but with all dynamically-allocated buffers duplicated in new buffers.
10248  */
10249 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
10250
10251 /**
10252  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
10253  */
10254 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
10255
10256 /**
10257  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
10258  */
10259 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
10260
10261 /**
10262  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
10263  */
10264 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
10265
10266 /**
10267  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
10268  * but with all dynamically-allocated buffers duplicated in new buffers.
10269  */
10270 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
10271
10272 /**
10273  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
10274  */
10275 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
10276
10277 /**
10278  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
10279  */
10280 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
10281
10282 /**
10283  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
10284  */
10285 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
10286
10287 /**
10288  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
10289  * but with all dynamically-allocated buffers duplicated in new buffers.
10290  */
10291 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
10292
10293 /**
10294  * Creates a new CResult_StringErrorZ in the success state.
10295  */
10296 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
10297
10298 /**
10299  * Creates a new CResult_StringErrorZ in the error state.
10300  */
10301 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
10302
10303 /**
10304  * Frees any resources used by the CResult_StringErrorZ.
10305  */
10306 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
10307
10308 /**
10309  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10310  */
10311 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
10312
10313 /**
10314  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10315  */
10316 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10317
10318 /**
10319  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10320  */
10321 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
10322
10323 /**
10324  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10325  * but with all dynamically-allocated buffers duplicated in new buffers.
10326  */
10327 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
10328
10329 /**
10330  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10331  */
10332 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
10333
10334 /**
10335  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10336  */
10337 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10338
10339 /**
10340  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10341  */
10342 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
10343
10344 /**
10345  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10346  * but with all dynamically-allocated buffers duplicated in new buffers.
10347  */
10348 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
10349
10350 /**
10351  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
10352  */
10353 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
10354
10355 /**
10356  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
10357  */
10358 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
10359
10360 /**
10361  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
10362  */
10363 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
10364
10365 /**
10366  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
10367  * but with all dynamically-allocated buffers duplicated in new buffers.
10368  */
10369 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
10370
10371 /**
10372  * Creates a new tuple which has the same data as `orig`
10373  * but with all dynamically-allocated buffers duplicated in new buffers.
10374  */
10375 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
10376
10377 /**
10378  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10379  */
10380 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
10381
10382 /**
10383  * Frees any resources used by the C2Tuple_OutPointScriptZ.
10384  */
10385 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
10386
10387 /**
10388  * Creates a new tuple which has the same data as `orig`
10389  * but with all dynamically-allocated buffers duplicated in new buffers.
10390  */
10391 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
10392
10393 /**
10394  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
10395  */
10396 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
10397
10398 /**
10399  * Frees any resources used by the C2Tuple_u32ScriptZ.
10400  */
10401 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
10402
10403 /**
10404  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10405  */
10406 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
10407
10408 /**
10409  * Creates a new tuple which has the same data as `orig`
10410  * but with all dynamically-allocated buffers duplicated in new buffers.
10411  */
10412 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
10413
10414 /**
10415  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10416  */
10417 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
10418
10419 /**
10420  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10421  */
10422 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
10423
10424 /**
10425  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10426  */
10427 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
10428
10429 /**
10430  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10431  */
10432 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
10433
10434 /**
10435  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10436  */
10437 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
10438
10439 /**
10440  * Creates a new tuple which has the same data as `orig`
10441  * but with all dynamically-allocated buffers duplicated in new buffers.
10442  */
10443 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
10444
10445 /**
10446  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
10447  */
10448 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
10449
10450 /**
10451  * Frees any resources used by the C2Tuple_u32TxOutZ.
10452  */
10453 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
10454
10455 /**
10456  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10457  */
10458 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
10459
10460 /**
10461  * Creates a new tuple which has the same data as `orig`
10462  * but with all dynamically-allocated buffers duplicated in new buffers.
10463  */
10464 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
10465
10466 /**
10467  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10468  */
10469 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
10470
10471 /**
10472  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10473  */
10474 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
10475
10476 /**
10477  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10478  */
10479 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
10480
10481 /**
10482  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10483  */
10484 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
10485
10486 /**
10487  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10488  */
10489 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
10490
10491 /**
10492  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10493  */
10494 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
10495
10496 /**
10497  * Creates a new CResult_boolLightningErrorZ in the success state.
10498  */
10499 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
10500
10501 /**
10502  * Creates a new CResult_boolLightningErrorZ in the error state.
10503  */
10504 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
10505
10506 /**
10507  * Frees any resources used by the CResult_boolLightningErrorZ.
10508  */
10509 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
10510
10511 /**
10512  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10513  * but with all dynamically-allocated buffers duplicated in new buffers.
10514  */
10515 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
10516
10517 /**
10518  * Creates a new tuple which has the same data as `orig`
10519  * but with all dynamically-allocated buffers duplicated in new buffers.
10520  */
10521 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
10522
10523 /**
10524  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10525  */
10526 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
10527
10528 /**
10529  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10530  */
10531 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
10532
10533 /**
10534  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10535  */
10536 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
10537
10538 /**
10539  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10540  */
10541 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
10542
10543 /**
10544  * Creates a new CResult_NoneLightningErrorZ in the success state.
10545  */
10546 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
10547
10548 /**
10549  * Creates a new CResult_NoneLightningErrorZ in the error state.
10550  */
10551 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
10552
10553 /**
10554  * Frees any resources used by the CResult_NoneLightningErrorZ.
10555  */
10556 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
10557
10558 /**
10559  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10560  * but with all dynamically-allocated buffers duplicated in new buffers.
10561  */
10562 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
10563
10564 /**
10565  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10566  */
10567 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
10568
10569 /**
10570  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10571  */
10572 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
10573
10574 /**
10575  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10576  */
10577 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10578
10579 /**
10580  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10581  */
10582 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
10583
10584 /**
10585  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10586  * but with all dynamically-allocated buffers duplicated in new buffers.
10587  */
10588 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
10589
10590 /**
10591  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
10592  */
10593 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
10594
10595 /**
10596  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
10597  */
10598 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
10599
10600 /**
10601  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
10602  */
10603 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
10604
10605 /**
10606  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10607  * but with all dynamically-allocated buffers duplicated in new buffers.
10608  */
10609 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
10610
10611 /**
10612  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
10613  */
10614 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
10615
10616 /**
10617  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
10618  */
10619 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10620
10621 /**
10622  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
10623  */
10624 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
10625
10626 /**
10627  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10628  * but with all dynamically-allocated buffers duplicated in new buffers.
10629  */
10630 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
10631
10632 /**
10633  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10634  */
10635 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
10636
10637 /**
10638  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10639  */
10640 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10641
10642 /**
10643  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10644  */
10645 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
10646
10647 /**
10648  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10649  * but with all dynamically-allocated buffers duplicated in new buffers.
10650  */
10651 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10652
10653 /**
10654  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10655  */
10656 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
10657
10658 /**
10659  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10660  */
10661 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10662
10663 /**
10664  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10665  */
10666 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
10667
10668 /**
10669  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10670  * but with all dynamically-allocated buffers duplicated in new buffers.
10671  */
10672 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10673
10674 /**
10675  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10676  */
10677 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
10678
10679 /**
10680  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10681  */
10682 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
10683
10684 /**
10685  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10686  */
10687 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
10688
10689 /**
10690  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10691  * but with all dynamically-allocated buffers duplicated in new buffers.
10692  */
10693 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10694
10695 /**
10696  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10697  */
10698 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10699
10700 /**
10701  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10702  */
10703 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10704
10705 /**
10706  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10707  */
10708 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10709
10710 /**
10711  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10712  * but with all dynamically-allocated buffers duplicated in new buffers.
10713  */
10714 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10715
10716 /**
10717  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10718  */
10719 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10720
10721 /**
10722  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10723  */
10724 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10725
10726 /**
10727  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10728  */
10729 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10730
10731 /**
10732  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10733  */
10734 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10735
10736 /**
10737  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10738  * but with all dynamically-allocated buffers duplicated in new buffers.
10739  */
10740 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10741
10742 /**
10743  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10744  */
10745 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10746
10747 /**
10748  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10749  */
10750 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10751
10752 /**
10753  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10754  */
10755 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10756
10757 /**
10758  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10759  * but with all dynamically-allocated buffers duplicated in new buffers.
10760  */
10761 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10762
10763 /**
10764  * Creates a new CResult_NetAddressu8Z in the success state.
10765  */
10766 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10767
10768 /**
10769  * Creates a new CResult_NetAddressu8Z in the error state.
10770  */
10771 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10772
10773 /**
10774  * Frees any resources used by the CResult_NetAddressu8Z.
10775  */
10776 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10777
10778 /**
10779  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10780  * but with all dynamically-allocated buffers duplicated in new buffers.
10781  */
10782 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10783
10784 /**
10785  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10786  */
10787 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10788
10789 /**
10790  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10791  */
10792 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10793
10794 /**
10795  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10796  */
10797 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10798
10799 /**
10800  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10801  * but with all dynamically-allocated buffers duplicated in new buffers.
10802  */
10803 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10804
10805 /**
10806  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10807  */
10808 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
10809
10810 /**
10811  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10812  */
10813 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
10814
10815 /**
10816  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10817  */
10818 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
10819
10820 /**
10821  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10822  * but with all dynamically-allocated buffers duplicated in new buffers.
10823  */
10824 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
10825
10826 /**
10827  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10828  */
10829 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10830
10831 /**
10832  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10833  */
10834 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10835
10836 /**
10837  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10838  */
10839 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10840
10841 /**
10842  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10843  */
10844 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10845
10846 /**
10847  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10848  */
10849 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10850
10851 /**
10852  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10853  */
10854 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10855
10856 /**
10857  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10858  */
10859 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10860
10861 /**
10862  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10863  * but with all dynamically-allocated buffers duplicated in new buffers.
10864  */
10865 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10866
10867 /**
10868  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10869  */
10870 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10871
10872 /**
10873  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10874  */
10875 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10876
10877 /**
10878  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10879  */
10880 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10881
10882 /**
10883  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10884  * but with all dynamically-allocated buffers duplicated in new buffers.
10885  */
10886 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10887
10888 /**
10889  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10890  */
10891 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10892
10893 /**
10894  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10895  */
10896 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10897
10898 /**
10899  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10900  */
10901 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10902
10903 /**
10904  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10905  * but with all dynamically-allocated buffers duplicated in new buffers.
10906  */
10907 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10908
10909 /**
10910  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10911  */
10912 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10913
10914 /**
10915  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10916  */
10917 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10918
10919 /**
10920  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10921  */
10922 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10923
10924 /**
10925  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10926  * but with all dynamically-allocated buffers duplicated in new buffers.
10927  */
10928 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10929
10930 /**
10931  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10932  */
10933 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10934
10935 /**
10936  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10937  */
10938 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10939
10940 /**
10941  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10942  */
10943 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10944
10945 /**
10946  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10947  * but with all dynamically-allocated buffers duplicated in new buffers.
10948  */
10949 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10950
10951 /**
10952  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10953  */
10954 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10955
10956 /**
10957  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10958  */
10959 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10960
10961 /**
10962  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10963  */
10964 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10965
10966 /**
10967  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10968  * but with all dynamically-allocated buffers duplicated in new buffers.
10969  */
10970 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10971
10972 /**
10973  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10974  */
10975 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10976
10977 /**
10978  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10979  */
10980 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10981
10982 /**
10983  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10984  */
10985 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10986
10987 /**
10988  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10989  * but with all dynamically-allocated buffers duplicated in new buffers.
10990  */
10991 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10992
10993 /**
10994  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10995  */
10996 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10997
10998 /**
10999  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11000  */
11001 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
11002
11003 /**
11004  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11005  */
11006 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
11007
11008 /**
11009  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11010  * but with all dynamically-allocated buffers duplicated in new buffers.
11011  */
11012 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
11013
11014 /**
11015  * Creates a new CResult_InitDecodeErrorZ in the success state.
11016  */
11017 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
11018
11019 /**
11020  * Creates a new CResult_InitDecodeErrorZ in the error state.
11021  */
11022 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
11023
11024 /**
11025  * Frees any resources used by the CResult_InitDecodeErrorZ.
11026  */
11027 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
11028
11029 /**
11030  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11031  * but with all dynamically-allocated buffers duplicated in new buffers.
11032  */
11033 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
11034
11035 /**
11036  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11037  */
11038 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
11039
11040 /**
11041  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11042  */
11043 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
11044
11045 /**
11046  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11047  */
11048 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
11049
11050 /**
11051  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11052  * but with all dynamically-allocated buffers duplicated in new buffers.
11053  */
11054 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
11055
11056 /**
11057  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11058  */
11059 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
11060
11061 /**
11062  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11063  */
11064 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
11065
11066 /**
11067  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11068  */
11069 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
11070
11071 /**
11072  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11073  * but with all dynamically-allocated buffers duplicated in new buffers.
11074  */
11075 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
11076
11077 /**
11078  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11079  */
11080 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
11081
11082 /**
11083  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11084  */
11085 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
11086
11087 /**
11088  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11089  */
11090 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
11091
11092 /**
11093  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11094  * but with all dynamically-allocated buffers duplicated in new buffers.
11095  */
11096 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
11097
11098 /**
11099  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11100  */
11101 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
11102
11103 /**
11104  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11105  */
11106 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11107
11108 /**
11109  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11110  */
11111 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
11112
11113 /**
11114  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11115  * but with all dynamically-allocated buffers duplicated in new buffers.
11116  */
11117 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
11118
11119 /**
11120  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11121  */
11122 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
11123
11124 /**
11125  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11126  */
11127 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11128
11129 /**
11130  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11131  */
11132 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
11133
11134 /**
11135  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11136  * but with all dynamically-allocated buffers duplicated in new buffers.
11137  */
11138 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
11139
11140 /**
11141  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11142  */
11143 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
11144
11145 /**
11146  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11147  */
11148 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
11149
11150 /**
11151  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11152  */
11153 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
11154
11155 /**
11156  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11157  * but with all dynamically-allocated buffers duplicated in new buffers.
11158  */
11159 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
11160
11161 /**
11162  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11163  */
11164 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
11165
11166 /**
11167  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11168  */
11169 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11170
11171 /**
11172  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11173  */
11174 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
11175
11176 /**
11177  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11178  * but with all dynamically-allocated buffers duplicated in new buffers.
11179  */
11180 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
11181
11182 /**
11183  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11184  */
11185 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
11186
11187 /**
11188  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11189  */
11190 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11191
11192 /**
11193  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11194  */
11195 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
11196
11197 /**
11198  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11199  * but with all dynamically-allocated buffers duplicated in new buffers.
11200  */
11201 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
11202
11203 /**
11204  * Creates a new CResult_PingDecodeErrorZ in the success state.
11205  */
11206 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
11207
11208 /**
11209  * Creates a new CResult_PingDecodeErrorZ in the error state.
11210  */
11211 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
11212
11213 /**
11214  * Frees any resources used by the CResult_PingDecodeErrorZ.
11215  */
11216 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
11217
11218 /**
11219  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11220  * but with all dynamically-allocated buffers duplicated in new buffers.
11221  */
11222 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
11223
11224 /**
11225  * Creates a new CResult_PongDecodeErrorZ in the success state.
11226  */
11227 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
11228
11229 /**
11230  * Creates a new CResult_PongDecodeErrorZ in the error state.
11231  */
11232 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
11233
11234 /**
11235  * Frees any resources used by the CResult_PongDecodeErrorZ.
11236  */
11237 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
11238
11239 /**
11240  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11241  * but with all dynamically-allocated buffers duplicated in new buffers.
11242  */
11243 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
11244
11245 /**
11246  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11247  */
11248 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
11249
11250 /**
11251  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11252  */
11253 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11254
11255 /**
11256  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11257  */
11258 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
11259
11260 /**
11261  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11262  * but with all dynamically-allocated buffers duplicated in new buffers.
11263  */
11264 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11265
11266 /**
11267  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11268  */
11269 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
11270
11271 /**
11272  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11273  */
11274 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11275
11276 /**
11277  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11278  */
11279 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
11280
11281 /**
11282  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11283  * but with all dynamically-allocated buffers duplicated in new buffers.
11284  */
11285 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11286
11287 /**
11288  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11289  */
11290 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
11291
11292 /**
11293  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11294  */
11295 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11296
11297 /**
11298  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11299  */
11300 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
11301
11302 /**
11303  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11304  * but with all dynamically-allocated buffers duplicated in new buffers.
11305  */
11306 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11307
11308 /**
11309  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11310  */
11311 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
11312
11313 /**
11314  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11315  */
11316 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11317
11318 /**
11319  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11320  */
11321 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
11322
11323 /**
11324  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11325  * but with all dynamically-allocated buffers duplicated in new buffers.
11326  */
11327 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11328
11329 /**
11330  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11331  */
11332 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
11333
11334 /**
11335  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11336  */
11337 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
11338
11339 /**
11340  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11341  */
11342 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
11343
11344 /**
11345  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11346  * but with all dynamically-allocated buffers duplicated in new buffers.
11347  */
11348 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
11349
11350 /**
11351  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11352  */
11353 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
11354
11355 /**
11356  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11357  */
11358 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11359
11360 /**
11361  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11362  */
11363 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
11364
11365 /**
11366  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11367  * but with all dynamically-allocated buffers duplicated in new buffers.
11368  */
11369 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11370
11371 /**
11372  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11373  */
11374 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
11375
11376 /**
11377  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11378  */
11379 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11380
11381 /**
11382  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11383  */
11384 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
11385
11386 /**
11387  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11388  * but with all dynamically-allocated buffers duplicated in new buffers.
11389  */
11390 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11391
11392 /**
11393  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11394  */
11395 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
11396
11397 /**
11398  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11399  */
11400 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
11401
11402 /**
11403  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11404  */
11405 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
11406
11407 /**
11408  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11409  * but with all dynamically-allocated buffers duplicated in new buffers.
11410  */
11411 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
11412
11413 /**
11414  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11415  */
11416 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
11417
11418 /**
11419  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11420  */
11421 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
11422
11423 /**
11424  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11425  */
11426 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
11427
11428 /**
11429  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11430  * but with all dynamically-allocated buffers duplicated in new buffers.
11431  */
11432 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
11433
11434 /**
11435  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11436  */
11437 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
11438
11439 /**
11440  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11441  */
11442 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11443
11444 /**
11445  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11446  */
11447 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
11448
11449 /**
11450  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11451  * but with all dynamically-allocated buffers duplicated in new buffers.
11452  */
11453 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11454
11455 /**
11456  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11457  */
11458 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
11459
11460 /**
11461  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11462  */
11463 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11464
11465 /**
11466  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11467  */
11468 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
11469
11470 /**
11471  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11472  * but with all dynamically-allocated buffers duplicated in new buffers.
11473  */
11474 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11475
11476 /**
11477  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11478  */
11479 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
11480
11481 /**
11482  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11483  */
11484 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
11485
11486 /**
11487  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11488  */
11489 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
11490
11491 /**
11492  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11493  * but with all dynamically-allocated buffers duplicated in new buffers.
11494  */
11495 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
11496
11497 /**
11498  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11499  */
11500 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
11501
11502 /**
11503  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11504  */
11505 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
11506
11507 /**
11508  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11509  */
11510 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
11511
11512 /**
11513  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11514  * but with all dynamically-allocated buffers duplicated in new buffers.
11515  */
11516 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
11517
11518 /**
11519  * Frees any resources used by the Event
11520  */
11521 void Event_free(struct LDKEvent this_ptr);
11522
11523 /**
11524  * Creates a copy of the Event
11525  */
11526 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11527
11528 /**
11529  * Serialize the Event object into a byte array which can be read by Event_read
11530  */
11531 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11532
11533 /**
11534  * Frees any resources used by the MessageSendEvent
11535  */
11536 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11537
11538 /**
11539  * Creates a copy of the MessageSendEvent
11540  */
11541 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11542
11543 /**
11544  * Calls the free function if one is set
11545  */
11546 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11547
11548 /**
11549  * Calls the free function if one is set
11550  */
11551 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11552
11553 /**
11554  * Calls the free function if one is set
11555  */
11556 void EventHandler_free(struct LDKEventHandler this_ptr);
11557
11558 /**
11559  * Frees any resources used by the APIError
11560  */
11561 void APIError_free(struct LDKAPIError this_ptr);
11562
11563 /**
11564  * Creates a copy of the APIError
11565  */
11566 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11567
11568 /**
11569  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11570  * 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.
11571  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11572  */
11573 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11574
11575 /**
11576  * Recovers the PublicKey of the signer of the message given the message and the signature.
11577  */
11578 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11579
11580 /**
11581  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11582  * and the PublicKey.
11583  */
11584 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11585
11586 /**
11587  * Creates a copy of the Level
11588  */
11589 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11590
11591 /**
11592  * Checks if two Levels contain equal inner contents.
11593  * This ignores pointers and is_owned flags and looks at the values in fields.
11594  */
11595 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11596
11597 /**
11598  * Checks if two Levels contain equal inner contents.
11599  */
11600 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11601
11602 /**
11603  * Returns the most verbose logging level.
11604  */
11605 MUST_USE_RES enum LDKLevel Level_max(void);
11606
11607 /**
11608  * Calls the free function if one is set
11609  */
11610 void Logger_free(struct LDKLogger this_ptr);
11611
11612 /**
11613  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11614  */
11615 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11616
11617 /**
11618  * Confirmations we will wait for before considering the channel locked in.
11619  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11620  * equivalent limit applied to outbound channels).
11621  *
11622  * Default value: 6.
11623  */
11624 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11625
11626 /**
11627  * Confirmations we will wait for before considering the channel locked in.
11628  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11629  * equivalent limit applied to outbound channels).
11630  *
11631  * Default value: 6.
11632  */
11633 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11634
11635 /**
11636  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11637  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11638  * transaction).
11639  *
11640  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11641  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11642  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11643  * possibly with time in between to RBF the spending transaction).
11644  *
11645  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11646  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11647  * our channel.
11648  *
11649  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11650  * can tweak config to ask for more security, not less.
11651  */
11652 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11653
11654 /**
11655  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11656  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11657  * transaction).
11658  *
11659  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11660  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11661  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11662  * possibly with time in between to RBF the spending transaction).
11663  *
11664  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11665  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11666  * our channel.
11667  *
11668  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11669  * can tweak config to ask for more security, not less.
11670  */
11671 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11672
11673 /**
11674  * Set to the smallest value HTLC we will accept to process.
11675  *
11676  * This value is sent to our counterparty on channel-open and we close the channel any time
11677  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11678  *
11679  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11680  * by the protocol.
11681  */
11682 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11683
11684 /**
11685  * Set to the smallest value HTLC we will accept to process.
11686  *
11687  * This value is sent to our counterparty on channel-open and we close the channel any time
11688  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11689  *
11690  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11691  * by the protocol.
11692  */
11693 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11694
11695 /**
11696  * Constructs a new ChannelHandshakeConfig given each field
11697  */
11698 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);
11699
11700 /**
11701  * Creates a copy of the ChannelHandshakeConfig
11702  */
11703 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11704
11705 /**
11706  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11707  */
11708 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11709
11710 /**
11711  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11712  */
11713 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11714
11715 /**
11716  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11717  * only applies to inbound channels.
11718  *
11719  * Default value: 0.
11720  */
11721 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11722
11723 /**
11724  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11725  * only applies to inbound channels.
11726  *
11727  * Default value: 0.
11728  */
11729 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11730
11731 /**
11732  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11733  * you to limit the maximum minimum-size they can require.
11734  *
11735  * Default value: u64::max_value.
11736  */
11737 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11738
11739 /**
11740  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11741  * you to limit the maximum minimum-size they can require.
11742  *
11743  * Default value: u64::max_value.
11744  */
11745 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11746
11747 /**
11748  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11749  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11750  *
11751  * Default value: 0.
11752  */
11753 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11754
11755 /**
11756  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11757  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11758  *
11759  * Default value: 0.
11760  */
11761 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11762
11763 /**
11764  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11765  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11766  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11767  *
11768  * Default value: u64::max_value.
11769  */
11770 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11771
11772 /**
11773  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11774  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11775  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11776  *
11777  * Default value: u64::max_value.
11778  */
11779 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11780
11781 /**
11782  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11783  * time. This allows you to set a minimum such value.
11784  *
11785  * Default value: 0.
11786  */
11787 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11788
11789 /**
11790  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11791  * time. This allows you to set a minimum such value.
11792  *
11793  * Default value: 0.
11794  */
11795 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11796
11797 /**
11798  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11799  * certain number of blocks, specified by the node which is not the funder (as the funder can
11800  * assume they aren't going to double-spend themselves).
11801  * This config allows you to set a limit on the maximum amount of time to wait.
11802  *
11803  * Default value: 144, or roughly one day and only applies to outbound channels.
11804  */
11805 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11806
11807 /**
11808  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11809  * certain number of blocks, specified by the node which is not the funder (as the funder can
11810  * assume they aren't going to double-spend themselves).
11811  * This config allows you to set a limit on the maximum amount of time to wait.
11812  *
11813  * Default value: 144, or roughly one day and only applies to outbound channels.
11814  */
11815 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11816
11817 /**
11818  * Set to force the incoming channel to match our announced channel preference in
11819  * ChannelConfig.
11820  *
11821  * Default value: true, to make the default that no announced channels are possible (which is
11822  * appropriate for any nodes which are not online very reliably).
11823  */
11824 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11825
11826 /**
11827  * Set to force the incoming channel to match our announced channel preference in
11828  * ChannelConfig.
11829  *
11830  * Default value: true, to make the default that no announced channels are possible (which is
11831  * appropriate for any nodes which are not online very reliably).
11832  */
11833 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11834
11835 /**
11836  * Set to the amount of time we're willing to wait to claim money back to us.
11837  *
11838  * Not checking this value would be a security issue, as our peer would be able to set it to
11839  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11840  *
11841  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11842  * reduce the loss of having useless locked funds (if your peer accepts)
11843  */
11844 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11845
11846 /**
11847  * Set to the amount of time we're willing to wait to claim money back to us.
11848  *
11849  * Not checking this value would be a security issue, as our peer would be able to set it to
11850  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11851  *
11852  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11853  * reduce the loss of having useless locked funds (if your peer accepts)
11854  */
11855 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11856
11857 /**
11858  * Constructs a new ChannelHandshakeLimits given each field
11859  */
11860 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);
11861
11862 /**
11863  * Creates a copy of the ChannelHandshakeLimits
11864  */
11865 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11866
11867 /**
11868  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11869  */
11870 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11871
11872 /**
11873  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11874  */
11875 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11876
11877 /**
11878  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11879  * This may be allowed to change at runtime in a later update, however doing so must result in
11880  * update messages sent to notify all nodes of our updated relay fee.
11881  *
11882  * Default value: 0.
11883  */
11884 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11885
11886 /**
11887  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11888  * This may be allowed to change at runtime in a later update, however doing so must result in
11889  * update messages sent to notify all nodes of our updated relay fee.
11890  *
11891  * Default value: 0.
11892  */
11893 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11894
11895 /**
11896  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11897  * the channel this config applies to.
11898  *
11899  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11900  * HTLC balance when a channel appears on-chain whereas
11901  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11902  * (non-HTLC-encumbered) balance.
11903  *
11904  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11905  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11906  * commitment transaction at least once per this many blocks (minus some margin to allow us
11907  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11908  * the spending transaction).
11909  *
11910  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11911  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11912  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11913  *
11914  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11915  */
11916 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11917
11918 /**
11919  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11920  * the channel this config applies to.
11921  *
11922  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11923  * HTLC balance when a channel appears on-chain whereas
11924  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11925  * (non-HTLC-encumbered) balance.
11926  *
11927  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11928  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11929  * commitment transaction at least once per this many blocks (minus some margin to allow us
11930  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11931  * the spending transaction).
11932  *
11933  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11934  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11935  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11936  *
11937  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11938  */
11939 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11940
11941 /**
11942  * Set to announce the channel publicly and notify all nodes that they can route via this
11943  * channel.
11944  *
11945  * This should only be set to true for nodes which expect to be online reliably.
11946  *
11947  * As the node which funds a channel picks this value this will only apply for new outbound
11948  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11949  *
11950  * This cannot be changed after the initial channel handshake.
11951  *
11952  * Default value: false.
11953  */
11954 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11955
11956 /**
11957  * Set to announce the channel publicly and notify all nodes that they can route via this
11958  * channel.
11959  *
11960  * This should only be set to true for nodes which expect to be online reliably.
11961  *
11962  * As the node which funds a channel picks this value this will only apply for new outbound
11963  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11964  *
11965  * This cannot be changed after the initial channel handshake.
11966  *
11967  * Default value: false.
11968  */
11969 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11970
11971 /**
11972  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11973  * supports it, they will then enforce the mutual-close output to us matches what we provided
11974  * at intialization, preventing us from closing to an alternate pubkey.
11975  *
11976  * This is set to true by default to provide a slight increase in security, though ultimately
11977  * any attacker who is able to take control of a channel can just as easily send the funds via
11978  * lightning payments, so we never require that our counterparties support this option.
11979  *
11980  * This cannot be changed after a channel has been initialized.
11981  *
11982  * Default value: true.
11983  */
11984 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11985
11986 /**
11987  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11988  * supports it, they will then enforce the mutual-close output to us matches what we provided
11989  * at intialization, preventing us from closing to an alternate pubkey.
11990  *
11991  * This is set to true by default to provide a slight increase in security, though ultimately
11992  * any attacker who is able to take control of a channel can just as easily send the funds via
11993  * lightning payments, so we never require that our counterparties support this option.
11994  *
11995  * This cannot be changed after a channel has been initialized.
11996  *
11997  * Default value: true.
11998  */
11999 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12000
12001 /**
12002  * Constructs a new ChannelConfig given each field
12003  */
12004 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);
12005
12006 /**
12007  * Creates a copy of the ChannelConfig
12008  */
12009 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
12010
12011 /**
12012  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
12013  */
12014 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
12015
12016 /**
12017  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
12018  */
12019 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
12020
12021 /**
12022  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
12023  */
12024 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
12025
12026 /**
12027  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
12028  */
12029 void UserConfig_free(struct LDKUserConfig this_obj);
12030
12031 /**
12032  * Channel config that we propose to our counterparty.
12033  */
12034 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12035
12036 /**
12037  * Channel config that we propose to our counterparty.
12038  */
12039 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
12040
12041 /**
12042  * Limits applied to our counterparty's proposed channel config settings.
12043  */
12044 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12045
12046 /**
12047  * Limits applied to our counterparty's proposed channel config settings.
12048  */
12049 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
12050
12051 /**
12052  * Channel config which affects behavior during channel lifetime.
12053  */
12054 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12055
12056 /**
12057  * Channel config which affects behavior during channel lifetime.
12058  */
12059 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
12060
12061 /**
12062  * Constructs a new UserConfig given each field
12063  */
12064 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);
12065
12066 /**
12067  * Creates a copy of the UserConfig
12068  */
12069 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
12070
12071 /**
12072  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
12073  */
12074 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
12075
12076 /**
12077  * Creates a copy of the AccessError
12078  */
12079 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
12080
12081 /**
12082  * Calls the free function if one is set
12083  */
12084 void Access_free(struct LDKAccess this_ptr);
12085
12086 /**
12087  * Calls the free function if one is set
12088  */
12089 void Listen_free(struct LDKListen this_ptr);
12090
12091 /**
12092  * Calls the free function if one is set
12093  */
12094 void Confirm_free(struct LDKConfirm this_ptr);
12095
12096 /**
12097  * Calls the free function if one is set
12098  */
12099 void Watch_free(struct LDKWatch this_ptr);
12100
12101 /**
12102  * Calls the free function if one is set
12103  */
12104 void Filter_free(struct LDKFilter this_ptr);
12105
12106 /**
12107  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
12108  */
12109 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
12110
12111 /**
12112  * First block where the transaction output may have been spent.
12113  */
12114 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12115
12116 /**
12117  * First block where the transaction output may have been spent.
12118  */
12119 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12120
12121 /**
12122  * Outpoint identifying the transaction output.
12123  */
12124 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12125
12126 /**
12127  * Outpoint identifying the transaction output.
12128  */
12129 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12130
12131 /**
12132  * Spending condition of the transaction output.
12133  */
12134 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12135
12136 /**
12137  * Spending condition of the transaction output.
12138  */
12139 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12140
12141 /**
12142  * Constructs a new WatchedOutput given each field
12143  */
12144 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
12145
12146 /**
12147  * Creates a copy of the WatchedOutput
12148  */
12149 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
12150
12151 /**
12152  * Checks if two WatchedOutputs contain equal inner contents.
12153  */
12154 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
12155
12156 /**
12157  * Calls the free function if one is set
12158  */
12159 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
12160
12161 /**
12162  * Creates a copy of the ConfirmationTarget
12163  */
12164 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
12165
12166 /**
12167  * Calls the free function if one is set
12168  */
12169 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
12170
12171 /**
12172  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
12173  */
12174 void ChainMonitor_free(struct LDKChainMonitor this_obj);
12175
12176 /**
12177  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
12178  *
12179  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
12180  * will call back to it indicating transactions and outputs of interest. This allows clients to
12181  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
12182  * always need to fetch full blocks absent another means for determining which blocks contain
12183  * transactions relevant to the watched channels.
12184  */
12185 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
12186
12187 /**
12188  * Constructs a new Listen which calls the relevant methods on this_arg.
12189  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12190  */
12191 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12192
12193 /**
12194  * Constructs a new Confirm which calls the relevant methods on this_arg.
12195  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12196  */
12197 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12198
12199 /**
12200  * Constructs a new Watch which calls the relevant methods on this_arg.
12201  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
12202  */
12203 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12204
12205 /**
12206  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12207  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12208  */
12209 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12210
12211 /**
12212  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
12213  */
12214 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
12215
12216 /**
12217  * The sequence number of this update. Updates *must* be replayed in-order according to this
12218  * sequence number (and updates may panic if they are not). The update_id values are strictly
12219  * increasing and increase by one for each new update, with one exception specified below.
12220  *
12221  * This sequence number is also used to track up to which points updates which returned
12222  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12223  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12224  *
12225  * The only instance where update_id values are not strictly increasing is the case where we
12226  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12227  * its docs for more details.
12228  */
12229 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
12230
12231 /**
12232  * The sequence number of this update. Updates *must* be replayed in-order according to this
12233  * sequence number (and updates may panic if they are not). The update_id values are strictly
12234  * increasing and increase by one for each new update, with one exception specified below.
12235  *
12236  * This sequence number is also used to track up to which points updates which returned
12237  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12238  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12239  *
12240  * The only instance where update_id values are not strictly increasing is the case where we
12241  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12242  * its docs for more details.
12243  */
12244 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
12245
12246 /**
12247  * Creates a copy of the ChannelMonitorUpdate
12248  */
12249 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
12250
12251 /**
12252  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
12253  */
12254 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
12255
12256 /**
12257  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
12258  */
12259 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
12260
12261 /**
12262  * Creates a copy of the ChannelMonitorUpdateErr
12263  */
12264 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
12265
12266 /**
12267  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
12268  */
12269 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
12270
12271 /**
12272  * Creates a copy of the MonitorUpdateError
12273  */
12274 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
12275
12276 /**
12277  * Frees any resources used by the MonitorEvent
12278  */
12279 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
12280
12281 /**
12282  * Creates a copy of the MonitorEvent
12283  */
12284 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
12285
12286 /**
12287  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
12288  */
12289 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
12290
12291 /**
12292  * Creates a copy of the HTLCUpdate
12293  */
12294 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
12295
12296 /**
12297  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
12298  */
12299 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
12300
12301 /**
12302  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
12303  */
12304 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
12305
12306 /**
12307  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12308  */
12309 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12310
12311 /**
12312  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12313  */
12314 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12315
12316 /**
12317  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12318  * itself.
12319  *
12320  * panics if the given update is not the next update by update_id.
12321  */
12322 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);
12323
12324 /**
12325  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12326  * ChannelMonitor.
12327  */
12328 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12329
12330 /**
12331  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12332  */
12333 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12334
12335 /**
12336  * Gets a list of txids, with their output scripts (in the order they appear in the
12337  * transaction), which we must learn about spends of via block_connected().
12338  */
12339 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12340
12341 /**
12342  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12343  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12344  * have been registered.
12345  */
12346 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12347
12348 /**
12349  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12350  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12351  */
12352 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12353
12354 /**
12355  * Gets the list of pending events which were generated by previous actions, clearing the list
12356  * in the process.
12357  *
12358  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12359  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12360  * no internal locking in ChannelMonitors.
12361  */
12362 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12363
12364 /**
12365  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12366  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12367  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12368  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12369  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12370  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12371  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12372  * out-of-band the other node operator to coordinate with him if option is available to you.
12373  * In any-case, choice is up to the user.
12374  */
12375 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);
12376
12377 /**
12378  * Processes transactions in a newly connected block, which may result in any of the following:
12379  * - update the monitor's state against resolved HTLCs
12380  * - punish the counterparty in the case of seeing a revoked commitment transaction
12381  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12382  * - detect settled outputs for later spending
12383  * - schedule and bump any in-flight claims
12384  *
12385  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12386  * [`get_outputs_to_watch`].
12387  *
12388  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12389  */
12390 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);
12391
12392 /**
12393  * Determines if the disconnected block contained any transactions of interest and updates
12394  * appropriately.
12395  */
12396 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);
12397
12398 /**
12399  * Processes transactions confirmed in a block with the given header and height, returning new
12400  * outputs to watch. See [`block_connected`] for details.
12401  *
12402  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12403  * blocks. See [`chain::Confirm`] for calling expectations.
12404  *
12405  * [`block_connected`]: Self::block_connected
12406  */
12407 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);
12408
12409 /**
12410  * Processes a transaction that was reorganized out of the chain.
12411  *
12412  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12413  * than blocks. See [`chain::Confirm`] for calling expectations.
12414  *
12415  * [`block_disconnected`]: Self::block_disconnected
12416  */
12417 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);
12418
12419 /**
12420  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12421  * [`block_connected`] for details.
12422  *
12423  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12424  * blocks. See [`chain::Confirm`] for calling expectations.
12425  *
12426  * [`block_connected`]: Self::block_connected
12427  */
12428 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);
12429
12430 /**
12431  * Returns the set of txids that should be monitored for re-organization out of the chain.
12432  */
12433 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12434
12435 /**
12436  * Calls the free function if one is set
12437  */
12438 void Persist_free(struct LDKPersist this_ptr);
12439
12440 /**
12441  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12442  */
12443 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12444
12445 /**
12446  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12447  */
12448 void OutPoint_free(struct LDKOutPoint this_obj);
12449
12450 /**
12451  * The referenced transaction's txid.
12452  */
12453 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12454
12455 /**
12456  * The referenced transaction's txid.
12457  */
12458 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12459
12460 /**
12461  * The index of the referenced output in its transaction's vout.
12462  */
12463 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12464
12465 /**
12466  * The index of the referenced output in its transaction's vout.
12467  */
12468 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12469
12470 /**
12471  * Constructs a new OutPoint given each field
12472  */
12473 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12474
12475 /**
12476  * Creates a copy of the OutPoint
12477  */
12478 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12479
12480 /**
12481  * Checks if two OutPoints contain equal inner contents.
12482  * This ignores pointers and is_owned flags and looks at the values in fields.
12483  * Two objects with NULL inner values will be considered "equal" here.
12484  */
12485 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12486
12487 /**
12488  * Checks if two OutPoints contain equal inner contents.
12489  */
12490 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12491
12492 /**
12493  * Convert an `OutPoint` to a lightning channel id.
12494  */
12495 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12496
12497 /**
12498  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12499  */
12500 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12501
12502 /**
12503  * Read a OutPoint from a byte array, created by OutPoint_write
12504  */
12505 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12506
12507 /**
12508  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12509  */
12510 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12511
12512 /**
12513  * The outpoint which is spendable
12514  */
12515 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12516
12517 /**
12518  * The outpoint which is spendable
12519  */
12520 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12521
12522 /**
12523  * Per commitment point to derive delayed_payment_key by key holder
12524  */
12525 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12526
12527 /**
12528  * Per commitment point to derive delayed_payment_key by key holder
12529  */
12530 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12531
12532 /**
12533  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12534  * the witness_script.
12535  */
12536 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12537
12538 /**
12539  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12540  * the witness_script.
12541  */
12542 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12543
12544 /**
12545  * The output which is referenced by the given outpoint
12546  */
12547 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12548
12549 /**
12550  * The revocation point specific to the commitment transaction which was broadcast. Used to
12551  * derive the witnessScript for this output.
12552  */
12553 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12554
12555 /**
12556  * The revocation point specific to the commitment transaction which was broadcast. Used to
12557  * derive the witnessScript for this output.
12558  */
12559 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12560
12561 /**
12562  * Arbitrary identification information returned by a call to
12563  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12564  * the channel to spend the output.
12565  */
12566 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12567
12568 /**
12569  * Arbitrary identification information returned by a call to
12570  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12571  * the channel to spend the output.
12572  */
12573 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12574
12575 /**
12576  * The value of the channel which this output originated from, possibly indirectly.
12577  */
12578 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12579
12580 /**
12581  * The value of the channel which this output originated from, possibly indirectly.
12582  */
12583 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12584
12585 /**
12586  * Constructs a new DelayedPaymentOutputDescriptor given each field
12587  */
12588 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);
12589
12590 /**
12591  * Creates a copy of the DelayedPaymentOutputDescriptor
12592  */
12593 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12594
12595 /**
12596  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
12597  */
12598 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
12599
12600 /**
12601  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
12602  */
12603 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
12604
12605 /**
12606  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12607  */
12608 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12609
12610 /**
12611  * The outpoint which is spendable
12612  */
12613 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12614
12615 /**
12616  * The outpoint which is spendable
12617  */
12618 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12619
12620 /**
12621  * The output which is referenced by the given outpoint
12622  */
12623 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12624
12625 /**
12626  * Arbitrary identification information returned by a call to
12627  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12628  * the channel to spend the output.
12629  */
12630 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12631
12632 /**
12633  * Arbitrary identification information returned by a call to
12634  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12635  * the channel to spend the output.
12636  */
12637 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12638
12639 /**
12640  * The value of the channel which this transactions spends.
12641  */
12642 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12643
12644 /**
12645  * The value of the channel which this transactions spends.
12646  */
12647 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12648
12649 /**
12650  * Constructs a new StaticPaymentOutputDescriptor given each field
12651  */
12652 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);
12653
12654 /**
12655  * Creates a copy of the StaticPaymentOutputDescriptor
12656  */
12657 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12658
12659 /**
12660  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
12661  */
12662 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
12663
12664 /**
12665  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
12666  */
12667 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
12668
12669 /**
12670  * Frees any resources used by the SpendableOutputDescriptor
12671  */
12672 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12673
12674 /**
12675  * Creates a copy of the SpendableOutputDescriptor
12676  */
12677 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12678
12679 /**
12680  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12681  */
12682 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12683
12684 /**
12685  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12686  */
12687 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12688
12689 /**
12690  * Calls the free function if one is set
12691  */
12692 void BaseSign_free(struct LDKBaseSign this_ptr);
12693
12694 /**
12695  * Creates a copy of a Sign
12696  */
12697 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12698
12699 /**
12700  * Calls the free function if one is set
12701  */
12702 void Sign_free(struct LDKSign this_ptr);
12703
12704 /**
12705  * Calls the free function if one is set
12706  */
12707 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12708
12709 /**
12710  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12711  */
12712 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12713
12714 /**
12715  * Private key of anchor tx
12716  */
12717 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12718
12719 /**
12720  * Private key of anchor tx
12721  */
12722 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12723
12724 /**
12725  * Holder secret key for blinded revocation pubkey
12726  */
12727 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12728
12729 /**
12730  * Holder secret key for blinded revocation pubkey
12731  */
12732 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12733
12734 /**
12735  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12736  */
12737 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12738
12739 /**
12740  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12741  */
12742 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12743
12744 /**
12745  * Holder secret key used in HTLC tx
12746  */
12747 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12748
12749 /**
12750  * Holder secret key used in HTLC tx
12751  */
12752 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12753
12754 /**
12755  * Holder htlc secret key used in commitment tx htlc outputs
12756  */
12757 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12758
12759 /**
12760  * Holder htlc secret key used in commitment tx htlc outputs
12761  */
12762 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12763
12764 /**
12765  * Commitment seed
12766  */
12767 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12768
12769 /**
12770  * Commitment seed
12771  */
12772 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12773
12774 /**
12775  * Creates a copy of the InMemorySigner
12776  */
12777 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12778
12779 /**
12780  * Create a new InMemorySigner
12781  */
12782 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);
12783
12784 /**
12785  * Counterparty pubkeys.
12786  * Will panic if ready_channel wasn't called.
12787  */
12788 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12789
12790 /**
12791  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12792  * transactions, ie the amount of time that we have to wait to recover our funds if we
12793  * broadcast a transaction.
12794  * Will panic if ready_channel wasn't called.
12795  */
12796 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12797
12798 /**
12799  * The contest_delay value specified by us and applied on transactions broadcastable
12800  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12801  * if they broadcast a transaction.
12802  * Will panic if ready_channel wasn't called.
12803  */
12804 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12805
12806 /**
12807  * Whether the holder is the initiator
12808  * Will panic if ready_channel wasn't called.
12809  */
12810 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12811
12812 /**
12813  * Funding outpoint
12814  * Will panic if ready_channel wasn't called.
12815  */
12816 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12817
12818 /**
12819  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12820  * building transactions.
12821  *
12822  * Will panic if ready_channel wasn't called.
12823  */
12824 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12825
12826 /**
12827  * Sign the single input of spend_tx at index `input_idx` which spends the output
12828  * described by descriptor, returning the witness stack for the input.
12829  *
12830  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12831  * or is not spending the outpoint described by `descriptor.outpoint`.
12832  */
12833 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);
12834
12835 /**
12836  * Sign the single input of spend_tx at index `input_idx` which spends the output
12837  * described by descriptor, returning the witness stack for the input.
12838  *
12839  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12840  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12841  * sequence set to `descriptor.to_self_delay`.
12842  */
12843 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);
12844
12845 /**
12846  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12847  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12848  */
12849 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12850
12851 /**
12852  * Constructs a new Sign which calls the relevant methods on this_arg.
12853  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12854  */
12855 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12856
12857 /**
12858  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12859  */
12860 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12861
12862 /**
12863  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12864  */
12865 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12866
12867 /**
12868  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12869  */
12870 void KeysManager_free(struct LDKKeysManager this_obj);
12871
12872 /**
12873  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12874  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12875  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12876  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12877  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12878  * simply use the current time (with very high precision).
12879  *
12880  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12881  * obviously, starting_time should be unique every time you reload the library - it is only
12882  * used to generate new ephemeral key data (which will be stored by the individual channel if
12883  * necessary).
12884  *
12885  * Note that the seed is required to recover certain on-chain funds independent of
12886  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12887  * channel, and some on-chain during-closing funds.
12888  *
12889  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12890  * versions. Once the library is more fully supported, the docs will be updated to include a
12891  * detailed description of the guarantee.
12892  */
12893 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12894
12895 /**
12896  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12897  *
12898  * Key derivation parameters are accessible through a per-channel secrets
12899  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12900  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12901  */
12902 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]);
12903
12904 /**
12905  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12906  * output to the given change destination (if sufficient change value remains). The
12907  * transaction will have a feerate, at least, of the given value.
12908  *
12909  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12910  * if a descriptor was duplicated.
12911  *
12912  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12913  *
12914  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12915  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12916  */
12917 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);
12918
12919 /**
12920  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12921  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12922  */
12923 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12924
12925 /**
12926  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12927  */
12928 void ChannelManager_free(struct LDKChannelManager this_obj);
12929
12930 /**
12931  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12932  */
12933 void ChainParameters_free(struct LDKChainParameters this_obj);
12934
12935 /**
12936  * The network for determining the `chain_hash` in Lightning messages.
12937  */
12938 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12939
12940 /**
12941  * The network for determining the `chain_hash` in Lightning messages.
12942  */
12943 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12944
12945 /**
12946  * The hash and height of the latest block successfully connected.
12947  *
12948  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12949  */
12950 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12951
12952 /**
12953  * The hash and height of the latest block successfully connected.
12954  *
12955  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12956  */
12957 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12958
12959 /**
12960  * Constructs a new ChainParameters given each field
12961  */
12962 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12963
12964 /**
12965  * Creates a copy of the ChainParameters
12966  */
12967 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
12968
12969 /**
12970  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12971  */
12972 void BestBlock_free(struct LDKBestBlock this_obj);
12973
12974 /**
12975  * Creates a copy of the BestBlock
12976  */
12977 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12978
12979 /**
12980  * Returns the best block from the genesis of the given network.
12981  */
12982 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12983
12984 /**
12985  * Returns the best block as identified by the given block hash and height.
12986  */
12987 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12988
12989 /**
12990  * Returns the best block hash.
12991  */
12992 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12993
12994 /**
12995  * Returns the best block height.
12996  */
12997 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12998
12999 /**
13000  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
13001  */
13002 void ChannelDetails_free(struct LDKChannelDetails this_obj);
13003
13004 /**
13005  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13006  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13007  * Note that this means this value is *not* persistent - it can change once during the
13008  * lifetime of the channel.
13009  */
13010 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
13011
13012 /**
13013  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13014  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13015  * Note that this means this value is *not* persistent - it can change once during the
13016  * lifetime of the channel.
13017  */
13018 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13019
13020 /**
13021  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13022  * our counterparty already.
13023  *
13024  * Note that, if this has been set, `channel_id` will be equivalent to
13025  * `funding_txo.unwrap().to_channel_id()`.
13026  */
13027 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13028
13029 /**
13030  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13031  * our counterparty already.
13032  *
13033  * Note that, if this has been set, `channel_id` will be equivalent to
13034  * `funding_txo.unwrap().to_channel_id()`.
13035  */
13036 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13037
13038 /**
13039  * The position of the funding transaction in the chain. None if the funding transaction has
13040  * not yet been confirmed and the channel fully opened.
13041  */
13042 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13043
13044 /**
13045  * The position of the funding transaction in the chain. None if the funding transaction has
13046  * not yet been confirmed and the channel fully opened.
13047  */
13048 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
13049
13050 /**
13051  * The node_id of our counterparty
13052  */
13053 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13054
13055 /**
13056  * The node_id of our counterparty
13057  */
13058 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13059
13060 /**
13061  * The Features the channel counterparty provided upon last connection.
13062  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13063  * many routing-relevant features are present in the init context.
13064  */
13065 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13066
13067 /**
13068  * The Features the channel counterparty provided upon last connection.
13069  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13070  * many routing-relevant features are present in the init context.
13071  */
13072 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13073
13074 /**
13075  * The value, in satoshis, of this channel as appears in the funding output
13076  */
13077 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13078
13079 /**
13080  * The value, in satoshis, of this channel as appears in the funding output
13081  */
13082 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13083
13084 /**
13085  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13086  */
13087 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13088
13089 /**
13090  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13091  */
13092 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13093
13094 /**
13095  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13096  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13097  * available for inclusion in new outbound HTLCs). This further does not include any pending
13098  * outgoing HTLCs which are awaiting some other resolution to be sent.
13099  */
13100 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13101
13102 /**
13103  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13104  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13105  * available for inclusion in new outbound HTLCs). This further does not include any pending
13106  * outgoing HTLCs which are awaiting some other resolution to be sent.
13107  */
13108 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13109
13110 /**
13111  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13112  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13113  * available for inclusion in new inbound HTLCs).
13114  * Note that there are some corner cases not fully handled here, so the actual available
13115  * inbound capacity may be slightly higher than this.
13116  */
13117 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13118
13119 /**
13120  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13121  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13122  * available for inclusion in new inbound HTLCs).
13123  * Note that there are some corner cases not fully handled here, so the actual available
13124  * inbound capacity may be slightly higher than this.
13125  */
13126 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13127
13128 /**
13129  * True if the channel was initiated (and thus funded) by us.
13130  */
13131 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13132
13133 /**
13134  * True if the channel was initiated (and thus funded) by us.
13135  */
13136 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13137
13138 /**
13139  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13140  * channel is not currently being shut down. `funding_locked` message exchange implies the
13141  * required confirmation count has been reached (and we were connected to the peer at some
13142  * point after the funding transaction received enough confirmations).
13143  */
13144 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13145
13146 /**
13147  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13148  * channel is not currently being shut down. `funding_locked` message exchange implies the
13149  * required confirmation count has been reached (and we were connected to the peer at some
13150  * point after the funding transaction received enough confirmations).
13151  */
13152 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13153
13154 /**
13155  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13156  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13157  * channel is not currently negotiating a shutdown.
13158  *
13159  * This is a strict superset of `is_funding_locked`.
13160  */
13161 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13162
13163 /**
13164  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13165  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13166  * channel is not currently negotiating a shutdown.
13167  *
13168  * This is a strict superset of `is_funding_locked`.
13169  */
13170 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13171
13172 /**
13173  * True if this channel is (or will be) publicly-announced.
13174  */
13175 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13176
13177 /**
13178  * True if this channel is (or will be) publicly-announced.
13179  */
13180 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13181
13182 /**
13183  * Creates a copy of the ChannelDetails
13184  */
13185 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
13186
13187 /**
13188  * Frees any resources used by the PaymentSendFailure
13189  */
13190 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
13191
13192 /**
13193  * Creates a copy of the PaymentSendFailure
13194  */
13195 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
13196
13197 /**
13198  * Constructs a new ChannelManager to hold several channels and route between them.
13199  *
13200  * This is the main \"logic hub\" for all channel-related actions, and implements
13201  * ChannelMessageHandler.
13202  *
13203  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
13204  *
13205  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
13206  *
13207  * Users need to notify the new ChannelManager when a new block is connected or
13208  * disconnected using its `block_connected` and `block_disconnected` methods, starting
13209  * from after `params.latest_hash`.
13210  */
13211 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);
13212
13213 /**
13214  * Gets the current configuration applied to all new channels,  as
13215  */
13216 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
13217
13218 /**
13219  * Creates a new outbound channel to the given remote node and with the given value.
13220  *
13221  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
13222  * tracking of which events correspond with which create_channel call. Note that the
13223  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
13224  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
13225  * otherwise ignored.
13226  *
13227  * If successful, will generate a SendOpenChannel message event, so you should probably poll
13228  * PeerManager::process_events afterwards.
13229  *
13230  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
13231  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
13232  */
13233 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);
13234
13235 /**
13236  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
13237  * more information.
13238  */
13239 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13240
13241 /**
13242  * Gets the list of usable channels, in random order. Useful as an argument to
13243  * get_route to ensure non-announced channels are used.
13244  *
13245  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
13246  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
13247  * are.
13248  */
13249 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13250
13251 /**
13252  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
13253  * will be accepted on the given channel, and after additional timeout/the closing of all
13254  * pending HTLCs, the channel will be closed on chain.
13255  *
13256  * May generate a SendShutdown message event on success, which should be relayed.
13257  */
13258 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13259
13260 /**
13261  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
13262  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
13263  */
13264 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13265
13266 /**
13267  * Force close all channels, immediately broadcasting the latest local commitment transaction
13268  * for each to the chain and rejecting new HTLCs on each.
13269  */
13270 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13271
13272 /**
13273  * Sends a payment along a given route.
13274  *
13275  * Value parameters are provided via the last hop in route, see documentation for RouteHop
13276  * fields for more info.
13277  *
13278  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
13279  * payment), we don't do anything to stop you! We always try to ensure that if the provided
13280  * next hop knows the preimage to payment_hash they can claim an additional amount as
13281  * specified in the last hop in the route! Thus, you should probably do your own
13282  * payment_preimage tracking (which you should already be doing as they represent \"proof of
13283  * payment\") and prevent double-sends yourself.
13284  *
13285  * May generate SendHTLCs message(s) event on success, which should be relayed.
13286  *
13287  * Each path may have a different return value, and PaymentSendValue may return a Vec with
13288  * each entry matching the corresponding-index entry in the route paths, see
13289  * PaymentSendFailure for more info.
13290  *
13291  * In general, a path may raise:
13292  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
13293  *    node public key) is specified.
13294  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
13295  *    (including due to previous monitor update failure or new permanent monitor update
13296  *    failure).
13297  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
13298  *    relevant updates.
13299  *
13300  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
13301  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
13302  * different route unless you intend to pay twice!
13303  *
13304  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
13305  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
13306  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
13307  * must not contain multiple paths as multi-path payments require a recipient-provided
13308  * payment_secret.
13309  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
13310  * bit set (either as required or as available). If multiple paths are present in the Route,
13311  * we assume the invoice had the basic_mpp feature set.
13312  */
13313 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);
13314
13315 /**
13316  * Call this upon creation of a funding transaction for the given channel.
13317  *
13318  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
13319  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
13320  *
13321  * Panics if a funding transaction has already been provided for this channel.
13322  *
13323  * May panic if the output found in the funding transaction is duplicative with some other
13324  * channel (note that this should be trivially prevented by using unique funding transaction
13325  * keys per-channel).
13326  *
13327  * Do NOT broadcast the funding transaction yourself. When we have safely received our
13328  * counterparty's signature the funding transaction will automatically be broadcast via the
13329  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
13330  *
13331  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13332  * not currently support replacing a funding transaction on an existing channel. Instead,
13333  * create a new channel with a conflicting funding transaction.
13334  *
13335  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13336  */
13337 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);
13338
13339 /**
13340  * Regenerates channel_announcements and generates a signed node_announcement from the given
13341  * arguments, providing them in corresponding events via
13342  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13343  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13344  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13345  * our network addresses.
13346  *
13347  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13348  * node to humans. They carry no in-protocol meaning.
13349  *
13350  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13351  * accepts incoming connections. These will be included in the node_announcement, publicly
13352  * tying these addresses together and to this node. If you wish to preserve user privacy,
13353  * addresses should likely contain only Tor Onion addresses.
13354  *
13355  * Panics if `addresses` is absurdly large (more than 500).
13356  *
13357  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13358  */
13359 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13360
13361 /**
13362  * Processes HTLCs which are pending waiting on random forward delay.
13363  *
13364  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13365  * Will likely generate further events.
13366  */
13367 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13368
13369 /**
13370  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13371  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13372  * to inform the network about the uselessness of these channels.
13373  *
13374  * This method handles all the details, and must be called roughly once per minute.
13375  *
13376  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13377  */
13378 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13379
13380 /**
13381  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13382  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13383  * along the path (including in our own channel on which we received it).
13384  * Returns false if no payment was found to fail backwards, true if the process of failing the
13385  * HTLC backwards has been started.
13386  */
13387 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13388
13389 /**
13390  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13391  * generating message events for the net layer to claim the payment, if possible. Thus, you
13392  * should probably kick the net layer to go send messages if this returns true!
13393  *
13394  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13395  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13396  * event matches your expectation. If you fail to do so and call this method, you may provide
13397  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13398  *
13399  * May panic if called except in response to a PaymentReceived event.
13400  *
13401  * [`create_inbound_payment`]: Self::create_inbound_payment
13402  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13403  */
13404 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13405
13406 /**
13407  * Gets the node_id held by this ChannelManager
13408  */
13409 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13410
13411 /**
13412  * Restores a single, given channel to normal operation after a
13413  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13414  * operation.
13415  *
13416  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13417  * fully committed in every copy of the given channels' ChannelMonitors.
13418  *
13419  * Note that there is no effect to calling with a highest_applied_update_id other than the
13420  * current latest ChannelMonitorUpdate and one call to this function after multiple
13421  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13422  * exists largely only to prevent races between this and concurrent update_monitor calls.
13423  *
13424  * Thus, the anticipated use is, at a high level:
13425  *  1) You register a chain::Watch with this ChannelManager,
13426  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13427  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13428  *     any time it cannot do so instantly,
13429  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13430  *  4) once all remote copies are updated, you call this function with the update_id that
13431  *     completed, and once it is the latest the Channel will be re-enabled.
13432  */
13433 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);
13434
13435 /**
13436  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13437  * to pay us.
13438  *
13439  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13440  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13441  *
13442  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13443  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13444  * passed directly to [`claim_funds`].
13445  *
13446  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13447  *
13448  * [`claim_funds`]: Self::claim_funds
13449  * [`PaymentReceived`]: events::Event::PaymentReceived
13450  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13451  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13452  */
13453 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);
13454
13455 /**
13456  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13457  * stored external to LDK.
13458  *
13459  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13460  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13461  * the `min_value_msat` provided here, if one is provided.
13462  *
13463  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13464  * method may return an Err if another payment with the same payment_hash is still pending.
13465  *
13466  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
13467  * allow tracking of which events correspond with which calls to this and
13468  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13469  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13470  * with invoice metadata stored elsewhere.
13471  *
13472  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13473  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13474  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13475  * sender \"proof-of-payment\" unless they have paid the required amount.
13476  *
13477  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13478  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13479  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13480  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13481  * invoices when no timeout is set.
13482  *
13483  * Note that we use block header time to time-out pending inbound payments (with some margin
13484  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13485  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13486  * If you need exact expiry semantics, you should enforce them upon receipt of
13487  * [`PaymentReceived`].
13488  *
13489  * Pending inbound payments are stored in memory and in serialized versions of this
13490  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13491  * space is limited, you may wish to rate-limit inbound payment creation.
13492  *
13493  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13494  *
13495  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13496  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13497  *
13498  * [`create_inbound_payment`]: Self::create_inbound_payment
13499  * [`PaymentReceived`]: events::Event::PaymentReceived
13500  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
13501  */
13502 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);
13503
13504 /**
13505  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13506  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13507  */
13508 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13509
13510 /**
13511  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13512  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13513  */
13514 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13515
13516 /**
13517  * Constructs a new Listen which calls the relevant methods on this_arg.
13518  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13519  */
13520 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13521
13522 /**
13523  * Constructs a new Confirm which calls the relevant methods on this_arg.
13524  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13525  */
13526 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13527
13528 /**
13529  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13530  * indicating whether persistence is necessary. Only one listener on
13531  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13532  * up.
13533  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13534  */
13535 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13536
13537 /**
13538  * Blocks until ChannelManager needs to be persisted. Only one listener on
13539  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13540  * up.
13541  */
13542 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13543
13544 /**
13545  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13546  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13547  */
13548 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13549
13550 /**
13551  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13552  */
13553 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13554
13555 /**
13556  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13557  */
13558 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13559
13560 /**
13561  * The keys provider which will give us relevant keys. Some keys will be loaded during
13562  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13563  * signing data.
13564  */
13565 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13566
13567 /**
13568  * The keys provider which will give us relevant keys. Some keys will be loaded during
13569  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13570  * signing data.
13571  */
13572 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13573
13574 /**
13575  * The fee_estimator for use in the ChannelManager in the future.
13576  *
13577  * No calls to the FeeEstimator will be made during deserialization.
13578  */
13579 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13580
13581 /**
13582  * The fee_estimator for use in the ChannelManager in the future.
13583  *
13584  * No calls to the FeeEstimator will be made during deserialization.
13585  */
13586 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13587
13588 /**
13589  * The chain::Watch for use in the ChannelManager in the future.
13590  *
13591  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13592  * you have deserialized ChannelMonitors separately and will add them to your
13593  * chain::Watch after deserializing this ChannelManager.
13594  */
13595 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13596
13597 /**
13598  * The chain::Watch for use in the ChannelManager in the future.
13599  *
13600  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13601  * you have deserialized ChannelMonitors separately and will add them to your
13602  * chain::Watch after deserializing this ChannelManager.
13603  */
13604 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13605
13606 /**
13607  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13608  * used to broadcast the latest local commitment transactions of channels which must be
13609  * force-closed during deserialization.
13610  */
13611 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13612
13613 /**
13614  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13615  * used to broadcast the latest local commitment transactions of channels which must be
13616  * force-closed during deserialization.
13617  */
13618 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13619
13620 /**
13621  * The Logger for use in the ChannelManager and which may be used to log information during
13622  * deserialization.
13623  */
13624 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13625
13626 /**
13627  * The Logger for use in the ChannelManager and which may be used to log information during
13628  * deserialization.
13629  */
13630 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13631
13632 /**
13633  * Default settings used for new channels. Any existing channels will continue to use the
13634  * runtime settings which were stored when the ChannelManager was serialized.
13635  */
13636 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13637
13638 /**
13639  * Default settings used for new channels. Any existing channels will continue to use the
13640  * runtime settings which were stored when the ChannelManager was serialized.
13641  */
13642 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13643
13644 /**
13645  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13646  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13647  * populate a HashMap directly from C.
13648  */
13649 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);
13650
13651 /**
13652  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13653  */
13654 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13655
13656 /**
13657  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13658  */
13659 void DecodeError_free(struct LDKDecodeError this_obj);
13660
13661 /**
13662  * Creates a copy of the DecodeError
13663  */
13664 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13665
13666 /**
13667  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13668  */
13669 void Init_free(struct LDKInit this_obj);
13670
13671 /**
13672  * The relevant features which the sender supports
13673  */
13674 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13675
13676 /**
13677  * The relevant features which the sender supports
13678  */
13679 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13680
13681 /**
13682  * Constructs a new Init given each field
13683  */
13684 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13685
13686 /**
13687  * Creates a copy of the Init
13688  */
13689 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13690
13691 /**
13692  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13693  */
13694 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13695
13696 /**
13697  * The channel ID involved in the error
13698  */
13699 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13700
13701 /**
13702  * The channel ID involved in the error
13703  */
13704 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13705
13706 /**
13707  * A possibly human-readable error description.
13708  * The string should be sanitized before it is used (e.g. emitted to logs
13709  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13710  * vulnerability in the terminal emulator or the logging subsystem.
13711  */
13712 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13713
13714 /**
13715  * A possibly human-readable error description.
13716  * The string should be sanitized before it is used (e.g. emitted to logs
13717  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13718  * vulnerability in the terminal emulator or the logging subsystem.
13719  */
13720 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13721
13722 /**
13723  * Constructs a new ErrorMessage given each field
13724  */
13725 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13726
13727 /**
13728  * Creates a copy of the ErrorMessage
13729  */
13730 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13731
13732 /**
13733  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13734  */
13735 void Ping_free(struct LDKPing this_obj);
13736
13737 /**
13738  * The desired response length
13739  */
13740 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13741
13742 /**
13743  * The desired response length
13744  */
13745 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13746
13747 /**
13748  * The ping packet size.
13749  * This field is not sent on the wire. byteslen zeros are sent.
13750  */
13751 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13752
13753 /**
13754  * The ping packet size.
13755  * This field is not sent on the wire. byteslen zeros are sent.
13756  */
13757 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13758
13759 /**
13760  * Constructs a new Ping given each field
13761  */
13762 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13763
13764 /**
13765  * Creates a copy of the Ping
13766  */
13767 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13768
13769 /**
13770  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13771  */
13772 void Pong_free(struct LDKPong this_obj);
13773
13774 /**
13775  * The pong packet size.
13776  * This field is not sent on the wire. byteslen zeros are sent.
13777  */
13778 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13779
13780 /**
13781  * The pong packet size.
13782  * This field is not sent on the wire. byteslen zeros are sent.
13783  */
13784 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13785
13786 /**
13787  * Constructs a new Pong given each field
13788  */
13789 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13790
13791 /**
13792  * Creates a copy of the Pong
13793  */
13794 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13795
13796 /**
13797  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13798  */
13799 void OpenChannel_free(struct LDKOpenChannel this_obj);
13800
13801 /**
13802  * The genesis hash of the blockchain where the channel is to be opened
13803  */
13804 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13805
13806 /**
13807  * The genesis hash of the blockchain where the channel is to be opened
13808  */
13809 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13810
13811 /**
13812  * A temporary channel ID, until the funding outpoint is announced
13813  */
13814 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13815
13816 /**
13817  * A temporary channel ID, until the funding outpoint is announced
13818  */
13819 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13820
13821 /**
13822  * The channel value
13823  */
13824 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13825
13826 /**
13827  * The channel value
13828  */
13829 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13830
13831 /**
13832  * The amount to push to the counterparty as part of the open, in milli-satoshi
13833  */
13834 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13835
13836 /**
13837  * The amount to push to the counterparty as part of the open, in milli-satoshi
13838  */
13839 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13840
13841 /**
13842  * The threshold below which outputs on transactions broadcast by sender will be omitted
13843  */
13844 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13845
13846 /**
13847  * The threshold below which outputs on transactions broadcast by sender will be omitted
13848  */
13849 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13850
13851 /**
13852  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13853  */
13854 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13855
13856 /**
13857  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13858  */
13859 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13860
13861 /**
13862  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13863  */
13864 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13865
13866 /**
13867  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13868  */
13869 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13870
13871 /**
13872  * The minimum HTLC size incoming to sender, in milli-satoshi
13873  */
13874 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13875
13876 /**
13877  * The minimum HTLC size incoming to sender, in milli-satoshi
13878  */
13879 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13880
13881 /**
13882  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13883  */
13884 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13885
13886 /**
13887  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13888  */
13889 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13890
13891 /**
13892  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13893  */
13894 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13895
13896 /**
13897  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13898  */
13899 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13900
13901 /**
13902  * The maximum number of inbound HTLCs towards sender
13903  */
13904 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13905
13906 /**
13907  * The maximum number of inbound HTLCs towards sender
13908  */
13909 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13910
13911 /**
13912  * The sender's key controlling the funding transaction
13913  */
13914 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13915
13916 /**
13917  * The sender's key controlling the funding transaction
13918  */
13919 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13920
13921 /**
13922  * Used to derive a revocation key for transactions broadcast by counterparty
13923  */
13924 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13925
13926 /**
13927  * Used to derive a revocation key for transactions broadcast by counterparty
13928  */
13929 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13930
13931 /**
13932  * A payment key to sender for transactions broadcast by counterparty
13933  */
13934 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13935
13936 /**
13937  * A payment key to sender for transactions broadcast by counterparty
13938  */
13939 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13940
13941 /**
13942  * Used to derive a payment key to sender for transactions broadcast by sender
13943  */
13944 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13945
13946 /**
13947  * Used to derive a payment key to sender for transactions broadcast by sender
13948  */
13949 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13950
13951 /**
13952  * Used to derive an HTLC payment key to sender
13953  */
13954 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13955
13956 /**
13957  * Used to derive an HTLC payment key to sender
13958  */
13959 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13960
13961 /**
13962  * The first to-be-broadcast-by-sender transaction's per commitment point
13963  */
13964 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13965
13966 /**
13967  * The first to-be-broadcast-by-sender transaction's per commitment point
13968  */
13969 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13970
13971 /**
13972  * Channel flags
13973  */
13974 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13975
13976 /**
13977  * Channel flags
13978  */
13979 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13980
13981 /**
13982  * Creates a copy of the OpenChannel
13983  */
13984 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13985
13986 /**
13987  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13988  */
13989 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13990
13991 /**
13992  * A temporary channel ID, until the funding outpoint is announced
13993  */
13994 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13995
13996 /**
13997  * A temporary channel ID, until the funding outpoint is announced
13998  */
13999 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14000
14001 /**
14002  * The threshold below which outputs on transactions broadcast by sender will be omitted
14003  */
14004 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14005
14006 /**
14007  * The threshold below which outputs on transactions broadcast by sender will be omitted
14008  */
14009 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14010
14011 /**
14012  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14013  */
14014 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14015
14016 /**
14017  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14018  */
14019 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14020
14021 /**
14022  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14023  */
14024 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14028  */
14029 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14030
14031 /**
14032  * The minimum HTLC size incoming to sender, in milli-satoshi
14033  */
14034 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14035
14036 /**
14037  * The minimum HTLC size incoming to sender, in milli-satoshi
14038  */
14039 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14040
14041 /**
14042  * Minimum depth of the funding transaction before the channel is considered open
14043  */
14044 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14045
14046 /**
14047  * Minimum depth of the funding transaction before the channel is considered open
14048  */
14049 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
14050
14051 /**
14052  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14053  */
14054 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14055
14056 /**
14057  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14058  */
14059 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14060
14061 /**
14062  * The maximum number of inbound HTLCs towards sender
14063  */
14064 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14065
14066 /**
14067  * The maximum number of inbound HTLCs towards sender
14068  */
14069 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14070
14071 /**
14072  * The sender's key controlling the funding transaction
14073  */
14074 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14075
14076 /**
14077  * The sender's key controlling the funding transaction
14078  */
14079 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14080
14081 /**
14082  * Used to derive a revocation key for transactions broadcast by counterparty
14083  */
14084 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14085
14086 /**
14087  * Used to derive a revocation key for transactions broadcast by counterparty
14088  */
14089 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14090
14091 /**
14092  * A payment key to sender for transactions broadcast by counterparty
14093  */
14094 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14095
14096 /**
14097  * A payment key to sender for transactions broadcast by counterparty
14098  */
14099 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14100
14101 /**
14102  * Used to derive a payment key to sender for transactions broadcast by sender
14103  */
14104 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14105
14106 /**
14107  * Used to derive a payment key to sender for transactions broadcast by sender
14108  */
14109 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14110
14111 /**
14112  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14113  */
14114 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14115
14116 /**
14117  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14118  */
14119 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14120
14121 /**
14122  * The first to-be-broadcast-by-sender transaction's per commitment point
14123  */
14124 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14125
14126 /**
14127  * The first to-be-broadcast-by-sender transaction's per commitment point
14128  */
14129 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14130
14131 /**
14132  * Creates a copy of the AcceptChannel
14133  */
14134 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
14135
14136 /**
14137  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
14138  */
14139 void FundingCreated_free(struct LDKFundingCreated this_obj);
14140
14141 /**
14142  * A temporary channel ID, until the funding is established
14143  */
14144 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14145
14146 /**
14147  * A temporary channel ID, until the funding is established
14148  */
14149 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14150
14151 /**
14152  * The funding transaction ID
14153  */
14154 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14155
14156 /**
14157  * The funding transaction ID
14158  */
14159 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14160
14161 /**
14162  * The specific output index funding this channel
14163  */
14164 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14165
14166 /**
14167  * The specific output index funding this channel
14168  */
14169 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
14170
14171 /**
14172  * The signature of the channel initiator (funder) on the funding transaction
14173  */
14174 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14175
14176 /**
14177  * The signature of the channel initiator (funder) on the funding transaction
14178  */
14179 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
14180
14181 /**
14182  * Constructs a new FundingCreated given each field
14183  */
14184 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);
14185
14186 /**
14187  * Creates a copy of the FundingCreated
14188  */
14189 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
14190
14191 /**
14192  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
14193  */
14194 void FundingSigned_free(struct LDKFundingSigned this_obj);
14195
14196 /**
14197  * The channel ID
14198  */
14199 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
14200
14201 /**
14202  * The channel ID
14203  */
14204 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14205
14206 /**
14207  * The signature of the channel acceptor (fundee) on the funding transaction
14208  */
14209 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
14210
14211 /**
14212  * The signature of the channel acceptor (fundee) on the funding transaction
14213  */
14214 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14215
14216 /**
14217  * Constructs a new FundingSigned given each field
14218  */
14219 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
14220
14221 /**
14222  * Creates a copy of the FundingSigned
14223  */
14224 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
14225
14226 /**
14227  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
14228  */
14229 void FundingLocked_free(struct LDKFundingLocked this_obj);
14230
14231 /**
14232  * The channel ID
14233  */
14234 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
14235
14236 /**
14237  * The channel ID
14238  */
14239 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14240
14241 /**
14242  * The per-commitment point of the second commitment transaction
14243  */
14244 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
14245
14246 /**
14247  * The per-commitment point of the second commitment transaction
14248  */
14249 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14250
14251 /**
14252  * Constructs a new FundingLocked given each field
14253  */
14254 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
14255
14256 /**
14257  * Creates a copy of the FundingLocked
14258  */
14259 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
14260
14261 /**
14262  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
14263  */
14264 void Shutdown_free(struct LDKShutdown this_obj);
14265
14266 /**
14267  * The channel ID
14268  */
14269 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
14270
14271 /**
14272  * The channel ID
14273  */
14274 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14275
14276 /**
14277  * The destination of this peer's funds on closing.
14278  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14279  */
14280 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
14281
14282 /**
14283  * The destination of this peer's funds on closing.
14284  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14285  */
14286 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14287
14288 /**
14289  * Constructs a new Shutdown given each field
14290  */
14291 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
14292
14293 /**
14294  * Creates a copy of the Shutdown
14295  */
14296 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
14297
14298 /**
14299  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
14300  */
14301 void ClosingSigned_free(struct LDKClosingSigned this_obj);
14302
14303 /**
14304  * The channel ID
14305  */
14306 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
14307
14308 /**
14309  * The channel ID
14310  */
14311 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14312
14313 /**
14314  * The proposed total fee for the closing transaction
14315  */
14316 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14317
14318 /**
14319  * The proposed total fee for the closing transaction
14320  */
14321 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
14322
14323 /**
14324  * A signature on the closing transaction
14325  */
14326 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14327
14328 /**
14329  * A signature on the closing transaction
14330  */
14331 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14332
14333 /**
14334  * Constructs a new ClosingSigned given each field
14335  */
14336 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14337
14338 /**
14339  * Creates a copy of the ClosingSigned
14340  */
14341 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14342
14343 /**
14344  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14345  */
14346 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14347
14348 /**
14349  * The channel ID
14350  */
14351 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14352
14353 /**
14354  * The channel ID
14355  */
14356 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14357
14358 /**
14359  * The HTLC ID
14360  */
14361 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14362
14363 /**
14364  * The HTLC ID
14365  */
14366 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14367
14368 /**
14369  * The HTLC value in milli-satoshi
14370  */
14371 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14372
14373 /**
14374  * The HTLC value in milli-satoshi
14375  */
14376 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14377
14378 /**
14379  * The payment hash, the pre-image of which controls HTLC redemption
14380  */
14381 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14382
14383 /**
14384  * The payment hash, the pre-image of which controls HTLC redemption
14385  */
14386 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14387
14388 /**
14389  * The expiry height of the HTLC
14390  */
14391 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14392
14393 /**
14394  * The expiry height of the HTLC
14395  */
14396 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14397
14398 /**
14399  * Creates a copy of the UpdateAddHTLC
14400  */
14401 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14402
14403 /**
14404  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14405  */
14406 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14407
14408 /**
14409  * The channel ID
14410  */
14411 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14412
14413 /**
14414  * The channel ID
14415  */
14416 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14417
14418 /**
14419  * The HTLC ID
14420  */
14421 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14422
14423 /**
14424  * The HTLC ID
14425  */
14426 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14427
14428 /**
14429  * The pre-image of the payment hash, allowing HTLC redemption
14430  */
14431 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14432
14433 /**
14434  * The pre-image of the payment hash, allowing HTLC redemption
14435  */
14436 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14437
14438 /**
14439  * Constructs a new UpdateFulfillHTLC given each field
14440  */
14441 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14442
14443 /**
14444  * Creates a copy of the UpdateFulfillHTLC
14445  */
14446 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14447
14448 /**
14449  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14450  */
14451 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14452
14453 /**
14454  * The channel ID
14455  */
14456 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14457
14458 /**
14459  * The channel ID
14460  */
14461 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14462
14463 /**
14464  * The HTLC ID
14465  */
14466 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14467
14468 /**
14469  * The HTLC ID
14470  */
14471 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14472
14473 /**
14474  * Creates a copy of the UpdateFailHTLC
14475  */
14476 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14477
14478 /**
14479  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14480  */
14481 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14482
14483 /**
14484  * The channel ID
14485  */
14486 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14487
14488 /**
14489  * The channel ID
14490  */
14491 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14492
14493 /**
14494  * The HTLC ID
14495  */
14496 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14497
14498 /**
14499  * The HTLC ID
14500  */
14501 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14502
14503 /**
14504  * The failure code
14505  */
14506 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14507
14508 /**
14509  * The failure code
14510  */
14511 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14512
14513 /**
14514  * Creates a copy of the UpdateFailMalformedHTLC
14515  */
14516 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14517
14518 /**
14519  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14520  */
14521 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14522
14523 /**
14524  * The channel ID
14525  */
14526 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14527
14528 /**
14529  * The channel ID
14530  */
14531 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14532
14533 /**
14534  * A signature on the commitment transaction
14535  */
14536 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14537
14538 /**
14539  * A signature on the commitment transaction
14540  */
14541 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14542
14543 /**
14544  * Signatures on the HTLC transactions
14545  */
14546 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14547
14548 /**
14549  * Constructs a new CommitmentSigned given each field
14550  */
14551 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14552
14553 /**
14554  * Creates a copy of the CommitmentSigned
14555  */
14556 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14557
14558 /**
14559  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14560  */
14561 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14562
14563 /**
14564  * The channel ID
14565  */
14566 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14567
14568 /**
14569  * The channel ID
14570  */
14571 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14572
14573 /**
14574  * The secret corresponding to the per-commitment point
14575  */
14576 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14577
14578 /**
14579  * The secret corresponding to the per-commitment point
14580  */
14581 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14582
14583 /**
14584  * The next sender-broadcast commitment transaction's per-commitment point
14585  */
14586 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14587
14588 /**
14589  * The next sender-broadcast commitment transaction's per-commitment point
14590  */
14591 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14592
14593 /**
14594  * Constructs a new RevokeAndACK given each field
14595  */
14596 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);
14597
14598 /**
14599  * Creates a copy of the RevokeAndACK
14600  */
14601 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14602
14603 /**
14604  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14605  */
14606 void UpdateFee_free(struct LDKUpdateFee this_obj);
14607
14608 /**
14609  * The channel ID
14610  */
14611 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14612
14613 /**
14614  * The channel ID
14615  */
14616 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14617
14618 /**
14619  * Fee rate per 1000-weight of the transaction
14620  */
14621 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14622
14623 /**
14624  * Fee rate per 1000-weight of the transaction
14625  */
14626 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14627
14628 /**
14629  * Constructs a new UpdateFee given each field
14630  */
14631 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14632
14633 /**
14634  * Creates a copy of the UpdateFee
14635  */
14636 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14637
14638 /**
14639  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14640  */
14641 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14642
14643 /**
14644  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14645  * belonging to the recipient
14646  */
14647 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14648
14649 /**
14650  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14651  * belonging to the recipient
14652  */
14653 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14654
14655 /**
14656  * The sender's per-commitment point for their current commitment transaction
14657  */
14658 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14659
14660 /**
14661  * The sender's per-commitment point for their current commitment transaction
14662  */
14663 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14664
14665 /**
14666  * Constructs a new DataLossProtect given each field
14667  */
14668 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14669
14670 /**
14671  * Creates a copy of the DataLossProtect
14672  */
14673 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14674
14675 /**
14676  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14677  */
14678 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14679
14680 /**
14681  * The channel ID
14682  */
14683 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14684
14685 /**
14686  * The channel ID
14687  */
14688 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14689
14690 /**
14691  * The next commitment number for the sender
14692  */
14693 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14694
14695 /**
14696  * The next commitment number for the sender
14697  */
14698 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14699
14700 /**
14701  * The next commitment number for the recipient
14702  */
14703 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14704
14705 /**
14706  * The next commitment number for the recipient
14707  */
14708 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14709
14710 /**
14711  * Creates a copy of the ChannelReestablish
14712  */
14713 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14714
14715 /**
14716  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14717  */
14718 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14719
14720 /**
14721  * The channel ID
14722  */
14723 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14724
14725 /**
14726  * The channel ID
14727  */
14728 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14729
14730 /**
14731  * The short channel ID
14732  */
14733 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14734
14735 /**
14736  * The short channel ID
14737  */
14738 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14739
14740 /**
14741  * A signature by the node key
14742  */
14743 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14744
14745 /**
14746  * A signature by the node key
14747  */
14748 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14749
14750 /**
14751  * A signature by the funding key
14752  */
14753 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14754
14755 /**
14756  * A signature by the funding key
14757  */
14758 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14759
14760 /**
14761  * Constructs a new AnnouncementSignatures given each field
14762  */
14763 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);
14764
14765 /**
14766  * Creates a copy of the AnnouncementSignatures
14767  */
14768 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14769
14770 /**
14771  * Frees any resources used by the NetAddress
14772  */
14773 void NetAddress_free(struct LDKNetAddress this_ptr);
14774
14775 /**
14776  * Creates a copy of the NetAddress
14777  */
14778 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14779
14780 /**
14781  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14782  */
14783 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14784
14785 /**
14786  * Read a Result from a byte array, created by Result_write
14787  */
14788 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14789
14790 /**
14791  * Read a NetAddress from a byte array, created by NetAddress_write
14792  */
14793 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
14794
14795 /**
14796  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14797  */
14798 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14799
14800 /**
14801  * The advertised features
14802  */
14803 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14804
14805 /**
14806  * The advertised features
14807  */
14808 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14809
14810 /**
14811  * A strictly monotonic announcement counter, with gaps allowed
14812  */
14813 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14814
14815 /**
14816  * A strictly monotonic announcement counter, with gaps allowed
14817  */
14818 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14819
14820 /**
14821  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14822  * to this node).
14823  */
14824 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14825
14826 /**
14827  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14828  * to this node).
14829  */
14830 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14831
14832 /**
14833  * An RGB color for UI purposes
14834  */
14835 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14836
14837 /**
14838  * An RGB color for UI purposes
14839  */
14840 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14841
14842 /**
14843  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14844  * of uniqueness.
14845  */
14846 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14847
14848 /**
14849  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14850  * of uniqueness.
14851  */
14852 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14853
14854 /**
14855  * List of addresses on which this node is reachable
14856  */
14857 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14858
14859 /**
14860  * Creates a copy of the UnsignedNodeAnnouncement
14861  */
14862 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14863
14864 /**
14865  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14866  */
14867 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14868
14869 /**
14870  * The signature by the node key
14871  */
14872 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14873
14874 /**
14875  * The signature by the node key
14876  */
14877 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14878
14879 /**
14880  * The actual content of the announcement
14881  */
14882 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14883
14884 /**
14885  * The actual content of the announcement
14886  */
14887 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14888
14889 /**
14890  * Constructs a new NodeAnnouncement given each field
14891  */
14892 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14893
14894 /**
14895  * Creates a copy of the NodeAnnouncement
14896  */
14897 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14898
14899 /**
14900  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14901  */
14902 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14903
14904 /**
14905  * The advertised channel features
14906  */
14907 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14908
14909 /**
14910  * The advertised channel features
14911  */
14912 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14913
14914 /**
14915  * The genesis hash of the blockchain where the channel is to be opened
14916  */
14917 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14918
14919 /**
14920  * The genesis hash of the blockchain where the channel is to be opened
14921  */
14922 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14923
14924 /**
14925  * The short channel ID
14926  */
14927 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14928
14929 /**
14930  * The short channel ID
14931  */
14932 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14933
14934 /**
14935  * One of the two node_ids which are endpoints of this channel
14936  */
14937 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14938
14939 /**
14940  * One of the two node_ids which are endpoints of this channel
14941  */
14942 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14943
14944 /**
14945  * The other of the two node_ids which are endpoints of this channel
14946  */
14947 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14948
14949 /**
14950  * The other of the two node_ids which are endpoints of this channel
14951  */
14952 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14953
14954 /**
14955  * The funding key for the first node
14956  */
14957 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14958
14959 /**
14960  * The funding key for the first node
14961  */
14962 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14963
14964 /**
14965  * The funding key for the second node
14966  */
14967 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14968
14969 /**
14970  * The funding key for the second node
14971  */
14972 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14973
14974 /**
14975  * Creates a copy of the UnsignedChannelAnnouncement
14976  */
14977 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14978
14979 /**
14980  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14981  */
14982 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14983
14984 /**
14985  * Authentication of the announcement by the first public node
14986  */
14987 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14988
14989 /**
14990  * Authentication of the announcement by the first public node
14991  */
14992 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14993
14994 /**
14995  * Authentication of the announcement by the second public node
14996  */
14997 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14998
14999 /**
15000  * Authentication of the announcement by the second public node
15001  */
15002 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15003
15004 /**
15005  * Proof of funding UTXO ownership by the first public node
15006  */
15007 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15008
15009 /**
15010  * Proof of funding UTXO ownership by the first public node
15011  */
15012 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15013
15014 /**
15015  * Proof of funding UTXO ownership by the second public node
15016  */
15017 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15018
15019 /**
15020  * Proof of funding UTXO ownership by the second public node
15021  */
15022 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15023
15024 /**
15025  * The actual announcement
15026  */
15027 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15028
15029 /**
15030  * The actual announcement
15031  */
15032 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
15033
15034 /**
15035  * Constructs a new ChannelAnnouncement given each field
15036  */
15037 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);
15038
15039 /**
15040  * Creates a copy of the ChannelAnnouncement
15041  */
15042 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
15043
15044 /**
15045  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
15046  */
15047 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
15048
15049 /**
15050  * The genesis hash of the blockchain where the channel is to be opened
15051  */
15052 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
15053
15054 /**
15055  * The genesis hash of the blockchain where the channel is to be opened
15056  */
15057 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15058
15059 /**
15060  * The short channel ID
15061  */
15062 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15063
15064 /**
15065  * The short channel ID
15066  */
15067 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15068
15069 /**
15070  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15071  */
15072 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15073
15074 /**
15075  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15076  */
15077 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15078
15079 /**
15080  * Channel flags
15081  */
15082 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15083
15084 /**
15085  * Channel flags
15086  */
15087 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
15088
15089 /**
15090  * The number of blocks such that if:
15091  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15092  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15093  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15094  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15095  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15096  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15097  * constructing the route.
15098  */
15099 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15100
15101 /**
15102  * The number of blocks such that if:
15103  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15104  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15105  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15106  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15107  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15108  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15109  * constructing the route.
15110  */
15111 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
15112
15113 /**
15114  * The minimum HTLC size incoming to sender, in milli-satoshi
15115  */
15116 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15117
15118 /**
15119  * The minimum HTLC size incoming to sender, in milli-satoshi
15120  */
15121 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15122
15123 /**
15124  * The base HTLC fee charged by sender, in milli-satoshi
15125  */
15126 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15127
15128 /**
15129  * The base HTLC fee charged by sender, in milli-satoshi
15130  */
15131 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15132
15133 /**
15134  * The amount to fee multiplier, in micro-satoshi
15135  */
15136 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15137
15138 /**
15139  * The amount to fee multiplier, in micro-satoshi
15140  */
15141 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15142
15143 /**
15144  * Creates a copy of the UnsignedChannelUpdate
15145  */
15146 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
15147
15148 /**
15149  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
15150  */
15151 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
15152
15153 /**
15154  * A signature of the channel update
15155  */
15156 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15157
15158 /**
15159  * A signature of the channel update
15160  */
15161 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
15162
15163 /**
15164  * The actual channel update
15165  */
15166 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15167
15168 /**
15169  * The actual channel update
15170  */
15171 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
15172
15173 /**
15174  * Constructs a new ChannelUpdate given each field
15175  */
15176 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
15177
15178 /**
15179  * Creates a copy of the ChannelUpdate
15180  */
15181 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
15182
15183 /**
15184  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
15185  */
15186 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
15187
15188 /**
15189  * The genesis hash of the blockchain being queried
15190  */
15191 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
15192
15193 /**
15194  * The genesis hash of the blockchain being queried
15195  */
15196 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15197
15198 /**
15199  * The height of the first block for the channel UTXOs being queried
15200  */
15201 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15202
15203 /**
15204  * The height of the first block for the channel UTXOs being queried
15205  */
15206 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15207
15208 /**
15209  * The number of blocks to include in the query results
15210  */
15211 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15212
15213 /**
15214  * The number of blocks to include in the query results
15215  */
15216 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15217
15218 /**
15219  * Constructs a new QueryChannelRange given each field
15220  */
15221 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
15222
15223 /**
15224  * Creates a copy of the QueryChannelRange
15225  */
15226 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
15227
15228 /**
15229  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
15230  */
15231 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
15232
15233 /**
15234  * The genesis hash of the blockchain being queried
15235  */
15236 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
15237
15238 /**
15239  * The genesis hash of the blockchain being queried
15240  */
15241 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15242
15243 /**
15244  * The height of the first block in the range of the reply
15245  */
15246 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15247
15248 /**
15249  * The height of the first block in the range of the reply
15250  */
15251 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15252
15253 /**
15254  * The number of blocks included in the range of the reply
15255  */
15256 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15257
15258 /**
15259  * The number of blocks included in the range of the reply
15260  */
15261 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15262
15263 /**
15264  * True when this is the final reply for a query
15265  */
15266 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15267
15268 /**
15269  * True when this is the final reply for a query
15270  */
15271 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
15272
15273 /**
15274  * The short_channel_ids in the channel range
15275  */
15276 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15277
15278 /**
15279  * Constructs a new ReplyChannelRange given each field
15280  */
15281 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);
15282
15283 /**
15284  * Creates a copy of the ReplyChannelRange
15285  */
15286 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
15287
15288 /**
15289  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
15290  */
15291 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
15292
15293 /**
15294  * The genesis hash of the blockchain being queried
15295  */
15296 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
15297
15298 /**
15299  * The genesis hash of the blockchain being queried
15300  */
15301 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15302
15303 /**
15304  * The short_channel_ids that are being queried
15305  */
15306 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15307
15308 /**
15309  * Constructs a new QueryShortChannelIds given each field
15310  */
15311 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
15312
15313 /**
15314  * Creates a copy of the QueryShortChannelIds
15315  */
15316 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
15317
15318 /**
15319  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
15320  */
15321 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
15322
15323 /**
15324  * The genesis hash of the blockchain that was queried
15325  */
15326 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
15327
15328 /**
15329  * The genesis hash of the blockchain that was queried
15330  */
15331 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15332
15333 /**
15334  * Indicates if the query recipient maintains up-to-date channel
15335  * information for the chain_hash
15336  */
15337 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15338
15339 /**
15340  * Indicates if the query recipient maintains up-to-date channel
15341  * information for the chain_hash
15342  */
15343 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15344
15345 /**
15346  * Constructs a new ReplyShortChannelIdsEnd given each field
15347  */
15348 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15349
15350 /**
15351  * Creates a copy of the ReplyShortChannelIdsEnd
15352  */
15353 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15354
15355 /**
15356  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15357  */
15358 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15359
15360 /**
15361  * The genesis hash of the blockchain for channel and node information
15362  */
15363 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15364
15365 /**
15366  * The genesis hash of the blockchain for channel and node information
15367  */
15368 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15369
15370 /**
15371  * The starting unix timestamp
15372  */
15373 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15374
15375 /**
15376  * The starting unix timestamp
15377  */
15378 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15379
15380 /**
15381  * The range of information in seconds
15382  */
15383 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15384
15385 /**
15386  * The range of information in seconds
15387  */
15388 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15389
15390 /**
15391  * Constructs a new GossipTimestampFilter given each field
15392  */
15393 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15394
15395 /**
15396  * Creates a copy of the GossipTimestampFilter
15397  */
15398 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15399
15400 /**
15401  * Frees any resources used by the ErrorAction
15402  */
15403 void ErrorAction_free(struct LDKErrorAction this_ptr);
15404
15405 /**
15406  * Creates a copy of the ErrorAction
15407  */
15408 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15409
15410 /**
15411  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15412  */
15413 void LightningError_free(struct LDKLightningError this_obj);
15414
15415 /**
15416  * A human-readable message describing the error
15417  */
15418 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15419
15420 /**
15421  * A human-readable message describing the error
15422  */
15423 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15424
15425 /**
15426  * The action which should be taken against the offending peer.
15427  */
15428 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15429
15430 /**
15431  * The action which should be taken against the offending peer.
15432  */
15433 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15434
15435 /**
15436  * Constructs a new LightningError given each field
15437  */
15438 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15439
15440 /**
15441  * Creates a copy of the LightningError
15442  */
15443 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15444
15445 /**
15446  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15447  */
15448 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15449
15450 /**
15451  * update_add_htlc messages which should be sent
15452  */
15453 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15454
15455 /**
15456  * update_fulfill_htlc messages which should be sent
15457  */
15458 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15459
15460 /**
15461  * update_fail_htlc messages which should be sent
15462  */
15463 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15464
15465 /**
15466  * update_fail_malformed_htlc messages which should be sent
15467  */
15468 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15469
15470 /**
15471  * An update_fee message which should be sent
15472  */
15473 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15474
15475 /**
15476  * An update_fee message which should be sent
15477  */
15478 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15479
15480 /**
15481  * Finally, the commitment_signed message which should be sent
15482  */
15483 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15484
15485 /**
15486  * Finally, the commitment_signed message which should be sent
15487  */
15488 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15489
15490 /**
15491  * Constructs a new CommitmentUpdate given each field
15492  */
15493 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);
15494
15495 /**
15496  * Creates a copy of the CommitmentUpdate
15497  */
15498 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15499
15500 /**
15501  * Frees any resources used by the HTLCFailChannelUpdate
15502  */
15503 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15504
15505 /**
15506  * Creates a copy of the HTLCFailChannelUpdate
15507  */
15508 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15509
15510 /**
15511  * Calls the free function if one is set
15512  */
15513 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15514
15515 /**
15516  * Calls the free function if one is set
15517  */
15518 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15519
15520 /**
15521  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15522  */
15523 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15524
15525 /**
15526  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15527  */
15528 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15529
15530 /**
15531  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15532  */
15533 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15534
15535 /**
15536  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15537  */
15538 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15539
15540 /**
15541  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15542  */
15543 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15544
15545 /**
15546  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15547  */
15548 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15549
15550 /**
15551  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15552  */
15553 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15554
15555 /**
15556  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15557  */
15558 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15559
15560 /**
15561  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15562  */
15563 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15564
15565 /**
15566  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15567  */
15568 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15569
15570 /**
15571  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15572  */
15573 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15574
15575 /**
15576  * Read a FundingCreated from a byte array, created by FundingCreated_write
15577  */
15578 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15579
15580 /**
15581  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15582  */
15583 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15584
15585 /**
15586  * Read a FundingSigned from a byte array, created by FundingSigned_write
15587  */
15588 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15589
15590 /**
15591  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15592  */
15593 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15594
15595 /**
15596  * Read a FundingLocked from a byte array, created by FundingLocked_write
15597  */
15598 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15599
15600 /**
15601  * Serialize the Init object into a byte array which can be read by Init_read
15602  */
15603 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15604
15605 /**
15606  * Read a Init from a byte array, created by Init_write
15607  */
15608 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15609
15610 /**
15611  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15612  */
15613 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15614
15615 /**
15616  * Read a OpenChannel from a byte array, created by OpenChannel_write
15617  */
15618 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15619
15620 /**
15621  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15622  */
15623 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15624
15625 /**
15626  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15627  */
15628 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15629
15630 /**
15631  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15632  */
15633 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15634
15635 /**
15636  * Read a Shutdown from a byte array, created by Shutdown_write
15637  */
15638 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15639
15640 /**
15641  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15642  */
15643 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15644
15645 /**
15646  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15647  */
15648 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15649
15650 /**
15651  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15652  */
15653 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15654
15655 /**
15656  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15657  */
15658 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15659
15660 /**
15661  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15662  */
15663 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15664
15665 /**
15666  * Read a UpdateFee from a byte array, created by UpdateFee_write
15667  */
15668 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15669
15670 /**
15671  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15672  */
15673 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15674
15675 /**
15676  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15677  */
15678 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15679
15680 /**
15681  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15682  */
15683 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15684
15685 /**
15686  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15687  */
15688 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15689
15690 /**
15691  * Serialize the Ping object into a byte array which can be read by Ping_read
15692  */
15693 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15694
15695 /**
15696  * Read a Ping from a byte array, created by Ping_write
15697  */
15698 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15699
15700 /**
15701  * Serialize the Pong object into a byte array which can be read by Pong_read
15702  */
15703 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15704
15705 /**
15706  * Read a Pong from a byte array, created by Pong_write
15707  */
15708 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15709
15710 /**
15711  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15712  */
15713 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15714
15715 /**
15716  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15717  */
15718 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15719
15720 /**
15721  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15722  */
15723 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15724
15725 /**
15726  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15727  */
15728 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15729
15730 /**
15731  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15732  */
15733 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15734
15735 /**
15736  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15737  */
15738 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15739
15740 /**
15741  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15742  */
15743 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15744
15745 /**
15746  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15747  */
15748 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15749
15750 /**
15751  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15752  */
15753 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15754
15755 /**
15756  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15757  */
15758 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15759
15760 /**
15761  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15762  */
15763 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15764
15765 /**
15766  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15767  */
15768 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15769
15770 /**
15771  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15772  */
15773 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15774
15775 /**
15776  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15777  */
15778 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15779
15780 /**
15781  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15782  */
15783 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15784
15785 /**
15786  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15787  */
15788 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15789
15790 /**
15791  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15792  */
15793 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15794
15795 /**
15796  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15797  */
15798 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15799
15800 /**
15801  *\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
15802  */
15803 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15804
15805 /**
15806  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15807  */
15808 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15809
15810 /**
15811  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15812  */
15813 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15814
15815 /**
15816  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15817  */
15818 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15819
15820 /**
15821  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15822  */
15823 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15824
15825 /**
15826  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15827  */
15828 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15829
15830 /**
15831  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15832  */
15833 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15834
15835 /**
15836  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15837  */
15838 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15839
15840 /**
15841  * Constructs a new IgnoringMessageHandler given each field
15842  */
15843 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15844
15845 /**
15846  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15847  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15848  */
15849 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15850
15851 /**
15852  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15853  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15854  */
15855 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15856
15857 /**
15858  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15859  */
15860 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15861
15862 /**
15863  * Constructs a new ErroringMessageHandler
15864  */
15865 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15866
15867 /**
15868  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15869  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15870  */
15871 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15872
15873 /**
15874  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15875  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15876  */
15877 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15878
15879 /**
15880  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15881  */
15882 void MessageHandler_free(struct LDKMessageHandler this_obj);
15883
15884 /**
15885  * A message handler which handles messages specific to channels. Usually this is just a
15886  * ChannelManager object or a ErroringMessageHandler.
15887  */
15888 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15889
15890 /**
15891  * A message handler which handles messages specific to channels. Usually this is just a
15892  * ChannelManager object or a ErroringMessageHandler.
15893  */
15894 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15895
15896 /**
15897  * A message handler which handles messages updating our knowledge of the network channel
15898  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15899  */
15900 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15901
15902 /**
15903  * A message handler which handles messages updating our knowledge of the network channel
15904  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15905  */
15906 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15907
15908 /**
15909  * Constructs a new MessageHandler given each field
15910  */
15911 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15912
15913 /**
15914  * Creates a copy of a SocketDescriptor
15915  */
15916 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15917
15918 /**
15919  * Calls the free function if one is set
15920  */
15921 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15922
15923 /**
15924  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15925  */
15926 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15927
15928 /**
15929  * Used to indicate that we probably can't make any future connections to this peer, implying
15930  * we should go ahead and force-close any channels we have with it.
15931  */
15932 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15933
15934 /**
15935  * Used to indicate that we probably can't make any future connections to this peer, implying
15936  * we should go ahead and force-close any channels we have with it.
15937  */
15938 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15939
15940 /**
15941  * Constructs a new PeerHandleError given each field
15942  */
15943 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15944
15945 /**
15946  * Creates a copy of the PeerHandleError
15947  */
15948 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15949
15950 /**
15951  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15952  */
15953 void PeerManager_free(struct LDKPeerManager this_obj);
15954
15955 /**
15956  * Constructs a new PeerManager with the given message handlers and node_id secret key
15957  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15958  * cryptographically secure random bytes.
15959  */
15960 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);
15961
15962 /**
15963  * Get the list of node ids for peers which have completed the initial handshake.
15964  *
15965  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15966  * new_outbound_connection, however entries will only appear once the initial handshake has
15967  * completed and we are sure the remote peer has the private key for the given node_id.
15968  */
15969 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15970
15971 /**
15972  * Indicates a new outbound connection has been established to a node with the given node_id.
15973  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15974  * descriptor but must disconnect the connection immediately.
15975  *
15976  * Returns a small number of bytes to send to the remote node (currently always 50).
15977  *
15978  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15979  * socket_disconnected().
15980  */
15981 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);
15982
15983 /**
15984  * Indicates a new inbound connection has been established.
15985  *
15986  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15987  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15988  * call socket_disconnected for the new descriptor but must disconnect the connection
15989  * immediately.
15990  *
15991  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15992  * socket_disconnected called.
15993  */
15994 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15995
15996 /**
15997  * Indicates that there is room to write data to the given socket descriptor.
15998  *
15999  * May return an Err to indicate that the connection should be closed.
16000  *
16001  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
16002  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
16003  * invariants around calling write_buffer_space_avail in case a write did not fully complete
16004  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
16005  * here isn't sufficient! Panics if the descriptor was not previously registered in a
16006  * new_\\*_connection event.
16007  */
16008 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16009
16010 /**
16011  * Indicates that data was read from the given socket descriptor.
16012  *
16013  * May return an Err to indicate that the connection should be closed.
16014  *
16015  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
16016  * Thus, however, you almost certainly want to call process_events() after any read_event to
16017  * generate send_data calls to handle responses.
16018  *
16019  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
16020  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
16021  *
16022  * Panics if the descriptor was not previously registered in a new_*_connection event.
16023  */
16024 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);
16025
16026 /**
16027  * Checks for any events generated by our handlers and processes them. Includes sending most
16028  * response messages as well as messages generated by calls to handler functions directly (eg
16029  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
16030  */
16031 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
16032
16033 /**
16034  * Indicates that the given socket descriptor's connection is now closed.
16035  *
16036  * This must only be called if the socket has been disconnected by the peer or your own
16037  * decision to disconnect it and must NOT be called in any case where other parts of this
16038  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
16039  * the peer.
16040  *
16041  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
16042  */
16043 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16044
16045 /**
16046  * Disconnect a peer given its node id.
16047  *
16048  * Set no_connection_possible to true to prevent any further connection with this peer,
16049  * force-closing any channels we have with it.
16050  *
16051  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
16052  * so be careful about reentrancy issues.
16053  */
16054 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
16055
16056 /**
16057  * This function should be called roughly once every 30 seconds.
16058  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
16059  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
16060  */
16061 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
16062
16063 /**
16064  * Build the commitment secret from the seed and the commitment number
16065  */
16066 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
16067
16068 /**
16069  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
16070  * from the base secret and the per_commitment_point.
16071  *
16072  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16073  * generated (ie our own).
16074  */
16075 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
16076
16077 /**
16078  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
16079  * from the base point and the per_commitment_key. This is the public equivalent of
16080  * derive_private_key - using only public keys to derive a public key instead of private keys.
16081  *
16082  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16083  * generated (ie our own).
16084  */
16085 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
16086
16087 /**
16088  * Derives a per-commitment-transaction revocation key from its constituent parts.
16089  *
16090  * Only the cheating participant owns a valid witness to propagate a revoked
16091  * commitment transaction, thus per_commitment_secret always come from cheater
16092  * and revocation_base_secret always come from punisher, which is the broadcaster
16093  * of the transaction spending with this key knowledge.
16094  *
16095  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16096  * generated (ie our own).
16097  */
16098 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
16099
16100 /**
16101  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
16102  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
16103  * public key instead of private keys.
16104  *
16105  * Only the cheating participant owns a valid witness to propagate a revoked
16106  * commitment transaction, thus per_commitment_point always come from cheater
16107  * and revocation_base_point always come from punisher, which is the broadcaster
16108  * of the transaction spending with this key knowledge.
16109  *
16110  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16111  * generated (ie our own).
16112  */
16113 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
16114
16115 /**
16116  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
16117  */
16118 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
16119
16120 /**
16121  * The broadcaster's per-commitment public key which was used to derive the other keys.
16122  */
16123 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16124
16125 /**
16126  * The broadcaster's per-commitment public key which was used to derive the other keys.
16127  */
16128 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16129
16130 /**
16131  * The revocation key which is used to allow the broadcaster of the commitment
16132  * transaction to provide their counterparty the ability to punish them if they broadcast
16133  * an old state.
16134  */
16135 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16136
16137 /**
16138  * The revocation key which is used to allow the broadcaster of the commitment
16139  * transaction to provide their counterparty the ability to punish them if they broadcast
16140  * an old state.
16141  */
16142 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16143
16144 /**
16145  * Broadcaster's HTLC Key
16146  */
16147 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16148
16149 /**
16150  * Broadcaster's HTLC Key
16151  */
16152 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16153
16154 /**
16155  * Countersignatory's HTLC Key
16156  */
16157 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16158
16159 /**
16160  * Countersignatory's HTLC Key
16161  */
16162 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16163
16164 /**
16165  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16166  */
16167 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16168
16169 /**
16170  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16171  */
16172 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16173
16174 /**
16175  * Constructs a new TxCreationKeys given each field
16176  */
16177 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);
16178
16179 /**
16180  * Creates a copy of the TxCreationKeys
16181  */
16182 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
16183
16184 /**
16185  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
16186  */
16187 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
16188
16189 /**
16190  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
16191  */
16192 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
16193
16194 /**
16195  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
16196  */
16197 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
16198
16199 /**
16200  * The public key which is used to sign all commitment transactions, as it appears in the
16201  * on-chain channel lock-in 2-of-2 multisig output.
16202  */
16203 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16204
16205 /**
16206  * The public key which is used to sign all commitment transactions, as it appears in the
16207  * on-chain channel lock-in 2-of-2 multisig output.
16208  */
16209 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16210
16211 /**
16212  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16213  * revocation keys. This is combined with the per-commitment-secret generated by the
16214  * counterparty to create a secret which the counterparty can reveal to revoke previous
16215  * states.
16216  */
16217 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16218
16219 /**
16220  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16221  * revocation keys. This is combined with the per-commitment-secret generated by the
16222  * counterparty to create a secret which the counterparty can reveal to revoke previous
16223  * states.
16224  */
16225 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16226
16227 /**
16228  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16229  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16230  * static across every commitment transaction.
16231  */
16232 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16233
16234 /**
16235  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16236  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16237  * static across every commitment transaction.
16238  */
16239 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16240
16241 /**
16242  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16243  * public key which receives non-HTLC-encumbered funds which are only available for spending
16244  * after some delay (or can be claimed via the revocation path).
16245  */
16246 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16247
16248 /**
16249  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16250  * public key which receives non-HTLC-encumbered funds which are only available for spending
16251  * after some delay (or can be claimed via the revocation path).
16252  */
16253 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16254
16255 /**
16256  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16257  * which is used to encumber HTLC-in-flight outputs.
16258  */
16259 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16260
16261 /**
16262  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16263  * which is used to encumber HTLC-in-flight outputs.
16264  */
16265 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16266
16267 /**
16268  * Constructs a new ChannelPublicKeys given each field
16269  */
16270 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);
16271
16272 /**
16273  * Creates a copy of the ChannelPublicKeys
16274  */
16275 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
16276
16277 /**
16278  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
16279  */
16280 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
16281
16282 /**
16283  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
16284  */
16285 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
16286
16287 /**
16288  * Create per-state keys from channel base points and the per-commitment point.
16289  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16290  */
16291 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);
16292
16293 /**
16294  * Generate per-state keys from channel static keys.
16295  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16296  */
16297 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);
16298
16299 /**
16300  * A script either spendable by the revocation
16301  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
16302  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
16303  */
16304 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
16305
16306 /**
16307  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
16308  */
16309 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
16310
16311 /**
16312  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16313  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16314  * need to compare this value to whether the commitment transaction in question is that of
16315  * the counterparty or our own.
16316  */
16317 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16318
16319 /**
16320  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16321  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16322  * need to compare this value to whether the commitment transaction in question is that of
16323  * the counterparty or our own.
16324  */
16325 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
16326
16327 /**
16328  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16329  * this divided by 1000.
16330  */
16331 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16332
16333 /**
16334  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16335  * this divided by 1000.
16336  */
16337 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16338
16339 /**
16340  * The CLTV lock-time at which this HTLC expires.
16341  */
16342 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16343
16344 /**
16345  * The CLTV lock-time at which this HTLC expires.
16346  */
16347 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16348
16349 /**
16350  * The hash of the preimage which unlocks this HTLC.
16351  */
16352 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16353
16354 /**
16355  * The hash of the preimage which unlocks this HTLC.
16356  */
16357 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16358
16359 /**
16360  * The position within the commitment transactions' outputs. This may be None if the value is
16361  * below the dust limit (in which case no output appears in the commitment transaction and the
16362  * value is spent to additional transaction fees).
16363  */
16364 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16365
16366 /**
16367  * The position within the commitment transactions' outputs. This may be None if the value is
16368  * below the dust limit (in which case no output appears in the commitment transaction and the
16369  * value is spent to additional transaction fees).
16370  */
16371 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16372
16373 /**
16374  * Constructs a new HTLCOutputInCommitment given each field
16375  */
16376 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);
16377
16378 /**
16379  * Creates a copy of the HTLCOutputInCommitment
16380  */
16381 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16382
16383 /**
16384  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16385  */
16386 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16387
16388 /**
16389  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16390  */
16391 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16392
16393 /**
16394  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16395  * does not need to have its previous_output_index filled.
16396  */
16397 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16398
16399 /**
16400  * Gets the redeemscript for a funding output from the two funding public keys.
16401  * Note that the order of funding public keys does not matter.
16402  */
16403 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16404
16405 /**
16406  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
16407  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
16408  * transaction which needs signing, and can be used to construct an HTLC transaction which is
16409  * broadcastable given a counterparty HTLC signature.
16410  *
16411  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
16412  * commitment transaction).
16413  */
16414 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);
16415
16416 /**
16417  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16418  */
16419 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16420
16421 /**
16422  * Holder public keys
16423  */
16424 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16425
16426 /**
16427  * Holder public keys
16428  */
16429 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16430
16431 /**
16432  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16433  */
16434 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16435
16436 /**
16437  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16438  */
16439 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16440
16441 /**
16442  * Whether the holder is the initiator of this channel.
16443  * This is an input to the commitment number obscure factor computation.
16444  */
16445 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16446
16447 /**
16448  * Whether the holder is the initiator of this channel.
16449  * This is an input to the commitment number obscure factor computation.
16450  */
16451 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16452
16453 /**
16454  * The late-bound counterparty channel transaction parameters.
16455  * These parameters are populated at the point in the protocol where the counterparty provides them.
16456  */
16457 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16458
16459 /**
16460  * The late-bound counterparty channel transaction parameters.
16461  * These parameters are populated at the point in the protocol where the counterparty provides them.
16462  */
16463 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16464
16465 /**
16466  * The late-bound funding outpoint
16467  */
16468 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16469
16470 /**
16471  * The late-bound funding outpoint
16472  */
16473 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16474
16475 /**
16476  * Constructs a new ChannelTransactionParameters given each field
16477  */
16478 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);
16479
16480 /**
16481  * Creates a copy of the ChannelTransactionParameters
16482  */
16483 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16484
16485 /**
16486  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16487  */
16488 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16489
16490 /**
16491  * Counter-party public keys
16492  */
16493 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16494
16495 /**
16496  * Counter-party public keys
16497  */
16498 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16499
16500 /**
16501  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16502  */
16503 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16504
16505 /**
16506  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16507  */
16508 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16509
16510 /**
16511  * Constructs a new CounterpartyChannelTransactionParameters given each field
16512  */
16513 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
16514
16515 /**
16516  * Creates a copy of the CounterpartyChannelTransactionParameters
16517  */
16518 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16519
16520 /**
16521  * Whether the late bound parameters are populated.
16522  */
16523 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16524
16525 /**
16526  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16527  * given that the holder is the broadcaster.
16528  *
16529  * self.is_populated() must be true before calling this function.
16530  */
16531 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16532
16533 /**
16534  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16535  * given that the counterparty is the broadcaster.
16536  *
16537  * self.is_populated() must be true before calling this function.
16538  */
16539 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16540
16541 /**
16542  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16543  */
16544 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16545
16546 /**
16547  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16548  */
16549 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16550
16551 /**
16552  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16553  */
16554 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16555
16556 /**
16557  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16558  */
16559 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16560
16561 /**
16562  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16563  */
16564 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16565
16566 /**
16567  * Get the channel pubkeys for the broadcaster
16568  */
16569 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16570
16571 /**
16572  * Get the channel pubkeys for the countersignatory
16573  */
16574 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16575
16576 /**
16577  * Get the contest delay applicable to the transactions.
16578  * Note that the contest delay was selected by the countersignatory.
16579  */
16580 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16581
16582 /**
16583  * Whether the channel is outbound from the broadcaster.
16584  *
16585  * The boolean representing the side that initiated the channel is
16586  * an input to the commitment number obscure factor computation.
16587  */
16588 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16589
16590 /**
16591  * The funding outpoint
16592  */
16593 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16594
16595 /**
16596  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16597  */
16598 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16599
16600 /**
16601  * Our counterparty's signature for the transaction
16602  */
16603 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16604
16605 /**
16606  * Our counterparty's signature for the transaction
16607  */
16608 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16609
16610 /**
16611  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16612  */
16613 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16614
16615 /**
16616  * Creates a copy of the HolderCommitmentTransaction
16617  */
16618 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16619
16620 /**
16621  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16622  */
16623 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16624
16625 /**
16626  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16627  */
16628 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16629
16630 /**
16631  * Create a new holder transaction with the given counterparty signatures.
16632  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16633  */
16634 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);
16635
16636 /**
16637  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16638  */
16639 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16640
16641 /**
16642  * The commitment transaction
16643  */
16644 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16645
16646 /**
16647  * The commitment transaction
16648  */
16649 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16650
16651 /**
16652  * The txid for the commitment transaction.
16653  *
16654  * This is provided as a performance optimization, instead of calling transaction.txid()
16655  * multiple times.
16656  */
16657 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16658
16659 /**
16660  * The txid for the commitment transaction.
16661  *
16662  * This is provided as a performance optimization, instead of calling transaction.txid()
16663  * multiple times.
16664  */
16665 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16666
16667 /**
16668  * Constructs a new BuiltCommitmentTransaction given each field
16669  */
16670 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16671
16672 /**
16673  * Creates a copy of the BuiltCommitmentTransaction
16674  */
16675 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16676
16677 /**
16678  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16679  */
16680 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16681
16682 /**
16683  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16684  */
16685 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16686
16687 /**
16688  * Get the SIGHASH_ALL sighash value of the transaction.
16689  *
16690  * This can be used to verify a signature.
16691  */
16692 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);
16693
16694 /**
16695  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16696  * because we are about to broadcast a holder transaction.
16697  */
16698 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);
16699
16700 /**
16701  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16702  */
16703 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16704
16705 /**
16706  * Creates a copy of the CommitmentTransaction
16707  */
16708 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16709
16710 /**
16711  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16712  */
16713 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16714
16715 /**
16716  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16717  */
16718 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16719
16720 /**
16721  * The backwards-counting commitment number
16722  */
16723 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16724
16725 /**
16726  * The value to be sent to the broadcaster
16727  */
16728 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16729
16730 /**
16731  * The value to be sent to the counterparty
16732  */
16733 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16734
16735 /**
16736  * The feerate paid per 1000-weight-unit in this commitment transaction.
16737  */
16738 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16739
16740 /**
16741  * Trust our pre-built transaction and derived transaction creation public keys.
16742  *
16743  * Applies a wrapper which allows access to these fields.
16744  *
16745  * This should only be used if you fully trust the builder of this object.  It should not
16746  *\tbe used by an external signer - instead use the verify function.
16747  */
16748 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16749
16750 /**
16751  * Verify our pre-built transaction and derived transaction creation public keys.
16752  *
16753  * Applies a wrapper which allows access to these fields.
16754  *
16755  * An external validating signer must call this method before signing
16756  * or using the built transaction.
16757  */
16758 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);
16759
16760 /**
16761  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16762  */
16763 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16764
16765 /**
16766  * The transaction ID of the built Bitcoin transaction
16767  */
16768 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16769
16770 /**
16771  * The pre-built Bitcoin commitment transaction
16772  */
16773 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16774
16775 /**
16776  * The pre-calculated transaction creation public keys.
16777  */
16778 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16779
16780 /**
16781  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16782  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16783  *
16784  * The returned Vec has one entry for each HTLC, and in the same order.
16785  */
16786 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);
16787
16788 /**
16789  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
16790  * shared secret first. This prevents on-chain observers from discovering how many commitment
16791  * transactions occurred in a channel before it was closed.
16792  *
16793  * This function gets the shared secret from relevant channel public keys and can be used to
16794  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
16795  */
16796 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16797
16798 /**
16799  * Checks if two InitFeaturess contain equal inner contents.
16800  * This ignores pointers and is_owned flags and looks at the values in fields.
16801  * Two objects with NULL inner values will be considered "equal" here.
16802  */
16803 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
16804
16805 /**
16806  * Checks if two NodeFeaturess contain equal inner contents.
16807  * This ignores pointers and is_owned flags and looks at the values in fields.
16808  * Two objects with NULL inner values will be considered "equal" here.
16809  */
16810 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
16811
16812 /**
16813  * Checks if two ChannelFeaturess contain equal inner contents.
16814  * This ignores pointers and is_owned flags and looks at the values in fields.
16815  * Two objects with NULL inner values will be considered "equal" here.
16816  */
16817 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
16818
16819 /**
16820  * Checks if two InvoiceFeaturess contain equal inner contents.
16821  * This ignores pointers and is_owned flags and looks at the values in fields.
16822  * Two objects with NULL inner values will be considered "equal" here.
16823  */
16824 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
16825
16826 /**
16827  * Creates a copy of the InitFeatures
16828  */
16829 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16830
16831 /**
16832  * Creates a copy of the NodeFeatures
16833  */
16834 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16835
16836 /**
16837  * Creates a copy of the ChannelFeatures
16838  */
16839 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16840
16841 /**
16842  * Creates a copy of the InvoiceFeatures
16843  */
16844 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16845
16846 /**
16847  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16848  */
16849 void InitFeatures_free(struct LDKInitFeatures this_obj);
16850
16851 /**
16852  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16853  */
16854 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16855
16856 /**
16857  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16858  */
16859 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16860
16861 /**
16862  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16863  */
16864 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16865
16866 /**
16867  * Create a blank Features with no features set
16868  */
16869 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16870
16871 /**
16872  * Creates a Features with the bits set which are known by the implementation
16873  */
16874 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16875
16876 /**
16877  * Create a blank Features with no features set
16878  */
16879 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16880
16881 /**
16882  * Creates a Features with the bits set which are known by the implementation
16883  */
16884 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16885
16886 /**
16887  * Create a blank Features with no features set
16888  */
16889 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16890
16891 /**
16892  * Creates a Features with the bits set which are known by the implementation
16893  */
16894 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16895
16896 /**
16897  * Create a blank Features with no features set
16898  */
16899 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16900
16901 /**
16902  * Creates a Features with the bits set which are known by the implementation
16903  */
16904 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16905
16906 /**
16907  * Returns whether the `payment_secret` feature is supported.
16908  */
16909 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
16910
16911 /**
16912  * Returns whether the `payment_secret` feature is supported.
16913  */
16914 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
16915
16916 /**
16917  * Returns whether the `payment_secret` feature is supported.
16918  */
16919 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
16920
16921 /**
16922  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16923  */
16924 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16925
16926 /**
16927  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16928  */
16929 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16930
16931 /**
16932  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16933  */
16934 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16935
16936 /**
16937  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16938  */
16939 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16940
16941 /**
16942  * Read a InitFeatures from a byte array, created by InitFeatures_write
16943  */
16944 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16945
16946 /**
16947  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16948  */
16949 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16950
16951 /**
16952  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16953  */
16954 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16955
16956 /**
16957  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16958  */
16959 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16960
16961 /**
16962  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16963  */
16964 void RouteHop_free(struct LDKRouteHop this_obj);
16965
16966 /**
16967  * The node_id of the node at this hop.
16968  */
16969 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16970
16971 /**
16972  * The node_id of the node at this hop.
16973  */
16974 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16975
16976 /**
16977  * The node_announcement features of the node at this hop. For the last hop, these may be
16978  * amended to match the features present in the invoice this node generated.
16979  */
16980 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16981
16982 /**
16983  * The node_announcement features of the node at this hop. For the last hop, these may be
16984  * amended to match the features present in the invoice this node generated.
16985  */
16986 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16987
16988 /**
16989  * The channel that should be used from the previous hop to reach this node.
16990  */
16991 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16992
16993 /**
16994  * The channel that should be used from the previous hop to reach this node.
16995  */
16996 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16997
16998 /**
16999  * The channel_announcement features of the channel that should be used from the previous hop
17000  * to reach this node.
17001  */
17002 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17003
17004 /**
17005  * The channel_announcement features of the channel that should be used from the previous hop
17006  * to reach this node.
17007  */
17008 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17009
17010 /**
17011  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17012  * For the last hop, this should be the full value of the payment (might be more than
17013  * requested if we had to match htlc_minimum_msat).
17014  */
17015 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17016
17017 /**
17018  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17019  * For the last hop, this should be the full value of the payment (might be more than
17020  * requested if we had to match htlc_minimum_msat).
17021  */
17022 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
17023
17024 /**
17025  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17026  * expected at the destination, in excess of the current block height.
17027  */
17028 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17029
17030 /**
17031  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17032  * expected at the destination, in excess of the current block height.
17033  */
17034 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
17035
17036 /**
17037  * Constructs a new RouteHop given each field
17038  */
17039 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);
17040
17041 /**
17042  * Creates a copy of the RouteHop
17043  */
17044 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
17045
17046 /**
17047  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
17048  */
17049 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
17050
17051 /**
17052  * Read a RouteHop from a byte array, created by RouteHop_write
17053  */
17054 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
17055
17056 /**
17057  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
17058  */
17059 void Route_free(struct LDKRoute this_obj);
17060
17061 /**
17062  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
17063  * last RouteHop in each path must be the same.
17064  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
17065  * destination. Thus, this must always be at least length one. While the maximum length of any
17066  * given path is variable, keeping the length of any path to less than 20 should currently
17067  * ensure it is viable.
17068  */
17069 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
17070
17071 /**
17072  * Constructs a new Route given each field
17073  */
17074 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
17075
17076 /**
17077  * Creates a copy of the Route
17078  */
17079 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
17080
17081 /**
17082  * Serialize the Route object into a byte array which can be read by Route_read
17083  */
17084 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
17085
17086 /**
17087  * Read a Route from a byte array, created by Route_write
17088  */
17089 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
17090
17091 /**
17092  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
17093  */
17094 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
17095
17096 /**
17097  * The node_id of the non-target end of the route
17098  */
17099 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17100
17101 /**
17102  * The node_id of the non-target end of the route
17103  */
17104 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17105
17106 /**
17107  * The short_channel_id of this channel
17108  */
17109 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17110
17111 /**
17112  * The short_channel_id of this channel
17113  */
17114 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
17115
17116 /**
17117  * The fees which must be paid to use this channel
17118  */
17119 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17120
17121 /**
17122  * The fees which must be paid to use this channel
17123  */
17124 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17125
17126 /**
17127  * The difference in CLTV values between this node and the next node.
17128  */
17129 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17130
17131 /**
17132  * The difference in CLTV values between this node and the next node.
17133  */
17134 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
17135
17136 /**
17137  * The minimum value, in msat, which must be relayed to the next hop.
17138  */
17139 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17140
17141 /**
17142  * The minimum value, in msat, which must be relayed to the next hop.
17143  */
17144 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17145
17146 /**
17147  * The maximum value in msat available for routing with a single HTLC.
17148  */
17149 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17150
17151 /**
17152  * The maximum value in msat available for routing with a single HTLC.
17153  */
17154 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17155
17156 /**
17157  * Constructs a new RouteHintHop given each field
17158  */
17159 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);
17160
17161 /**
17162  * Checks if two RouteHintHops contain equal inner contents.
17163  * This ignores pointers and is_owned flags and looks at the values in fields.
17164  * Two objects with NULL inner values will be considered "equal" here.
17165  */
17166 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
17167
17168 /**
17169  * Creates a copy of the RouteHintHop
17170  */
17171 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
17172
17173 /**
17174  * Gets a route from us (payer) to the given target node (payee).
17175  *
17176  * If the payee provided features in their invoice, they should be provided via payee_features.
17177  * Without this, MPP will only be used if the payee's features are available in the network graph.
17178  *
17179  * Extra routing hops between known nodes and the target will be used if they are included in
17180  * last_hops.
17181  *
17182  * If some channels aren't announced, it may be useful to fill in a first_hops with the
17183  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
17184  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
17185  * in first_hops will be used.
17186  *
17187  * Panics if first_hops contains channels without short_channel_ids
17188  * (ChannelManager::list_usable_channels will never include such channels).
17189  *
17190  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
17191  * equal), however the enabled/disabled bit on such channels as well as the
17192  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
17193  */
17194 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
17195
17196 /**
17197  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
17198  */
17199 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
17200
17201 /**
17202  * Creates a copy of the NetworkGraph
17203  */
17204 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
17205
17206 /**
17207  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
17208  */
17209 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
17210
17211 /**
17212  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
17213  */
17214 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
17215
17216 /**
17217  * Creates a new tracker of the actual state of the network of channels and nodes,
17218  * assuming a fresh network graph.
17219  * Chain monitor is used to make sure announced channels exist on-chain,
17220  * channel data is correct, and that the announcement is signed with
17221  * channel owners' keys.
17222  */
17223 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
17224
17225 /**
17226  * Creates a new tracker of the actual state of the network of channels and nodes,
17227  * assuming an existing Network Graph.
17228  */
17229 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
17230
17231 /**
17232  * Adds a provider used to check new announcements. Does not affect
17233  * existing announcements unless they are updated.
17234  * Add, update or remove the provider would replace the current one.
17235  */
17236 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
17237
17238 /**
17239  * Take a read lock on the network_graph and return it in the C-bindings
17240  * newtype helper. This is likely only useful when called via the C
17241  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
17242  * yourself.
17243  */
17244 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17245
17246 /**
17247  * Get a reference to the NetworkGraph which this read-lock contains.
17248  */
17249 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
17250
17251 /**
17252  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17253  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17254  */
17255 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17256
17257 /**
17258  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17259  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17260  */
17261 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17262
17263 /**
17264  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
17265  */
17266 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
17267
17268 /**
17269  * When the last update to the channel direction was issued.
17270  * Value is opaque, as set in the announcement.
17271  */
17272 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17273
17274 /**
17275  * When the last update to the channel direction was issued.
17276  * Value is opaque, as set in the announcement.
17277  */
17278 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
17279
17280 /**
17281  * Whether the channel can be currently used for payments (in this one direction).
17282  */
17283 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17284
17285 /**
17286  * Whether the channel can be currently used for payments (in this one direction).
17287  */
17288 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
17289
17290 /**
17291  * The difference in CLTV values that you must have when routing through this channel.
17292  */
17293 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17294
17295 /**
17296  * The difference in CLTV values that you must have when routing through this channel.
17297  */
17298 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
17299
17300 /**
17301  * The minimum value, which must be relayed to the next hop via the channel
17302  */
17303 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17304
17305 /**
17306  * The minimum value, which must be relayed to the next hop via the channel
17307  */
17308 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
17309
17310 /**
17311  * The maximum value which may be relayed to the next hop via the channel.
17312  */
17313 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17314
17315 /**
17316  * The maximum value which may be relayed to the next hop via the channel.
17317  */
17318 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17319
17320 /**
17321  * Fees charged when the channel is used for routing
17322  */
17323 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17324
17325 /**
17326  * Fees charged when the channel is used for routing
17327  */
17328 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17329
17330 /**
17331  * Most recent update for the channel received from the network
17332  * Mostly redundant with the data we store in fields explicitly.
17333  * Everything else is useful only for sending out for initial routing sync.
17334  * Not stored if contains excess data to prevent DoS.
17335  */
17336 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17337
17338 /**
17339  * Most recent update for the channel received from the network
17340  * Mostly redundant with the data we store in fields explicitly.
17341  * Everything else is useful only for sending out for initial routing sync.
17342  * Not stored if contains excess data to prevent DoS.
17343  */
17344 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
17345
17346 /**
17347  * Constructs a new DirectionalChannelInfo given each field
17348  */
17349 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);
17350
17351 /**
17352  * Creates a copy of the DirectionalChannelInfo
17353  */
17354 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17355
17356 /**
17357  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17358  */
17359 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17360
17361 /**
17362  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17363  */
17364 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17365
17366 /**
17367  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17368  */
17369 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17370
17371 /**
17372  * Protocol features of a channel communicated during its announcement
17373  */
17374 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17375
17376 /**
17377  * Protocol features of a channel communicated during its announcement
17378  */
17379 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17380
17381 /**
17382  * Source node of the first direction of a channel
17383  */
17384 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17385
17386 /**
17387  * Source node of the first direction of a channel
17388  */
17389 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17390
17391 /**
17392  * Details about the first direction of a channel
17393  */
17394 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17395
17396 /**
17397  * Details about the first direction of a channel
17398  */
17399 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17400
17401 /**
17402  * Source node of the second direction of a channel
17403  */
17404 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17405
17406 /**
17407  * Source node of the second direction of a channel
17408  */
17409 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17410
17411 /**
17412  * Details about the second direction of a channel
17413  */
17414 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17415
17416 /**
17417  * Details about the second direction of a channel
17418  */
17419 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17420
17421 /**
17422  * The channel capacity as seen on-chain, if chain lookup is available.
17423  */
17424 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17425
17426 /**
17427  * The channel capacity as seen on-chain, if chain lookup is available.
17428  */
17429 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17430
17431 /**
17432  * An initial announcement of the channel
17433  * Mostly redundant with the data we store in fields explicitly.
17434  * Everything else is useful only for sending out for initial routing sync.
17435  * Not stored if contains excess data to prevent DoS.
17436  */
17437 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17438
17439 /**
17440  * An initial announcement of the channel
17441  * Mostly redundant with the data we store in fields explicitly.
17442  * Everything else is useful only for sending out for initial routing sync.
17443  * Not stored if contains excess data to prevent DoS.
17444  */
17445 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17446
17447 /**
17448  * Constructs a new ChannelInfo given each field
17449  */
17450 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);
17451
17452 /**
17453  * Creates a copy of the ChannelInfo
17454  */
17455 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17456
17457 /**
17458  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17459  */
17460 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17461
17462 /**
17463  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17464  */
17465 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17466
17467 /**
17468  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
17469  */
17470 void RoutingFees_free(struct LDKRoutingFees this_obj);
17471
17472 /**
17473  * Flat routing fee in satoshis
17474  */
17475 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17476
17477 /**
17478  * Flat routing fee in satoshis
17479  */
17480 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17481
17482 /**
17483  * Liquidity-based routing fee in millionths of a routed amount.
17484  * In other words, 10000 is 1%.
17485  */
17486 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17487
17488 /**
17489  * Liquidity-based routing fee in millionths of a routed amount.
17490  * In other words, 10000 is 1%.
17491  */
17492 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17493
17494 /**
17495  * Constructs a new RoutingFees given each field
17496  */
17497 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
17498
17499 /**
17500  * Checks if two RoutingFeess contain equal inner contents.
17501  * This ignores pointers and is_owned flags and looks at the values in fields.
17502  * Two objects with NULL inner values will be considered "equal" here.
17503  */
17504 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
17505
17506 /**
17507  * Creates a copy of the RoutingFees
17508  */
17509 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
17510
17511 /**
17512  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
17513  */
17514 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
17515
17516 /**
17517  * Read a RoutingFees from a byte array, created by RoutingFees_write
17518  */
17519 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
17520
17521 /**
17522  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
17523  */
17524 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
17525
17526 /**
17527  * Protocol features the node announced support for
17528  */
17529 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17530
17531 /**
17532  * Protocol features the node announced support for
17533  */
17534 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17535
17536 /**
17537  * When the last known update to the node state was issued.
17538  * Value is opaque, as set in the announcement.
17539  */
17540 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17541
17542 /**
17543  * When the last known update to the node state was issued.
17544  * Value is opaque, as set in the announcement.
17545  */
17546 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
17547
17548 /**
17549  * Color assigned to the node
17550  */
17551 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
17552
17553 /**
17554  * Color assigned to the node
17555  */
17556 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17557
17558 /**
17559  * Moniker assigned to the node.
17560  * May be invalid or malicious (eg control chars),
17561  * should not be exposed to the user.
17562  */
17563 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
17564
17565 /**
17566  * Moniker assigned to the node.
17567  * May be invalid or malicious (eg control chars),
17568  * should not be exposed to the user.
17569  */
17570 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17571
17572 /**
17573  * Internet-level addresses via which one can connect to the node
17574  */
17575 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17576
17577 /**
17578  * An initial announcement of the node
17579  * Mostly redundant with the data we store in fields explicitly.
17580  * Everything else is useful only for sending out for initial routing sync.
17581  * Not stored if contains excess data to prevent DoS.
17582  */
17583 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17584
17585 /**
17586  * An initial announcement of the node
17587  * Mostly redundant with the data we store in fields explicitly.
17588  * Everything else is useful only for sending out for initial routing sync.
17589  * Not stored if contains excess data to prevent DoS.
17590  */
17591 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17592
17593 /**
17594  * Constructs a new NodeAnnouncementInfo given each field
17595  */
17596 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);
17597
17598 /**
17599  * Creates a copy of the NodeAnnouncementInfo
17600  */
17601 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17602
17603 /**
17604  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17605  */
17606 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17607
17608 /**
17609  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17610  */
17611 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17612
17613 /**
17614  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17615  */
17616 void NodeInfo_free(struct LDKNodeInfo this_obj);
17617
17618 /**
17619  * All valid channels a node has announced
17620  */
17621 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17622
17623 /**
17624  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17625  * The two fields (flat and proportional fee) are independent,
17626  * meaning they don't have to refer to the same channel.
17627  */
17628 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17629
17630 /**
17631  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17632  * The two fields (flat and proportional fee) are independent,
17633  * meaning they don't have to refer to the same channel.
17634  */
17635 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17636
17637 /**
17638  * More information about a node from node_announcement.
17639  * Optional because we store a Node entry after learning about it from
17640  * a channel announcement, but before receiving a node announcement.
17641  */
17642 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17643
17644 /**
17645  * More information about a node from node_announcement.
17646  * Optional because we store a Node entry after learning about it from
17647  * a channel announcement, but before receiving a node announcement.
17648  */
17649 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17650
17651 /**
17652  * Constructs a new NodeInfo given each field
17653  */
17654 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17655
17656 /**
17657  * Creates a copy of the NodeInfo
17658  */
17659 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17660
17661 /**
17662  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17663  */
17664 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17665
17666 /**
17667  * Read a NodeInfo from a byte array, created by NodeInfo_write
17668  */
17669 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17670
17671 /**
17672  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17673  */
17674 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17675
17676 /**
17677  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17678  */
17679 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17680
17681 /**
17682  * Creates a new, empty, network graph.
17683  */
17684 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17685
17686 /**
17687  * For an already known node (from channel announcements), update its stored properties from a
17688  * given node announcement.
17689  *
17690  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17691  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17692  * routing messages from a source using a protocol other than the lightning P2P protocol.
17693  */
17694 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17695
17696 /**
17697  * For an already known node (from channel announcements), update its stored properties from a
17698  * given node announcement without verifying the associated signatures. Because we aren't
17699  * given the associated signatures here we cannot relay the node announcement to any of our
17700  * peers.
17701  */
17702 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17703
17704 /**
17705  * Store or update channel info from a channel announcement.
17706  *
17707  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17708  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17709  * routing messages from a source using a protocol other than the lightning P2P protocol.
17710  *
17711  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17712  * the corresponding UTXO exists on chain and is correctly-formatted.
17713  */
17714 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);
17715
17716 /**
17717  * Store or update channel info from a channel announcement without verifying the associated
17718  * signatures. Because we aren't given the associated signatures here we cannot relay the
17719  * channel announcement to any of our peers.
17720  *
17721  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17722  * the corresponding UTXO exists on chain and is correctly-formatted.
17723  */
17724 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);
17725
17726 /**
17727  * Close a channel if a corresponding HTLC fail was sent.
17728  * If permanent, removes a channel from the local storage.
17729  * May cause the removal of nodes too, if this was their last channel.
17730  * If not permanent, makes channels unavailable for routing.
17731  */
17732 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17733
17734 /**
17735  * For an already known (from announcement) channel, update info about one of the directions
17736  * of the channel.
17737  *
17738  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17739  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17740  * routing messages from a source using a protocol other than the lightning P2P protocol.
17741  */
17742 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17743
17744 /**
17745  * For an already known (from announcement) channel, update info about one of the directions
17746  * of the channel without verifying the associated signatures. Because we aren't given the
17747  * associated signatures here we cannot relay the channel update to any of our peers.
17748  */
17749 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17750
17751 /**
17752  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17753  */
17754 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17755
17756 /**
17757  * Initialize a new FilesystemPersister and set the path to the individual channels'
17758  * files.
17759  */
17760 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17761
17762 /**
17763  * Get the directory which was provided when this persister was initialized.
17764  */
17765 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17766
17767 /**
17768  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17769  * initialization, within a file called \"manager\".
17770  */
17771 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17772
17773 /**
17774  * Read `ChannelMonitor`s from disk.
17775  */
17776 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17777
17778 /**
17779  * Constructs a new Persist which calls the relevant methods on this_arg.
17780  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17781  */
17782 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17783
17784 /**
17785  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
17786  */
17787 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
17788
17789 /**
17790  * Calls the free function if one is set
17791  */
17792 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
17793
17794 /**
17795  * Start a background thread that takes care of responsibilities enumerated in the top-level
17796  * documentation.
17797  *
17798  * If `persist_manager` returns an error, then this thread will return said error (and
17799  * `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
17800  * wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
17801  * returned, or implement `persist_manager` such that an error is never returned to the
17802  * `BackgroundProcessor`
17803  *
17804  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
17805  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
17806  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
17807  * provided implementation.
17808  *
17809  * [`thread_handle`]: BackgroundProcessor::thread_handle
17810  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
17811  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
17812  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
17813  */
17814 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);
17815
17816 /**
17817  * Stop `BackgroundProcessor`'s thread.
17818  */
17819 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
17820
17821 /**
17822  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17823  *
17824  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17825  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17826  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17827  * since this check is fast we recommend to do it anyway.
17828  *
17829  * If this function fails this is considered a bug. Please open an issue describing your
17830  * platform and stating your current system time.
17831  *
17832  * # Panics
17833  * If the check fails this function panics. By calling this function on startup you ensure that
17834  * this wont happen at an arbitrary later point in time.
17835  */
17836 void check_platform(void);
17837
17838 /**
17839  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17840  */
17841 void Invoice_free(struct LDKInvoice this_obj);
17842
17843 /**
17844  * Checks if two Invoices contain equal inner contents.
17845  * This ignores pointers and is_owned flags and looks at the values in fields.
17846  * Two objects with NULL inner values will be considered "equal" here.
17847  */
17848 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
17849
17850 /**
17851  * Creates a copy of the Invoice
17852  */
17853 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17854
17855 /**
17856  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17857  */
17858 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17859
17860 /**
17861  * Checks if two SignedRawInvoices contain equal inner contents.
17862  * This ignores pointers and is_owned flags and looks at the values in fields.
17863  * Two objects with NULL inner values will be considered "equal" here.
17864  */
17865 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
17866
17867 /**
17868  * Creates a copy of the SignedRawInvoice
17869  */
17870 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17871
17872 /**
17873  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17874  */
17875 void RawInvoice_free(struct LDKRawInvoice this_obj);
17876
17877 /**
17878  * data part
17879  */
17880 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17881
17882 /**
17883  * data part
17884  */
17885 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17886
17887 /**
17888  * Checks if two RawInvoices contain equal inner contents.
17889  * This ignores pointers and is_owned flags and looks at the values in fields.
17890  * Two objects with NULL inner values will be considered "equal" here.
17891  */
17892 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
17893
17894 /**
17895  * Creates a copy of the RawInvoice
17896  */
17897 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17898
17899 /**
17900  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17901  */
17902 void RawDataPart_free(struct LDKRawDataPart this_obj);
17903
17904 /**
17905  * generation time of the invoice
17906  */
17907 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17908
17909 /**
17910  * generation time of the invoice
17911  */
17912 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17913
17914 /**
17915  * Checks if two RawDataParts contain equal inner contents.
17916  * This ignores pointers and is_owned flags and looks at the values in fields.
17917  * Two objects with NULL inner values will be considered "equal" here.
17918  */
17919 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
17920
17921 /**
17922  * Creates a copy of the RawDataPart
17923  */
17924 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17925
17926 /**
17927  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17928  */
17929 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17930
17931 /**
17932  * Checks if two PositiveTimestamps contain equal inner contents.
17933  * This ignores pointers and is_owned flags and looks at the values in fields.
17934  * Two objects with NULL inner values will be considered "equal" here.
17935  */
17936 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
17937
17938 /**
17939  * Creates a copy of the PositiveTimestamp
17940  */
17941 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17942
17943 /**
17944  * Creates a copy of the SiPrefix
17945  */
17946 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17947
17948 /**
17949  * Checks if two SiPrefixs contain equal inner contents.
17950  * This ignores pointers and is_owned flags and looks at the values in fields.
17951  */
17952 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
17953
17954 /**
17955  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17956  * This is effectively 10^12 * the prefix multiplier
17957  */
17958 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17959
17960 /**
17961  * Creates a copy of the Currency
17962  */
17963 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17964
17965 /**
17966  * Checks if two Currencys contain equal inner contents.
17967  * This ignores pointers and is_owned flags and looks at the values in fields.
17968  */
17969 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
17970
17971 /**
17972  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17973  */
17974 void Sha256_free(struct LDKSha256 this_obj);
17975
17976 /**
17977  * Checks if two Sha256s contain equal inner contents.
17978  * This ignores pointers and is_owned flags and looks at the values in fields.
17979  * Two objects with NULL inner values will be considered "equal" here.
17980  */
17981 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
17982
17983 /**
17984  * Creates a copy of the Sha256
17985  */
17986 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17987
17988 /**
17989  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17990  */
17991 void Description_free(struct LDKDescription this_obj);
17992
17993 /**
17994  * Checks if two Descriptions contain equal inner contents.
17995  * This ignores pointers and is_owned flags and looks at the values in fields.
17996  * Two objects with NULL inner values will be considered "equal" here.
17997  */
17998 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
17999
18000 /**
18001  * Creates a copy of the Description
18002  */
18003 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
18004
18005 /**
18006  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
18007  */
18008 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
18009
18010 /**
18011  * Checks if two PayeePubKeys contain equal inner contents.
18012  * This ignores pointers and is_owned flags and looks at the values in fields.
18013  * Two objects with NULL inner values will be considered "equal" here.
18014  */
18015 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
18016
18017 /**
18018  * Creates a copy of the PayeePubKey
18019  */
18020 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
18021
18022 /**
18023  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
18024  */
18025 void ExpiryTime_free(struct LDKExpiryTime this_obj);
18026
18027 /**
18028  * Checks if two ExpiryTimes contain equal inner contents.
18029  * This ignores pointers and is_owned flags and looks at the values in fields.
18030  * Two objects with NULL inner values will be considered "equal" here.
18031  */
18032 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
18033
18034 /**
18035  * Creates a copy of the ExpiryTime
18036  */
18037 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
18038
18039 /**
18040  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
18041  */
18042 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
18043
18044 /**
18045  * Checks if two MinFinalCltvExpirys contain equal inner contents.
18046  * This ignores pointers and is_owned flags and looks at the values in fields.
18047  * Two objects with NULL inner values will be considered "equal" here.
18048  */
18049 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
18050
18051 /**
18052  * Creates a copy of the MinFinalCltvExpiry
18053  */
18054 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
18055
18056 /**
18057  * Frees any resources used by the Fallback
18058  */
18059 void Fallback_free(struct LDKFallback this_ptr);
18060
18061 /**
18062  * Creates a copy of the Fallback
18063  */
18064 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
18065
18066 /**
18067  * Checks if two Fallbacks contain equal inner contents.
18068  * This ignores pointers and is_owned flags and looks at the values in fields.
18069  */
18070 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
18071
18072 /**
18073  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
18074  */
18075 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
18076
18077 /**
18078  * Checks if two InvoiceSignatures contain equal inner contents.
18079  * This ignores pointers and is_owned flags and looks at the values in fields.
18080  * Two objects with NULL inner values will be considered "equal" here.
18081  */
18082 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
18083
18084 /**
18085  * Creates a copy of the InvoiceSignature
18086  */
18087 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
18088
18089 /**
18090  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
18091  */
18092 void RouteHint_free(struct LDKRouteHint this_obj);
18093
18094 /**
18095  * Checks if two RouteHints contain equal inner contents.
18096  * This ignores pointers and is_owned flags and looks at the values in fields.
18097  * Two objects with NULL inner values will be considered "equal" here.
18098  */
18099 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
18100
18101 /**
18102  * Creates a copy of the RouteHint
18103  */
18104 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
18105
18106 /**
18107  * Disassembles the `SignedRawInvoice` into its three parts:
18108  *  1. raw invoice
18109  *  2. hash of the raw invoice
18110  *  3. signature
18111  */
18112 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
18113
18114 /**
18115  * The `RawInvoice` which was signed.
18116  */
18117 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18118
18119 /**
18120  * The hash of the `RawInvoice` that was signed.
18121  */
18122 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
18123
18124 /**
18125  * InvoiceSignature for the invoice.
18126  */
18127 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18128
18129 /**
18130  * Recovers the public key used for signing the invoice from the recoverable signature.
18131  */
18132 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18133
18134 /**
18135  * Checks if the signature is valid for the included payee public key or if none exists if it's
18136  * valid for the recovered signature (which should always be true?).
18137  */
18138 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18139
18140 /**
18141  * Calculate the hash of the encoded `RawInvoice`
18142  */
18143 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18144
18145 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18146
18147 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18148
18149 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18150
18151 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18152
18153 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18154
18155 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18156
18157 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18158
18159 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18160
18161 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18162
18163 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18164
18165 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18166
18167 /**
18168  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
18169  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18170  * `CreationError::TimestampOutOfBounds`.
18171  */
18172 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
18173
18174 /**
18175  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
18176  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18177  * `CreationError::TimestampOutOfBounds`.
18178  */
18179 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
18180
18181 /**
18182  * Returns the UNIX timestamp representing the stored time
18183  */
18184 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18185
18186 /**
18187  * Returns a reference to the internal `SystemTime` time representation
18188  */
18189 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18190
18191 /**
18192  * Transform the `Invoice` into it's unchecked version
18193  */
18194 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
18195
18196 /**
18197  * Check that the invoice is signed correctly and that key recovery works
18198  */
18199 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
18200
18201 /**
18202  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
18203  * ```
18204  * use lightning_invoice::*;
18205  *
18206  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
18207  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
18208  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
18209  * \tky03ylcqca784w\";
18210  *
18211  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
18212  *
18213  * assert!(Invoice::from_signed(signed).is_ok());
18214  * ```
18215  */
18216 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
18217
18218 /**
18219  * Returns the `Invoice`'s timestamp (should equal it's creation time)
18220  */
18221 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
18222
18223 /**
18224  * Returns the hash to which we will receive the preimage on completion of the payment
18225  */
18226 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
18227
18228 /**
18229  * Get the payee's public key if one was included in the invoice
18230  */
18231 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18232
18233 /**
18234  * Get the payment secret if one was included in the invoice
18235  */
18236 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
18237
18238 /**
18239  * Get the invoice features if they were included in the invoice
18240  */
18241 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
18242
18243 /**
18244  * Recover the payee's public key (only to be used if none was included in the invoice)
18245  */
18246 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18247
18248 /**
18249  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
18250  */
18251 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
18252
18253 /**
18254  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
18255  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
18256  */
18257 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
18258
18259 /**
18260  * Returns a list of all routes included in the invoice
18261  */
18262 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
18263
18264 /**
18265  * Returns the currency for which the invoice was issued
18266  */
18267 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
18268
18269 /**
18270  * Returns the amount if specified in the invoice as pico <currency>.
18271  */
18272 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
18273
18274 /**
18275  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
18276  * returns `CreationError::DescriptionTooLong` otherwise
18277  *
18278  * Please note that single characters may use more than one byte due to UTF8 encoding.
18279  */
18280 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
18281
18282 /**
18283  * Returns the underlying description `String`
18284  */
18285 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
18286
18287 /**
18288  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
18289  * overflow on adding the `EpiryTime` to it then this function will return a
18290  * `CreationError::ExpiryTimeOutOfBounds`.
18291  */
18292 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
18293
18294 /**
18295  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
18296  * would overflow on adding the `EpiryTime` to it then this function will return a
18297  * `CreationError::ExpiryTimeOutOfBounds`.
18298  */
18299 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
18300
18301 /**
18302  * Returns the expiry time in seconds
18303  */
18304 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18305
18306 /**
18307  * Returns a reference to the underlying `Duration` (=expiry time)
18308  */
18309 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18310
18311 /**
18312  * Create a new (partial) route from a list of hops
18313  */
18314 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
18315
18316 /**
18317  * Returrn the underlying vector of hops
18318  */
18319 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
18320
18321 /**
18322  * Creates a copy of the CreationError
18323  */
18324 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
18325
18326 /**
18327  * Checks if two CreationErrors contain equal inner contents.
18328  * This ignores pointers and is_owned flags and looks at the values in fields.
18329  */
18330 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
18331
18332 /**
18333  * Get the string representation of a CreationError object
18334  */
18335 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
18336
18337 /**
18338  * Creates a copy of the SemanticError
18339  */
18340 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
18341
18342 /**
18343  * Checks if two SemanticErrors contain equal inner contents.
18344  * This ignores pointers and is_owned flags and looks at the values in fields.
18345  */
18346 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
18347
18348 /**
18349  * Get the string representation of a SemanticError object
18350  */
18351 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
18352
18353 /**
18354  * Frees any resources used by the SignOrCreationError
18355  */
18356 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
18357
18358 /**
18359  * Creates a copy of the SignOrCreationError
18360  */
18361 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
18362
18363 /**
18364  * Checks if two SignOrCreationErrors contain equal inner contents.
18365  * This ignores pointers and is_owned flags and looks at the values in fields.
18366  */
18367 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
18368
18369 /**
18370  * Get the string representation of a SignOrCreationError object
18371  */
18372 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
18373
18374 /**
18375  * Utility to construct an invoice. Generally, unless you want to do something like a custom
18376  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
18377  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
18378  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
18379  * that the payment secret is valid when the invoice is paid.
18380  */
18381 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);
18382
18383 /**
18384  * Read a SiPrefix object from a string
18385  */
18386 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
18387
18388 /**
18389  * Read a Invoice object from a string
18390  */
18391 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18392
18393 /**
18394  * Read a SignedRawInvoice object from a string
18395  */
18396 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18397
18398 /**
18399  * Get the string representation of a Invoice object
18400  */
18401 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18402
18403 /**
18404  * Get the string representation of a SignedRawInvoice object
18405  */
18406 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18407
18408 /**
18409  * Get the string representation of a Currency object
18410  */
18411 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18412
18413 /**
18414  * Get the string representation of a SiPrefix object
18415  */
18416 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18417
18418 #endif /* LDK_C_BINDINGS_H */
18419
18420 #include <ldk_ver.h>