Merge pull request #51 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.20.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 enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An error enum representing a failure to persist a channel monitor update.
51  */
52 typedef enum LDKChannelMonitorUpdateErr {
53    /**
54     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
55     * our state failed, but is expected to succeed at some point in the future).
56     *
57     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
58     * submitting new commitment transactions to the counterparty. Once the update(s) that failed
59     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
60     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
61     * operational state.
62     *
63     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
64     * you return a TemporaryFailure you must ensure that it is written to disk safely before
65     * writing out the latest ChannelManager state.
66     *
67     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
68     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
69     * to claim it on this channel) and those updates must be applied wherever they can be. At
70     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
71     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
72     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
73     * been \"frozen\".
74     *
75     * Note that even if updates made after TemporaryFailure succeed you must still provide a
76     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
77     * normal channel operation. Note that this is normally generated through a call to
78     * [`ChainMonitor::channel_monitor_updated`].
79     *
80     * Note that the update being processed here will not be replayed for you when you return a
81     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
82     * you must store the update itself on your own local disk prior to returning a
83     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
84     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
85     * reload-time.
86     *
87     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
88     * remote location (with local copies persisted immediately), it is anticipated that all
89     * updates will return TemporaryFailure until the remote copies could be updated.
90     *
91     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
92     */
93    LDKChannelMonitorUpdateErr_TemporaryFailure,
94    /**
95     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
96     * different watchtower and cannot update with all watchtowers that were previously informed
97     * of this channel).
98     *
99     * At reception of this error, ChannelManager will force-close the channel and return at
100     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
101     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
102     * update must be rejected.
103     *
104     * This failure may also signal a failure to update the local persisted copy of one of
105     * the channel monitor instance.
106     *
107     * Note that even when you fail a holder commitment transaction update, you must store the
108     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
109     * broadcasts it (e.g distributed channel-monitor deployment)
110     *
111     * In case of distributed watchtowers deployment, the new version must be written to disk, as
112     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
113     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
114     * lagging behind on block processing.
115     */
116    LDKChannelMonitorUpdateErr_PermanentFailure,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKChannelMonitorUpdateErr_Sentinel,
121 } LDKChannelMonitorUpdateErr;
122
123 /**
124  * An enum that represents the speed at which we want a transaction to confirm used for feerate
125  * estimation.
126  */
127 typedef enum LDKConfirmationTarget {
128    /**
129     * We are happy with this transaction confirming slowly when feerate drops some.
130     */
131    LDKConfirmationTarget_Background,
132    /**
133     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
134     */
135    LDKConfirmationTarget_Normal,
136    /**
137     * We'd like this transaction to confirm in the next few blocks.
138     */
139    LDKConfirmationTarget_HighPriority,
140    /**
141     * Must be last for serialization purposes
142     */
143    LDKConfirmationTarget_Sentinel,
144 } LDKConfirmationTarget;
145
146 /**
147  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
148  */
149 typedef enum LDKCreationError {
150    /**
151     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
152     */
153    LDKCreationError_DescriptionTooLong,
154    /**
155     * The specified route has too many hops and can't be encoded
156     */
157    LDKCreationError_RouteTooLong,
158    /**
159     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
160     */
161    LDKCreationError_TimestampOutOfBounds,
162    /**
163     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
164     */
165    LDKCreationError_ExpiryTimeOutOfBounds,
166    /**
167     * The supplied millisatoshi amount was greater than the total bitcoin supply.
168     */
169    LDKCreationError_InvalidAmount,
170    /**
171     * Must be last for serialization purposes
172     */
173    LDKCreationError_Sentinel,
174 } LDKCreationError;
175
176 /**
177  * Enum representing the crypto currencies (or networks) supported by this library
178  */
179 typedef enum LDKCurrency {
180    /**
181     * Bitcoin mainnet
182     */
183    LDKCurrency_Bitcoin,
184    /**
185     * Bitcoin testnet
186     */
187    LDKCurrency_BitcoinTestnet,
188    /**
189     * Bitcoin regtest
190     */
191    LDKCurrency_Regtest,
192    /**
193     * Bitcoin simnet
194     */
195    LDKCurrency_Simnet,
196    /**
197     * Bitcoin signet
198     */
199    LDKCurrency_Signet,
200    /**
201     * Must be last for serialization purposes
202     */
203    LDKCurrency_Sentinel,
204 } LDKCurrency;
205
206 /**
207  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
208  */
209 typedef enum LDKIOError {
210    LDKIOError_NotFound,
211    LDKIOError_PermissionDenied,
212    LDKIOError_ConnectionRefused,
213    LDKIOError_ConnectionReset,
214    LDKIOError_ConnectionAborted,
215    LDKIOError_NotConnected,
216    LDKIOError_AddrInUse,
217    LDKIOError_AddrNotAvailable,
218    LDKIOError_BrokenPipe,
219    LDKIOError_AlreadyExists,
220    LDKIOError_WouldBlock,
221    LDKIOError_InvalidInput,
222    LDKIOError_InvalidData,
223    LDKIOError_TimedOut,
224    LDKIOError_WriteZero,
225    LDKIOError_Interrupted,
226    LDKIOError_Other,
227    LDKIOError_UnexpectedEof,
228    /**
229     * Must be last for serialization purposes
230     */
231    LDKIOError_Sentinel,
232 } LDKIOError;
233
234 /**
235  * An enum representing the available verbosity levels of the logger.
236  */
237 typedef enum LDKLevel {
238    /**
239     * Designates extremely verbose information, including gossip-induced messages
240     */
241    LDKLevel_Gossip,
242    /**
243     * Designates very low priority, often extremely verbose, information
244     */
245    LDKLevel_Trace,
246    /**
247     * Designates lower priority information
248     */
249    LDKLevel_Debug,
250    /**
251     * Designates useful information
252     */
253    LDKLevel_Info,
254    /**
255     * Designates hazardous situations
256     */
257    LDKLevel_Warn,
258    /**
259     * Designates very serious errors
260     */
261    LDKLevel_Error,
262    /**
263     * Must be last for serialization purposes
264     */
265    LDKLevel_Sentinel,
266 } LDKLevel;
267
268 /**
269  * An enum representing the possible Bitcoin or test networks which we can run on
270  */
271 typedef enum LDKNetwork {
272    /**
273     * The main Bitcoin blockchain.
274     */
275    LDKNetwork_Bitcoin,
276    /**
277     * The testnet3 blockchain.
278     */
279    LDKNetwork_Testnet,
280    /**
281     * A local test blockchain.
282     */
283    LDKNetwork_Regtest,
284    /**
285     * A blockchain on which blocks are signed instead of mined.
286     */
287    LDKNetwork_Signet,
288    /**
289     * Must be last for serialization purposes
290     */
291    LDKNetwork_Sentinel,
292 } LDKNetwork;
293
294 /**
295  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
296  */
297 typedef enum LDKSecp256k1Error {
298    /**
299     * Signature failed verification
300     */
301    LDKSecp256k1Error_IncorrectSignature,
302    /**
303     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
304     */
305    LDKSecp256k1Error_InvalidMessage,
306    /**
307     * Bad public key
308     */
309    LDKSecp256k1Error_InvalidPublicKey,
310    /**
311     * Bad signature
312     */
313    LDKSecp256k1Error_InvalidSignature,
314    /**
315     * Bad secret key
316     */
317    LDKSecp256k1Error_InvalidSecretKey,
318    /**
319     * Bad recovery id
320     */
321    LDKSecp256k1Error_InvalidRecoveryId,
322    /**
323     * Invalid tweak for add_assign or mul_assign
324     */
325    LDKSecp256k1Error_InvalidTweak,
326    /**
327     * tweak_add_check failed on an xonly public key
328     */
329    LDKSecp256k1Error_TweakCheckFailed,
330    /**
331     * Didn't pass enough memory to context creation with preallocated memory
332     */
333    LDKSecp256k1Error_NotEnoughMemory,
334    /**
335     * Must be last for serialization purposes
336     */
337    LDKSecp256k1Error_Sentinel,
338 } LDKSecp256k1Error;
339
340 /**
341  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
342  * requirements sections in BOLT #11
343  */
344 typedef enum LDKSemanticError {
345    /**
346     * The invoice is missing the mandatory payment hash
347     */
348    LDKSemanticError_NoPaymentHash,
349    /**
350     * The invoice has multiple payment hashes which isn't allowed
351     */
352    LDKSemanticError_MultiplePaymentHashes,
353    /**
354     * No description or description hash are part of the invoice
355     */
356    LDKSemanticError_NoDescription,
357    /**
358     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
359     */
360    LDKSemanticError_MultipleDescriptions,
361    /**
362     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
363     * should provide.
364     */
365    LDKSemanticError_NoPaymentSecret,
366    /**
367     * The invoice contains multiple payment secrets
368     */
369    LDKSemanticError_MultiplePaymentSecrets,
370    /**
371     * The invoice's features are invalid
372     */
373    LDKSemanticError_InvalidFeatures,
374    /**
375     * The recovery id doesn't fit the signature/pub key
376     */
377    LDKSemanticError_InvalidRecoveryId,
378    /**
379     * The invoice's signature is invalid
380     */
381    LDKSemanticError_InvalidSignature,
382    /**
383     * The invoice's amount was not a whole number of millisatoshis
384     */
385    LDKSemanticError_ImpreciseAmount,
386    /**
387     * Must be last for serialization purposes
388     */
389    LDKSemanticError_Sentinel,
390 } LDKSemanticError;
391
392 /**
393  * SI prefixes for the human readable part
394  */
395 typedef enum LDKSiPrefix {
396    /**
397     * 10^-3
398     */
399    LDKSiPrefix_Milli,
400    /**
401     * 10^-6
402     */
403    LDKSiPrefix_Micro,
404    /**
405     * 10^-9
406     */
407    LDKSiPrefix_Nano,
408    /**
409     * 10^-12
410     */
411    LDKSiPrefix_Pico,
412    /**
413     * Must be last for serialization purposes
414     */
415    LDKSiPrefix_Sentinel,
416 } LDKSiPrefix;
417
418 /**
419  * A Rust str object, ie a reference to a UTF8-valid string.
420  * This is *not* null-terminated so cannot be used directly as a C string!
421  */
422 typedef struct LDKStr {
423    /**
424     * A pointer to the string's bytes, in UTF8 encoding
425     */
426    const uint8_t *chars;
427    /**
428     * The number of bytes (not characters!) pointed to by `chars`
429     */
430    uintptr_t len;
431    /**
432     * Whether the data pointed to by `chars` should be freed or not.
433     */
434    bool chars_is_owned;
435 } LDKStr;
436
437 /**
438  * A serialized transaction, in (pointer, length) form.
439  *
440  * This type optionally owns its own memory, and thus the semantics around access change based on
441  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
442  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
443  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
444  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
445  * you would be invalid.
446  *
447  * Note that, while it may change in the future, because transactions on the Rust side are stored
448  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
449  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
450  * `data_is_owned` either set or unset at your discretion.
451  */
452 typedef struct LDKTransaction {
453    /**
454     * The serialized transaction data.
455     *
456     * This is non-const for your convenience, an object passed to Rust is never written to.
457     */
458    uint8_t *data;
459    /**
460     * The length of the serialized transaction
461     */
462    uintptr_t datalen;
463    /**
464     * Whether the data pointed to by `data` should be freed or not.
465     */
466    bool data_is_owned;
467 } LDKTransaction;
468
469 /**
470  * A dynamically-allocated array of u8s of arbitrary size.
471  * This corresponds to std::vector in C++
472  */
473 typedef struct LDKCVec_u8Z {
474    /**
475     * The elements in the array.
476     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
477     */
478    uint8_t *data;
479    /**
480     * The number of elements pointed to by `data`.
481     */
482    uintptr_t datalen;
483 } LDKCVec_u8Z;
484
485 /**
486  * A transaction output including a scriptPubKey and value.
487  * This type *does* own its own memory, so must be free'd appropriately.
488  */
489 typedef struct LDKTxOut {
490    /**
491     * The script_pubkey in this output
492     */
493    struct LDKCVec_u8Z script_pubkey;
494    /**
495     * The value, in satoshis, of this output
496     */
497    uint64_t value;
498 } LDKTxOut;
499
500 /**
501  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
502  */
503 typedef struct LDKSecretKey {
504    /**
505     * The bytes of the secret key
506     */
507    uint8_t bytes[32];
508 } LDKSecretKey;
509
510 /**
511  * The contents of CResult_SecretKeyErrorZ
512  */
513 typedef union LDKCResult_SecretKeyErrorZPtr {
514    /**
515     * A pointer to the contents in the success state.
516     * Reading from this pointer when `result_ok` is not set is undefined.
517     */
518    struct LDKSecretKey *result;
519    /**
520     * A pointer to the contents in the error state.
521     * Reading from this pointer when `result_ok` is set is undefined.
522     */
523    enum LDKSecp256k1Error *err;
524 } LDKCResult_SecretKeyErrorZPtr;
525
526 /**
527  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
528  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
530  */
531 typedef struct LDKCResult_SecretKeyErrorZ {
532    /**
533     * The contents of this CResult_SecretKeyErrorZ, accessible via either
534     * `err` or `result` depending on the state of `result_ok`.
535     */
536    union LDKCResult_SecretKeyErrorZPtr contents;
537    /**
538     * Whether this CResult_SecretKeyErrorZ represents a success state.
539     */
540    bool result_ok;
541 } LDKCResult_SecretKeyErrorZ;
542
543 /**
544  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
545  */
546 typedef struct LDKPublicKey {
547    /**
548     * The bytes of the public key
549     */
550    uint8_t compressed_form[33];
551 } LDKPublicKey;
552
553 /**
554  * The contents of CResult_PublicKeyErrorZ
555  */
556 typedef union LDKCResult_PublicKeyErrorZPtr {
557    /**
558     * A pointer to the contents in the success state.
559     * Reading from this pointer when `result_ok` is not set is undefined.
560     */
561    struct LDKPublicKey *result;
562    /**
563     * A pointer to the contents in the error state.
564     * Reading from this pointer when `result_ok` is set is undefined.
565     */
566    enum LDKSecp256k1Error *err;
567 } LDKCResult_PublicKeyErrorZPtr;
568
569 /**
570  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
571  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
572  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
573  */
574 typedef struct LDKCResult_PublicKeyErrorZ {
575    /**
576     * The contents of this CResult_PublicKeyErrorZ, accessible via either
577     * `err` or `result` depending on the state of `result_ok`.
578     */
579    union LDKCResult_PublicKeyErrorZPtr contents;
580    /**
581     * Whether this CResult_PublicKeyErrorZ represents a success state.
582     */
583    bool result_ok;
584 } LDKCResult_PublicKeyErrorZ;
585
586
587
588 /**
589  * The set of public keys which are used in the creation of one commitment transaction.
590  * These are derived from the channel base keys and per-commitment data.
591  *
592  * A broadcaster key is provided from potential broadcaster of the computed transaction.
593  * A countersignatory key is coming from a protocol participant unable to broadcast the
594  * transaction.
595  *
596  * These keys are assumed to be good, either because the code derived them from
597  * channel basepoints via the new function, or they were obtained via
598  * CommitmentTransaction.trust().keys() because we trusted the source of the
599  * pre-calculated keys.
600  */
601 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
602    /**
603     * A pointer to the opaque Rust object.
604     * Nearly everywhere, inner must be non-null, however in places where
605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
606     */
607    LDKnativeTxCreationKeys *inner;
608    /**
609     * Indicates that this is the only struct which contains the same pointer.
610     * Rust functions which take ownership of an object provided via an argument require
611     * this to be true and invalidate the object pointed to by inner.
612     */
613    bool is_owned;
614 } LDKTxCreationKeys;
615
616
617
618 /**
619  * An error in decoding a message or struct.
620  */
621 typedef struct MUST_USE_STRUCT LDKDecodeError {
622    /**
623     * A pointer to the opaque Rust object.
624     * Nearly everywhere, inner must be non-null, however in places where
625     * the Rust equivalent takes an Option, it may be set to null to indicate None.
626     */
627    LDKnativeDecodeError *inner;
628    /**
629     * Indicates that this is the only struct which contains the same pointer.
630     * Rust functions which take ownership of an object provided via an argument require
631     * this to be true and invalidate the object pointed to by inner.
632     */
633    bool is_owned;
634 } LDKDecodeError;
635
636 /**
637  * The contents of CResult_TxCreationKeysDecodeErrorZ
638  */
639 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
640    /**
641     * A pointer to the contents in the success state.
642     * Reading from this pointer when `result_ok` is not set is undefined.
643     */
644    struct LDKTxCreationKeys *result;
645    /**
646     * A pointer to the contents in the error state.
647     * Reading from this pointer when `result_ok` is set is undefined.
648     */
649    struct LDKDecodeError *err;
650 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
651
652 /**
653  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
654  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
656  */
657 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
658    /**
659     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
660     * `err` or `result` depending on the state of `result_ok`.
661     */
662    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
663    /**
664     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
665     */
666    bool result_ok;
667 } LDKCResult_TxCreationKeysDecodeErrorZ;
668
669
670
671 /**
672  * One counterparty's public keys which do not change over the life of a channel.
673  */
674 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
675    /**
676     * A pointer to the opaque Rust object.
677     * Nearly everywhere, inner must be non-null, however in places where
678     * the Rust equivalent takes an Option, it may be set to null to indicate None.
679     */
680    LDKnativeChannelPublicKeys *inner;
681    /**
682     * Indicates that this is the only struct which contains the same pointer.
683     * Rust functions which take ownership of an object provided via an argument require
684     * this to be true and invalidate the object pointed to by inner.
685     */
686    bool is_owned;
687 } LDKChannelPublicKeys;
688
689 /**
690  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
691  */
692 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
693    /**
694     * A pointer to the contents in the success state.
695     * Reading from this pointer when `result_ok` is not set is undefined.
696     */
697    struct LDKChannelPublicKeys *result;
698    /**
699     * A pointer to the contents in the error state.
700     * Reading from this pointer when `result_ok` is set is undefined.
701     */
702    struct LDKDecodeError *err;
703 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
704
705 /**
706  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
707  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
708  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
709  */
710 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
711    /**
712     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
713     * `err` or `result` depending on the state of `result_ok`.
714     */
715    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
716    /**
717     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
718     */
719    bool result_ok;
720 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
721
722 /**
723  * The contents of CResult_TxCreationKeysErrorZ
724  */
725 typedef union LDKCResult_TxCreationKeysErrorZPtr {
726    /**
727     * A pointer to the contents in the success state.
728     * Reading from this pointer when `result_ok` is not set is undefined.
729     */
730    struct LDKTxCreationKeys *result;
731    /**
732     * A pointer to the contents in the error state.
733     * Reading from this pointer when `result_ok` is set is undefined.
734     */
735    enum LDKSecp256k1Error *err;
736 } LDKCResult_TxCreationKeysErrorZPtr;
737
738 /**
739  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
740  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
741  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
742  */
743 typedef struct LDKCResult_TxCreationKeysErrorZ {
744    /**
745     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
746     * `err` or `result` depending on the state of `result_ok`.
747     */
748    union LDKCResult_TxCreationKeysErrorZPtr contents;
749    /**
750     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
751     */
752    bool result_ok;
753 } LDKCResult_TxCreationKeysErrorZ;
754
755 /**
756  * An enum which can either contain a u32 or not
757  */
758 typedef enum LDKCOption_u32Z_Tag {
759    /**
760     * When we're in this state, this COption_u32Z contains a u32
761     */
762    LDKCOption_u32Z_Some,
763    /**
764     * When we're in this state, this COption_u32Z contains nothing
765     */
766    LDKCOption_u32Z_None,
767    /**
768     * Must be last for serialization purposes
769     */
770    LDKCOption_u32Z_Sentinel,
771 } LDKCOption_u32Z_Tag;
772
773 typedef struct LDKCOption_u32Z {
774    LDKCOption_u32Z_Tag tag;
775    union {
776       struct {
777          uint32_t some;
778       };
779    };
780 } LDKCOption_u32Z;
781
782
783
784 /**
785  * Information about an HTLC as it appears in a commitment transaction
786  */
787 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
788    /**
789     * A pointer to the opaque Rust object.
790     * Nearly everywhere, inner must be non-null, however in places where
791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
792     */
793    LDKnativeHTLCOutputInCommitment *inner;
794    /**
795     * Indicates that this is the only struct which contains the same pointer.
796     * Rust functions which take ownership of an object provided via an argument require
797     * this to be true and invalidate the object pointed to by inner.
798     */
799    bool is_owned;
800 } LDKHTLCOutputInCommitment;
801
802 /**
803  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
804  */
805 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
806    /**
807     * A pointer to the contents in the success state.
808     * Reading from this pointer when `result_ok` is not set is undefined.
809     */
810    struct LDKHTLCOutputInCommitment *result;
811    /**
812     * A pointer to the contents in the error state.
813     * Reading from this pointer when `result_ok` is set is undefined.
814     */
815    struct LDKDecodeError *err;
816 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
817
818 /**
819  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
820  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
822  */
823 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
824    /**
825     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
826     * `err` or `result` depending on the state of `result_ok`.
827     */
828    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
829    /**
830     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
831     */
832    bool result_ok;
833 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
834
835
836
837 /**
838  * Late-bound per-channel counterparty data used to build transactions.
839  */
840 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
841    /**
842     * A pointer to the opaque Rust object.
843     * Nearly everywhere, inner must be non-null, however in places where
844     * the Rust equivalent takes an Option, it may be set to null to indicate None.
845     */
846    LDKnativeCounterpartyChannelTransactionParameters *inner;
847    /**
848     * Indicates that this is the only struct which contains the same pointer.
849     * Rust functions which take ownership of an object provided via an argument require
850     * this to be true and invalidate the object pointed to by inner.
851     */
852    bool is_owned;
853 } LDKCounterpartyChannelTransactionParameters;
854
855 /**
856  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
857  */
858 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
859    /**
860     * A pointer to the contents in the success state.
861     * Reading from this pointer when `result_ok` is not set is undefined.
862     */
863    struct LDKCounterpartyChannelTransactionParameters *result;
864    /**
865     * A pointer to the contents in the error state.
866     * Reading from this pointer when `result_ok` is set is undefined.
867     */
868    struct LDKDecodeError *err;
869 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
870
871 /**
872  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
873  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
874  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
875  */
876 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
877    /**
878     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
879     * `err` or `result` depending on the state of `result_ok`.
880     */
881    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
882    /**
883     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
884     */
885    bool result_ok;
886 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
887
888
889
890 /**
891  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
892  * The fields are organized by holder/counterparty.
893  *
894  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
895  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
896  */
897 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
898    /**
899     * A pointer to the opaque Rust object.
900     * Nearly everywhere, inner must be non-null, however in places where
901     * the Rust equivalent takes an Option, it may be set to null to indicate None.
902     */
903    LDKnativeChannelTransactionParameters *inner;
904    /**
905     * Indicates that this is the only struct which contains the same pointer.
906     * Rust functions which take ownership of an object provided via an argument require
907     * this to be true and invalidate the object pointed to by inner.
908     */
909    bool is_owned;
910 } LDKChannelTransactionParameters;
911
912 /**
913  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
914  */
915 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
916    /**
917     * A pointer to the contents in the success state.
918     * Reading from this pointer when `result_ok` is not set is undefined.
919     */
920    struct LDKChannelTransactionParameters *result;
921    /**
922     * A pointer to the contents in the error state.
923     * Reading from this pointer when `result_ok` is set is undefined.
924     */
925    struct LDKDecodeError *err;
926 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
927
928 /**
929  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
930  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
931  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
932  */
933 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
934    /**
935     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
936     * `err` or `result` depending on the state of `result_ok`.
937     */
938    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
939    /**
940     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
941     */
942    bool result_ok;
943 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
944
945 /**
946  * Represents a secp256k1 signature serialized as two 32-byte numbers
947  */
948 typedef struct LDKSignature {
949    /**
950     * The bytes of the signature in "compact" form
951     */
952    uint8_t compact_form[64];
953 } LDKSignature;
954
955 /**
956  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
957  * This corresponds to std::vector in C++
958  */
959 typedef struct LDKCVec_SignatureZ {
960    /**
961     * The elements in the array.
962     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
963     */
964    struct LDKSignature *data;
965    /**
966     * The number of elements pointed to by `data`.
967     */
968    uintptr_t datalen;
969 } LDKCVec_SignatureZ;
970
971
972
973 /**
974  * Information needed to build and sign a holder's commitment transaction.
975  *
976  * The transaction is only signed once we are ready to broadcast.
977  */
978 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
979    /**
980     * A pointer to the opaque Rust object.
981     * Nearly everywhere, inner must be non-null, however in places where
982     * the Rust equivalent takes an Option, it may be set to null to indicate None.
983     */
984    LDKnativeHolderCommitmentTransaction *inner;
985    /**
986     * Indicates that this is the only struct which contains the same pointer.
987     * Rust functions which take ownership of an object provided via an argument require
988     * this to be true and invalidate the object pointed to by inner.
989     */
990    bool is_owned;
991 } LDKHolderCommitmentTransaction;
992
993 /**
994  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
995  */
996 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
997    /**
998     * A pointer to the contents in the success state.
999     * Reading from this pointer when `result_ok` is not set is undefined.
1000     */
1001    struct LDKHolderCommitmentTransaction *result;
1002    /**
1003     * A pointer to the contents in the error state.
1004     * Reading from this pointer when `result_ok` is set is undefined.
1005     */
1006    struct LDKDecodeError *err;
1007 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1008
1009 /**
1010  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1011  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1012  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1013  */
1014 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1015    /**
1016     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1017     * `err` or `result` depending on the state of `result_ok`.
1018     */
1019    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1020    /**
1021     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1022     */
1023    bool result_ok;
1024 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1025
1026
1027
1028 /**
1029  * A pre-built Bitcoin commitment transaction and its txid.
1030  */
1031 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1032    /**
1033     * A pointer to the opaque Rust object.
1034     * Nearly everywhere, inner must be non-null, however in places where
1035     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1036     */
1037    LDKnativeBuiltCommitmentTransaction *inner;
1038    /**
1039     * Indicates that this is the only struct which contains the same pointer.
1040     * Rust functions which take ownership of an object provided via an argument require
1041     * this to be true and invalidate the object pointed to by inner.
1042     */
1043    bool is_owned;
1044 } LDKBuiltCommitmentTransaction;
1045
1046 /**
1047  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1048  */
1049 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1050    /**
1051     * A pointer to the contents in the success state.
1052     * Reading from this pointer when `result_ok` is not set is undefined.
1053     */
1054    struct LDKBuiltCommitmentTransaction *result;
1055    /**
1056     * A pointer to the contents in the error state.
1057     * Reading from this pointer when `result_ok` is set is undefined.
1058     */
1059    struct LDKDecodeError *err;
1060 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1061
1062 /**
1063  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1064  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1065  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1066  */
1067 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1068    /**
1069     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1070     * `err` or `result` depending on the state of `result_ok`.
1071     */
1072    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1073    /**
1074     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1075     */
1076    bool result_ok;
1077 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1078
1079
1080
1081 /**
1082  * A wrapper on ClosingTransaction indicating that the built bitcoin
1083  * transaction is trusted.
1084  *
1085  * See trust() and verify() functions on CommitmentTransaction.
1086  *
1087  * This structure implements Deref.
1088  */
1089 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1090    /**
1091     * A pointer to the opaque Rust object.
1092     * Nearly everywhere, inner must be non-null, however in places where
1093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1094     */
1095    LDKnativeTrustedClosingTransaction *inner;
1096    /**
1097     * Indicates that this is the only struct which contains the same pointer.
1098     * Rust functions which take ownership of an object provided via an argument require
1099     * this to be true and invalidate the object pointed to by inner.
1100     */
1101    bool is_owned;
1102 } LDKTrustedClosingTransaction;
1103
1104 /**
1105  * The contents of CResult_TrustedClosingTransactionNoneZ
1106  */
1107 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1108    /**
1109     * A pointer to the contents in the success state.
1110     * Reading from this pointer when `result_ok` is not set is undefined.
1111     */
1112    struct LDKTrustedClosingTransaction *result;
1113    /**
1114     * Note that this value is always NULL, as there are no contents in the Err variant
1115     */
1116    void *err;
1117 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1118
1119 /**
1120  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1121  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1123  */
1124 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1125    /**
1126     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1127     * `err` or `result` depending on the state of `result_ok`.
1128     */
1129    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1130    /**
1131     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1132     */
1133    bool result_ok;
1134 } LDKCResult_TrustedClosingTransactionNoneZ;
1135
1136
1137
1138 /**
1139  * This class tracks the per-transaction information needed to build a commitment transaction and will
1140  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1141  * and for transactions we sign for the counterparty.
1142  *
1143  * This class can be used inside a signer implementation to generate a signature given the relevant
1144  * secret key.
1145  */
1146 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1147    /**
1148     * A pointer to the opaque Rust object.
1149     * Nearly everywhere, inner must be non-null, however in places where
1150     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1151     */
1152    LDKnativeCommitmentTransaction *inner;
1153    /**
1154     * Indicates that this is the only struct which contains the same pointer.
1155     * Rust functions which take ownership of an object provided via an argument require
1156     * this to be true and invalidate the object pointed to by inner.
1157     */
1158    bool is_owned;
1159 } LDKCommitmentTransaction;
1160
1161 /**
1162  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1163  */
1164 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1165    /**
1166     * A pointer to the contents in the success state.
1167     * Reading from this pointer when `result_ok` is not set is undefined.
1168     */
1169    struct LDKCommitmentTransaction *result;
1170    /**
1171     * A pointer to the contents in the error state.
1172     * Reading from this pointer when `result_ok` is set is undefined.
1173     */
1174    struct LDKDecodeError *err;
1175 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1176
1177 /**
1178  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1179  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1180  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1181  */
1182 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1183    /**
1184     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1185     * `err` or `result` depending on the state of `result_ok`.
1186     */
1187    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1188    /**
1189     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1190     */
1191    bool result_ok;
1192 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1193
1194
1195
1196 /**
1197  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1198  * transaction and the transaction creation keys) are trusted.
1199  *
1200  * See trust() and verify() functions on CommitmentTransaction.
1201  *
1202  * This structure implements Deref.
1203  */
1204 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1205    /**
1206     * A pointer to the opaque Rust object.
1207     * Nearly everywhere, inner must be non-null, however in places where
1208     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1209     */
1210    LDKnativeTrustedCommitmentTransaction *inner;
1211    /**
1212     * Indicates that this is the only struct which contains the same pointer.
1213     * Rust functions which take ownership of an object provided via an argument require
1214     * this to be true and invalidate the object pointed to by inner.
1215     */
1216    bool is_owned;
1217 } LDKTrustedCommitmentTransaction;
1218
1219 /**
1220  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1221  */
1222 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1223    /**
1224     * A pointer to the contents in the success state.
1225     * Reading from this pointer when `result_ok` is not set is undefined.
1226     */
1227    struct LDKTrustedCommitmentTransaction *result;
1228    /**
1229     * Note that this value is always NULL, as there are no contents in the Err variant
1230     */
1231    void *err;
1232 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1233
1234 /**
1235  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1236  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1237  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1238  */
1239 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1240    /**
1241     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1242     * `err` or `result` depending on the state of `result_ok`.
1243     */
1244    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1245    /**
1246     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1247     */
1248    bool result_ok;
1249 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1250
1251 /**
1252  * The contents of CResult_CVec_SignatureZNoneZ
1253  */
1254 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1255    /**
1256     * A pointer to the contents in the success state.
1257     * Reading from this pointer when `result_ok` is not set is undefined.
1258     */
1259    struct LDKCVec_SignatureZ *result;
1260    /**
1261     * Note that this value is always NULL, as there are no contents in the Err variant
1262     */
1263    void *err;
1264 } LDKCResult_CVec_SignatureZNoneZPtr;
1265
1266 /**
1267  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1268  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1270  */
1271 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1272    /**
1273     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1274     * `err` or `result` depending on the state of `result_ok`.
1275     */
1276    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1277    /**
1278     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1279     */
1280    bool result_ok;
1281 } LDKCResult_CVec_SignatureZNoneZ;
1282
1283
1284
1285 /**
1286  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1287  *
1288  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1289  */
1290 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1291    /**
1292     * A pointer to the opaque Rust object.
1293     * Nearly everywhere, inner must be non-null, however in places where
1294     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1295     */
1296    LDKnativeShutdownScript *inner;
1297    /**
1298     * Indicates that this is the only struct which contains the same pointer.
1299     * Rust functions which take ownership of an object provided via an argument require
1300     * this to be true and invalidate the object pointed to by inner.
1301     */
1302    bool is_owned;
1303 } LDKShutdownScript;
1304
1305 /**
1306  * The contents of CResult_ShutdownScriptDecodeErrorZ
1307  */
1308 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1309    /**
1310     * A pointer to the contents in the success state.
1311     * Reading from this pointer when `result_ok` is not set is undefined.
1312     */
1313    struct LDKShutdownScript *result;
1314    /**
1315     * A pointer to the contents in the error state.
1316     * Reading from this pointer when `result_ok` is set is undefined.
1317     */
1318    struct LDKDecodeError *err;
1319 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1320
1321 /**
1322  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1323  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1324  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1325  */
1326 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1327    /**
1328     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1329     * `err` or `result` depending on the state of `result_ok`.
1330     */
1331    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1332    /**
1333     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1334     */
1335    bool result_ok;
1336 } LDKCResult_ShutdownScriptDecodeErrorZ;
1337
1338
1339
1340 /**
1341  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1342  */
1343 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1344    /**
1345     * A pointer to the opaque Rust object.
1346     * Nearly everywhere, inner must be non-null, however in places where
1347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1348     */
1349    LDKnativeInvalidShutdownScript *inner;
1350    /**
1351     * Indicates that this is the only struct which contains the same pointer.
1352     * Rust functions which take ownership of an object provided via an argument require
1353     * this to be true and invalidate the object pointed to by inner.
1354     */
1355    bool is_owned;
1356 } LDKInvalidShutdownScript;
1357
1358 /**
1359  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1360  */
1361 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1362    /**
1363     * A pointer to the contents in the success state.
1364     * Reading from this pointer when `result_ok` is not set is undefined.
1365     */
1366    struct LDKShutdownScript *result;
1367    /**
1368     * A pointer to the contents in the error state.
1369     * Reading from this pointer when `result_ok` is set is undefined.
1370     */
1371    struct LDKInvalidShutdownScript *err;
1372 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1373
1374 /**
1375  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1376  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1377  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1378  */
1379 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1380    /**
1381     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1382     * `err` or `result` depending on the state of `result_ok`.
1383     */
1384    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1385    /**
1386     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1387     */
1388    bool result_ok;
1389 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1390
1391 /**
1392  * The contents of CResult_NoneErrorZ
1393  */
1394 typedef union LDKCResult_NoneErrorZPtr {
1395    /**
1396     * Note that this value is always NULL, as there are no contents in the OK variant
1397     */
1398    void *result;
1399    /**
1400     * A pointer to the contents in the error state.
1401     * Reading from this pointer when `result_ok` is set is undefined.
1402     */
1403    enum LDKIOError *err;
1404 } LDKCResult_NoneErrorZPtr;
1405
1406 /**
1407  * A CResult_NoneErrorZ represents the result of a fallible operation,
1408  * containing a () on success and a crate::c_types::IOError on failure.
1409  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1410  */
1411 typedef struct LDKCResult_NoneErrorZ {
1412    /**
1413     * The contents of this CResult_NoneErrorZ, accessible via either
1414     * `err` or `result` depending on the state of `result_ok`.
1415     */
1416    union LDKCResult_NoneErrorZPtr contents;
1417    /**
1418     * Whether this CResult_NoneErrorZ represents a success state.
1419     */
1420    bool result_ok;
1421 } LDKCResult_NoneErrorZ;
1422
1423
1424
1425 /**
1426  * A hop in a route
1427  */
1428 typedef struct MUST_USE_STRUCT LDKRouteHop {
1429    /**
1430     * A pointer to the opaque Rust object.
1431     * Nearly everywhere, inner must be non-null, however in places where
1432     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1433     */
1434    LDKnativeRouteHop *inner;
1435    /**
1436     * Indicates that this is the only struct which contains the same pointer.
1437     * Rust functions which take ownership of an object provided via an argument require
1438     * this to be true and invalidate the object pointed to by inner.
1439     */
1440    bool is_owned;
1441 } LDKRouteHop;
1442
1443 /**
1444  * The contents of CResult_RouteHopDecodeErrorZ
1445  */
1446 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1447    /**
1448     * A pointer to the contents in the success state.
1449     * Reading from this pointer when `result_ok` is not set is undefined.
1450     */
1451    struct LDKRouteHop *result;
1452    /**
1453     * A pointer to the contents in the error state.
1454     * Reading from this pointer when `result_ok` is set is undefined.
1455     */
1456    struct LDKDecodeError *err;
1457 } LDKCResult_RouteHopDecodeErrorZPtr;
1458
1459 /**
1460  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1461  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1462  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1463  */
1464 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1465    /**
1466     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1467     * `err` or `result` depending on the state of `result_ok`.
1468     */
1469    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1470    /**
1471     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1472     */
1473    bool result_ok;
1474 } LDKCResult_RouteHopDecodeErrorZ;
1475
1476 /**
1477  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1478  * This corresponds to std::vector in C++
1479  */
1480 typedef struct LDKCVec_RouteHopZ {
1481    /**
1482     * The elements in the array.
1483     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1484     */
1485    struct LDKRouteHop *data;
1486    /**
1487     * The number of elements pointed to by `data`.
1488     */
1489    uintptr_t datalen;
1490 } LDKCVec_RouteHopZ;
1491
1492 /**
1493  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1494  * This corresponds to std::vector in C++
1495  */
1496 typedef struct LDKCVec_CVec_RouteHopZZ {
1497    /**
1498     * The elements in the array.
1499     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1500     */
1501    struct LDKCVec_RouteHopZ *data;
1502    /**
1503     * The number of elements pointed to by `data`.
1504     */
1505    uintptr_t datalen;
1506 } LDKCVec_CVec_RouteHopZZ;
1507
1508
1509
1510 /**
1511  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1512  * it can take multiple paths. Each path is composed of one or more hops through the network.
1513  */
1514 typedef struct MUST_USE_STRUCT LDKRoute {
1515    /**
1516     * A pointer to the opaque Rust object.
1517     * Nearly everywhere, inner must be non-null, however in places where
1518     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1519     */
1520    LDKnativeRoute *inner;
1521    /**
1522     * Indicates that this is the only struct which contains the same pointer.
1523     * Rust functions which take ownership of an object provided via an argument require
1524     * this to be true and invalidate the object pointed to by inner.
1525     */
1526    bool is_owned;
1527 } LDKRoute;
1528
1529 /**
1530  * The contents of CResult_RouteDecodeErrorZ
1531  */
1532 typedef union LDKCResult_RouteDecodeErrorZPtr {
1533    /**
1534     * A pointer to the contents in the success state.
1535     * Reading from this pointer when `result_ok` is not set is undefined.
1536     */
1537    struct LDKRoute *result;
1538    /**
1539     * A pointer to the contents in the error state.
1540     * Reading from this pointer when `result_ok` is set is undefined.
1541     */
1542    struct LDKDecodeError *err;
1543 } LDKCResult_RouteDecodeErrorZPtr;
1544
1545 /**
1546  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1547  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1549  */
1550 typedef struct LDKCResult_RouteDecodeErrorZ {
1551    /**
1552     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1553     * `err` or `result` depending on the state of `result_ok`.
1554     */
1555    union LDKCResult_RouteDecodeErrorZPtr contents;
1556    /**
1557     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1558     */
1559    bool result_ok;
1560 } LDKCResult_RouteDecodeErrorZ;
1561
1562
1563
1564 /**
1565  * Parameters needed to find a [`Route`] for paying a [`Payee`].
1566  *
1567  * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
1568  * payment path.
1569  *
1570  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1571  */
1572 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1573    /**
1574     * A pointer to the opaque Rust object.
1575     * Nearly everywhere, inner must be non-null, however in places where
1576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1577     */
1578    LDKnativeRouteParameters *inner;
1579    /**
1580     * Indicates that this is the only struct which contains the same pointer.
1581     * Rust functions which take ownership of an object provided via an argument require
1582     * this to be true and invalidate the object pointed to by inner.
1583     */
1584    bool is_owned;
1585 } LDKRouteParameters;
1586
1587 /**
1588  * The contents of CResult_RouteParametersDecodeErrorZ
1589  */
1590 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1591    /**
1592     * A pointer to the contents in the success state.
1593     * Reading from this pointer when `result_ok` is not set is undefined.
1594     */
1595    struct LDKRouteParameters *result;
1596    /**
1597     * A pointer to the contents in the error state.
1598     * Reading from this pointer when `result_ok` is set is undefined.
1599     */
1600    struct LDKDecodeError *err;
1601 } LDKCResult_RouteParametersDecodeErrorZPtr;
1602
1603 /**
1604  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1605  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1606  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1607  */
1608 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1609    /**
1610     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1611     * `err` or `result` depending on the state of `result_ok`.
1612     */
1613    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1614    /**
1615     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1616     */
1617    bool result_ok;
1618 } LDKCResult_RouteParametersDecodeErrorZ;
1619
1620
1621
1622 /**
1623  * A list of hops along a payment path terminating with a channel to the recipient.
1624  */
1625 typedef struct MUST_USE_STRUCT LDKRouteHint {
1626    /**
1627     * A pointer to the opaque Rust object.
1628     * Nearly everywhere, inner must be non-null, however in places where
1629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1630     */
1631    LDKnativeRouteHint *inner;
1632    /**
1633     * Indicates that this is the only struct which contains the same pointer.
1634     * Rust functions which take ownership of an object provided via an argument require
1635     * this to be true and invalidate the object pointed to by inner.
1636     */
1637    bool is_owned;
1638 } LDKRouteHint;
1639
1640 /**
1641  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1642  * This corresponds to std::vector in C++
1643  */
1644 typedef struct LDKCVec_RouteHintZ {
1645    /**
1646     * The elements in the array.
1647     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1648     */
1649    struct LDKRouteHint *data;
1650    /**
1651     * The number of elements pointed to by `data`.
1652     */
1653    uintptr_t datalen;
1654 } LDKCVec_RouteHintZ;
1655
1656 /**
1657  * An enum which can either contain a u64 or not
1658  */
1659 typedef enum LDKCOption_u64Z_Tag {
1660    /**
1661     * When we're in this state, this COption_u64Z contains a u64
1662     */
1663    LDKCOption_u64Z_Some,
1664    /**
1665     * When we're in this state, this COption_u64Z contains nothing
1666     */
1667    LDKCOption_u64Z_None,
1668    /**
1669     * Must be last for serialization purposes
1670     */
1671    LDKCOption_u64Z_Sentinel,
1672 } LDKCOption_u64Z_Tag;
1673
1674 typedef struct LDKCOption_u64Z {
1675    LDKCOption_u64Z_Tag tag;
1676    union {
1677       struct {
1678          uint64_t some;
1679       };
1680    };
1681 } LDKCOption_u64Z;
1682
1683
1684
1685 /**
1686  * The recipient of a payment.
1687  */
1688 typedef struct MUST_USE_STRUCT LDKPayee {
1689    /**
1690     * A pointer to the opaque Rust object.
1691     * Nearly everywhere, inner must be non-null, however in places where
1692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1693     */
1694    LDKnativePayee *inner;
1695    /**
1696     * Indicates that this is the only struct which contains the same pointer.
1697     * Rust functions which take ownership of an object provided via an argument require
1698     * this to be true and invalidate the object pointed to by inner.
1699     */
1700    bool is_owned;
1701 } LDKPayee;
1702
1703 /**
1704  * The contents of CResult_PayeeDecodeErrorZ
1705  */
1706 typedef union LDKCResult_PayeeDecodeErrorZPtr {
1707    /**
1708     * A pointer to the contents in the success state.
1709     * Reading from this pointer when `result_ok` is not set is undefined.
1710     */
1711    struct LDKPayee *result;
1712    /**
1713     * A pointer to the contents in the error state.
1714     * Reading from this pointer when `result_ok` is set is undefined.
1715     */
1716    struct LDKDecodeError *err;
1717 } LDKCResult_PayeeDecodeErrorZPtr;
1718
1719 /**
1720  * A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
1721  * containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
1722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723  */
1724 typedef struct LDKCResult_PayeeDecodeErrorZ {
1725    /**
1726     * The contents of this CResult_PayeeDecodeErrorZ, accessible via either
1727     * `err` or `result` depending on the state of `result_ok`.
1728     */
1729    union LDKCResult_PayeeDecodeErrorZPtr contents;
1730    /**
1731     * Whether this CResult_PayeeDecodeErrorZ represents a success state.
1732     */
1733    bool result_ok;
1734 } LDKCResult_PayeeDecodeErrorZ;
1735
1736
1737
1738 /**
1739  * A channel descriptor for a hop along a payment path.
1740  */
1741 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1742    /**
1743     * A pointer to the opaque Rust object.
1744     * Nearly everywhere, inner must be non-null, however in places where
1745     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1746     */
1747    LDKnativeRouteHintHop *inner;
1748    /**
1749     * Indicates that this is the only struct which contains the same pointer.
1750     * Rust functions which take ownership of an object provided via an argument require
1751     * this to be true and invalidate the object pointed to by inner.
1752     */
1753    bool is_owned;
1754 } LDKRouteHintHop;
1755
1756 /**
1757  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1758  * This corresponds to std::vector in C++
1759  */
1760 typedef struct LDKCVec_RouteHintHopZ {
1761    /**
1762     * The elements in the array.
1763     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1764     */
1765    struct LDKRouteHintHop *data;
1766    /**
1767     * The number of elements pointed to by `data`.
1768     */
1769    uintptr_t datalen;
1770 } LDKCVec_RouteHintHopZ;
1771
1772 /**
1773  * The contents of CResult_RouteHintDecodeErrorZ
1774  */
1775 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1776    /**
1777     * A pointer to the contents in the success state.
1778     * Reading from this pointer when `result_ok` is not set is undefined.
1779     */
1780    struct LDKRouteHint *result;
1781    /**
1782     * A pointer to the contents in the error state.
1783     * Reading from this pointer when `result_ok` is set is undefined.
1784     */
1785    struct LDKDecodeError *err;
1786 } LDKCResult_RouteHintDecodeErrorZPtr;
1787
1788 /**
1789  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1790  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1791  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1792  */
1793 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1794    /**
1795     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1796     * `err` or `result` depending on the state of `result_ok`.
1797     */
1798    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1799    /**
1800     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1801     */
1802    bool result_ok;
1803 } LDKCResult_RouteHintDecodeErrorZ;
1804
1805 /**
1806  * The contents of CResult_RouteHintHopDecodeErrorZ
1807  */
1808 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1809    /**
1810     * A pointer to the contents in the success state.
1811     * Reading from this pointer when `result_ok` is not set is undefined.
1812     */
1813    struct LDKRouteHintHop *result;
1814    /**
1815     * A pointer to the contents in the error state.
1816     * Reading from this pointer when `result_ok` is set is undefined.
1817     */
1818    struct LDKDecodeError *err;
1819 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1820
1821 /**
1822  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1823  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1824  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1825  */
1826 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1827    /**
1828     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
1829     * `err` or `result` depending on the state of `result_ok`.
1830     */
1831    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
1832    /**
1833     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
1834     */
1835    bool result_ok;
1836 } LDKCResult_RouteHintHopDecodeErrorZ;
1837
1838
1839
1840 /**
1841  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1842  */
1843 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1844    /**
1845     * A pointer to the opaque Rust object.
1846     * Nearly everywhere, inner must be non-null, however in places where
1847     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1848     */
1849    LDKnativeChannelDetails *inner;
1850    /**
1851     * Indicates that this is the only struct which contains the same pointer.
1852     * Rust functions which take ownership of an object provided via an argument require
1853     * this to be true and invalidate the object pointed to by inner.
1854     */
1855    bool is_owned;
1856 } LDKChannelDetails;
1857
1858 /**
1859  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1860  * This corresponds to std::vector in C++
1861  */
1862 typedef struct LDKCVec_ChannelDetailsZ {
1863    /**
1864     * The elements in the array.
1865     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1866     */
1867    struct LDKChannelDetails *data;
1868    /**
1869     * The number of elements pointed to by `data`.
1870     */
1871    uintptr_t datalen;
1872 } LDKCVec_ChannelDetailsZ;
1873
1874
1875
1876 /**
1877  * An Err type for failure to process messages.
1878  */
1879 typedef struct MUST_USE_STRUCT LDKLightningError {
1880    /**
1881     * A pointer to the opaque Rust object.
1882     * Nearly everywhere, inner must be non-null, however in places where
1883     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1884     */
1885    LDKnativeLightningError *inner;
1886    /**
1887     * Indicates that this is the only struct which contains the same pointer.
1888     * Rust functions which take ownership of an object provided via an argument require
1889     * this to be true and invalidate the object pointed to by inner.
1890     */
1891    bool is_owned;
1892 } LDKLightningError;
1893
1894 /**
1895  * The contents of CResult_RouteLightningErrorZ
1896  */
1897 typedef union LDKCResult_RouteLightningErrorZPtr {
1898    /**
1899     * A pointer to the contents in the success state.
1900     * Reading from this pointer when `result_ok` is not set is undefined.
1901     */
1902    struct LDKRoute *result;
1903    /**
1904     * A pointer to the contents in the error state.
1905     * Reading from this pointer when `result_ok` is set is undefined.
1906     */
1907    struct LDKLightningError *err;
1908 } LDKCResult_RouteLightningErrorZPtr;
1909
1910 /**
1911  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1912  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1913  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1914  */
1915 typedef struct LDKCResult_RouteLightningErrorZ {
1916    /**
1917     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1918     * `err` or `result` depending on the state of `result_ok`.
1919     */
1920    union LDKCResult_RouteLightningErrorZPtr contents;
1921    /**
1922     * Whether this CResult_RouteLightningErrorZ represents a success state.
1923     */
1924    bool result_ok;
1925 } LDKCResult_RouteLightningErrorZ;
1926
1927 /**
1928  * The contents of CResult_TxOutAccessErrorZ
1929  */
1930 typedef union LDKCResult_TxOutAccessErrorZPtr {
1931    /**
1932     * A pointer to the contents in the success state.
1933     * Reading from this pointer when `result_ok` is not set is undefined.
1934     */
1935    struct LDKTxOut *result;
1936    /**
1937     * A pointer to the contents in the error state.
1938     * Reading from this pointer when `result_ok` is set is undefined.
1939     */
1940    enum LDKAccessError *err;
1941 } LDKCResult_TxOutAccessErrorZPtr;
1942
1943 /**
1944  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1945  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1946  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1947  */
1948 typedef struct LDKCResult_TxOutAccessErrorZ {
1949    /**
1950     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1951     * `err` or `result` depending on the state of `result_ok`.
1952     */
1953    union LDKCResult_TxOutAccessErrorZPtr contents;
1954    /**
1955     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1956     */
1957    bool result_ok;
1958 } LDKCResult_TxOutAccessErrorZ;
1959
1960 /**
1961  * A tuple of 2 elements. See the individual fields for the types contained.
1962  */
1963 typedef struct LDKC2Tuple_usizeTransactionZ {
1964    /**
1965     * The element at position 0
1966     */
1967    uintptr_t a;
1968    /**
1969     * The element at position 1
1970     */
1971    struct LDKTransaction b;
1972 } LDKC2Tuple_usizeTransactionZ;
1973
1974 /**
1975  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1976  * This corresponds to std::vector in C++
1977  */
1978 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1979    /**
1980     * The elements in the array.
1981     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1982     */
1983    struct LDKC2Tuple_usizeTransactionZ *data;
1984    /**
1985     * The number of elements pointed to by `data`.
1986     */
1987    uintptr_t datalen;
1988 } LDKCVec_C2Tuple_usizeTransactionZZ;
1989
1990 /**
1991  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1992  * look up the corresponding function in rust-lightning's docs.
1993  */
1994 typedef struct LDKThirtyTwoBytes {
1995    /**
1996     * The thirty-two bytes
1997     */
1998    uint8_t data[32];
1999 } LDKThirtyTwoBytes;
2000
2001 /**
2002  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2003  * This corresponds to std::vector in C++
2004  */
2005 typedef struct LDKCVec_TxidZ {
2006    /**
2007     * The elements in the array.
2008     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2009     */
2010    struct LDKThirtyTwoBytes *data;
2011    /**
2012     * The number of elements pointed to by `data`.
2013     */
2014    uintptr_t datalen;
2015 } LDKCVec_TxidZ;
2016
2017 /**
2018  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2019  */
2020 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2021    /**
2022     * Note that this value is always NULL, as there are no contents in the OK variant
2023     */
2024    void *result;
2025    /**
2026     * A pointer to the contents in the error state.
2027     * Reading from this pointer when `result_ok` is set is undefined.
2028     */
2029    enum LDKChannelMonitorUpdateErr *err;
2030 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2031
2032 /**
2033  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2034  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2036  */
2037 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2038    /**
2039     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2040     * `err` or `result` depending on the state of `result_ok`.
2041     */
2042    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2043    /**
2044     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2045     */
2046    bool result_ok;
2047 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2048
2049
2050
2051 /**
2052  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2053  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2054  * preimage claim backward will lead to loss of funds.
2055  */
2056 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2057    /**
2058     * A pointer to the opaque Rust object.
2059     * Nearly everywhere, inner must be non-null, however in places where
2060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2061     */
2062    LDKnativeHTLCUpdate *inner;
2063    /**
2064     * Indicates that this is the only struct which contains the same pointer.
2065     * Rust functions which take ownership of an object provided via an argument require
2066     * this to be true and invalidate the object pointed to by inner.
2067     */
2068    bool is_owned;
2069 } LDKHTLCUpdate;
2070
2071
2072
2073 /**
2074  * A reference to a transaction output.
2075  *
2076  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2077  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2078  */
2079 typedef struct MUST_USE_STRUCT LDKOutPoint {
2080    /**
2081     * A pointer to the opaque Rust object.
2082     * Nearly everywhere, inner must be non-null, however in places where
2083     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2084     */
2085    LDKnativeOutPoint *inner;
2086    /**
2087     * Indicates that this is the only struct which contains the same pointer.
2088     * Rust functions which take ownership of an object provided via an argument require
2089     * this to be true and invalidate the object pointed to by inner.
2090     */
2091    bool is_owned;
2092 } LDKOutPoint;
2093
2094 /**
2095  * An event to be processed by the ChannelManager.
2096  */
2097 typedef enum LDKMonitorEvent_Tag {
2098    /**
2099     * A monitor event containing an HTLCUpdate.
2100     */
2101    LDKMonitorEvent_HTLCEvent,
2102    /**
2103     * A monitor event that the Channel's commitment transaction was confirmed.
2104     */
2105    LDKMonitorEvent_CommitmentTxConfirmed,
2106    /**
2107     * Indicates a [`ChannelMonitor`] update has completed. See
2108     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
2109     *
2110     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
2111     */
2112    LDKMonitorEvent_UpdateCompleted,
2113    /**
2114     * Indicates a [`ChannelMonitor`] update has failed. See
2115     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
2116     *
2117     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
2118     */
2119    LDKMonitorEvent_UpdateFailed,
2120    /**
2121     * Must be last for serialization purposes
2122     */
2123    LDKMonitorEvent_Sentinel,
2124 } LDKMonitorEvent_Tag;
2125
2126 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
2127    /**
2128     * The funding outpoint of the [`ChannelMonitor`] that was updated
2129     */
2130    struct LDKOutPoint funding_txo;
2131    /**
2132     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
2133     * [`ChannelMonitor::get_latest_update_id`].
2134     *
2135     * Note that this should only be set to a given update's ID if all previous updates for the
2136     * same [`ChannelMonitor`] have been applied and persisted.
2137     */
2138    uint64_t monitor_update_id;
2139 } LDKMonitorEvent_LDKUpdateCompleted_Body;
2140
2141 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2142    LDKMonitorEvent_Tag tag;
2143    union {
2144       struct {
2145          struct LDKHTLCUpdate htlc_event;
2146       };
2147       struct {
2148          struct LDKOutPoint commitment_tx_confirmed;
2149       };
2150       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
2151       struct {
2152          struct LDKOutPoint update_failed;
2153       };
2154    };
2155 } LDKMonitorEvent;
2156
2157 /**
2158  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2159  * This corresponds to std::vector in C++
2160  */
2161 typedef struct LDKCVec_MonitorEventZ {
2162    /**
2163     * The elements in the array.
2164     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2165     */
2166    struct LDKMonitorEvent *data;
2167    /**
2168     * The number of elements pointed to by `data`.
2169     */
2170    uintptr_t datalen;
2171 } LDKCVec_MonitorEventZ;
2172
2173 /**
2174  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2175  */
2176 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2177    /**
2178     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2179     */
2180    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2181    /**
2182     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2183     */
2184    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2185    /**
2186     * Must be last for serialization purposes
2187     */
2188    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2189 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2190
2191 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2192    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2193    union {
2194       struct {
2195          struct LDKC2Tuple_usizeTransactionZ some;
2196       };
2197    };
2198 } LDKCOption_C2Tuple_usizeTransactionZZ;
2199
2200 /**
2201  * The reason the channel was closed. See individual variants more details.
2202  */
2203 typedef enum LDKClosureReason_Tag {
2204    /**
2205     * Closure generated from receiving a peer error message.
2206     *
2207     * Our counterparty may have broadcasted their latest commitment state, and we have
2208     * as well.
2209     */
2210    LDKClosureReason_CounterpartyForceClosed,
2211    /**
2212     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2213     *
2214     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2215     */
2216    LDKClosureReason_HolderForceClosed,
2217    /**
2218     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2219     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2220     */
2221    LDKClosureReason_CooperativeClosure,
2222    /**
2223     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2224     * commitment transaction came from our counterparty, but it may also have come from
2225     * a copy of our own `ChannelMonitor`.
2226     */
2227    LDKClosureReason_CommitmentTxConfirmed,
2228    /**
2229     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2230     */
2231    LDKClosureReason_FundingTimedOut,
2232    /**
2233     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2234     */
2235    LDKClosureReason_ProcessingError,
2236    /**
2237     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
2238     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
2239     * peer again in the future or if the peer disconnected before we finished negotiating
2240     * the channel open. The first case may be caused by incompatible features which our
2241     * counterparty, or we, require.
2242     */
2243    LDKClosureReason_DisconnectedPeer,
2244    /**
2245     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2246     * the ChannelManager deserialized.
2247     */
2248    LDKClosureReason_OutdatedChannelManager,
2249    /**
2250     * Must be last for serialization purposes
2251     */
2252    LDKClosureReason_Sentinel,
2253 } LDKClosureReason_Tag;
2254
2255 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2256    /**
2257     * The error which the peer sent us.
2258     *
2259     * The string should be sanitized before it is used (e.g emitted to logs
2260     * or printed to stdout). Otherwise, a well crafted error message may exploit
2261     * a security vulnerability in the terminal emulator or the logging subsystem.
2262     */
2263    struct LDKStr peer_msg;
2264 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2265
2266 typedef struct LDKClosureReason_LDKProcessingError_Body {
2267    /**
2268     * A developer-readable error message which we generated.
2269     */
2270    struct LDKStr err;
2271 } LDKClosureReason_LDKProcessingError_Body;
2272
2273 typedef struct MUST_USE_STRUCT LDKClosureReason {
2274    LDKClosureReason_Tag tag;
2275    union {
2276       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2277       LDKClosureReason_LDKProcessingError_Body processing_error;
2278    };
2279 } LDKClosureReason;
2280
2281 /**
2282  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2283  */
2284 typedef enum LDKCOption_ClosureReasonZ_Tag {
2285    /**
2286     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2287     */
2288    LDKCOption_ClosureReasonZ_Some,
2289    /**
2290     * When we're in this state, this COption_ClosureReasonZ contains nothing
2291     */
2292    LDKCOption_ClosureReasonZ_None,
2293    /**
2294     * Must be last for serialization purposes
2295     */
2296    LDKCOption_ClosureReasonZ_Sentinel,
2297 } LDKCOption_ClosureReasonZ_Tag;
2298
2299 typedef struct LDKCOption_ClosureReasonZ {
2300    LDKCOption_ClosureReasonZ_Tag tag;
2301    union {
2302       struct {
2303          struct LDKClosureReason some;
2304       };
2305    };
2306 } LDKCOption_ClosureReasonZ;
2307
2308 /**
2309  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2310  */
2311 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2312    /**
2313     * A pointer to the contents in the success state.
2314     * Reading from this pointer when `result_ok` is not set is undefined.
2315     */
2316    struct LDKCOption_ClosureReasonZ *result;
2317    /**
2318     * A pointer to the contents in the error state.
2319     * Reading from this pointer when `result_ok` is set is undefined.
2320     */
2321    struct LDKDecodeError *err;
2322 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2323
2324 /**
2325  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2326  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2327  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2328  */
2329 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2330    /**
2331     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2332     * `err` or `result` depending on the state of `result_ok`.
2333     */
2334    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2335    /**
2336     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2337     */
2338    bool result_ok;
2339 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2340
2341
2342
2343 /**
2344  * A channel_update message to be sent or received from a peer
2345  */
2346 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2347    /**
2348     * A pointer to the opaque Rust object.
2349     * Nearly everywhere, inner must be non-null, however in places where
2350     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2351     */
2352    LDKnativeChannelUpdate *inner;
2353    /**
2354     * Indicates that this is the only struct which contains the same pointer.
2355     * Rust functions which take ownership of an object provided via an argument require
2356     * this to be true and invalidate the object pointed to by inner.
2357     */
2358    bool is_owned;
2359 } LDKChannelUpdate;
2360
2361 /**
2362  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2363  * return packet by a node along the route. See [BOLT #4] for details.
2364  *
2365  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2366  */
2367 typedef enum LDKNetworkUpdate_Tag {
2368    /**
2369     * An error indicating a `channel_update` messages should be applied via
2370     * [`NetworkGraph::update_channel`].
2371     */
2372    LDKNetworkUpdate_ChannelUpdateMessage,
2373    /**
2374     * An error indicating only that a channel has been closed, which should be applied via
2375     * [`NetworkGraph::close_channel_from_update`].
2376     */
2377    LDKNetworkUpdate_ChannelClosed,
2378    /**
2379     * An error indicating only that a node has failed, which should be applied via
2380     * [`NetworkGraph::fail_node`].
2381     */
2382    LDKNetworkUpdate_NodeFailure,
2383    /**
2384     * Must be last for serialization purposes
2385     */
2386    LDKNetworkUpdate_Sentinel,
2387 } LDKNetworkUpdate_Tag;
2388
2389 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2390    /**
2391     * The update to apply via [`NetworkGraph::update_channel`].
2392     */
2393    struct LDKChannelUpdate msg;
2394 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2395
2396 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2397    /**
2398     * The short channel id of the closed channel.
2399     */
2400    uint64_t short_channel_id;
2401    /**
2402     * Whether the channel should be permanently removed or temporarily disabled until a new
2403     * `channel_update` message is received.
2404     */
2405    bool is_permanent;
2406 } LDKNetworkUpdate_LDKChannelClosed_Body;
2407
2408 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2409    /**
2410     * The node id of the failed node.
2411     */
2412    struct LDKPublicKey node_id;
2413    /**
2414     * Whether the node should be permanently removed from consideration or can be restored
2415     * when a new `channel_update` message is received.
2416     */
2417    bool is_permanent;
2418 } LDKNetworkUpdate_LDKNodeFailure_Body;
2419
2420 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2421    LDKNetworkUpdate_Tag tag;
2422    union {
2423       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2424       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2425       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2426    };
2427 } LDKNetworkUpdate;
2428
2429 /**
2430  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2431  */
2432 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2433    /**
2434     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2435     */
2436    LDKCOption_NetworkUpdateZ_Some,
2437    /**
2438     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2439     */
2440    LDKCOption_NetworkUpdateZ_None,
2441    /**
2442     * Must be last for serialization purposes
2443     */
2444    LDKCOption_NetworkUpdateZ_Sentinel,
2445 } LDKCOption_NetworkUpdateZ_Tag;
2446
2447 typedef struct LDKCOption_NetworkUpdateZ {
2448    LDKCOption_NetworkUpdateZ_Tag tag;
2449    union {
2450       struct {
2451          struct LDKNetworkUpdate some;
2452       };
2453    };
2454 } LDKCOption_NetworkUpdateZ;
2455
2456
2457
2458 /**
2459  * Information about a spendable output to a P2WSH script. See
2460  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2461  */
2462 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2463    /**
2464     * A pointer to the opaque Rust object.
2465     * Nearly everywhere, inner must be non-null, however in places where
2466     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2467     */
2468    LDKnativeDelayedPaymentOutputDescriptor *inner;
2469    /**
2470     * Indicates that this is the only struct which contains the same pointer.
2471     * Rust functions which take ownership of an object provided via an argument require
2472     * this to be true and invalidate the object pointed to by inner.
2473     */
2474    bool is_owned;
2475 } LDKDelayedPaymentOutputDescriptor;
2476
2477
2478
2479 /**
2480  * Information about a spendable output to our \"payment key\". See
2481  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2482  */
2483 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2484    /**
2485     * A pointer to the opaque Rust object.
2486     * Nearly everywhere, inner must be non-null, however in places where
2487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2488     */
2489    LDKnativeStaticPaymentOutputDescriptor *inner;
2490    /**
2491     * Indicates that this is the only struct which contains the same pointer.
2492     * Rust functions which take ownership of an object provided via an argument require
2493     * this to be true and invalidate the object pointed to by inner.
2494     */
2495    bool is_owned;
2496 } LDKStaticPaymentOutputDescriptor;
2497
2498 /**
2499  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2500  * claim at any point in the future) an event is generated which you must track and be able to
2501  * spend on-chain. The information needed to do this is provided in this enum, including the
2502  * outpoint describing which txid and output index is available, the full output which exists at
2503  * that txid/index, and any keys or other information required to sign.
2504  */
2505 typedef enum LDKSpendableOutputDescriptor_Tag {
2506    /**
2507     * An output to a script which was provided via KeysInterface directly, either from
2508     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2509     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2510     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2511     * on-chain using the payment preimage or after it has timed out.
2512     */
2513    LDKSpendableOutputDescriptor_StaticOutput,
2514    /**
2515     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2516     *
2517     * The witness in the spending input should be:
2518     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2519     *
2520     * Note that the nSequence field in the spending input must be set to to_self_delay
2521     * (which means the transaction is not broadcastable until at least to_self_delay
2522     * blocks after the outpoint confirms).
2523     *
2524     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2525     * it is an output from an old state which we broadcast (which should never happen).
2526     *
2527     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2528     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2529     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2530     * chan_utils::derive_private_key. The public key can be generated without the secret key
2531     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2532     * Sign::pubkeys().
2533     *
2534     * To derive the revocation_pubkey provided here (which is used in the witness
2535     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2536     * call to Sign::ready_channel) and the provided per_commitment point
2537     * to chan_utils::derive_public_revocation_key.
2538     *
2539     * The witness script which is hashed and included in the output script_pubkey may be
2540     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2541     * (derived as above), and the to_self_delay contained here to
2542     * chan_utils::get_revokeable_redeemscript.
2543     */
2544    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2545    /**
2546     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2547     * corresponds to the public key in Sign::pubkeys().payment_point).
2548     * The witness in the spending input, is, thus, simply:
2549     * <BIP 143 signature> <payment key>
2550     *
2551     * These are generally the result of our counterparty having broadcast the current state,
2552     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2553     */
2554    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2555    /**
2556     * Must be last for serialization purposes
2557     */
2558    LDKSpendableOutputDescriptor_Sentinel,
2559 } LDKSpendableOutputDescriptor_Tag;
2560
2561 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2562    /**
2563     * The outpoint which is spendable
2564     */
2565    struct LDKOutPoint outpoint;
2566    /**
2567     * The output which is referenced by the given outpoint.
2568     */
2569    struct LDKTxOut output;
2570 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2571
2572 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2573    LDKSpendableOutputDescriptor_Tag tag;
2574    union {
2575       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2576       struct {
2577          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2578       };
2579       struct {
2580          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2581       };
2582    };
2583 } LDKSpendableOutputDescriptor;
2584
2585 /**
2586  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2587  * This corresponds to std::vector in C++
2588  */
2589 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2590    /**
2591     * The elements in the array.
2592     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2593     */
2594    struct LDKSpendableOutputDescriptor *data;
2595    /**
2596     * The number of elements pointed to by `data`.
2597     */
2598    uintptr_t datalen;
2599 } LDKCVec_SpendableOutputDescriptorZ;
2600
2601 /**
2602  * Some information provided on receipt of payment depends on whether the payment received is a
2603  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2604  */
2605 typedef enum LDKPaymentPurpose_Tag {
2606    /**
2607     * Information for receiving a payment that we generated an invoice for.
2608     */
2609    LDKPaymentPurpose_InvoicePayment,
2610    /**
2611     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2612     * (the payee) providing a preimage.
2613     */
2614    LDKPaymentPurpose_SpontaneousPayment,
2615    /**
2616     * Must be last for serialization purposes
2617     */
2618    LDKPaymentPurpose_Sentinel,
2619 } LDKPaymentPurpose_Tag;
2620
2621 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2622    /**
2623     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2624     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2625     * [`ChannelManager::claim_funds`].
2626     *
2627     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2628     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2629     *
2630     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2631     */
2632    struct LDKThirtyTwoBytes payment_preimage;
2633    /**
2634     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2635     * number of deanonymization attacks during the routing process.
2636     * It is provided here for your reference, however its accuracy is enforced directly by
2637     * [`ChannelManager`] using the values you previously provided to
2638     * [`ChannelManager::create_inbound_payment`] or
2639     * [`ChannelManager::create_inbound_payment_for_hash`].
2640     *
2641     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2642     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2643     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2644     */
2645    struct LDKThirtyTwoBytes payment_secret;
2646 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2647
2648 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2649    LDKPaymentPurpose_Tag tag;
2650    union {
2651       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2652       struct {
2653          struct LDKThirtyTwoBytes spontaneous_payment;
2654       };
2655    };
2656 } LDKPaymentPurpose;
2657
2658 /**
2659  * An Event which you should probably take some action in response to.
2660  *
2661  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2662  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2663  * written as it makes no sense to respond to it after reconnecting to peers).
2664  */
2665 typedef enum LDKEvent_Tag {
2666    /**
2667     * Used to indicate that the client should generate a funding transaction with the given
2668     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2669     * Generated in [`ChannelManager`] message handling.
2670     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2671     * counterparty can steal your funds!
2672     *
2673     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2674     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2675     */
2676    LDKEvent_FundingGenerationReady,
2677    /**
2678     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2679     * [`ChannelManager::claim_funds`] to get it....
2680     * Note that if the preimage is not known, you should call
2681     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2682     * network congestion.
2683     * If you fail to call either [`ChannelManager::claim_funds`] or
2684     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2685     * automatically failed.
2686     *
2687     * # Note
2688     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2689     * `PaymentReceived` events may be generated for the same payment.
2690     *
2691     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2692     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2693     */
2694    LDKEvent_PaymentReceived,
2695    /**
2696     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2697     * and we got back the payment preimage for it).
2698     *
2699     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2700     * event. In this situation, you SHOULD treat this payment as having succeeded.
2701     */
2702    LDKEvent_PaymentSent,
2703    /**
2704     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2705     * something. You may wish to retry with a different route.
2706     *
2707     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2708     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2709     *
2710     * [`all_paths_failed`]: Self::all_paths_failed
2711     */
2712    LDKEvent_PaymentPathFailed,
2713    /**
2714     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2715     * provide failure information for each MPP part in the payment.
2716     *
2717     * This event is provided once there are no further pending HTLCs for the payment and the
2718     * payment is no longer retryable, either due to a several-block timeout or because
2719     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2720     *
2721     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2722     */
2723    LDKEvent_PaymentFailed,
2724    /**
2725     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2726     * a time in the future.
2727     *
2728     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2729     */
2730    LDKEvent_PendingHTLCsForwardable,
2731    /**
2732     * Used to indicate that an output which you should know how to spend was confirmed on chain
2733     * and is now spendable.
2734     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2735     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2736     * somewhere and spend them when you create on-chain transactions.
2737     */
2738    LDKEvent_SpendableOutputs,
2739    /**
2740     * This event is generated when a payment has been successfully forwarded through us and a
2741     * forwarding fee earned.
2742     */
2743    LDKEvent_PaymentForwarded,
2744    /**
2745     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2746     */
2747    LDKEvent_ChannelClosed,
2748    /**
2749     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2750     * inputs for another purpose.
2751     */
2752    LDKEvent_DiscardFunding,
2753    /**
2754     * Indicates that a path for an outbound payment was successful.
2755     *
2756     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2757     * [`Event::PaymentSent`] for obtaining the payment preimage.
2758     */
2759    LDKEvent_PaymentPathSuccessful,
2760    /**
2761     * Must be last for serialization purposes
2762     */
2763    LDKEvent_Sentinel,
2764 } LDKEvent_Tag;
2765
2766 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2767    /**
2768     * The random channel_id we picked which you'll need to pass into
2769     * ChannelManager::funding_transaction_generated.
2770     */
2771    struct LDKThirtyTwoBytes temporary_channel_id;
2772    /**
2773     * The value, in satoshis, that the output should have.
2774     */
2775    uint64_t channel_value_satoshis;
2776    /**
2777     * The script which should be used in the transaction output.
2778     */
2779    struct LDKCVec_u8Z output_script;
2780    /**
2781     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2782     * an inbound channel.
2783     *
2784     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2785     */
2786    uint64_t user_channel_id;
2787 } LDKEvent_LDKFundingGenerationReady_Body;
2788
2789 typedef struct LDKEvent_LDKPaymentReceived_Body {
2790    /**
2791     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2792     * not stop you from registering duplicate payment hashes for inbound payments.
2793     */
2794    struct LDKThirtyTwoBytes payment_hash;
2795    /**
2796     * The value, in thousandths of a satoshi, that this payment is for.
2797     */
2798    uint64_t amt;
2799    /**
2800     * Information for claiming this received payment, based on whether the purpose of the
2801     * payment is to pay an invoice or to send a spontaneous payment.
2802     */
2803    struct LDKPaymentPurpose purpose;
2804 } LDKEvent_LDKPaymentReceived_Body;
2805
2806 typedef struct LDKEvent_LDKPaymentSent_Body {
2807    /**
2808     * The id returned by [`ChannelManager::send_payment`] and used with
2809     * [`ChannelManager::retry_payment`].
2810     *
2811     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2812     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2813     *
2814     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2815     */
2816    struct LDKThirtyTwoBytes payment_id;
2817    /**
2818     * The preimage to the hash given to ChannelManager::send_payment.
2819     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2820     * store it somehow!
2821     */
2822    struct LDKThirtyTwoBytes payment_preimage;
2823    /**
2824     * The hash that was given to [`ChannelManager::send_payment`].
2825     *
2826     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2827     */
2828    struct LDKThirtyTwoBytes payment_hash;
2829    /**
2830     * The total fee which was spent at intermediate hops in this payment, across all paths.
2831     *
2832     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2833     * overpayment to the recipient node.
2834     *
2835     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2836     * overstate the amount paid, though this is unlikely.
2837     *
2838     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2839     */
2840    struct LDKCOption_u64Z fee_paid_msat;
2841 } LDKEvent_LDKPaymentSent_Body;
2842
2843 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2844    /**
2845     * The id returned by [`ChannelManager::send_payment`] and used with
2846     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2847     *
2848     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2849     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2850     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2851     *
2852     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2853     */
2854    struct LDKThirtyTwoBytes payment_id;
2855    /**
2856     * The hash that was given to [`ChannelManager::send_payment`].
2857     *
2858     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2859     */
2860    struct LDKThirtyTwoBytes payment_hash;
2861    /**
2862     * Indicates the payment was rejected for some reason by the recipient. This implies that
2863     * the payment has failed, not just the route in question. If this is not set, you may
2864     * retry the payment via a different route.
2865     */
2866    bool rejected_by_dest;
2867    /**
2868     * Any failure information conveyed via the Onion return packet by a node along the failed
2869     * payment route.
2870     *
2871     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2872     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
2873     *
2874     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
2875     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
2876     */
2877    struct LDKCOption_NetworkUpdateZ network_update;
2878    /**
2879     * For both single-path and multi-path payments, this is set if all paths of the payment have
2880     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
2881     * larger MPP payment were still in flight when this event was generated.
2882     *
2883     * Note that if you are retrying individual MPP parts, using this value to determine if a
2884     * payment has fully failed is race-y. Because multiple failures can happen prior to events
2885     * being processed, you may retry in response to a first failure, with a second failure
2886     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
2887     * you will see `all_paths_failed` set even though the retry of the first failure still
2888     * has an associated in-flight HTLC. See (1) for an example of such a failure.
2889     *
2890     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
2891     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
2892     *
2893     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
2894     *
2895     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2896     */
2897    bool all_paths_failed;
2898    /**
2899     * The payment path that failed.
2900     */
2901    struct LDKCVec_RouteHopZ path;
2902    /**
2903     * The channel responsible for the failed payment path.
2904     *
2905     * If this is `Some`, then the corresponding channel should be avoided when the payment is
2906     * retried. May be `None` for older [`Event`] serializations.
2907     */
2908    struct LDKCOption_u64Z short_channel_id;
2909    /**
2910     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
2911     *
2912     * See [`find_route`] for details.
2913     *
2914     * [`Route`]: crate::routing::router::Route
2915     * [`find_route`]: crate::routing::router::find_route
2916     *
2917     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2918     */
2919    struct LDKRouteParameters retry;
2920 } LDKEvent_LDKPaymentPathFailed_Body;
2921
2922 typedef struct LDKEvent_LDKPaymentFailed_Body {
2923    /**
2924     * The id returned by [`ChannelManager::send_payment`] and used with
2925     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2926     *
2927     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2928     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2929     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2930     */
2931    struct LDKThirtyTwoBytes payment_id;
2932    /**
2933     * The hash that was given to [`ChannelManager::send_payment`].
2934     *
2935     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2936     */
2937    struct LDKThirtyTwoBytes payment_hash;
2938 } LDKEvent_LDKPaymentFailed_Body;
2939
2940 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2941    /**
2942     * The minimum amount of time that should be waited prior to calling
2943     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2944     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2945     * now + 5*time_forwardable).
2946     */
2947    uint64_t time_forwardable;
2948 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2949
2950 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2951    /**
2952     * The outputs which you should store as spendable by you.
2953     */
2954    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2955 } LDKEvent_LDKSpendableOutputs_Body;
2956
2957 typedef struct LDKEvent_LDKPaymentForwarded_Body {
2958    /**
2959     * The fee, in milli-satoshis, which was earned as a result of the payment.
2960     *
2961     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
2962     * was pending, the amount the next hop claimed will have been rounded down to the nearest
2963     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
2964     * claimed the full value in millisatoshis from the source. In this case,
2965     * `claim_from_onchain_tx` will be set.
2966     *
2967     * If the channel which sent us the payment has been force-closed, we will claim the funds
2968     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
2969     * fees which we will spend and will instead set this to `None`. It is possible duplicate
2970     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
2971     * `None`.
2972     */
2973    struct LDKCOption_u64Z fee_earned_msat;
2974    /**
2975     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
2976     * transaction.
2977     */
2978    bool claim_from_onchain_tx;
2979 } LDKEvent_LDKPaymentForwarded_Body;
2980
2981 typedef struct LDKEvent_LDKChannelClosed_Body {
2982    /**
2983     * The channel_id of the channel which has been closed. Note that on-chain transactions
2984     * resolving the channel are likely still awaiting confirmation.
2985     */
2986    struct LDKThirtyTwoBytes channel_id;
2987    /**
2988     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2989     * an inbound channel. This will always be zero for objects serialized with LDK versions
2990     * prior to 0.0.102.
2991     *
2992     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2993     */
2994    uint64_t user_channel_id;
2995    /**
2996     * The reason the channel was closed.
2997     */
2998    struct LDKClosureReason reason;
2999 } LDKEvent_LDKChannelClosed_Body;
3000
3001 typedef struct LDKEvent_LDKDiscardFunding_Body {
3002    /**
3003     * The channel_id of the channel which has been closed.
3004     */
3005    struct LDKThirtyTwoBytes channel_id;
3006    /**
3007     * The full transaction received from the user
3008     */
3009    struct LDKTransaction transaction;
3010 } LDKEvent_LDKDiscardFunding_Body;
3011
3012 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3013    /**
3014     * The id returned by [`ChannelManager::send_payment`] and used with
3015     * [`ChannelManager::retry_payment`].
3016     *
3017     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3018     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3019     */
3020    struct LDKThirtyTwoBytes payment_id;
3021    /**
3022     * The hash that was given to [`ChannelManager::send_payment`].
3023     *
3024     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3025     *
3026     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3027     */
3028    struct LDKThirtyTwoBytes payment_hash;
3029    /**
3030     * The payment path that was successful.
3031     *
3032     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3033     */
3034    struct LDKCVec_RouteHopZ path;
3035 } LDKEvent_LDKPaymentPathSuccessful_Body;
3036
3037 typedef struct MUST_USE_STRUCT LDKEvent {
3038    LDKEvent_Tag tag;
3039    union {
3040       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3041       LDKEvent_LDKPaymentReceived_Body payment_received;
3042       LDKEvent_LDKPaymentSent_Body payment_sent;
3043       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3044       LDKEvent_LDKPaymentFailed_Body payment_failed;
3045       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3046       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3047       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3048       LDKEvent_LDKChannelClosed_Body channel_closed;
3049       LDKEvent_LDKDiscardFunding_Body discard_funding;
3050       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3051    };
3052 } LDKEvent;
3053
3054 /**
3055  * An enum which can either contain a crate::lightning::util::events::Event or not
3056  */
3057 typedef enum LDKCOption_EventZ_Tag {
3058    /**
3059     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3060     */
3061    LDKCOption_EventZ_Some,
3062    /**
3063     * When we're in this state, this COption_EventZ contains nothing
3064     */
3065    LDKCOption_EventZ_None,
3066    /**
3067     * Must be last for serialization purposes
3068     */
3069    LDKCOption_EventZ_Sentinel,
3070 } LDKCOption_EventZ_Tag;
3071
3072 typedef struct LDKCOption_EventZ {
3073    LDKCOption_EventZ_Tag tag;
3074    union {
3075       struct {
3076          struct LDKEvent some;
3077       };
3078    };
3079 } LDKCOption_EventZ;
3080
3081 /**
3082  * The contents of CResult_COption_EventZDecodeErrorZ
3083  */
3084 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
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 LDKCOption_EventZ *result;
3090    /**
3091     * A pointer to the contents in the error state.
3092     * Reading from this pointer when `result_ok` is set is undefined.
3093     */
3094    struct LDKDecodeError *err;
3095 } LDKCResult_COption_EventZDecodeErrorZPtr;
3096
3097 /**
3098  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3099  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3101  */
3102 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3103    /**
3104     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3105     * `err` or `result` depending on the state of `result_ok`.
3106     */
3107    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3108    /**
3109     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3110     */
3111    bool result_ok;
3112 } LDKCResult_COption_EventZDecodeErrorZ;
3113
3114
3115
3116 /**
3117  * An accept_channel message to be sent or received from a peer
3118  */
3119 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3120    /**
3121     * A pointer to the opaque Rust object.
3122     * Nearly everywhere, inner must be non-null, however in places where
3123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3124     */
3125    LDKnativeAcceptChannel *inner;
3126    /**
3127     * Indicates that this is the only struct which contains the same pointer.
3128     * Rust functions which take ownership of an object provided via an argument require
3129     * this to be true and invalidate the object pointed to by inner.
3130     */
3131    bool is_owned;
3132 } LDKAcceptChannel;
3133
3134
3135
3136 /**
3137  * An open_channel message to be sent or received from a peer
3138  */
3139 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3140    /**
3141     * A pointer to the opaque Rust object.
3142     * Nearly everywhere, inner must be non-null, however in places where
3143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3144     */
3145    LDKnativeOpenChannel *inner;
3146    /**
3147     * Indicates that this is the only struct which contains the same pointer.
3148     * Rust functions which take ownership of an object provided via an argument require
3149     * this to be true and invalidate the object pointed to by inner.
3150     */
3151    bool is_owned;
3152 } LDKOpenChannel;
3153
3154
3155
3156 /**
3157  * A funding_created message to be sent or received from a peer
3158  */
3159 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3160    /**
3161     * A pointer to the opaque Rust object.
3162     * Nearly everywhere, inner must be non-null, however in places where
3163     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3164     */
3165    LDKnativeFundingCreated *inner;
3166    /**
3167     * Indicates that this is the only struct which contains the same pointer.
3168     * Rust functions which take ownership of an object provided via an argument require
3169     * this to be true and invalidate the object pointed to by inner.
3170     */
3171    bool is_owned;
3172 } LDKFundingCreated;
3173
3174
3175
3176 /**
3177  * A funding_signed message to be sent or received from a peer
3178  */
3179 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3180    /**
3181     * A pointer to the opaque Rust object.
3182     * Nearly everywhere, inner must be non-null, however in places where
3183     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3184     */
3185    LDKnativeFundingSigned *inner;
3186    /**
3187     * Indicates that this is the only struct which contains the same pointer.
3188     * Rust functions which take ownership of an object provided via an argument require
3189     * this to be true and invalidate the object pointed to by inner.
3190     */
3191    bool is_owned;
3192 } LDKFundingSigned;
3193
3194
3195
3196 /**
3197  * A funding_locked message to be sent or received from a peer
3198  */
3199 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3200    /**
3201     * A pointer to the opaque Rust object.
3202     * Nearly everywhere, inner must be non-null, however in places where
3203     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3204     */
3205    LDKnativeFundingLocked *inner;
3206    /**
3207     * Indicates that this is the only struct which contains the same pointer.
3208     * Rust functions which take ownership of an object provided via an argument require
3209     * this to be true and invalidate the object pointed to by inner.
3210     */
3211    bool is_owned;
3212 } LDKFundingLocked;
3213
3214
3215
3216 /**
3217  * An announcement_signatures message to be sent or received from a peer
3218  */
3219 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3220    /**
3221     * A pointer to the opaque Rust object.
3222     * Nearly everywhere, inner must be non-null, however in places where
3223     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3224     */
3225    LDKnativeAnnouncementSignatures *inner;
3226    /**
3227     * Indicates that this is the only struct which contains the same pointer.
3228     * Rust functions which take ownership of an object provided via an argument require
3229     * this to be true and invalidate the object pointed to by inner.
3230     */
3231    bool is_owned;
3232 } LDKAnnouncementSignatures;
3233
3234
3235
3236 /**
3237  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3238  * transaction updates if they were pending.
3239  */
3240 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3241    /**
3242     * A pointer to the opaque Rust object.
3243     * Nearly everywhere, inner must be non-null, however in places where
3244     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3245     */
3246    LDKnativeCommitmentUpdate *inner;
3247    /**
3248     * Indicates that this is the only struct which contains the same pointer.
3249     * Rust functions which take ownership of an object provided via an argument require
3250     * this to be true and invalidate the object pointed to by inner.
3251     */
3252    bool is_owned;
3253 } LDKCommitmentUpdate;
3254
3255
3256
3257 /**
3258  * A revoke_and_ack message to be sent or received from a peer
3259  */
3260 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3261    /**
3262     * A pointer to the opaque Rust object.
3263     * Nearly everywhere, inner must be non-null, however in places where
3264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3265     */
3266    LDKnativeRevokeAndACK *inner;
3267    /**
3268     * Indicates that this is the only struct which contains the same pointer.
3269     * Rust functions which take ownership of an object provided via an argument require
3270     * this to be true and invalidate the object pointed to by inner.
3271     */
3272    bool is_owned;
3273 } LDKRevokeAndACK;
3274
3275
3276
3277 /**
3278  * A closing_signed message to be sent or received from a peer
3279  */
3280 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3281    /**
3282     * A pointer to the opaque Rust object.
3283     * Nearly everywhere, inner must be non-null, however in places where
3284     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3285     */
3286    LDKnativeClosingSigned *inner;
3287    /**
3288     * Indicates that this is the only struct which contains the same pointer.
3289     * Rust functions which take ownership of an object provided via an argument require
3290     * this to be true and invalidate the object pointed to by inner.
3291     */
3292    bool is_owned;
3293 } LDKClosingSigned;
3294
3295
3296
3297 /**
3298  * A shutdown message to be sent or received from a peer
3299  */
3300 typedef struct MUST_USE_STRUCT LDKShutdown {
3301    /**
3302     * A pointer to the opaque Rust object.
3303     * Nearly everywhere, inner must be non-null, however in places where
3304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3305     */
3306    LDKnativeShutdown *inner;
3307    /**
3308     * Indicates that this is the only struct which contains the same pointer.
3309     * Rust functions which take ownership of an object provided via an argument require
3310     * this to be true and invalidate the object pointed to by inner.
3311     */
3312    bool is_owned;
3313 } LDKShutdown;
3314
3315
3316
3317 /**
3318  * A channel_reestablish message to be sent or received from a peer
3319  */
3320 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3321    /**
3322     * A pointer to the opaque Rust object.
3323     * Nearly everywhere, inner must be non-null, however in places where
3324     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3325     */
3326    LDKnativeChannelReestablish *inner;
3327    /**
3328     * Indicates that this is the only struct which contains the same pointer.
3329     * Rust functions which take ownership of an object provided via an argument require
3330     * this to be true and invalidate the object pointed to by inner.
3331     */
3332    bool is_owned;
3333 } LDKChannelReestablish;
3334
3335
3336
3337 /**
3338  * A channel_announcement message to be sent or received from a peer
3339  */
3340 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3341    /**
3342     * A pointer to the opaque Rust object.
3343     * Nearly everywhere, inner must be non-null, however in places where
3344     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3345     */
3346    LDKnativeChannelAnnouncement *inner;
3347    /**
3348     * Indicates that this is the only struct which contains the same pointer.
3349     * Rust functions which take ownership of an object provided via an argument require
3350     * this to be true and invalidate the object pointed to by inner.
3351     */
3352    bool is_owned;
3353 } LDKChannelAnnouncement;
3354
3355
3356
3357 /**
3358  * A node_announcement message to be sent or received from a peer
3359  */
3360 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3361    /**
3362     * A pointer to the opaque Rust object.
3363     * Nearly everywhere, inner must be non-null, however in places where
3364     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3365     */
3366    LDKnativeNodeAnnouncement *inner;
3367    /**
3368     * Indicates that this is the only struct which contains the same pointer.
3369     * Rust functions which take ownership of an object provided via an argument require
3370     * this to be true and invalidate the object pointed to by inner.
3371     */
3372    bool is_owned;
3373 } LDKNodeAnnouncement;
3374
3375
3376
3377 /**
3378  * An error message to be sent or received from a peer
3379  */
3380 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3381    /**
3382     * A pointer to the opaque Rust object.
3383     * Nearly everywhere, inner must be non-null, however in places where
3384     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3385     */
3386    LDKnativeErrorMessage *inner;
3387    /**
3388     * Indicates that this is the only struct which contains the same pointer.
3389     * Rust functions which take ownership of an object provided via an argument require
3390     * this to be true and invalidate the object pointed to by inner.
3391     */
3392    bool is_owned;
3393 } LDKErrorMessage;
3394
3395 /**
3396  * Used to put an error message in a LightningError
3397  */
3398 typedef enum LDKErrorAction_Tag {
3399    /**
3400     * The peer took some action which made us think they were useless. Disconnect them.
3401     */
3402    LDKErrorAction_DisconnectPeer,
3403    /**
3404     * The peer did something harmless that we weren't able to process, just log and ignore
3405     */
3406    LDKErrorAction_IgnoreError,
3407    /**
3408     * The peer did something harmless that we weren't able to meaningfully process.
3409     * If the error is logged, log it at the given level.
3410     */
3411    LDKErrorAction_IgnoreAndLog,
3412    /**
3413     * The peer provided us with a gossip message which we'd already seen. In most cases this
3414     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3415     * our own channel announcements.
3416     */
3417    LDKErrorAction_IgnoreDuplicateGossip,
3418    /**
3419     * The peer did something incorrect. Tell them.
3420     */
3421    LDKErrorAction_SendErrorMessage,
3422    /**
3423     * Must be last for serialization purposes
3424     */
3425    LDKErrorAction_Sentinel,
3426 } LDKErrorAction_Tag;
3427
3428 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3429    /**
3430     * An error message which we should make an effort to send before we disconnect.
3431     *
3432     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3433     */
3434    struct LDKErrorMessage msg;
3435 } LDKErrorAction_LDKDisconnectPeer_Body;
3436
3437 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3438    /**
3439     * The message to send.
3440     */
3441    struct LDKErrorMessage msg;
3442 } LDKErrorAction_LDKSendErrorMessage_Body;
3443
3444 typedef struct MUST_USE_STRUCT LDKErrorAction {
3445    LDKErrorAction_Tag tag;
3446    union {
3447       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3448       struct {
3449          enum LDKLevel ignore_and_log;
3450       };
3451       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3452    };
3453 } LDKErrorAction;
3454
3455
3456
3457 /**
3458  * A query_channel_range message is used to query a peer for channel
3459  * UTXOs in a range of blocks. The recipient of a query makes a best
3460  * effort to reply to the query using one or more reply_channel_range
3461  * messages.
3462  */
3463 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3464    /**
3465     * A pointer to the opaque Rust object.
3466     * Nearly everywhere, inner must be non-null, however in places where
3467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3468     */
3469    LDKnativeQueryChannelRange *inner;
3470    /**
3471     * Indicates that this is the only struct which contains the same pointer.
3472     * Rust functions which take ownership of an object provided via an argument require
3473     * this to be true and invalidate the object pointed to by inner.
3474     */
3475    bool is_owned;
3476 } LDKQueryChannelRange;
3477
3478
3479
3480 /**
3481  * A query_short_channel_ids message is used to query a peer for
3482  * routing gossip messages related to one or more short_channel_ids.
3483  * The query recipient will reply with the latest, if available,
3484  * channel_announcement, channel_update and node_announcement messages
3485  * it maintains for the requested short_channel_ids followed by a
3486  * reply_short_channel_ids_end message. The short_channel_ids sent in
3487  * this query are encoded. We only support encoding_type=0 uncompressed
3488  * serialization and do not support encoding_type=1 zlib serialization.
3489  */
3490 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3491    /**
3492     * A pointer to the opaque Rust object.
3493     * Nearly everywhere, inner must be non-null, however in places where
3494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3495     */
3496    LDKnativeQueryShortChannelIds *inner;
3497    /**
3498     * Indicates that this is the only struct which contains the same pointer.
3499     * Rust functions which take ownership of an object provided via an argument require
3500     * this to be true and invalidate the object pointed to by inner.
3501     */
3502    bool is_owned;
3503 } LDKQueryShortChannelIds;
3504
3505
3506
3507 /**
3508  * A reply_channel_range message is a reply to a query_channel_range
3509  * message. Multiple reply_channel_range messages can be sent in reply
3510  * to a single query_channel_range message. The query recipient makes a
3511  * best effort to respond based on their local network view which may
3512  * not be a perfect view of the network. The short_channel_ids in the
3513  * reply are encoded. We only support encoding_type=0 uncompressed
3514  * serialization and do not support encoding_type=1 zlib serialization.
3515  */
3516 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3517    /**
3518     * A pointer to the opaque Rust object.
3519     * Nearly everywhere, inner must be non-null, however in places where
3520     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3521     */
3522    LDKnativeReplyChannelRange *inner;
3523    /**
3524     * Indicates that this is the only struct which contains the same pointer.
3525     * Rust functions which take ownership of an object provided via an argument require
3526     * this to be true and invalidate the object pointed to by inner.
3527     */
3528    bool is_owned;
3529 } LDKReplyChannelRange;
3530
3531 /**
3532  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3533  * broadcast to most peers).
3534  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3535  */
3536 typedef enum LDKMessageSendEvent_Tag {
3537    /**
3538     * Used to indicate that we've accepted a channel open and should send the accept_channel
3539     * message provided to the given peer.
3540     */
3541    LDKMessageSendEvent_SendAcceptChannel,
3542    /**
3543     * Used to indicate that we've initiated a channel open and should send the open_channel
3544     * message provided to the given peer.
3545     */
3546    LDKMessageSendEvent_SendOpenChannel,
3547    /**
3548     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3549     */
3550    LDKMessageSendEvent_SendFundingCreated,
3551    /**
3552     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3553     */
3554    LDKMessageSendEvent_SendFundingSigned,
3555    /**
3556     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3557     */
3558    LDKMessageSendEvent_SendFundingLocked,
3559    /**
3560     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3561     */
3562    LDKMessageSendEvent_SendAnnouncementSignatures,
3563    /**
3564     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3565     * message should be sent to the peer with the given node_id.
3566     */
3567    LDKMessageSendEvent_UpdateHTLCs,
3568    /**
3569     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3570     */
3571    LDKMessageSendEvent_SendRevokeAndACK,
3572    /**
3573     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3574     */
3575    LDKMessageSendEvent_SendClosingSigned,
3576    /**
3577     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3578     */
3579    LDKMessageSendEvent_SendShutdown,
3580    /**
3581     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3582     */
3583    LDKMessageSendEvent_SendChannelReestablish,
3584    /**
3585     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3586     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3587     *
3588     * Note that after doing so, you very likely (unless you did so very recently) want to call
3589     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3590     * This ensures that any nodes which see our channel_announcement also have a relevant
3591     * node_announcement, including relevant feature flags which may be important for routing
3592     * through or to us.
3593     */
3594    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3595    /**
3596     * Used to indicate that a node_announcement should be broadcast to all peers.
3597     */
3598    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3599    /**
3600     * Used to indicate that a channel_update should be broadcast to all peers.
3601     */
3602    LDKMessageSendEvent_BroadcastChannelUpdate,
3603    /**
3604     * Used to indicate that a channel_update should be sent to a single peer.
3605     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3606     * private channel and we shouldn't be informing all of our peers of channel parameters.
3607     */
3608    LDKMessageSendEvent_SendChannelUpdate,
3609    /**
3610     * Broadcast an error downstream to be handled
3611     */
3612    LDKMessageSendEvent_HandleError,
3613    /**
3614     * Query a peer for channels with funding transaction UTXOs in a block range.
3615     */
3616    LDKMessageSendEvent_SendChannelRangeQuery,
3617    /**
3618     * Request routing gossip messages from a peer for a list of channels identified by
3619     * their short_channel_ids.
3620     */
3621    LDKMessageSendEvent_SendShortIdsQuery,
3622    /**
3623     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3624     * emitted during processing of the query.
3625     */
3626    LDKMessageSendEvent_SendReplyChannelRange,
3627    /**
3628     * Must be last for serialization purposes
3629     */
3630    LDKMessageSendEvent_Sentinel,
3631 } LDKMessageSendEvent_Tag;
3632
3633 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3634    /**
3635     * The node_id of the node which should receive this message
3636     */
3637    struct LDKPublicKey node_id;
3638    /**
3639     * The message which should be sent.
3640     */
3641    struct LDKAcceptChannel msg;
3642 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3643
3644 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3645    /**
3646     * The node_id of the node which should receive this message
3647     */
3648    struct LDKPublicKey node_id;
3649    /**
3650     * The message which should be sent.
3651     */
3652    struct LDKOpenChannel msg;
3653 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3654
3655 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3656    /**
3657     * The node_id of the node which should receive this message
3658     */
3659    struct LDKPublicKey node_id;
3660    /**
3661     * The message which should be sent.
3662     */
3663    struct LDKFundingCreated msg;
3664 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3665
3666 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3667    /**
3668     * The node_id of the node which should receive this message
3669     */
3670    struct LDKPublicKey node_id;
3671    /**
3672     * The message which should be sent.
3673     */
3674    struct LDKFundingSigned msg;
3675 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3676
3677 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3678    /**
3679     * The node_id of the node which should receive these message(s)
3680     */
3681    struct LDKPublicKey node_id;
3682    /**
3683     * The funding_locked message which should be sent.
3684     */
3685    struct LDKFundingLocked msg;
3686 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3687
3688 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3689    /**
3690     * The node_id of the node which should receive these message(s)
3691     */
3692    struct LDKPublicKey node_id;
3693    /**
3694     * The announcement_signatures message which should be sent.
3695     */
3696    struct LDKAnnouncementSignatures msg;
3697 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3698
3699 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3700    /**
3701     * The node_id of the node which should receive these message(s)
3702     */
3703    struct LDKPublicKey node_id;
3704    /**
3705     * The update messages which should be sent. ALL messages in the struct should be sent!
3706     */
3707    struct LDKCommitmentUpdate updates;
3708 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3709
3710 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3711    /**
3712     * The node_id of the node which should receive this message
3713     */
3714    struct LDKPublicKey node_id;
3715    /**
3716     * The message which should be sent.
3717     */
3718    struct LDKRevokeAndACK msg;
3719 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3720
3721 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3722    /**
3723     * The node_id of the node which should receive this message
3724     */
3725    struct LDKPublicKey node_id;
3726    /**
3727     * The message which should be sent.
3728     */
3729    struct LDKClosingSigned msg;
3730 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3731
3732 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3733    /**
3734     * The node_id of the node which should receive this message
3735     */
3736    struct LDKPublicKey node_id;
3737    /**
3738     * The message which should be sent.
3739     */
3740    struct LDKShutdown msg;
3741 } LDKMessageSendEvent_LDKSendShutdown_Body;
3742
3743 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3744    /**
3745     * The node_id of the node which should receive this message
3746     */
3747    struct LDKPublicKey node_id;
3748    /**
3749     * The message which should be sent.
3750     */
3751    struct LDKChannelReestablish msg;
3752 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3753
3754 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3755    /**
3756     * The channel_announcement which should be sent.
3757     */
3758    struct LDKChannelAnnouncement msg;
3759    /**
3760     * The followup channel_update which should be sent.
3761     */
3762    struct LDKChannelUpdate update_msg;
3763 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3764
3765 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3766    /**
3767     * The node_announcement which should be sent.
3768     */
3769    struct LDKNodeAnnouncement msg;
3770 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3771
3772 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3773    /**
3774     * The channel_update which should be sent.
3775     */
3776    struct LDKChannelUpdate msg;
3777 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3778
3779 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3780    /**
3781     * The node_id of the node which should receive this message
3782     */
3783    struct LDKPublicKey node_id;
3784    /**
3785     * The channel_update which should be sent.
3786     */
3787    struct LDKChannelUpdate msg;
3788 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3789
3790 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3791    /**
3792     * The node_id of the node which should receive this message
3793     */
3794    struct LDKPublicKey node_id;
3795    /**
3796     * The action which should be taken.
3797     */
3798    struct LDKErrorAction action;
3799 } LDKMessageSendEvent_LDKHandleError_Body;
3800
3801 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3802    /**
3803     * The node_id of this message recipient
3804     */
3805    struct LDKPublicKey node_id;
3806    /**
3807     * The query_channel_range which should be sent.
3808     */
3809    struct LDKQueryChannelRange msg;
3810 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3811
3812 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3813    /**
3814     * The node_id of this message recipient
3815     */
3816    struct LDKPublicKey node_id;
3817    /**
3818     * The query_short_channel_ids which should be sent.
3819     */
3820    struct LDKQueryShortChannelIds msg;
3821 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3822
3823 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3824    /**
3825     * The node_id of this message recipient
3826     */
3827    struct LDKPublicKey node_id;
3828    /**
3829     * The reply_channel_range which should be sent.
3830     */
3831    struct LDKReplyChannelRange msg;
3832 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3833
3834 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3835    LDKMessageSendEvent_Tag tag;
3836    union {
3837       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3838       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3839       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3840       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3841       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3842       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3843       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3844       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3845       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3846       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3847       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3848       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3849       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3850       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3851       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
3852       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3853       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3854       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3855       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3856    };
3857 } LDKMessageSendEvent;
3858
3859 /**
3860  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3861  * This corresponds to std::vector in C++
3862  */
3863 typedef struct LDKCVec_MessageSendEventZ {
3864    /**
3865     * The elements in the array.
3866     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3867     */
3868    struct LDKMessageSendEvent *data;
3869    /**
3870     * The number of elements pointed to by `data`.
3871     */
3872    uintptr_t datalen;
3873 } LDKCVec_MessageSendEventZ;
3874
3875
3876
3877 /**
3878  * Parameters for configuring [`Scorer`].
3879  */
3880 typedef struct MUST_USE_STRUCT LDKScoringParameters {
3881    /**
3882     * A pointer to the opaque Rust object.
3883     * Nearly everywhere, inner must be non-null, however in places where
3884     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3885     */
3886    LDKnativeScoringParameters *inner;
3887    /**
3888     * Indicates that this is the only struct which contains the same pointer.
3889     * Rust functions which take ownership of an object provided via an argument require
3890     * this to be true and invalidate the object pointed to by inner.
3891     */
3892    bool is_owned;
3893 } LDKScoringParameters;
3894
3895 /**
3896  * The contents of CResult_ScoringParametersDecodeErrorZ
3897  */
3898 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
3899    /**
3900     * A pointer to the contents in the success state.
3901     * Reading from this pointer when `result_ok` is not set is undefined.
3902     */
3903    struct LDKScoringParameters *result;
3904    /**
3905     * A pointer to the contents in the error state.
3906     * Reading from this pointer when `result_ok` is set is undefined.
3907     */
3908    struct LDKDecodeError *err;
3909 } LDKCResult_ScoringParametersDecodeErrorZPtr;
3910
3911 /**
3912  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3913  * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3915  */
3916 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
3917    /**
3918     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3919     * `err` or `result` depending on the state of `result_ok`.
3920     */
3921    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
3922    /**
3923     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3924     */
3925    bool result_ok;
3926 } LDKCResult_ScoringParametersDecodeErrorZ;
3927
3928
3929
3930 /**
3931  * [`Score`] implementation that provides reasonable default behavior.
3932  *
3933  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
3934  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
3935  *
3936  * See [module-level documentation] for usage.
3937  *
3938  * [module-level documentation]: crate::routing::scoring
3939  */
3940 typedef struct MUST_USE_STRUCT LDKScorer {
3941    /**
3942     * A pointer to the opaque Rust object.
3943     * Nearly everywhere, inner must be non-null, however in places where
3944     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3945     */
3946    LDKnativeScorer *inner;
3947    /**
3948     * Indicates that this is the only struct which contains the same pointer.
3949     * Rust functions which take ownership of an object provided via an argument require
3950     * this to be true and invalidate the object pointed to by inner.
3951     */
3952    bool is_owned;
3953 } LDKScorer;
3954
3955 /**
3956  * The contents of CResult_ScorerDecodeErrorZ
3957  */
3958 typedef union LDKCResult_ScorerDecodeErrorZPtr {
3959    /**
3960     * A pointer to the contents in the success state.
3961     * Reading from this pointer when `result_ok` is not set is undefined.
3962     */
3963    struct LDKScorer *result;
3964    /**
3965     * A pointer to the contents in the error state.
3966     * Reading from this pointer when `result_ok` is set is undefined.
3967     */
3968    struct LDKDecodeError *err;
3969 } LDKCResult_ScorerDecodeErrorZPtr;
3970
3971 /**
3972  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3973  * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3974  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3975  */
3976 typedef struct LDKCResult_ScorerDecodeErrorZ {
3977    /**
3978     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3979     * `err` or `result` depending on the state of `result_ok`.
3980     */
3981    union LDKCResult_ScorerDecodeErrorZPtr contents;
3982    /**
3983     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
3984     */
3985    bool result_ok;
3986 } LDKCResult_ScorerDecodeErrorZ;
3987
3988
3989
3990 /**
3991  * Features used within an `init` message.
3992  */
3993 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3994    /**
3995     * A pointer to the opaque Rust object.
3996     * Nearly everywhere, inner must be non-null, however in places where
3997     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3998     */
3999    LDKnativeInitFeatures *inner;
4000    /**
4001     * Indicates that this is the only struct which contains the same pointer.
4002     * Rust functions which take ownership of an object provided via an argument require
4003     * this to be true and invalidate the object pointed to by inner.
4004     */
4005    bool is_owned;
4006 } LDKInitFeatures;
4007
4008 /**
4009  * The contents of CResult_InitFeaturesDecodeErrorZ
4010  */
4011 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4012    /**
4013     * A pointer to the contents in the success state.
4014     * Reading from this pointer when `result_ok` is not set is undefined.
4015     */
4016    struct LDKInitFeatures *result;
4017    /**
4018     * A pointer to the contents in the error state.
4019     * Reading from this pointer when `result_ok` is set is undefined.
4020     */
4021    struct LDKDecodeError *err;
4022 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4023
4024 /**
4025  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4026  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4027  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4028  */
4029 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4030    /**
4031     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4032     * `err` or `result` depending on the state of `result_ok`.
4033     */
4034    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4035    /**
4036     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4037     */
4038    bool result_ok;
4039 } LDKCResult_InitFeaturesDecodeErrorZ;
4040
4041
4042
4043 /**
4044  * Features used within a `channel_announcement` message.
4045  */
4046 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4047    /**
4048     * A pointer to the opaque Rust object.
4049     * Nearly everywhere, inner must be non-null, however in places where
4050     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4051     */
4052    LDKnativeChannelFeatures *inner;
4053    /**
4054     * Indicates that this is the only struct which contains the same pointer.
4055     * Rust functions which take ownership of an object provided via an argument require
4056     * this to be true and invalidate the object pointed to by inner.
4057     */
4058    bool is_owned;
4059 } LDKChannelFeatures;
4060
4061 /**
4062  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4063  */
4064 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4065    /**
4066     * A pointer to the contents in the success state.
4067     * Reading from this pointer when `result_ok` is not set is undefined.
4068     */
4069    struct LDKChannelFeatures *result;
4070    /**
4071     * A pointer to the contents in the error state.
4072     * Reading from this pointer when `result_ok` is set is undefined.
4073     */
4074    struct LDKDecodeError *err;
4075 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4076
4077 /**
4078  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4079  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4080  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4081  */
4082 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4083    /**
4084     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4085     * `err` or `result` depending on the state of `result_ok`.
4086     */
4087    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4088    /**
4089     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4090     */
4091    bool result_ok;
4092 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4093
4094
4095
4096 /**
4097  * Features used within a `node_announcement` message.
4098  */
4099 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4100    /**
4101     * A pointer to the opaque Rust object.
4102     * Nearly everywhere, inner must be non-null, however in places where
4103     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4104     */
4105    LDKnativeNodeFeatures *inner;
4106    /**
4107     * Indicates that this is the only struct which contains the same pointer.
4108     * Rust functions which take ownership of an object provided via an argument require
4109     * this to be true and invalidate the object pointed to by inner.
4110     */
4111    bool is_owned;
4112 } LDKNodeFeatures;
4113
4114 /**
4115  * The contents of CResult_NodeFeaturesDecodeErrorZ
4116  */
4117 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4118    /**
4119     * A pointer to the contents in the success state.
4120     * Reading from this pointer when `result_ok` is not set is undefined.
4121     */
4122    struct LDKNodeFeatures *result;
4123    /**
4124     * A pointer to the contents in the error state.
4125     * Reading from this pointer when `result_ok` is set is undefined.
4126     */
4127    struct LDKDecodeError *err;
4128 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4129
4130 /**
4131  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4132  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4133  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4134  */
4135 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4136    /**
4137     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4138     * `err` or `result` depending on the state of `result_ok`.
4139     */
4140    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4141    /**
4142     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4143     */
4144    bool result_ok;
4145 } LDKCResult_NodeFeaturesDecodeErrorZ;
4146
4147
4148
4149 /**
4150  * Features used within an invoice.
4151  */
4152 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4153    /**
4154     * A pointer to the opaque Rust object.
4155     * Nearly everywhere, inner must be non-null, however in places where
4156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4157     */
4158    LDKnativeInvoiceFeatures *inner;
4159    /**
4160     * Indicates that this is the only struct which contains the same pointer.
4161     * Rust functions which take ownership of an object provided via an argument require
4162     * this to be true and invalidate the object pointed to by inner.
4163     */
4164    bool is_owned;
4165 } LDKInvoiceFeatures;
4166
4167 /**
4168  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4169  */
4170 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4171    /**
4172     * A pointer to the contents in the success state.
4173     * Reading from this pointer when `result_ok` is not set is undefined.
4174     */
4175    struct LDKInvoiceFeatures *result;
4176    /**
4177     * A pointer to the contents in the error state.
4178     * Reading from this pointer when `result_ok` is set is undefined.
4179     */
4180    struct LDKDecodeError *err;
4181 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4182
4183 /**
4184  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4185  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4187  */
4188 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4189    /**
4190     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4191     * `err` or `result` depending on the state of `result_ok`.
4192     */
4193    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4194    /**
4195     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4196     */
4197    bool result_ok;
4198 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4199
4200
4201
4202 /**
4203  * Features used within the channel_type field in an OpenChannel message.
4204  *
4205  * A channel is always of some known \"type\", describing the transaction formats used and the exact
4206  * semantics of our interaction with our peer.
4207  *
4208  * Note that because a channel is a specific type which is proposed by the opener and accepted by
4209  * the counterparty, only required features are allowed here.
4210  *
4211  * This is serialized differently from other feature types - it is not prefixed by a length, and
4212  * thus must only appear inside a TLV where its length is known in advance.
4213  */
4214 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
4215    /**
4216     * A pointer to the opaque Rust object.
4217     * Nearly everywhere, inner must be non-null, however in places where
4218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4219     */
4220    LDKnativeChannelTypeFeatures *inner;
4221    /**
4222     * Indicates that this is the only struct which contains the same pointer.
4223     * Rust functions which take ownership of an object provided via an argument require
4224     * this to be true and invalidate the object pointed to by inner.
4225     */
4226    bool is_owned;
4227 } LDKChannelTypeFeatures;
4228
4229 /**
4230  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4231  */
4232 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4233    /**
4234     * A pointer to the contents in the success state.
4235     * Reading from this pointer when `result_ok` is not set is undefined.
4236     */
4237    struct LDKChannelTypeFeatures *result;
4238    /**
4239     * A pointer to the contents in the error state.
4240     * Reading from this pointer when `result_ok` is set is undefined.
4241     */
4242    struct LDKDecodeError *err;
4243 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4244
4245 /**
4246  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4247  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4248  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4249  */
4250 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4251    /**
4252     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4253     * `err` or `result` depending on the state of `result_ok`.
4254     */
4255    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4256    /**
4257     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4258     */
4259    bool result_ok;
4260 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4261
4262 /**
4263  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4264  */
4265 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4266    /**
4267     * A pointer to the contents in the success state.
4268     * Reading from this pointer when `result_ok` is not set is undefined.
4269     */
4270    struct LDKDelayedPaymentOutputDescriptor *result;
4271    /**
4272     * A pointer to the contents in the error state.
4273     * Reading from this pointer when `result_ok` is set is undefined.
4274     */
4275    struct LDKDecodeError *err;
4276 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4277
4278 /**
4279  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4280  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4281  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282  */
4283 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4284    /**
4285     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4286     * `err` or `result` depending on the state of `result_ok`.
4287     */
4288    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4289    /**
4290     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4291     */
4292    bool result_ok;
4293 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4294
4295 /**
4296  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4297  */
4298 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4299    /**
4300     * A pointer to the contents in the success state.
4301     * Reading from this pointer when `result_ok` is not set is undefined.
4302     */
4303    struct LDKStaticPaymentOutputDescriptor *result;
4304    /**
4305     * A pointer to the contents in the error state.
4306     * Reading from this pointer when `result_ok` is set is undefined.
4307     */
4308    struct LDKDecodeError *err;
4309 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4310
4311 /**
4312  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4313  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4314  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4315  */
4316 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4317    /**
4318     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4319     * `err` or `result` depending on the state of `result_ok`.
4320     */
4321    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4322    /**
4323     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4324     */
4325    bool result_ok;
4326 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4327
4328 /**
4329  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4330  */
4331 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4332    /**
4333     * A pointer to the contents in the success state.
4334     * Reading from this pointer when `result_ok` is not set is undefined.
4335     */
4336    struct LDKSpendableOutputDescriptor *result;
4337    /**
4338     * A pointer to the contents in the error state.
4339     * Reading from this pointer when `result_ok` is set is undefined.
4340     */
4341    struct LDKDecodeError *err;
4342 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4343
4344 /**
4345  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4346  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4347  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4348  */
4349 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4350    /**
4351     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4352     * `err` or `result` depending on the state of `result_ok`.
4353     */
4354    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4355    /**
4356     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4357     */
4358    bool result_ok;
4359 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4360
4361 /**
4362  * The contents of CResult_NoneNoneZ
4363  */
4364 typedef union LDKCResult_NoneNoneZPtr {
4365    /**
4366     * Note that this value is always NULL, as there are no contents in the OK variant
4367     */
4368    void *result;
4369    /**
4370     * Note that this value is always NULL, as there are no contents in the Err variant
4371     */
4372    void *err;
4373 } LDKCResult_NoneNoneZPtr;
4374
4375 /**
4376  * A CResult_NoneNoneZ represents the result of a fallible operation,
4377  * containing a () on success and a () on failure.
4378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4379  */
4380 typedef struct LDKCResult_NoneNoneZ {
4381    /**
4382     * The contents of this CResult_NoneNoneZ, accessible via either
4383     * `err` or `result` depending on the state of `result_ok`.
4384     */
4385    union LDKCResult_NoneNoneZPtr contents;
4386    /**
4387     * Whether this CResult_NoneNoneZ represents a success state.
4388     */
4389    bool result_ok;
4390 } LDKCResult_NoneNoneZ;
4391
4392 /**
4393  * A tuple of 2 elements. See the individual fields for the types contained.
4394  */
4395 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4396    /**
4397     * The element at position 0
4398     */
4399    struct LDKSignature a;
4400    /**
4401     * The element at position 1
4402     */
4403    struct LDKCVec_SignatureZ b;
4404 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4405
4406 /**
4407  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4408  */
4409 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4410    /**
4411     * A pointer to the contents in the success state.
4412     * Reading from this pointer when `result_ok` is not set is undefined.
4413     */
4414    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4415    /**
4416     * Note that this value is always NULL, as there are no contents in the Err variant
4417     */
4418    void *err;
4419 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4420
4421 /**
4422  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4423  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4424  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4425  */
4426 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4427    /**
4428     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4429     * `err` or `result` depending on the state of `result_ok`.
4430     */
4431    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4432    /**
4433     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4434     */
4435    bool result_ok;
4436 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4437
4438 /**
4439  * The contents of CResult_SignatureNoneZ
4440  */
4441 typedef union LDKCResult_SignatureNoneZPtr {
4442    /**
4443     * A pointer to the contents in the success state.
4444     * Reading from this pointer when `result_ok` is not set is undefined.
4445     */
4446    struct LDKSignature *result;
4447    /**
4448     * Note that this value is always NULL, as there are no contents in the Err variant
4449     */
4450    void *err;
4451 } LDKCResult_SignatureNoneZPtr;
4452
4453 /**
4454  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4455  * containing a crate::c_types::Signature on success and a () on failure.
4456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4457  */
4458 typedef struct LDKCResult_SignatureNoneZ {
4459    /**
4460     * The contents of this CResult_SignatureNoneZ, accessible via either
4461     * `err` or `result` depending on the state of `result_ok`.
4462     */
4463    union LDKCResult_SignatureNoneZPtr contents;
4464    /**
4465     * Whether this CResult_SignatureNoneZ represents a success state.
4466     */
4467    bool result_ok;
4468 } LDKCResult_SignatureNoneZ;
4469
4470
4471
4472 /**
4473  * This class tracks the per-transaction information needed to build a closing transaction and will
4474  * actually build it and sign.
4475  *
4476  * This class can be used inside a signer implementation to generate a signature given the relevant
4477  * secret key.
4478  */
4479 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4480    /**
4481     * A pointer to the opaque Rust object.
4482     * Nearly everywhere, inner must be non-null, however in places where
4483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4484     */
4485    LDKnativeClosingTransaction *inner;
4486    /**
4487     * Indicates that this is the only struct which contains the same pointer.
4488     * Rust functions which take ownership of an object provided via an argument require
4489     * this to be true and invalidate the object pointed to by inner.
4490     */
4491    bool is_owned;
4492 } LDKClosingTransaction;
4493
4494
4495
4496 /**
4497  * The unsigned part of a channel_announcement
4498  */
4499 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
4500    /**
4501     * A pointer to the opaque Rust object.
4502     * Nearly everywhere, inner must be non-null, however in places where
4503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4504     */
4505    LDKnativeUnsignedChannelAnnouncement *inner;
4506    /**
4507     * Indicates that this is the only struct which contains the same pointer.
4508     * Rust functions which take ownership of an object provided via an argument require
4509     * this to be true and invalidate the object pointed to by inner.
4510     */
4511    bool is_owned;
4512 } LDKUnsignedChannelAnnouncement;
4513
4514 /**
4515  * A trait to sign lightning channel transactions as described in BOLT 3.
4516  *
4517  * Signing services could be implemented on a hardware wallet. In this case,
4518  * the current Sign would be a front-end on top of a communication
4519  * channel connected to your secure device and lightning key material wouldn't
4520  * reside on a hot server. Nevertheless, a this deployment would still need
4521  * to trust the ChannelManager to avoid loss of funds as this latest component
4522  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
4523  *
4524  * A more secure iteration would be to use hashlock (or payment points) to pair
4525  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
4526  * at the price of more state and computation on the hardware wallet side. In the future,
4527  * we are looking forward to design such interface.
4528  *
4529  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
4530  * to act, as liveness and breach reply correctness are always going to be hard requirements
4531  * of LN security model, orthogonal of key management issues.
4532  */
4533 typedef struct LDKBaseSign {
4534    /**
4535     * An opaque pointer which is passed to your function implementations as an argument.
4536     * This has no meaning in the LDK, and can be NULL or any other value.
4537     */
4538    void *this_arg;
4539    /**
4540     * Gets the per-commitment point for a specific commitment number
4541     *
4542     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4543     */
4544    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
4545    /**
4546     * Gets the commitment secret for a specific commitment number as part of the revocation process
4547     *
4548     * An external signer implementation should error here if the commitment was already signed
4549     * and should refuse to sign it in the future.
4550     *
4551     * May be called more than once for the same index.
4552     *
4553     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4554     */
4555    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
4556    /**
4557     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
4558     *
4559     * This is required in order for the signer to make sure that releasing a commitment
4560     * secret won't leave us without a broadcastable holder transaction.
4561     * Policy checks should be implemented in this function, including checking the amount
4562     * sent to us and checking the HTLCs.
4563     */
4564    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
4565    /**
4566     * Gets the holder's channel public keys and basepoints
4567     */
4568    struct LDKChannelPublicKeys pubkeys;
4569    /**
4570     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
4571     * Note that this takes a pointer to this object, not the this_ptr like other methods do
4572     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
4573     */
4574    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
4575    /**
4576     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
4577     * some SpendableOutputDescriptor types. This should be sufficient to identify this
4578     * Sign object uniquely and lookup or re-derive its keys.
4579     */
4580    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
4581    /**
4582     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
4583     *
4584     * Note that if signing fails or is rejected, the channel will be force-closed.
4585     *
4586     * Policy checks should be implemented in this function, including checking the amount
4587     * sent to us and checking the HTLCs.
4588     */
4589    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
4590    /**
4591     * Validate the counterparty's revocation.
4592     *
4593     * This is required in order for the signer to make sure that the state has moved
4594     * forward and it is safe to sign the next counterparty commitment.
4595     */
4596    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
4597    /**
4598     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
4599     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
4600     * latest commitment_tx when we initiate a force-close.
4601     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
4602     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
4603     * the latest.
4604     * This may be called multiple times for the same transaction.
4605     *
4606     * An external signer implementation should check that the commitment has not been revoked.
4607     *
4608     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
4609     */
4610    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
4611    /**
4612     * Create a signature for the given input in a transaction spending an HTLC transaction output
4613     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
4614     *
4615     * A justice transaction may claim multiple outputs at the same time if timelocks are
4616     * similar, but only a signature for the input at index `input` should be signed for here.
4617     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
4618     * to an upcoming timelock expiration.
4619     *
4620     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4621     *
4622     * per_commitment_key is revocation secret which was provided by our counterparty when they
4623     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
4624     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
4625     * so).
4626     */
4627    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]);
4628    /**
4629     * Create a signature for the given input in a transaction spending a commitment transaction
4630     * HTLC output when our counterparty broadcasts an old state.
4631     *
4632     * A justice transaction may claim multiple outputs at the same time if timelocks are
4633     * similar, but only a signature for the input at index `input` should be signed for here.
4634     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
4635     * to an upcoming timelock expiration.
4636     *
4637     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4638     *
4639     * per_commitment_key is revocation secret which was provided by our counterparty when they
4640     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
4641     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
4642     * so).
4643     *
4644     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
4645     * (which is committed to in the BIP 143 signatures).
4646     */
4647    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);
4648    /**
4649     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
4650     * transaction, either offered or received.
4651     *
4652     * Such a transaction may claim multiples offered outputs at same time if we know the
4653     * preimage for each when we create it, but only the input at index `input` should be
4654     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
4655     * needed with regards to an upcoming timelock expiration.
4656     *
4657     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
4658     * outputs.
4659     *
4660     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4661     *
4662     * Per_commitment_point is the dynamic point corresponding to the channel state
4663     * detected onchain. It has been generated by our counterparty and is used to derive
4664     * channel state keys, which are then included in the witness script and committed to in the
4665     * BIP 143 signature.
4666     */
4667    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);
4668    /**
4669     * Create a signature for a (proposed) closing transaction.
4670     *
4671     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
4672     * chosen to forgo their output as dust.
4673     */
4674    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
4675    /**
4676     * Signs a channel announcement message with our funding key, proving it comes from one
4677     * of the channel participants.
4678     *
4679     * Note that if this fails or is rejected, the channel will not be publicly announced and
4680     * our counterparty may (though likely will not) close the channel on us for violating the
4681     * protocol.
4682     */
4683    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
4684    /**
4685     * Set the counterparty static channel data, including basepoints,
4686     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
4687     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
4688     * they MUST NOT be allowed to change to different values once set.
4689     *
4690     * channel_parameters.is_populated() MUST be true.
4691     *
4692     * We bind holder_selected_contest_delay late here for API convenience.
4693     *
4694     * Will be called before any signatures are applied.
4695     */
4696    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
4697    /**
4698     * Frees any resources associated with this object given its this_arg pointer.
4699     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4700     */
4701    void (*free)(void *this_arg);
4702 } LDKBaseSign;
4703
4704 /**
4705  * A cloneable signer.
4706  *
4707  * Although we require signers to be cloneable, it may be useful for developers to be able to use
4708  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
4709  * which implies Sized, into this derived trait.
4710  */
4711 typedef struct LDKSign {
4712    /**
4713     * An opaque pointer which is passed to your function implementations as an argument.
4714     * This has no meaning in the LDK, and can be NULL or any other value.
4715     */
4716    void *this_arg;
4717    /**
4718     * Implementation of BaseSign for this object.
4719     */
4720    struct LDKBaseSign BaseSign;
4721    /**
4722     * Serialize the object into a byte array
4723     */
4724    struct LDKCVec_u8Z (*write)(const void *this_arg);
4725    /**
4726     * Called, if set, after this Sign has been cloned into a duplicate object.
4727     * The new Sign is provided, and should be mutated as needed to perform a
4728     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
4729     */
4730    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
4731    /**
4732     * Frees any resources associated with this object given its this_arg pointer.
4733     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4734     */
4735    void (*free)(void *this_arg);
4736 } LDKSign;
4737
4738 /**
4739  * The contents of CResult_SignDecodeErrorZ
4740  */
4741 typedef union LDKCResult_SignDecodeErrorZPtr {
4742    /**
4743     * A pointer to the contents in the success state.
4744     * Reading from this pointer when `result_ok` is not set is undefined.
4745     */
4746    struct LDKSign *result;
4747    /**
4748     * A pointer to the contents in the error state.
4749     * Reading from this pointer when `result_ok` is set is undefined.
4750     */
4751    struct LDKDecodeError *err;
4752 } LDKCResult_SignDecodeErrorZPtr;
4753
4754 /**
4755  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4756  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4757  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4758  */
4759 typedef struct LDKCResult_SignDecodeErrorZ {
4760    /**
4761     * The contents of this CResult_SignDecodeErrorZ, accessible via either
4762     * `err` or `result` depending on the state of `result_ok`.
4763     */
4764    union LDKCResult_SignDecodeErrorZPtr contents;
4765    /**
4766     * Whether this CResult_SignDecodeErrorZ represents a success state.
4767     */
4768    bool result_ok;
4769 } LDKCResult_SignDecodeErrorZ;
4770
4771 /**
4772  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
4773  * allows recovering the exact public key which created the signature given the message.
4774  */
4775 typedef struct LDKRecoverableSignature {
4776    /**
4777     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
4778     * recovery.
4779     */
4780    uint8_t serialized_form[68];
4781 } LDKRecoverableSignature;
4782
4783 /**
4784  * The contents of CResult_RecoverableSignatureNoneZ
4785  */
4786 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
4787    /**
4788     * A pointer to the contents in the success state.
4789     * Reading from this pointer when `result_ok` is not set is undefined.
4790     */
4791    struct LDKRecoverableSignature *result;
4792    /**
4793     * Note that this value is always NULL, as there are no contents in the Err variant
4794     */
4795    void *err;
4796 } LDKCResult_RecoverableSignatureNoneZPtr;
4797
4798 /**
4799  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4800  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
4801  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4802  */
4803 typedef struct LDKCResult_RecoverableSignatureNoneZ {
4804    /**
4805     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4806     * `err` or `result` depending on the state of `result_ok`.
4807     */
4808    union LDKCResult_RecoverableSignatureNoneZPtr contents;
4809    /**
4810     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4811     */
4812    bool result_ok;
4813 } LDKCResult_RecoverableSignatureNoneZ;
4814
4815 /**
4816  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4817  * This corresponds to std::vector in C++
4818  */
4819 typedef struct LDKCVec_CVec_u8ZZ {
4820    /**
4821     * The elements in the array.
4822     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4823     */
4824    struct LDKCVec_u8Z *data;
4825    /**
4826     * The number of elements pointed to by `data`.
4827     */
4828    uintptr_t datalen;
4829 } LDKCVec_CVec_u8ZZ;
4830
4831 /**
4832  * The contents of CResult_CVec_CVec_u8ZZNoneZ
4833  */
4834 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
4835    /**
4836     * A pointer to the contents in the success state.
4837     * Reading from this pointer when `result_ok` is not set is undefined.
4838     */
4839    struct LDKCVec_CVec_u8ZZ *result;
4840    /**
4841     * Note that this value is always NULL, as there are no contents in the Err variant
4842     */
4843    void *err;
4844 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
4845
4846 /**
4847  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4848  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4849  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4850  */
4851 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
4852    /**
4853     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4854     * `err` or `result` depending on the state of `result_ok`.
4855     */
4856    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
4857    /**
4858     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4859     */
4860    bool result_ok;
4861 } LDKCResult_CVec_CVec_u8ZZNoneZ;
4862
4863
4864
4865 /**
4866  * A simple implementation of Sign that just keeps the private keys in memory.
4867  *
4868  * This implementation performs no policy checks and is insufficient by itself as
4869  * a secure external signer.
4870  */
4871 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
4872    /**
4873     * A pointer to the opaque Rust object.
4874     * Nearly everywhere, inner must be non-null, however in places where
4875     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4876     */
4877    LDKnativeInMemorySigner *inner;
4878    /**
4879     * Indicates that this is the only struct which contains the same pointer.
4880     * Rust functions which take ownership of an object provided via an argument require
4881     * this to be true and invalidate the object pointed to by inner.
4882     */
4883    bool is_owned;
4884 } LDKInMemorySigner;
4885
4886 /**
4887  * The contents of CResult_InMemorySignerDecodeErrorZ
4888  */
4889 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
4890    /**
4891     * A pointer to the contents in the success state.
4892     * Reading from this pointer when `result_ok` is not set is undefined.
4893     */
4894    struct LDKInMemorySigner *result;
4895    /**
4896     * A pointer to the contents in the error state.
4897     * Reading from this pointer when `result_ok` is set is undefined.
4898     */
4899    struct LDKDecodeError *err;
4900 } LDKCResult_InMemorySignerDecodeErrorZPtr;
4901
4902 /**
4903  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4904  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4906  */
4907 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
4908    /**
4909     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4910     * `err` or `result` depending on the state of `result_ok`.
4911     */
4912    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
4913    /**
4914     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4915     */
4916    bool result_ok;
4917 } LDKCResult_InMemorySignerDecodeErrorZ;
4918
4919 /**
4920  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4921  * This corresponds to std::vector in C++
4922  */
4923 typedef struct LDKCVec_TxOutZ {
4924    /**
4925     * The elements in the array.
4926     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4927     */
4928    struct LDKTxOut *data;
4929    /**
4930     * The number of elements pointed to by `data`.
4931     */
4932    uintptr_t datalen;
4933 } LDKCVec_TxOutZ;
4934
4935 /**
4936  * The contents of CResult_TransactionNoneZ
4937  */
4938 typedef union LDKCResult_TransactionNoneZPtr {
4939    /**
4940     * A pointer to the contents in the success state.
4941     * Reading from this pointer when `result_ok` is not set is undefined.
4942     */
4943    struct LDKTransaction *result;
4944    /**
4945     * Note that this value is always NULL, as there are no contents in the Err variant
4946     */
4947    void *err;
4948 } LDKCResult_TransactionNoneZPtr;
4949
4950 /**
4951  * A CResult_TransactionNoneZ represents the result of a fallible operation,
4952  * containing a crate::c_types::Transaction on success and a () on failure.
4953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4954  */
4955 typedef struct LDKCResult_TransactionNoneZ {
4956    /**
4957     * The contents of this CResult_TransactionNoneZ, accessible via either
4958     * `err` or `result` depending on the state of `result_ok`.
4959     */
4960    union LDKCResult_TransactionNoneZPtr contents;
4961    /**
4962     * Whether this CResult_TransactionNoneZ represents a success state.
4963     */
4964    bool result_ok;
4965 } LDKCResult_TransactionNoneZ;
4966
4967
4968
4969 /**
4970  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
4971  * on-chain transactions to ensure no loss of funds occurs.
4972  *
4973  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
4974  * information and are actively monitoring the chain.
4975  *
4976  * Pending Events or updated HTLCs which have not yet been read out by
4977  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
4978  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
4979  * gotten are fully handled before re-serializing the new state.
4980  *
4981  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
4982  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4983  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
4984  * returned block hash and the the current chain and then reconnecting blocks to get to the
4985  * best chain) upon deserializing the object!
4986  */
4987 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
4988    /**
4989     * A pointer to the opaque Rust object.
4990     * Nearly everywhere, inner must be non-null, however in places where
4991     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4992     */
4993    LDKnativeChannelMonitor *inner;
4994    /**
4995     * Indicates that this is the only struct which contains the same pointer.
4996     * Rust functions which take ownership of an object provided via an argument require
4997     * this to be true and invalidate the object pointed to by inner.
4998     */
4999    bool is_owned;
5000 } LDKChannelMonitor;
5001
5002 /**
5003  * A tuple of 2 elements. See the individual fields for the types contained.
5004  */
5005 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
5006    /**
5007     * The element at position 0
5008     */
5009    struct LDKThirtyTwoBytes a;
5010    /**
5011     * The element at position 1
5012     */
5013    struct LDKChannelMonitor b;
5014 } LDKC2Tuple_BlockHashChannelMonitorZ;
5015
5016 /**
5017  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5018  * This corresponds to std::vector in C++
5019  */
5020 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
5021    /**
5022     * The elements in the array.
5023     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5024     */
5025    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
5026    /**
5027     * The number of elements pointed to by `data`.
5028     */
5029    uintptr_t datalen;
5030 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
5031
5032 /**
5033  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5034  */
5035 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5036    /**
5037     * A pointer to the contents in the success state.
5038     * Reading from this pointer when `result_ok` is not set is undefined.
5039     */
5040    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
5041    /**
5042     * A pointer to the contents in the error state.
5043     * Reading from this pointer when `result_ok` is set is undefined.
5044     */
5045    enum LDKIOError *err;
5046 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
5047
5048 /**
5049  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5050  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5051  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5052  */
5053 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5054    /**
5055     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5056     * `err` or `result` depending on the state of `result_ok`.
5057     */
5058    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
5059    /**
5060     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5061     */
5062    bool result_ok;
5063 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
5064
5065 /**
5066  * An enum which can either contain a u16 or not
5067  */
5068 typedef enum LDKCOption_u16Z_Tag {
5069    /**
5070     * When we're in this state, this COption_u16Z contains a u16
5071     */
5072    LDKCOption_u16Z_Some,
5073    /**
5074     * When we're in this state, this COption_u16Z contains nothing
5075     */
5076    LDKCOption_u16Z_None,
5077    /**
5078     * Must be last for serialization purposes
5079     */
5080    LDKCOption_u16Z_Sentinel,
5081 } LDKCOption_u16Z_Tag;
5082
5083 typedef struct LDKCOption_u16Z {
5084    LDKCOption_u16Z_Tag tag;
5085    union {
5086       struct {
5087          uint16_t some;
5088       };
5089    };
5090 } LDKCOption_u16Z;
5091
5092 /**
5093  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
5094  * too-high values)
5095  */
5096 typedef enum LDKAPIError_Tag {
5097    /**
5098     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
5099     * are documented, but generally indicates some precondition of a function was violated.
5100     */
5101    LDKAPIError_APIMisuseError,
5102    /**
5103     * Due to a high feerate, we were unable to complete the request.
5104     * For example, this may be returned if the feerate implies we cannot open a channel at the
5105     * requested value, but opening a larger channel would succeed.
5106     */
5107    LDKAPIError_FeeRateTooHigh,
5108    /**
5109     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
5110     * too-many-hops, etc).
5111     */
5112    LDKAPIError_RouteError,
5113    /**
5114     * We were unable to complete the request as the Channel required to do so is unable to
5115     * complete the request (or was not found). This can take many forms, including disconnected
5116     * peer, channel at capacity, channel shutting down, etc.
5117     */
5118    LDKAPIError_ChannelUnavailable,
5119    /**
5120     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
5121     * attempted action to fail.
5122     */
5123    LDKAPIError_MonitorUpdateFailed,
5124    /**
5125     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
5126     * with the channel counterparty as negotiated in [`InitFeatures`].
5127     *
5128     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
5129     * a channel or cooperatively close one with this peer (and will have to force-close instead).
5130     *
5131     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
5132     * [`InitFeatures`]: crate::ln::features::InitFeatures
5133     */
5134    LDKAPIError_IncompatibleShutdownScript,
5135    /**
5136     * Must be last for serialization purposes
5137     */
5138    LDKAPIError_Sentinel,
5139 } LDKAPIError_Tag;
5140
5141 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
5142    /**
5143     * A human-readable error message
5144     */
5145    struct LDKStr err;
5146 } LDKAPIError_LDKAPIMisuseError_Body;
5147
5148 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
5149    /**
5150     * A human-readable error message
5151     */
5152    struct LDKStr err;
5153    /**
5154     * The feerate which was too high.
5155     */
5156    uint32_t feerate;
5157 } LDKAPIError_LDKFeeRateTooHigh_Body;
5158
5159 typedef struct LDKAPIError_LDKRouteError_Body {
5160    /**
5161     * A human-readable error message
5162     */
5163    struct LDKStr err;
5164 } LDKAPIError_LDKRouteError_Body;
5165
5166 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
5167    /**
5168     * A human-readable error message
5169     */
5170    struct LDKStr err;
5171 } LDKAPIError_LDKChannelUnavailable_Body;
5172
5173 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
5174    /**
5175     * The incompatible shutdown script.
5176     */
5177    struct LDKShutdownScript script;
5178 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
5179
5180 typedef struct MUST_USE_STRUCT LDKAPIError {
5181    LDKAPIError_Tag tag;
5182    union {
5183       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5184       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5185       LDKAPIError_LDKRouteError_Body route_error;
5186       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5187       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5188    };
5189 } LDKAPIError;
5190
5191 /**
5192  * The contents of CResult_NoneAPIErrorZ
5193  */
5194 typedef union LDKCResult_NoneAPIErrorZPtr {
5195    /**
5196     * Note that this value is always NULL, as there are no contents in the OK variant
5197     */
5198    void *result;
5199    /**
5200     * A pointer to the contents in the error state.
5201     * Reading from this pointer when `result_ok` is set is undefined.
5202     */
5203    struct LDKAPIError *err;
5204 } LDKCResult_NoneAPIErrorZPtr;
5205
5206 /**
5207  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5208  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5210  */
5211 typedef struct LDKCResult_NoneAPIErrorZ {
5212    /**
5213     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5214     * `err` or `result` depending on the state of `result_ok`.
5215     */
5216    union LDKCResult_NoneAPIErrorZPtr contents;
5217    /**
5218     * Whether this CResult_NoneAPIErrorZ represents a success state.
5219     */
5220    bool result_ok;
5221 } LDKCResult_NoneAPIErrorZ;
5222
5223 /**
5224  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5225  * This corresponds to std::vector in C++
5226  */
5227 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5228    /**
5229     * The elements in the array.
5230     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5231     */
5232    struct LDKCResult_NoneAPIErrorZ *data;
5233    /**
5234     * The number of elements pointed to by `data`.
5235     */
5236    uintptr_t datalen;
5237 } LDKCVec_CResult_NoneAPIErrorZZ;
5238
5239 /**
5240  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5241  * This corresponds to std::vector in C++
5242  */
5243 typedef struct LDKCVec_APIErrorZ {
5244    /**
5245     * The elements in the array.
5246     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5247     */
5248    struct LDKAPIError *data;
5249    /**
5250     * The number of elements pointed to by `data`.
5251     */
5252    uintptr_t datalen;
5253 } LDKCVec_APIErrorZ;
5254
5255 /**
5256  * The contents of CResult__u832APIErrorZ
5257  */
5258 typedef union LDKCResult__u832APIErrorZPtr {
5259    /**
5260     * A pointer to the contents in the success state.
5261     * Reading from this pointer when `result_ok` is not set is undefined.
5262     */
5263    struct LDKThirtyTwoBytes *result;
5264    /**
5265     * A pointer to the contents in the error state.
5266     * Reading from this pointer when `result_ok` is set is undefined.
5267     */
5268    struct LDKAPIError *err;
5269 } LDKCResult__u832APIErrorZPtr;
5270
5271 /**
5272  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5273  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5274  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5275  */
5276 typedef struct LDKCResult__u832APIErrorZ {
5277    /**
5278     * The contents of this CResult__u832APIErrorZ, accessible via either
5279     * `err` or `result` depending on the state of `result_ok`.
5280     */
5281    union LDKCResult__u832APIErrorZPtr contents;
5282    /**
5283     * Whether this CResult__u832APIErrorZ represents a success state.
5284     */
5285    bool result_ok;
5286 } LDKCResult__u832APIErrorZ;
5287
5288 /**
5289  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5290  * Err() type describing which state the payment is in, see the description of individual enum
5291  * states for more.
5292  */
5293 typedef enum LDKPaymentSendFailure_Tag {
5294    /**
5295     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5296     * send the payment at all. No channel state has been changed or messages sent to peers, and
5297     * once you've changed the parameter at error, you can freely retry the payment in full.
5298     */
5299    LDKPaymentSendFailure_ParameterError,
5300    /**
5301     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5302     * from attempting to send the payment at all. No channel state has been changed or messages
5303     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5304     * payment in full.
5305     *
5306     * The results here are ordered the same as the paths in the route object which was passed to
5307     * send_payment.
5308     */
5309    LDKPaymentSendFailure_PathParameterError,
5310    /**
5311     * All paths which were attempted failed to send, with no channel state change taking place.
5312     * You can freely retry the payment in full (though you probably want to do so over different
5313     * paths than the ones selected).
5314     */
5315    LDKPaymentSendFailure_AllFailedRetrySafe,
5316    /**
5317     * Some paths which were attempted failed to send, though possibly not all. At least some
5318     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5319     * in over-/re-payment.
5320     *
5321     * The results here are ordered the same as the paths in the route object which was passed to
5322     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5323     * retried (though there is currently no API with which to do so).
5324     *
5325     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5326     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5327     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5328     * with the latest update_id.
5329     */
5330    LDKPaymentSendFailure_PartialFailure,
5331    /**
5332     * Must be last for serialization purposes
5333     */
5334    LDKPaymentSendFailure_Sentinel,
5335 } LDKPaymentSendFailure_Tag;
5336
5337 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5338    /**
5339     * The errors themselves, in the same order as the route hops.
5340     */
5341    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5342    /**
5343     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5344     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5345     * will pay all remaining unpaid balance.
5346     *
5347     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5348     */
5349    struct LDKRouteParameters failed_paths_retry;
5350    /**
5351     * The payment id for the payment, which is now at least partially pending.
5352     */
5353    struct LDKThirtyTwoBytes payment_id;
5354 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5355
5356 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5357    LDKPaymentSendFailure_Tag tag;
5358    union {
5359       struct {
5360          struct LDKAPIError parameter_error;
5361       };
5362       struct {
5363          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5364       };
5365       struct {
5366          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5367       };
5368       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5369    };
5370 } LDKPaymentSendFailure;
5371
5372 /**
5373  * The contents of CResult_PaymentIdPaymentSendFailureZ
5374  */
5375 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5376    /**
5377     * A pointer to the contents in the success state.
5378     * Reading from this pointer when `result_ok` is not set is undefined.
5379     */
5380    struct LDKThirtyTwoBytes *result;
5381    /**
5382     * A pointer to the contents in the error state.
5383     * Reading from this pointer when `result_ok` is set is undefined.
5384     */
5385    struct LDKPaymentSendFailure *err;
5386 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5387
5388 /**
5389  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5390  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5391  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5392  */
5393 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5394    /**
5395     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5396     * `err` or `result` depending on the state of `result_ok`.
5397     */
5398    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5399    /**
5400     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5401     */
5402    bool result_ok;
5403 } LDKCResult_PaymentIdPaymentSendFailureZ;
5404
5405 /**
5406  * The contents of CResult_NonePaymentSendFailureZ
5407  */
5408 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5409    /**
5410     * Note that this value is always NULL, as there are no contents in the OK variant
5411     */
5412    void *result;
5413    /**
5414     * A pointer to the contents in the error state.
5415     * Reading from this pointer when `result_ok` is set is undefined.
5416     */
5417    struct LDKPaymentSendFailure *err;
5418 } LDKCResult_NonePaymentSendFailureZPtr;
5419
5420 /**
5421  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5422  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5423  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5424  */
5425 typedef struct LDKCResult_NonePaymentSendFailureZ {
5426    /**
5427     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5428     * `err` or `result` depending on the state of `result_ok`.
5429     */
5430    union LDKCResult_NonePaymentSendFailureZPtr contents;
5431    /**
5432     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5433     */
5434    bool result_ok;
5435 } LDKCResult_NonePaymentSendFailureZ;
5436
5437 /**
5438  * A tuple of 2 elements. See the individual fields for the types contained.
5439  */
5440 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5441    /**
5442     * The element at position 0
5443     */
5444    struct LDKThirtyTwoBytes a;
5445    /**
5446     * The element at position 1
5447     */
5448    struct LDKThirtyTwoBytes b;
5449 } LDKC2Tuple_PaymentHashPaymentIdZ;
5450
5451 /**
5452  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5453  */
5454 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5455    /**
5456     * A pointer to the contents in the success state.
5457     * Reading from this pointer when `result_ok` is not set is undefined.
5458     */
5459    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
5460    /**
5461     * A pointer to the contents in the error state.
5462     * Reading from this pointer when `result_ok` is set is undefined.
5463     */
5464    struct LDKPaymentSendFailure *err;
5465 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
5466
5467 /**
5468  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5469  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5470  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5471  */
5472 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5473    /**
5474     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5475     * `err` or `result` depending on the state of `result_ok`.
5476     */
5477    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
5478    /**
5479     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5480     */
5481    bool result_ok;
5482 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
5483
5484 /**
5485  * A 4-byte byte array.
5486  */
5487 typedef struct LDKFourBytes {
5488    /**
5489     * The four bytes
5490     */
5491    uint8_t data[4];
5492 } LDKFourBytes;
5493
5494 /**
5495  * A 16-byte byte array.
5496  */
5497 typedef struct LDKSixteenBytes {
5498    /**
5499     * The sixteen bytes
5500     */
5501    uint8_t data[16];
5502 } LDKSixteenBytes;
5503
5504 /**
5505  * A 12-byte byte array.
5506  */
5507 typedef struct LDKTwelveBytes {
5508    /**
5509     * The twelve bytes
5510     */
5511    uint8_t data[12];
5512 } LDKTwelveBytes;
5513
5514 /**
5515  * An address which can be used to connect to a remote peer
5516  */
5517 typedef enum LDKNetAddress_Tag {
5518    /**
5519     * An IPv4 address/port on which the peer is listening.
5520     */
5521    LDKNetAddress_IPv4,
5522    /**
5523     * An IPv6 address/port on which the peer is listening.
5524     */
5525    LDKNetAddress_IPv6,
5526    /**
5527     * An old-style Tor onion address/port on which the peer is listening.
5528     *
5529     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5530     * addresses. Thus, the details are not parsed here.
5531     */
5532    LDKNetAddress_OnionV2,
5533    /**
5534     * A new-style Tor onion address/port on which the peer is listening.
5535     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5536     * wrap as base32 and append \".onion\".
5537     */
5538    LDKNetAddress_OnionV3,
5539    /**
5540     * Must be last for serialization purposes
5541     */
5542    LDKNetAddress_Sentinel,
5543 } LDKNetAddress_Tag;
5544
5545 typedef struct LDKNetAddress_LDKIPv4_Body {
5546    /**
5547     * The 4-byte IPv4 address
5548     */
5549    struct LDKFourBytes addr;
5550    /**
5551     * The port on which the node is listening
5552     */
5553    uint16_t port;
5554 } LDKNetAddress_LDKIPv4_Body;
5555
5556 typedef struct LDKNetAddress_LDKIPv6_Body {
5557    /**
5558     * The 16-byte IPv6 address
5559     */
5560    struct LDKSixteenBytes addr;
5561    /**
5562     * The port on which the node is listening
5563     */
5564    uint16_t port;
5565 } LDKNetAddress_LDKIPv6_Body;
5566
5567 typedef struct LDKNetAddress_LDKOnionV3_Body {
5568    /**
5569     * The ed25519 long-term public key of the peer
5570     */
5571    struct LDKThirtyTwoBytes ed25519_pubkey;
5572    /**
5573     * The checksum of the pubkey and version, as included in the onion address
5574     */
5575    uint16_t checksum;
5576    /**
5577     * The version byte, as defined by the Tor Onion v3 spec.
5578     */
5579    uint8_t version;
5580    /**
5581     * The port on which the node is listening
5582     */
5583    uint16_t port;
5584 } LDKNetAddress_LDKOnionV3_Body;
5585
5586 typedef struct MUST_USE_STRUCT LDKNetAddress {
5587    LDKNetAddress_Tag tag;
5588    union {
5589       LDKNetAddress_LDKIPv4_Body i_pv4;
5590       LDKNetAddress_LDKIPv6_Body i_pv6;
5591       struct {
5592          struct LDKTwelveBytes onion_v2;
5593       };
5594       LDKNetAddress_LDKOnionV3_Body onion_v3;
5595    };
5596 } LDKNetAddress;
5597
5598 /**
5599  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5600  * This corresponds to std::vector in C++
5601  */
5602 typedef struct LDKCVec_NetAddressZ {
5603    /**
5604     * The elements in the array.
5605     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5606     */
5607    struct LDKNetAddress *data;
5608    /**
5609     * The number of elements pointed to by `data`.
5610     */
5611    uintptr_t datalen;
5612 } LDKCVec_NetAddressZ;
5613
5614 /**
5615  * A tuple of 2 elements. See the individual fields for the types contained.
5616  */
5617 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
5618    /**
5619     * The element at position 0
5620     */
5621    struct LDKThirtyTwoBytes a;
5622    /**
5623     * The element at position 1
5624     */
5625    struct LDKThirtyTwoBytes b;
5626 } LDKC2Tuple_PaymentHashPaymentSecretZ;
5627
5628 /**
5629  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
5630  */
5631 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
5632    /**
5633     * A pointer to the contents in the success state.
5634     * Reading from this pointer when `result_ok` is not set is undefined.
5635     */
5636    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
5637    /**
5638     * Note that this value is always NULL, as there are no contents in the Err variant
5639     */
5640    void *err;
5641 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
5642
5643 /**
5644  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
5645  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
5646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5647  */
5648 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
5649    /**
5650     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
5651     * `err` or `result` depending on the state of `result_ok`.
5652     */
5653    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
5654    /**
5655     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
5656     */
5657    bool result_ok;
5658 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
5659
5660 /**
5661  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
5662  */
5663 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
5664    /**
5665     * A pointer to the contents in the success state.
5666     * Reading from this pointer when `result_ok` is not set is undefined.
5667     */
5668    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
5669    /**
5670     * A pointer to the contents in the error state.
5671     * Reading from this pointer when `result_ok` is set is undefined.
5672     */
5673    struct LDKAPIError *err;
5674 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
5675
5676 /**
5677  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
5678  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
5679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5680  */
5681 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
5682    /**
5683     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
5684     * `err` or `result` depending on the state of `result_ok`.
5685     */
5686    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
5687    /**
5688     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
5689     */
5690    bool result_ok;
5691 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
5692
5693 /**
5694  * The contents of CResult_PaymentSecretNoneZ
5695  */
5696 typedef union LDKCResult_PaymentSecretNoneZPtr {
5697    /**
5698     * A pointer to the contents in the success state.
5699     * Reading from this pointer when `result_ok` is not set is undefined.
5700     */
5701    struct LDKThirtyTwoBytes *result;
5702    /**
5703     * Note that this value is always NULL, as there are no contents in the Err variant
5704     */
5705    void *err;
5706 } LDKCResult_PaymentSecretNoneZPtr;
5707
5708 /**
5709  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
5710  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
5711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5712  */
5713 typedef struct LDKCResult_PaymentSecretNoneZ {
5714    /**
5715     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
5716     * `err` or `result` depending on the state of `result_ok`.
5717     */
5718    union LDKCResult_PaymentSecretNoneZPtr contents;
5719    /**
5720     * Whether this CResult_PaymentSecretNoneZ represents a success state.
5721     */
5722    bool result_ok;
5723 } LDKCResult_PaymentSecretNoneZ;
5724
5725 /**
5726  * The contents of CResult_PaymentSecretAPIErrorZ
5727  */
5728 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
5729    /**
5730     * A pointer to the contents in the success state.
5731     * Reading from this pointer when `result_ok` is not set is undefined.
5732     */
5733    struct LDKThirtyTwoBytes *result;
5734    /**
5735     * A pointer to the contents in the error state.
5736     * Reading from this pointer when `result_ok` is set is undefined.
5737     */
5738    struct LDKAPIError *err;
5739 } LDKCResult_PaymentSecretAPIErrorZPtr;
5740
5741 /**
5742  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5743  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5745  */
5746 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
5747    /**
5748     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5749     * `err` or `result` depending on the state of `result_ok`.
5750     */
5751    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
5752    /**
5753     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5754     */
5755    bool result_ok;
5756 } LDKCResult_PaymentSecretAPIErrorZ;
5757
5758 /**
5759  * The contents of CResult_PaymentPreimageAPIErrorZ
5760  */
5761 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
5762    /**
5763     * A pointer to the contents in the success state.
5764     * Reading from this pointer when `result_ok` is not set is undefined.
5765     */
5766    struct LDKThirtyTwoBytes *result;
5767    /**
5768     * A pointer to the contents in the error state.
5769     * Reading from this pointer when `result_ok` is set is undefined.
5770     */
5771    struct LDKAPIError *err;
5772 } LDKCResult_PaymentPreimageAPIErrorZPtr;
5773
5774 /**
5775  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
5776  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5778  */
5779 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
5780    /**
5781     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
5782     * `err` or `result` depending on the state of `result_ok`.
5783     */
5784    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
5785    /**
5786     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
5787     */
5788    bool result_ok;
5789 } LDKCResult_PaymentPreimageAPIErrorZ;
5790
5791 /**
5792  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5793  * This corresponds to std::vector in C++
5794  */
5795 typedef struct LDKCVec_ChannelMonitorZ {
5796    /**
5797     * The elements in the array.
5798     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5799     */
5800    struct LDKChannelMonitor *data;
5801    /**
5802     * The number of elements pointed to by `data`.
5803     */
5804    uintptr_t datalen;
5805 } LDKCVec_ChannelMonitorZ;
5806
5807
5808
5809 /**
5810  * An update generated by the underlying Channel itself which contains some new information the
5811  * ChannelMonitor should be made aware of.
5812  */
5813 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
5814    /**
5815     * A pointer to the opaque Rust object.
5816     * Nearly everywhere, inner must be non-null, however in places where
5817     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5818     */
5819    LDKnativeChannelMonitorUpdate *inner;
5820    /**
5821     * Indicates that this is the only struct which contains the same pointer.
5822     * Rust functions which take ownership of an object provided via an argument require
5823     * this to be true and invalidate the object pointed to by inner.
5824     */
5825    bool is_owned;
5826 } LDKChannelMonitorUpdate;
5827
5828 /**
5829  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
5830  * blocks are connected and disconnected.
5831  *
5832  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
5833  * responsible for maintaining a set of monitors such that they can be updated accordingly as
5834  * channel state changes and HTLCs are resolved. See method documentation for specific
5835  * requirements.
5836  *
5837  * Implementations **must** ensure that updates are successfully applied and persisted upon method
5838  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
5839  * without taking any further action such as persisting the current state.
5840  *
5841  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
5842  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
5843  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
5844  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
5845  * multiple instances.
5846  *
5847  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
5848  */
5849 typedef struct LDKWatch {
5850    /**
5851     * An opaque pointer which is passed to your function implementations as an argument.
5852     * This has no meaning in the LDK, and can be NULL or any other value.
5853     */
5854    void *this_arg;
5855    /**
5856     * Watches a channel identified by `funding_txo` using `monitor`.
5857     *
5858     * Implementations are responsible for watching the chain for the funding transaction along
5859     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
5860     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
5861     *
5862     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
5863     * the given `funding_txo` has previously been registered via `watch_channel`.
5864     *
5865     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
5866     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
5867     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
5868     */
5869    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
5870    /**
5871     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
5872     *
5873     * Implementations must call [`update_monitor`] with the given update. See
5874     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
5875     *
5876     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
5877     */
5878    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
5879    /**
5880     * Returns any monitor events since the last call. Subsequent calls must only return new
5881     * events.
5882     *
5883     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
5884     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
5885     * to disk.
5886     *
5887     * For details on asynchronous [`ChannelMonitor`] updating and returning
5888     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
5889     */
5890    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
5891    /**
5892     * Frees any resources associated with this object given its this_arg pointer.
5893     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5894     */
5895    void (*free)(void *this_arg);
5896 } LDKWatch;
5897
5898 /**
5899  * An interface to send a transaction to the Bitcoin network.
5900  */
5901 typedef struct LDKBroadcasterInterface {
5902    /**
5903     * An opaque pointer which is passed to your function implementations as an argument.
5904     * This has no meaning in the LDK, and can be NULL or any other value.
5905     */
5906    void *this_arg;
5907    /**
5908     * Sends a transaction out to (hopefully) be mined.
5909     */
5910    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
5911    /**
5912     * Frees any resources associated with this object given its this_arg pointer.
5913     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5914     */
5915    void (*free)(void *this_arg);
5916 } LDKBroadcasterInterface;
5917
5918 /**
5919  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
5920  * own the memory pointed to by data.
5921  */
5922 typedef struct LDKu8slice {
5923    /**
5924     * A pointer to the byte buffer
5925     */
5926    const uint8_t *data;
5927    /**
5928     * The number of bytes pointed to by `data`.
5929     */
5930    uintptr_t datalen;
5931 } LDKu8slice;
5932
5933 /**
5934  * A trait to describe an object which can get user secrets and key material.
5935  */
5936 typedef struct LDKKeysInterface {
5937    /**
5938     * An opaque pointer which is passed to your function implementations as an argument.
5939     * This has no meaning in the LDK, and can be NULL or any other value.
5940     */
5941    void *this_arg;
5942    /**
5943     * Get node secret key (aka node_id or network_key).
5944     *
5945     * This method must return the same value each time it is called.
5946     */
5947    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
5948    /**
5949     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
5950     *
5951     * This method should return a different value each time it is called, to avoid linking
5952     * on-chain funds across channels as controlled to the same user.
5953     */
5954    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
5955    /**
5956     * Get a script pubkey which we will send funds to when closing a channel.
5957     *
5958     * This method should return a different value each time it is called, to avoid linking
5959     * on-chain funds across channels as controlled to the same user.
5960     */
5961    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
5962    /**
5963     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
5964     * restarted with some stale data!
5965     *
5966     * This method must return a different value each time it is called.
5967     */
5968    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
5969    /**
5970     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
5971     * onion packets and for temporary channel IDs. There is no requirement that these be
5972     * persisted anywhere, though they must be unique across restarts.
5973     *
5974     * This method must return a different value each time it is called.
5975     */
5976    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
5977    /**
5978     * Reads a `Signer` for this `KeysInterface` from the given input stream.
5979     * This is only called during deserialization of other objects which contain
5980     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
5981     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
5982     * contain no versioning scheme. You may wish to include your own version prefix and ensure
5983     * you've read all of the provided bytes to ensure no corruption occurred.
5984     */
5985    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
5986    /**
5987     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
5988     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
5989     * this trait to parse the invoice and make sure they're signing what they expect, rather than
5990     * blindly signing the hash.
5991     */
5992    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
5993    /**
5994     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
5995     *
5996     * This method must return the same value each time it is called.
5997     */
5998    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
5999    /**
6000     * Frees any resources associated with this object given its this_arg pointer.
6001     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6002     */
6003    void (*free)(void *this_arg);
6004 } LDKKeysInterface;
6005
6006 /**
6007  * A trait which should be implemented to provide feerate information on a number of time
6008  * horizons.
6009  *
6010  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6011  * called from inside the library in response to chain events, P2P events, or timer events).
6012  */
6013 typedef struct LDKFeeEstimator {
6014    /**
6015     * An opaque pointer which is passed to your function implementations as an argument.
6016     * This has no meaning in the LDK, and can be NULL or any other value.
6017     */
6018    void *this_arg;
6019    /**
6020     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6021     *
6022     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
6023     * round-downs don't put us below 1 satoshi-per-byte).
6024     *
6025     * This method can be implemented with the following unit conversions:
6026     *  * max(satoshis-per-byte * 250, 253)
6027     *  * max(satoshis-per-kbyte / 4, 253)
6028     */
6029    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6030    /**
6031     * Frees any resources associated with this object given its this_arg pointer.
6032     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6033     */
6034    void (*free)(void *this_arg);
6035 } LDKFeeEstimator;
6036
6037
6038
6039 /**
6040  * A Record, unit of logging output with Metadata to enable filtering
6041  * Module_path, file, line to inform on log's source
6042  */
6043 typedef struct MUST_USE_STRUCT LDKRecord {
6044    /**
6045     * A pointer to the opaque Rust object.
6046     * Nearly everywhere, inner must be non-null, however in places where
6047     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6048     */
6049    LDKnativeRecord *inner;
6050    /**
6051     * Indicates that this is the only struct which contains the same pointer.
6052     * Rust functions which take ownership of an object provided via an argument require
6053     * this to be true and invalidate the object pointed to by inner.
6054     */
6055    bool is_owned;
6056 } LDKRecord;
6057
6058 /**
6059  * A trait encapsulating the operations required of a logger
6060  */
6061 typedef struct LDKLogger {
6062    /**
6063     * An opaque pointer which is passed to your function implementations as an argument.
6064     * This has no meaning in the LDK, and can be NULL or any other value.
6065     */
6066    void *this_arg;
6067    /**
6068     * Logs the `Record`
6069     */
6070    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
6071    /**
6072     * Frees any resources associated with this object given its this_arg pointer.
6073     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6074     */
6075    void (*free)(void *this_arg);
6076 } LDKLogger;
6077
6078
6079
6080 /**
6081  * Manager which keeps track of a number of channels and sends messages to the appropriate
6082  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6083  *
6084  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6085  * to individual Channels.
6086  *
6087  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6088  * all peers during write/read (though does not modify this instance, only the instance being
6089  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6090  * called funding_transaction_generated for outbound channels).
6091  *
6092  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6093  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6094  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6095  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6096  * the serialization process). If the deserialized version is out-of-date compared to the
6097  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6098  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6099  *
6100  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6101  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6102  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6103  * block_connected() to step towards your best block) upon deserialization before using the
6104  * object!
6105  *
6106  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6107  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6108  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6109  * offline for a full minute. In order to track this, you must call
6110  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6111  *
6112  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6113  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6114  * essentially you should default to using a SimpleRefChannelManager, and use a
6115  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6116  * you're using lightning-net-tokio.
6117  */
6118 typedef struct MUST_USE_STRUCT LDKChannelManager {
6119    /**
6120     * A pointer to the opaque Rust object.
6121     * Nearly everywhere, inner must be non-null, however in places where
6122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6123     */
6124    LDKnativeChannelManager *inner;
6125    /**
6126     * Indicates that this is the only struct which contains the same pointer.
6127     * Rust functions which take ownership of an object provided via an argument require
6128     * this to be true and invalidate the object pointed to by inner.
6129     */
6130    bool is_owned;
6131 } LDKChannelManager;
6132
6133 /**
6134  * A tuple of 2 elements. See the individual fields for the types contained.
6135  */
6136 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6137    /**
6138     * The element at position 0
6139     */
6140    struct LDKThirtyTwoBytes a;
6141    /**
6142     * The element at position 1
6143     */
6144    struct LDKChannelManager b;
6145 } LDKC2Tuple_BlockHashChannelManagerZ;
6146
6147 /**
6148  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6149  */
6150 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6151    /**
6152     * A pointer to the contents in the success state.
6153     * Reading from this pointer when `result_ok` is not set is undefined.
6154     */
6155    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6156    /**
6157     * A pointer to the contents in the error state.
6158     * Reading from this pointer when `result_ok` is set is undefined.
6159     */
6160    struct LDKDecodeError *err;
6161 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6162
6163 /**
6164  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6165  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6166  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6167  */
6168 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6169    /**
6170     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6171     * `err` or `result` depending on the state of `result_ok`.
6172     */
6173    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6174    /**
6175     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6176     */
6177    bool result_ok;
6178 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6179
6180
6181
6182 /**
6183  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
6184  * with our counterparty.
6185  */
6186 typedef struct MUST_USE_STRUCT LDKChannelConfig {
6187    /**
6188     * A pointer to the opaque Rust object.
6189     * Nearly everywhere, inner must be non-null, however in places where
6190     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6191     */
6192    LDKnativeChannelConfig *inner;
6193    /**
6194     * Indicates that this is the only struct which contains the same pointer.
6195     * Rust functions which take ownership of an object provided via an argument require
6196     * this to be true and invalidate the object pointed to by inner.
6197     */
6198    bool is_owned;
6199 } LDKChannelConfig;
6200
6201 /**
6202  * The contents of CResult_ChannelConfigDecodeErrorZ
6203  */
6204 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
6205    /**
6206     * A pointer to the contents in the success state.
6207     * Reading from this pointer when `result_ok` is not set is undefined.
6208     */
6209    struct LDKChannelConfig *result;
6210    /**
6211     * A pointer to the contents in the error state.
6212     * Reading from this pointer when `result_ok` is set is undefined.
6213     */
6214    struct LDKDecodeError *err;
6215 } LDKCResult_ChannelConfigDecodeErrorZPtr;
6216
6217 /**
6218  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6219  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6220  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6221  */
6222 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
6223    /**
6224     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6225     * `err` or `result` depending on the state of `result_ok`.
6226     */
6227    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
6228    /**
6229     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6230     */
6231    bool result_ok;
6232 } LDKCResult_ChannelConfigDecodeErrorZ;
6233
6234 /**
6235  * The contents of CResult_OutPointDecodeErrorZ
6236  */
6237 typedef union LDKCResult_OutPointDecodeErrorZPtr {
6238    /**
6239     * A pointer to the contents in the success state.
6240     * Reading from this pointer when `result_ok` is not set is undefined.
6241     */
6242    struct LDKOutPoint *result;
6243    /**
6244     * A pointer to the contents in the error state.
6245     * Reading from this pointer when `result_ok` is set is undefined.
6246     */
6247    struct LDKDecodeError *err;
6248 } LDKCResult_OutPointDecodeErrorZPtr;
6249
6250 /**
6251  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6252  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6253  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6254  */
6255 typedef struct LDKCResult_OutPointDecodeErrorZ {
6256    /**
6257     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6258     * `err` or `result` depending on the state of `result_ok`.
6259     */
6260    union LDKCResult_OutPointDecodeErrorZPtr contents;
6261    /**
6262     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
6263     */
6264    bool result_ok;
6265 } LDKCResult_OutPointDecodeErrorZ;
6266
6267 /**
6268  * Defines a type identifier for sending messages over the wire.
6269  *
6270  * Messages implementing this trait specify a type and must be [`Writeable`].
6271  */
6272 typedef struct LDKType {
6273    /**
6274     * An opaque pointer which is passed to your function implementations as an argument.
6275     * This has no meaning in the LDK, and can be NULL or any other value.
6276     */
6277    void *this_arg;
6278    /**
6279     * Returns the type identifying the message payload.
6280     */
6281    uint16_t (*type_id)(const void *this_arg);
6282    /**
6283     * Return a human-readable "debug" string describing this object
6284     */
6285    struct LDKStr (*debug_str)(const void *this_arg);
6286    /**
6287     * Serialize the object into a byte array
6288     */
6289    struct LDKCVec_u8Z (*write)(const void *this_arg);
6290    /**
6291     * Frees any resources associated with this object given its this_arg pointer.
6292     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6293     */
6294    void (*free)(void *this_arg);
6295 } LDKType;
6296
6297 /**
6298  * An enum which can either contain a crate::lightning::ln::wire::Type or not
6299  */
6300 typedef enum LDKCOption_TypeZ_Tag {
6301    /**
6302     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6303     */
6304    LDKCOption_TypeZ_Some,
6305    /**
6306     * When we're in this state, this COption_TypeZ contains nothing
6307     */
6308    LDKCOption_TypeZ_None,
6309    /**
6310     * Must be last for serialization purposes
6311     */
6312    LDKCOption_TypeZ_Sentinel,
6313 } LDKCOption_TypeZ_Tag;
6314
6315 typedef struct LDKCOption_TypeZ {
6316    LDKCOption_TypeZ_Tag tag;
6317    union {
6318       struct {
6319          struct LDKType some;
6320       };
6321    };
6322 } LDKCOption_TypeZ;
6323
6324 /**
6325  * The contents of CResult_COption_TypeZDecodeErrorZ
6326  */
6327 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
6328    /**
6329     * A pointer to the contents in the success state.
6330     * Reading from this pointer when `result_ok` is not set is undefined.
6331     */
6332    struct LDKCOption_TypeZ *result;
6333    /**
6334     * A pointer to the contents in the error state.
6335     * Reading from this pointer when `result_ok` is set is undefined.
6336     */
6337    struct LDKDecodeError *err;
6338 } LDKCResult_COption_TypeZDecodeErrorZPtr;
6339
6340 /**
6341  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6342  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6344  */
6345 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
6346    /**
6347     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6348     * `err` or `result` depending on the state of `result_ok`.
6349     */
6350    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
6351    /**
6352     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6353     */
6354    bool result_ok;
6355 } LDKCResult_COption_TypeZDecodeErrorZ;
6356
6357 /**
6358  * An error that may occur when making a payment.
6359  */
6360 typedef enum LDKPaymentError_Tag {
6361    /**
6362     * An error resulting from the provided [`Invoice`] or payment hash.
6363     */
6364    LDKPaymentError_Invoice,
6365    /**
6366     * An error occurring when finding a route.
6367     */
6368    LDKPaymentError_Routing,
6369    /**
6370     * An error occurring when sending a payment.
6371     */
6372    LDKPaymentError_Sending,
6373    /**
6374     * Must be last for serialization purposes
6375     */
6376    LDKPaymentError_Sentinel,
6377 } LDKPaymentError_Tag;
6378
6379 typedef struct MUST_USE_STRUCT LDKPaymentError {
6380    LDKPaymentError_Tag tag;
6381    union {
6382       struct {
6383          struct LDKStr invoice;
6384       };
6385       struct {
6386          struct LDKLightningError routing;
6387       };
6388       struct {
6389          struct LDKPaymentSendFailure sending;
6390       };
6391    };
6392 } LDKPaymentError;
6393
6394 /**
6395  * The contents of CResult_PaymentIdPaymentErrorZ
6396  */
6397 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
6398    /**
6399     * A pointer to the contents in the success state.
6400     * Reading from this pointer when `result_ok` is not set is undefined.
6401     */
6402    struct LDKThirtyTwoBytes *result;
6403    /**
6404     * A pointer to the contents in the error state.
6405     * Reading from this pointer when `result_ok` is set is undefined.
6406     */
6407    struct LDKPaymentError *err;
6408 } LDKCResult_PaymentIdPaymentErrorZPtr;
6409
6410 /**
6411  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6412  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6413  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6414  */
6415 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
6416    /**
6417     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6418     * `err` or `result` depending on the state of `result_ok`.
6419     */
6420    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
6421    /**
6422     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6423     */
6424    bool result_ok;
6425 } LDKCResult_PaymentIdPaymentErrorZ;
6426
6427 /**
6428  * The contents of CResult_SiPrefixNoneZ
6429  */
6430 typedef union LDKCResult_SiPrefixNoneZPtr {
6431    /**
6432     * A pointer to the contents in the success state.
6433     * Reading from this pointer when `result_ok` is not set is undefined.
6434     */
6435    enum LDKSiPrefix *result;
6436    /**
6437     * Note that this value is always NULL, as there are no contents in the Err variant
6438     */
6439    void *err;
6440 } LDKCResult_SiPrefixNoneZPtr;
6441
6442 /**
6443  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6444  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6445  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6446  */
6447 typedef struct LDKCResult_SiPrefixNoneZ {
6448    /**
6449     * The contents of this CResult_SiPrefixNoneZ, accessible via either
6450     * `err` or `result` depending on the state of `result_ok`.
6451     */
6452    union LDKCResult_SiPrefixNoneZPtr contents;
6453    /**
6454     * Whether this CResult_SiPrefixNoneZ represents a success state.
6455     */
6456    bool result_ok;
6457 } LDKCResult_SiPrefixNoneZ;
6458
6459
6460
6461 /**
6462  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
6463  *
6464  * There are three ways to construct an `Invoice`:
6465  *  1. using `InvoiceBuilder`
6466  *  2. using `Invoice::from_signed(SignedRawInvoice)`
6467  *  3. using `str::parse::<Invoice>(&str)`
6468  */
6469 typedef struct MUST_USE_STRUCT LDKInvoice {
6470    /**
6471     * A pointer to the opaque Rust object.
6472     * Nearly everywhere, inner must be non-null, however in places where
6473     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6474     */
6475    LDKnativeInvoice *inner;
6476    /**
6477     * Indicates that this is the only struct which contains the same pointer.
6478     * Rust functions which take ownership of an object provided via an argument require
6479     * this to be true and invalidate the object pointed to by inner.
6480     */
6481    bool is_owned;
6482 } LDKInvoice;
6483
6484 /**
6485  * The contents of CResult_InvoiceNoneZ
6486  */
6487 typedef union LDKCResult_InvoiceNoneZPtr {
6488    /**
6489     * A pointer to the contents in the success state.
6490     * Reading from this pointer when `result_ok` is not set is undefined.
6491     */
6492    struct LDKInvoice *result;
6493    /**
6494     * Note that this value is always NULL, as there are no contents in the Err variant
6495     */
6496    void *err;
6497 } LDKCResult_InvoiceNoneZPtr;
6498
6499 /**
6500  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
6501  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
6502  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6503  */
6504 typedef struct LDKCResult_InvoiceNoneZ {
6505    /**
6506     * The contents of this CResult_InvoiceNoneZ, accessible via either
6507     * `err` or `result` depending on the state of `result_ok`.
6508     */
6509    union LDKCResult_InvoiceNoneZPtr contents;
6510    /**
6511     * Whether this CResult_InvoiceNoneZ represents a success state.
6512     */
6513    bool result_ok;
6514 } LDKCResult_InvoiceNoneZ;
6515
6516
6517
6518 /**
6519  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
6520  * invalid.
6521  *
6522  * # Invariants
6523  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
6524  */
6525 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
6526    /**
6527     * A pointer to the opaque Rust object.
6528     * Nearly everywhere, inner must be non-null, however in places where
6529     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6530     */
6531    LDKnativeSignedRawInvoice *inner;
6532    /**
6533     * Indicates that this is the only struct which contains the same pointer.
6534     * Rust functions which take ownership of an object provided via an argument require
6535     * this to be true and invalidate the object pointed to by inner.
6536     */
6537    bool is_owned;
6538 } LDKSignedRawInvoice;
6539
6540 /**
6541  * The contents of CResult_SignedRawInvoiceNoneZ
6542  */
6543 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
6544    /**
6545     * A pointer to the contents in the success state.
6546     * Reading from this pointer when `result_ok` is not set is undefined.
6547     */
6548    struct LDKSignedRawInvoice *result;
6549    /**
6550     * Note that this value is always NULL, as there are no contents in the Err variant
6551     */
6552    void *err;
6553 } LDKCResult_SignedRawInvoiceNoneZPtr;
6554
6555 /**
6556  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6557  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6558  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6559  */
6560 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
6561    /**
6562     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6563     * `err` or `result` depending on the state of `result_ok`.
6564     */
6565    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
6566    /**
6567     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6568     */
6569    bool result_ok;
6570 } LDKCResult_SignedRawInvoiceNoneZ;
6571
6572
6573
6574 /**
6575  * Represents an syntactically correct Invoice for a payment on the lightning network,
6576  * but without the signature information.
6577  * De- and encoding should not lead to information loss but may lead to different hashes.
6578  *
6579  * For methods without docs see the corresponding methods in `Invoice`.
6580  */
6581 typedef struct MUST_USE_STRUCT LDKRawInvoice {
6582    /**
6583     * A pointer to the opaque Rust object.
6584     * Nearly everywhere, inner must be non-null, however in places where
6585     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6586     */
6587    LDKnativeRawInvoice *inner;
6588    /**
6589     * Indicates that this is the only struct which contains the same pointer.
6590     * Rust functions which take ownership of an object provided via an argument require
6591     * this to be true and invalidate the object pointed to by inner.
6592     */
6593    bool is_owned;
6594 } LDKRawInvoice;
6595
6596
6597
6598 /**
6599  * Recoverable signature
6600  */
6601 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
6602    /**
6603     * A pointer to the opaque Rust object.
6604     * Nearly everywhere, inner must be non-null, however in places where
6605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6606     */
6607    LDKnativeInvoiceSignature *inner;
6608    /**
6609     * Indicates that this is the only struct which contains the same pointer.
6610     * Rust functions which take ownership of an object provided via an argument require
6611     * this to be true and invalidate the object pointed to by inner.
6612     */
6613    bool is_owned;
6614 } LDKInvoiceSignature;
6615
6616 /**
6617  * A tuple of 3 elements. See the individual fields for the types contained.
6618  */
6619 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
6620    /**
6621     * The element at position 0
6622     */
6623    struct LDKRawInvoice a;
6624    /**
6625     * The element at position 1
6626     */
6627    struct LDKThirtyTwoBytes b;
6628    /**
6629     * The element at position 2
6630     */
6631    struct LDKInvoiceSignature c;
6632 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
6633
6634
6635
6636 /**
6637  * Payee public key
6638  */
6639 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
6640    /**
6641     * A pointer to the opaque Rust object.
6642     * Nearly everywhere, inner must be non-null, however in places where
6643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6644     */
6645    LDKnativePayeePubKey *inner;
6646    /**
6647     * Indicates that this is the only struct which contains the same pointer.
6648     * Rust functions which take ownership of an object provided via an argument require
6649     * this to be true and invalidate the object pointed to by inner.
6650     */
6651    bool is_owned;
6652 } LDKPayeePubKey;
6653
6654 /**
6655  * The contents of CResult_PayeePubKeyErrorZ
6656  */
6657 typedef union LDKCResult_PayeePubKeyErrorZPtr {
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 LDKPayeePubKey *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    enum LDKSecp256k1Error *err;
6668 } LDKCResult_PayeePubKeyErrorZPtr;
6669
6670 /**
6671  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6672  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6673  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6674  */
6675 typedef struct LDKCResult_PayeePubKeyErrorZ {
6676    /**
6677     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6678     * `err` or `result` depending on the state of `result_ok`.
6679     */
6680    union LDKCResult_PayeePubKeyErrorZPtr contents;
6681    /**
6682     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
6683     */
6684    bool result_ok;
6685 } LDKCResult_PayeePubKeyErrorZ;
6686
6687
6688
6689 /**
6690  * Private routing information
6691  *
6692  * # Invariants
6693  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
6694  *
6695  */
6696 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
6697    /**
6698     * A pointer to the opaque Rust object.
6699     * Nearly everywhere, inner must be non-null, however in places where
6700     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6701     */
6702    LDKnativePrivateRoute *inner;
6703    /**
6704     * Indicates that this is the only struct which contains the same pointer.
6705     * Rust functions which take ownership of an object provided via an argument require
6706     * this to be true and invalidate the object pointed to by inner.
6707     */
6708    bool is_owned;
6709 } LDKPrivateRoute;
6710
6711 /**
6712  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6713  * This corresponds to std::vector in C++
6714  */
6715 typedef struct LDKCVec_PrivateRouteZ {
6716    /**
6717     * The elements in the array.
6718     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6719     */
6720    struct LDKPrivateRoute *data;
6721    /**
6722     * The number of elements pointed to by `data`.
6723     */
6724    uintptr_t datalen;
6725 } LDKCVec_PrivateRouteZ;
6726
6727
6728
6729 /**
6730  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
6731  * timestamp is positive.
6732  *
6733  * # Invariants
6734  * The UNIX timestamp representing the stored time has to be positive and small enough so that
6735  * a `EpiryTime` can be added to it without an overflow.
6736  */
6737 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
6738    /**
6739     * A pointer to the opaque Rust object.
6740     * Nearly everywhere, inner must be non-null, however in places where
6741     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6742     */
6743    LDKnativePositiveTimestamp *inner;
6744    /**
6745     * Indicates that this is the only struct which contains the same pointer.
6746     * Rust functions which take ownership of an object provided via an argument require
6747     * this to be true and invalidate the object pointed to by inner.
6748     */
6749    bool is_owned;
6750 } LDKPositiveTimestamp;
6751
6752 /**
6753  * The contents of CResult_PositiveTimestampCreationErrorZ
6754  */
6755 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
6756    /**
6757     * A pointer to the contents in the success state.
6758     * Reading from this pointer when `result_ok` is not set is undefined.
6759     */
6760    struct LDKPositiveTimestamp *result;
6761    /**
6762     * A pointer to the contents in the error state.
6763     * Reading from this pointer when `result_ok` is set is undefined.
6764     */
6765    enum LDKCreationError *err;
6766 } LDKCResult_PositiveTimestampCreationErrorZPtr;
6767
6768 /**
6769  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6770  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6771  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6772  */
6773 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
6774    /**
6775     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6776     * `err` or `result` depending on the state of `result_ok`.
6777     */
6778    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
6779    /**
6780     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6781     */
6782    bool result_ok;
6783 } LDKCResult_PositiveTimestampCreationErrorZ;
6784
6785 /**
6786  * The contents of CResult_NoneSemanticErrorZ
6787  */
6788 typedef union LDKCResult_NoneSemanticErrorZPtr {
6789    /**
6790     * Note that this value is always NULL, as there are no contents in the OK variant
6791     */
6792    void *result;
6793    /**
6794     * A pointer to the contents in the error state.
6795     * Reading from this pointer when `result_ok` is set is undefined.
6796     */
6797    enum LDKSemanticError *err;
6798 } LDKCResult_NoneSemanticErrorZPtr;
6799
6800 /**
6801  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6802  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6803  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804  */
6805 typedef struct LDKCResult_NoneSemanticErrorZ {
6806    /**
6807     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
6808     * `err` or `result` depending on the state of `result_ok`.
6809     */
6810    union LDKCResult_NoneSemanticErrorZPtr contents;
6811    /**
6812     * Whether this CResult_NoneSemanticErrorZ represents a success state.
6813     */
6814    bool result_ok;
6815 } LDKCResult_NoneSemanticErrorZ;
6816
6817 /**
6818  * The contents of CResult_InvoiceSemanticErrorZ
6819  */
6820 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
6821    /**
6822     * A pointer to the contents in the success state.
6823     * Reading from this pointer when `result_ok` is not set is undefined.
6824     */
6825    struct LDKInvoice *result;
6826    /**
6827     * A pointer to the contents in the error state.
6828     * Reading from this pointer when `result_ok` is set is undefined.
6829     */
6830    enum LDKSemanticError *err;
6831 } LDKCResult_InvoiceSemanticErrorZPtr;
6832
6833 /**
6834  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6835  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6836  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6837  */
6838 typedef struct LDKCResult_InvoiceSemanticErrorZ {
6839    /**
6840     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6841     * `err` or `result` depending on the state of `result_ok`.
6842     */
6843    union LDKCResult_InvoiceSemanticErrorZPtr contents;
6844    /**
6845     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6846     */
6847    bool result_ok;
6848 } LDKCResult_InvoiceSemanticErrorZ;
6849
6850
6851
6852 /**
6853  * Description string
6854  *
6855  * # Invariants
6856  * The description can be at most 639 __bytes__ long
6857  */
6858 typedef struct MUST_USE_STRUCT LDKDescription {
6859    /**
6860     * A pointer to the opaque Rust object.
6861     * Nearly everywhere, inner must be non-null, however in places where
6862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6863     */
6864    LDKnativeDescription *inner;
6865    /**
6866     * Indicates that this is the only struct which contains the same pointer.
6867     * Rust functions which take ownership of an object provided via an argument require
6868     * this to be true and invalidate the object pointed to by inner.
6869     */
6870    bool is_owned;
6871 } LDKDescription;
6872
6873 /**
6874  * The contents of CResult_DescriptionCreationErrorZ
6875  */
6876 typedef union LDKCResult_DescriptionCreationErrorZPtr {
6877    /**
6878     * A pointer to the contents in the success state.
6879     * Reading from this pointer when `result_ok` is not set is undefined.
6880     */
6881    struct LDKDescription *result;
6882    /**
6883     * A pointer to the contents in the error state.
6884     * Reading from this pointer when `result_ok` is set is undefined.
6885     */
6886    enum LDKCreationError *err;
6887 } LDKCResult_DescriptionCreationErrorZPtr;
6888
6889 /**
6890  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6891  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6892  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6893  */
6894 typedef struct LDKCResult_DescriptionCreationErrorZ {
6895    /**
6896     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6897     * `err` or `result` depending on the state of `result_ok`.
6898     */
6899    union LDKCResult_DescriptionCreationErrorZPtr contents;
6900    /**
6901     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
6902     */
6903    bool result_ok;
6904 } LDKCResult_DescriptionCreationErrorZ;
6905
6906
6907
6908 /**
6909  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
6910  * expires
6911  *
6912  * # Invariants
6913  * The number of seconds this expiry time represents has to be in the range
6914  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
6915  * timestamp
6916  */
6917 typedef struct MUST_USE_STRUCT LDKExpiryTime {
6918    /**
6919     * A pointer to the opaque Rust object.
6920     * Nearly everywhere, inner must be non-null, however in places where
6921     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6922     */
6923    LDKnativeExpiryTime *inner;
6924    /**
6925     * Indicates that this is the only struct which contains the same pointer.
6926     * Rust functions which take ownership of an object provided via an argument require
6927     * this to be true and invalidate the object pointed to by inner.
6928     */
6929    bool is_owned;
6930 } LDKExpiryTime;
6931
6932 /**
6933  * The contents of CResult_ExpiryTimeCreationErrorZ
6934  */
6935 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
6936    /**
6937     * A pointer to the contents in the success state.
6938     * Reading from this pointer when `result_ok` is not set is undefined.
6939     */
6940    struct LDKExpiryTime *result;
6941    /**
6942     * A pointer to the contents in the error state.
6943     * Reading from this pointer when `result_ok` is set is undefined.
6944     */
6945    enum LDKCreationError *err;
6946 } LDKCResult_ExpiryTimeCreationErrorZPtr;
6947
6948 /**
6949  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6950  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6951  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6952  */
6953 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
6954    /**
6955     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6956     * `err` or `result` depending on the state of `result_ok`.
6957     */
6958    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
6959    /**
6960     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6961     */
6962    bool result_ok;
6963 } LDKCResult_ExpiryTimeCreationErrorZ;
6964
6965 /**
6966  * The contents of CResult_PrivateRouteCreationErrorZ
6967  */
6968 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
6969    /**
6970     * A pointer to the contents in the success state.
6971     * Reading from this pointer when `result_ok` is not set is undefined.
6972     */
6973    struct LDKPrivateRoute *result;
6974    /**
6975     * A pointer to the contents in the error state.
6976     * Reading from this pointer when `result_ok` is set is undefined.
6977     */
6978    enum LDKCreationError *err;
6979 } LDKCResult_PrivateRouteCreationErrorZPtr;
6980
6981 /**
6982  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6983  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6985  */
6986 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
6987    /**
6988     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6989     * `err` or `result` depending on the state of `result_ok`.
6990     */
6991    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
6992    /**
6993     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6994     */
6995    bool result_ok;
6996 } LDKCResult_PrivateRouteCreationErrorZ;
6997
6998 /**
6999  * The contents of CResult_StringErrorZ
7000  */
7001 typedef union LDKCResult_StringErrorZPtr {
7002    /**
7003     * A pointer to the contents in the success state.
7004     * Reading from this pointer when `result_ok` is not set is undefined.
7005     */
7006    struct LDKStr *result;
7007    /**
7008     * A pointer to the contents in the error state.
7009     * Reading from this pointer when `result_ok` is set is undefined.
7010     */
7011    enum LDKSecp256k1Error *err;
7012 } LDKCResult_StringErrorZPtr;
7013
7014 /**
7015  * A CResult_StringErrorZ represents the result of a fallible operation,
7016  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7017  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7018  */
7019 typedef struct LDKCResult_StringErrorZ {
7020    /**
7021     * The contents of this CResult_StringErrorZ, accessible via either
7022     * `err` or `result` depending on the state of `result_ok`.
7023     */
7024    union LDKCResult_StringErrorZPtr contents;
7025    /**
7026     * Whether this CResult_StringErrorZ represents a success state.
7027     */
7028    bool result_ok;
7029 } LDKCResult_StringErrorZ;
7030
7031 /**
7032  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7033  */
7034 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
7035    /**
7036     * A pointer to the contents in the success state.
7037     * Reading from this pointer when `result_ok` is not set is undefined.
7038     */
7039    struct LDKChannelMonitorUpdate *result;
7040    /**
7041     * A pointer to the contents in the error state.
7042     * Reading from this pointer when `result_ok` is set is undefined.
7043     */
7044    struct LDKDecodeError *err;
7045 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
7046
7047 /**
7048  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7049  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7050  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7051  */
7052 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
7053    /**
7054     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7055     * `err` or `result` depending on the state of `result_ok`.
7056     */
7057    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
7058    /**
7059     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7060     */
7061    bool result_ok;
7062 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
7063
7064 /**
7065  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7066  */
7067 typedef enum LDKCOption_MonitorEventZ_Tag {
7068    /**
7069     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7070     */
7071    LDKCOption_MonitorEventZ_Some,
7072    /**
7073     * When we're in this state, this COption_MonitorEventZ contains nothing
7074     */
7075    LDKCOption_MonitorEventZ_None,
7076    /**
7077     * Must be last for serialization purposes
7078     */
7079    LDKCOption_MonitorEventZ_Sentinel,
7080 } LDKCOption_MonitorEventZ_Tag;
7081
7082 typedef struct LDKCOption_MonitorEventZ {
7083    LDKCOption_MonitorEventZ_Tag tag;
7084    union {
7085       struct {
7086          struct LDKMonitorEvent some;
7087       };
7088    };
7089 } LDKCOption_MonitorEventZ;
7090
7091 /**
7092  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
7093  */
7094 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
7095    /**
7096     * A pointer to the contents in the success state.
7097     * Reading from this pointer when `result_ok` is not set is undefined.
7098     */
7099    struct LDKCOption_MonitorEventZ *result;
7100    /**
7101     * A pointer to the contents in the error state.
7102     * Reading from this pointer when `result_ok` is set is undefined.
7103     */
7104    struct LDKDecodeError *err;
7105 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
7106
7107 /**
7108  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7109  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7111  */
7112 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
7113    /**
7114     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7115     * `err` or `result` depending on the state of `result_ok`.
7116     */
7117    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
7118    /**
7119     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7120     */
7121    bool result_ok;
7122 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
7123
7124 /**
7125  * The contents of CResult_HTLCUpdateDecodeErrorZ
7126  */
7127 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
7128    /**
7129     * A pointer to the contents in the success state.
7130     * Reading from this pointer when `result_ok` is not set is undefined.
7131     */
7132    struct LDKHTLCUpdate *result;
7133    /**
7134     * A pointer to the contents in the error state.
7135     * Reading from this pointer when `result_ok` is set is undefined.
7136     */
7137    struct LDKDecodeError *err;
7138 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
7139
7140 /**
7141  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7142  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7143  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7144  */
7145 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
7146    /**
7147     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7148     * `err` or `result` depending on the state of `result_ok`.
7149     */
7150    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
7151    /**
7152     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7153     */
7154    bool result_ok;
7155 } LDKCResult_HTLCUpdateDecodeErrorZ;
7156
7157 /**
7158  * A tuple of 2 elements. See the individual fields for the types contained.
7159  */
7160 typedef struct LDKC2Tuple_OutPointScriptZ {
7161    /**
7162     * The element at position 0
7163     */
7164    struct LDKOutPoint a;
7165    /**
7166     * The element at position 1
7167     */
7168    struct LDKCVec_u8Z b;
7169 } LDKC2Tuple_OutPointScriptZ;
7170
7171 /**
7172  * A tuple of 2 elements. See the individual fields for the types contained.
7173  */
7174 typedef struct LDKC2Tuple_u32ScriptZ {
7175    /**
7176     * The element at position 0
7177     */
7178    uint32_t a;
7179    /**
7180     * The element at position 1
7181     */
7182    struct LDKCVec_u8Z b;
7183 } LDKC2Tuple_u32ScriptZ;
7184
7185 /**
7186  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7187  * This corresponds to std::vector in C++
7188  */
7189 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
7190    /**
7191     * The elements in the array.
7192     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7193     */
7194    struct LDKC2Tuple_u32ScriptZ *data;
7195    /**
7196     * The number of elements pointed to by `data`.
7197     */
7198    uintptr_t datalen;
7199 } LDKCVec_C2Tuple_u32ScriptZZ;
7200
7201 /**
7202  * A tuple of 2 elements. See the individual fields for the types contained.
7203  */
7204 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7205    /**
7206     * The element at position 0
7207     */
7208    struct LDKThirtyTwoBytes a;
7209    /**
7210     * The element at position 1
7211     */
7212    struct LDKCVec_C2Tuple_u32ScriptZZ b;
7213 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
7214
7215 /**
7216  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7217  * This corresponds to std::vector in C++
7218  */
7219 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7220    /**
7221     * The elements in the array.
7222     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7223     */
7224    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
7225    /**
7226     * The number of elements pointed to by `data`.
7227     */
7228    uintptr_t datalen;
7229 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
7230
7231 /**
7232  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7233  * This corresponds to std::vector in C++
7234  */
7235 typedef struct LDKCVec_EventZ {
7236    /**
7237     * The elements in the array.
7238     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7239     */
7240    struct LDKEvent *data;
7241    /**
7242     * The number of elements pointed to by `data`.
7243     */
7244    uintptr_t datalen;
7245 } LDKCVec_EventZ;
7246
7247 /**
7248  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7249  * This corresponds to std::vector in C++
7250  */
7251 typedef struct LDKCVec_TransactionZ {
7252    /**
7253     * The elements in the array.
7254     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7255     */
7256    struct LDKTransaction *data;
7257    /**
7258     * The number of elements pointed to by `data`.
7259     */
7260    uintptr_t datalen;
7261 } LDKCVec_TransactionZ;
7262
7263 /**
7264  * A tuple of 2 elements. See the individual fields for the types contained.
7265  */
7266 typedef struct LDKC2Tuple_u32TxOutZ {
7267    /**
7268     * The element at position 0
7269     */
7270    uint32_t a;
7271    /**
7272     * The element at position 1
7273     */
7274    struct LDKTxOut b;
7275 } LDKC2Tuple_u32TxOutZ;
7276
7277 /**
7278  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7279  * This corresponds to std::vector in C++
7280  */
7281 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
7282    /**
7283     * The elements in the array.
7284     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7285     */
7286    struct LDKC2Tuple_u32TxOutZ *data;
7287    /**
7288     * The number of elements pointed to by `data`.
7289     */
7290    uintptr_t datalen;
7291 } LDKCVec_C2Tuple_u32TxOutZZ;
7292
7293 /**
7294  * A tuple of 2 elements. See the individual fields for the types contained.
7295  */
7296 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7297    /**
7298     * The element at position 0
7299     */
7300    struct LDKThirtyTwoBytes a;
7301    /**
7302     * The element at position 1
7303     */
7304    struct LDKCVec_C2Tuple_u32TxOutZZ b;
7305 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
7306
7307 /**
7308  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7309  * This corresponds to std::vector in C++
7310  */
7311 typedef struct LDKCVec_TransactionOutputsZ {
7312    /**
7313     * The elements in the array.
7314     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7315     */
7316    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
7317    /**
7318     * The number of elements pointed to by `data`.
7319     */
7320    uintptr_t datalen;
7321 } LDKCVec_TransactionOutputsZ;
7322
7323 /**
7324  * Details about the balance(s) available for spending once the channel appears on chain.
7325  *
7326  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
7327  * be provided.
7328  */
7329 typedef enum LDKBalance_Tag {
7330    /**
7331     * The channel is not yet closed (or the commitment or closing transaction has not yet
7332     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
7333     * force-closed now.
7334     */
7335    LDKBalance_ClaimableOnChannelClose,
7336    /**
7337     * The channel has been closed, and the given balance is ours but awaiting confirmations until
7338     * we consider it spendable.
7339     */
7340    LDKBalance_ClaimableAwaitingConfirmations,
7341    /**
7342     * The channel has been closed, and the given balance should be ours but awaiting spending
7343     * transaction confirmation. If the spending transaction does not confirm in time, it is
7344     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
7345     *
7346     * Once the spending transaction confirms, before it has reached enough confirmations to be
7347     * considered safe from chain reorganizations, the balance will instead be provided via
7348     * [`Balance::ClaimableAwaitingConfirmations`].
7349     */
7350    LDKBalance_ContentiousClaimable,
7351    /**
7352     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
7353     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
7354     * likely to be claimed by our counterparty before we do.
7355     */
7356    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
7357    /**
7358     * Must be last for serialization purposes
7359     */
7360    LDKBalance_Sentinel,
7361 } LDKBalance_Tag;
7362
7363 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
7364    /**
7365     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7366     * required to do so.
7367     */
7368    uint64_t claimable_amount_satoshis;
7369 } LDKBalance_LDKClaimableOnChannelClose_Body;
7370
7371 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
7372    /**
7373     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
7374     * were spent in broadcasting the transaction.
7375     */
7376    uint64_t claimable_amount_satoshis;
7377    /**
7378     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
7379     * amount.
7380     */
7381    uint32_t confirmation_height;
7382 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
7383
7384 typedef struct LDKBalance_LDKContentiousClaimable_Body {
7385    /**
7386     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7387     * required to do so.
7388     */
7389    uint64_t claimable_amount_satoshis;
7390    /**
7391     * The height at which the counterparty may be able to claim the balance if we have not
7392     * done so.
7393     */
7394    uint32_t timeout_height;
7395 } LDKBalance_LDKContentiousClaimable_Body;
7396
7397 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
7398    /**
7399     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7400     * required to do so.
7401     */
7402    uint64_t claimable_amount_satoshis;
7403    /**
7404     * The height at which we will be able to claim the balance if our counterparty has not
7405     * done so.
7406     */
7407    uint32_t claimable_height;
7408 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
7409
7410 typedef struct MUST_USE_STRUCT LDKBalance {
7411    LDKBalance_Tag tag;
7412    union {
7413       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
7414       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
7415       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
7416       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
7417    };
7418 } LDKBalance;
7419
7420 /**
7421  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7422  * This corresponds to std::vector in C++
7423  */
7424 typedef struct LDKCVec_BalanceZ {
7425    /**
7426     * The elements in the array.
7427     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7428     */
7429    struct LDKBalance *data;
7430    /**
7431     * The number of elements pointed to by `data`.
7432     */
7433    uintptr_t datalen;
7434 } LDKCVec_BalanceZ;
7435
7436 /**
7437  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7438  */
7439 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7440    /**
7441     * A pointer to the contents in the success state.
7442     * Reading from this pointer when `result_ok` is not set is undefined.
7443     */
7444    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
7445    /**
7446     * A pointer to the contents in the error state.
7447     * Reading from this pointer when `result_ok` is set is undefined.
7448     */
7449    struct LDKDecodeError *err;
7450 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
7451
7452 /**
7453  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7454  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7456  */
7457 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7458    /**
7459     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7460     * `err` or `result` depending on the state of `result_ok`.
7461     */
7462    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
7463    /**
7464     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7465     */
7466    bool result_ok;
7467 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
7468
7469 /**
7470  * The contents of CResult_NoneLightningErrorZ
7471  */
7472 typedef union LDKCResult_NoneLightningErrorZPtr {
7473    /**
7474     * Note that this value is always NULL, as there are no contents in the OK variant
7475     */
7476    void *result;
7477    /**
7478     * A pointer to the contents in the error state.
7479     * Reading from this pointer when `result_ok` is set is undefined.
7480     */
7481    struct LDKLightningError *err;
7482 } LDKCResult_NoneLightningErrorZPtr;
7483
7484 /**
7485  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7486  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7488  */
7489 typedef struct LDKCResult_NoneLightningErrorZ {
7490    /**
7491     * The contents of this CResult_NoneLightningErrorZ, accessible via either
7492     * `err` or `result` depending on the state of `result_ok`.
7493     */
7494    union LDKCResult_NoneLightningErrorZPtr contents;
7495    /**
7496     * Whether this CResult_NoneLightningErrorZ represents a success state.
7497     */
7498    bool result_ok;
7499 } LDKCResult_NoneLightningErrorZ;
7500
7501 /**
7502  * A tuple of 2 elements. See the individual fields for the types contained.
7503  */
7504 typedef struct LDKC2Tuple_PublicKeyTypeZ {
7505    /**
7506     * The element at position 0
7507     */
7508    struct LDKPublicKey a;
7509    /**
7510     * The element at position 1
7511     */
7512    struct LDKType b;
7513 } LDKC2Tuple_PublicKeyTypeZ;
7514
7515 /**
7516  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7517  * This corresponds to std::vector in C++
7518  */
7519 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
7520    /**
7521     * The elements in the array.
7522     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7523     */
7524    struct LDKC2Tuple_PublicKeyTypeZ *data;
7525    /**
7526     * The number of elements pointed to by `data`.
7527     */
7528    uintptr_t datalen;
7529 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
7530
7531 /**
7532  * The contents of CResult_boolLightningErrorZ
7533  */
7534 typedef union LDKCResult_boolLightningErrorZPtr {
7535    /**
7536     * A pointer to the contents in the success state.
7537     * Reading from this pointer when `result_ok` is not set is undefined.
7538     */
7539    bool *result;
7540    /**
7541     * A pointer to the contents in the error state.
7542     * Reading from this pointer when `result_ok` is set is undefined.
7543     */
7544    struct LDKLightningError *err;
7545 } LDKCResult_boolLightningErrorZPtr;
7546
7547 /**
7548  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
7549  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7550  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7551  */
7552 typedef struct LDKCResult_boolLightningErrorZ {
7553    /**
7554     * The contents of this CResult_boolLightningErrorZ, accessible via either
7555     * `err` or `result` depending on the state of `result_ok`.
7556     */
7557    union LDKCResult_boolLightningErrorZPtr contents;
7558    /**
7559     * Whether this CResult_boolLightningErrorZ represents a success state.
7560     */
7561    bool result_ok;
7562 } LDKCResult_boolLightningErrorZ;
7563
7564 /**
7565  * A tuple of 3 elements. See the individual fields for the types contained.
7566  */
7567 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7568    /**
7569     * The element at position 0
7570     */
7571    struct LDKChannelAnnouncement a;
7572    /**
7573     * The element at position 1
7574     */
7575    struct LDKChannelUpdate b;
7576    /**
7577     * The element at position 2
7578     */
7579    struct LDKChannelUpdate c;
7580 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
7581
7582 /**
7583  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7584  * This corresponds to std::vector in C++
7585  */
7586 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7587    /**
7588     * The elements in the array.
7589     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7590     */
7591    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
7592    /**
7593     * The number of elements pointed to by `data`.
7594     */
7595    uintptr_t datalen;
7596 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
7597
7598 /**
7599  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7600  * This corresponds to std::vector in C++
7601  */
7602 typedef struct LDKCVec_NodeAnnouncementZ {
7603    /**
7604     * The elements in the array.
7605     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7606     */
7607    struct LDKNodeAnnouncement *data;
7608    /**
7609     * The number of elements pointed to by `data`.
7610     */
7611    uintptr_t datalen;
7612 } LDKCVec_NodeAnnouncementZ;
7613
7614 /**
7615  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7616  * This corresponds to std::vector in C++
7617  */
7618 typedef struct LDKCVec_PublicKeyZ {
7619    /**
7620     * The elements in the array.
7621     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7622     */
7623    struct LDKPublicKey *data;
7624    /**
7625     * The number of elements pointed to by `data`.
7626     */
7627    uintptr_t datalen;
7628 } LDKCVec_PublicKeyZ;
7629
7630
7631
7632 /**
7633  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
7634  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
7635  * descriptor.
7636  */
7637 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
7638    /**
7639     * A pointer to the opaque Rust object.
7640     * Nearly everywhere, inner must be non-null, however in places where
7641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7642     */
7643    LDKnativePeerHandleError *inner;
7644    /**
7645     * Indicates that this is the only struct which contains the same pointer.
7646     * Rust functions which take ownership of an object provided via an argument require
7647     * this to be true and invalidate the object pointed to by inner.
7648     */
7649    bool is_owned;
7650 } LDKPeerHandleError;
7651
7652 /**
7653  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
7654  */
7655 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
7656    /**
7657     * A pointer to the contents in the success state.
7658     * Reading from this pointer when `result_ok` is not set is undefined.
7659     */
7660    struct LDKCVec_u8Z *result;
7661    /**
7662     * A pointer to the contents in the error state.
7663     * Reading from this pointer when `result_ok` is set is undefined.
7664     */
7665    struct LDKPeerHandleError *err;
7666 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
7667
7668 /**
7669  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7670  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7672  */
7673 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
7674    /**
7675     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7676     * `err` or `result` depending on the state of `result_ok`.
7677     */
7678    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
7679    /**
7680     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7681     */
7682    bool result_ok;
7683 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
7684
7685 /**
7686  * The contents of CResult_NonePeerHandleErrorZ
7687  */
7688 typedef union LDKCResult_NonePeerHandleErrorZPtr {
7689    /**
7690     * Note that this value is always NULL, as there are no contents in the OK variant
7691     */
7692    void *result;
7693    /**
7694     * A pointer to the contents in the error state.
7695     * Reading from this pointer when `result_ok` is set is undefined.
7696     */
7697    struct LDKPeerHandleError *err;
7698 } LDKCResult_NonePeerHandleErrorZPtr;
7699
7700 /**
7701  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7702  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7704  */
7705 typedef struct LDKCResult_NonePeerHandleErrorZ {
7706    /**
7707     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7708     * `err` or `result` depending on the state of `result_ok`.
7709     */
7710    union LDKCResult_NonePeerHandleErrorZPtr contents;
7711    /**
7712     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
7713     */
7714    bool result_ok;
7715 } LDKCResult_NonePeerHandleErrorZ;
7716
7717 /**
7718  * The contents of CResult_boolPeerHandleErrorZ
7719  */
7720 typedef union LDKCResult_boolPeerHandleErrorZPtr {
7721    /**
7722     * A pointer to the contents in the success state.
7723     * Reading from this pointer when `result_ok` is not set is undefined.
7724     */
7725    bool *result;
7726    /**
7727     * A pointer to the contents in the error state.
7728     * Reading from this pointer when `result_ok` is set is undefined.
7729     */
7730    struct LDKPeerHandleError *err;
7731 } LDKCResult_boolPeerHandleErrorZPtr;
7732
7733 /**
7734  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7735  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7737  */
7738 typedef struct LDKCResult_boolPeerHandleErrorZ {
7739    /**
7740     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7741     * `err` or `result` depending on the state of `result_ok`.
7742     */
7743    union LDKCResult_boolPeerHandleErrorZPtr contents;
7744    /**
7745     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
7746     */
7747    bool result_ok;
7748 } LDKCResult_boolPeerHandleErrorZ;
7749
7750
7751
7752 /**
7753  * Represents the compressed public key of a node
7754  */
7755 typedef struct MUST_USE_STRUCT LDKNodeId {
7756    /**
7757     * A pointer to the opaque Rust object.
7758     * Nearly everywhere, inner must be non-null, however in places where
7759     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7760     */
7761    LDKnativeNodeId *inner;
7762    /**
7763     * Indicates that this is the only struct which contains the same pointer.
7764     * Rust functions which take ownership of an object provided via an argument require
7765     * this to be true and invalidate the object pointed to by inner.
7766     */
7767    bool is_owned;
7768 } LDKNodeId;
7769
7770 /**
7771  * The contents of CResult_NodeIdDecodeErrorZ
7772  */
7773 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
7774    /**
7775     * A pointer to the contents in the success state.
7776     * Reading from this pointer when `result_ok` is not set is undefined.
7777     */
7778    struct LDKNodeId *result;
7779    /**
7780     * A pointer to the contents in the error state.
7781     * Reading from this pointer when `result_ok` is set is undefined.
7782     */
7783    struct LDKDecodeError *err;
7784 } LDKCResult_NodeIdDecodeErrorZPtr;
7785
7786 /**
7787  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7788  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7789  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7790  */
7791 typedef struct LDKCResult_NodeIdDecodeErrorZ {
7792    /**
7793     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7794     * `err` or `result` depending on the state of `result_ok`.
7795     */
7796    union LDKCResult_NodeIdDecodeErrorZPtr contents;
7797    /**
7798     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7799     */
7800    bool result_ok;
7801 } LDKCResult_NodeIdDecodeErrorZ;
7802
7803 /**
7804  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7805  */
7806 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
7807    /**
7808     * A pointer to the contents in the success state.
7809     * Reading from this pointer when `result_ok` is not set is undefined.
7810     */
7811    struct LDKCOption_NetworkUpdateZ *result;
7812    /**
7813     * A pointer to the contents in the error state.
7814     * Reading from this pointer when `result_ok` is set is undefined.
7815     */
7816    struct LDKDecodeError *err;
7817 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
7818
7819 /**
7820  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7821  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7822  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7823  */
7824 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
7825    /**
7826     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7827     * `err` or `result` depending on the state of `result_ok`.
7828     */
7829    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
7830    /**
7831     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7832     */
7833    bool result_ok;
7834 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
7835
7836 /**
7837  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7838  * UTXOs.
7839  */
7840 typedef struct LDKAccess {
7841    /**
7842     * An opaque pointer which is passed to your function implementations as an argument.
7843     * This has no meaning in the LDK, and can be NULL or any other value.
7844     */
7845    void *this_arg;
7846    /**
7847     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7848     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7849     * is unknown.
7850     *
7851     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7852     */
7853    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7854    /**
7855     * Frees any resources associated with this object given its this_arg pointer.
7856     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7857     */
7858    void (*free)(void *this_arg);
7859 } LDKAccess;
7860
7861 /**
7862  * An enum which can either contain a crate::lightning::chain::Access or not
7863  */
7864 typedef enum LDKCOption_AccessZ_Tag {
7865    /**
7866     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7867     */
7868    LDKCOption_AccessZ_Some,
7869    /**
7870     * When we're in this state, this COption_AccessZ contains nothing
7871     */
7872    LDKCOption_AccessZ_None,
7873    /**
7874     * Must be last for serialization purposes
7875     */
7876    LDKCOption_AccessZ_Sentinel,
7877 } LDKCOption_AccessZ_Tag;
7878
7879 typedef struct LDKCOption_AccessZ {
7880    LDKCOption_AccessZ_Tag tag;
7881    union {
7882       struct {
7883          struct LDKAccess some;
7884       };
7885    };
7886 } LDKCOption_AccessZ;
7887
7888
7889
7890 /**
7891  * Details about one direction of a channel. Received
7892  * within a channel update.
7893  */
7894 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
7895    /**
7896     * A pointer to the opaque Rust object.
7897     * Nearly everywhere, inner must be non-null, however in places where
7898     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7899     */
7900    LDKnativeDirectionalChannelInfo *inner;
7901    /**
7902     * Indicates that this is the only struct which contains the same pointer.
7903     * Rust functions which take ownership of an object provided via an argument require
7904     * this to be true and invalidate the object pointed to by inner.
7905     */
7906    bool is_owned;
7907 } LDKDirectionalChannelInfo;
7908
7909 /**
7910  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7911  */
7912 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
7913    /**
7914     * A pointer to the contents in the success state.
7915     * Reading from this pointer when `result_ok` is not set is undefined.
7916     */
7917    struct LDKDirectionalChannelInfo *result;
7918    /**
7919     * A pointer to the contents in the error state.
7920     * Reading from this pointer when `result_ok` is set is undefined.
7921     */
7922    struct LDKDecodeError *err;
7923 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
7924
7925 /**
7926  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7927  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929  */
7930 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
7931    /**
7932     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7933     * `err` or `result` depending on the state of `result_ok`.
7934     */
7935    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
7936    /**
7937     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7938     */
7939    bool result_ok;
7940 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
7941
7942
7943
7944 /**
7945  * Details about a channel (both directions).
7946  * Received within a channel announcement.
7947  */
7948 typedef struct MUST_USE_STRUCT LDKChannelInfo {
7949    /**
7950     * A pointer to the opaque Rust object.
7951     * Nearly everywhere, inner must be non-null, however in places where
7952     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7953     */
7954    LDKnativeChannelInfo *inner;
7955    /**
7956     * Indicates that this is the only struct which contains the same pointer.
7957     * Rust functions which take ownership of an object provided via an argument require
7958     * this to be true and invalidate the object pointed to by inner.
7959     */
7960    bool is_owned;
7961 } LDKChannelInfo;
7962
7963 /**
7964  * The contents of CResult_ChannelInfoDecodeErrorZ
7965  */
7966 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
7967    /**
7968     * A pointer to the contents in the success state.
7969     * Reading from this pointer when `result_ok` is not set is undefined.
7970     */
7971    struct LDKChannelInfo *result;
7972    /**
7973     * A pointer to the contents in the error state.
7974     * Reading from this pointer when `result_ok` is set is undefined.
7975     */
7976    struct LDKDecodeError *err;
7977 } LDKCResult_ChannelInfoDecodeErrorZPtr;
7978
7979 /**
7980  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7981  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7982  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7983  */
7984 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
7985    /**
7986     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7987     * `err` or `result` depending on the state of `result_ok`.
7988     */
7989    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7990    /**
7991     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7992     */
7993    bool result_ok;
7994 } LDKCResult_ChannelInfoDecodeErrorZ;
7995
7996
7997
7998 /**
7999  * Fees for routing via a given channel or a node
8000  */
8001 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8002    /**
8003     * A pointer to the opaque Rust object.
8004     * Nearly everywhere, inner must be non-null, however in places where
8005     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8006     */
8007    LDKnativeRoutingFees *inner;
8008    /**
8009     * Indicates that this is the only struct which contains the same pointer.
8010     * Rust functions which take ownership of an object provided via an argument require
8011     * this to be true and invalidate the object pointed to by inner.
8012     */
8013    bool is_owned;
8014 } LDKRoutingFees;
8015
8016 /**
8017  * The contents of CResult_RoutingFeesDecodeErrorZ
8018  */
8019 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8020    /**
8021     * A pointer to the contents in the success state.
8022     * Reading from this pointer when `result_ok` is not set is undefined.
8023     */
8024    struct LDKRoutingFees *result;
8025    /**
8026     * A pointer to the contents in the error state.
8027     * Reading from this pointer when `result_ok` is set is undefined.
8028     */
8029    struct LDKDecodeError *err;
8030 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8031
8032 /**
8033  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8034  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8036  */
8037 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8038    /**
8039     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8040     * `err` or `result` depending on the state of `result_ok`.
8041     */
8042    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8043    /**
8044     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8045     */
8046    bool result_ok;
8047 } LDKCResult_RoutingFeesDecodeErrorZ;
8048
8049
8050
8051 /**
8052  * Information received in the latest node_announcement from this node.
8053  */
8054 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8055    /**
8056     * A pointer to the opaque Rust object.
8057     * Nearly everywhere, inner must be non-null, however in places where
8058     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8059     */
8060    LDKnativeNodeAnnouncementInfo *inner;
8061    /**
8062     * Indicates that this is the only struct which contains the same pointer.
8063     * Rust functions which take ownership of an object provided via an argument require
8064     * this to be true and invalidate the object pointed to by inner.
8065     */
8066    bool is_owned;
8067 } LDKNodeAnnouncementInfo;
8068
8069 /**
8070  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8071  */
8072 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8073    /**
8074     * A pointer to the contents in the success state.
8075     * Reading from this pointer when `result_ok` is not set is undefined.
8076     */
8077    struct LDKNodeAnnouncementInfo *result;
8078    /**
8079     * A pointer to the contents in the error state.
8080     * Reading from this pointer when `result_ok` is set is undefined.
8081     */
8082    struct LDKDecodeError *err;
8083 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8084
8085 /**
8086  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8087  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8088  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8089  */
8090 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8091    /**
8092     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8093     * `err` or `result` depending on the state of `result_ok`.
8094     */
8095    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8096    /**
8097     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8098     */
8099    bool result_ok;
8100 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8101
8102 /**
8103  * A dynamically-allocated array of u64s of arbitrary size.
8104  * This corresponds to std::vector in C++
8105  */
8106 typedef struct LDKCVec_u64Z {
8107    /**
8108     * The elements in the array.
8109     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8110     */
8111    uint64_t *data;
8112    /**
8113     * The number of elements pointed to by `data`.
8114     */
8115    uintptr_t datalen;
8116 } LDKCVec_u64Z;
8117
8118
8119
8120 /**
8121  * Details about a node in the network, known from the network announcement.
8122  */
8123 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8124    /**
8125     * A pointer to the opaque Rust object.
8126     * Nearly everywhere, inner must be non-null, however in places where
8127     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8128     */
8129    LDKnativeNodeInfo *inner;
8130    /**
8131     * Indicates that this is the only struct which contains the same pointer.
8132     * Rust functions which take ownership of an object provided via an argument require
8133     * this to be true and invalidate the object pointed to by inner.
8134     */
8135    bool is_owned;
8136 } LDKNodeInfo;
8137
8138 /**
8139  * The contents of CResult_NodeInfoDecodeErrorZ
8140  */
8141 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
8142    /**
8143     * A pointer to the contents in the success state.
8144     * Reading from this pointer when `result_ok` is not set is undefined.
8145     */
8146    struct LDKNodeInfo *result;
8147    /**
8148     * A pointer to the contents in the error state.
8149     * Reading from this pointer when `result_ok` is set is undefined.
8150     */
8151    struct LDKDecodeError *err;
8152 } LDKCResult_NodeInfoDecodeErrorZPtr;
8153
8154 /**
8155  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8156  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8157  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8158  */
8159 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
8160    /**
8161     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8162     * `err` or `result` depending on the state of `result_ok`.
8163     */
8164    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
8165    /**
8166     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8167     */
8168    bool result_ok;
8169 } LDKCResult_NodeInfoDecodeErrorZ;
8170
8171
8172
8173 /**
8174  * Represents the network as nodes and channels between them
8175  */
8176 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
8177    /**
8178     * A pointer to the opaque Rust object.
8179     * Nearly everywhere, inner must be non-null, however in places where
8180     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8181     */
8182    LDKnativeNetworkGraph *inner;
8183    /**
8184     * Indicates that this is the only struct which contains the same pointer.
8185     * Rust functions which take ownership of an object provided via an argument require
8186     * this to be true and invalidate the object pointed to by inner.
8187     */
8188    bool is_owned;
8189 } LDKNetworkGraph;
8190
8191 /**
8192  * The contents of CResult_NetworkGraphDecodeErrorZ
8193  */
8194 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
8195    /**
8196     * A pointer to the contents in the success state.
8197     * Reading from this pointer when `result_ok` is not set is undefined.
8198     */
8199    struct LDKNetworkGraph *result;
8200    /**
8201     * A pointer to the contents in the error state.
8202     * Reading from this pointer when `result_ok` is set is undefined.
8203     */
8204    struct LDKDecodeError *err;
8205 } LDKCResult_NetworkGraphDecodeErrorZPtr;
8206
8207 /**
8208  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8209  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8210  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8211  */
8212 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
8213    /**
8214     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8215     * `err` or `result` depending on the state of `result_ok`.
8216     */
8217    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
8218    /**
8219     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8220     */
8221    bool result_ok;
8222 } LDKCResult_NetworkGraphDecodeErrorZ;
8223
8224 /**
8225  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8226  */
8227 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
8228    /**
8229     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8230     */
8231    LDKCOption_CVec_NetAddressZZ_Some,
8232    /**
8233     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8234     */
8235    LDKCOption_CVec_NetAddressZZ_None,
8236    /**
8237     * Must be last for serialization purposes
8238     */
8239    LDKCOption_CVec_NetAddressZZ_Sentinel,
8240 } LDKCOption_CVec_NetAddressZZ_Tag;
8241
8242 typedef struct LDKCOption_CVec_NetAddressZZ {
8243    LDKCOption_CVec_NetAddressZZ_Tag tag;
8244    union {
8245       struct {
8246          struct LDKCVec_NetAddressZ some;
8247       };
8248    };
8249 } LDKCOption_CVec_NetAddressZZ;
8250
8251 /**
8252  * The contents of CResult_NetAddressDecodeErrorZ
8253  */
8254 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
8255    /**
8256     * A pointer to the contents in the success state.
8257     * Reading from this pointer when `result_ok` is not set is undefined.
8258     */
8259    struct LDKNetAddress *result;
8260    /**
8261     * A pointer to the contents in the error state.
8262     * Reading from this pointer when `result_ok` is set is undefined.
8263     */
8264    struct LDKDecodeError *err;
8265 } LDKCResult_NetAddressDecodeErrorZPtr;
8266
8267 /**
8268  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8269  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8270  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8271  */
8272 typedef struct LDKCResult_NetAddressDecodeErrorZ {
8273    /**
8274     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8275     * `err` or `result` depending on the state of `result_ok`.
8276     */
8277    union LDKCResult_NetAddressDecodeErrorZPtr contents;
8278    /**
8279     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8280     */
8281    bool result_ok;
8282 } LDKCResult_NetAddressDecodeErrorZ;
8283
8284
8285
8286 /**
8287  * An update_add_htlc message to be sent or received from a peer
8288  */
8289 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
8290    /**
8291     * A pointer to the opaque Rust object.
8292     * Nearly everywhere, inner must be non-null, however in places where
8293     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8294     */
8295    LDKnativeUpdateAddHTLC *inner;
8296    /**
8297     * Indicates that this is the only struct which contains the same pointer.
8298     * Rust functions which take ownership of an object provided via an argument require
8299     * this to be true and invalidate the object pointed to by inner.
8300     */
8301    bool is_owned;
8302 } LDKUpdateAddHTLC;
8303
8304 /**
8305  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8306  * This corresponds to std::vector in C++
8307  */
8308 typedef struct LDKCVec_UpdateAddHTLCZ {
8309    /**
8310     * The elements in the array.
8311     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8312     */
8313    struct LDKUpdateAddHTLC *data;
8314    /**
8315     * The number of elements pointed to by `data`.
8316     */
8317    uintptr_t datalen;
8318 } LDKCVec_UpdateAddHTLCZ;
8319
8320
8321
8322 /**
8323  * An update_fulfill_htlc message to be sent or received from a peer
8324  */
8325 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
8326    /**
8327     * A pointer to the opaque Rust object.
8328     * Nearly everywhere, inner must be non-null, however in places where
8329     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8330     */
8331    LDKnativeUpdateFulfillHTLC *inner;
8332    /**
8333     * Indicates that this is the only struct which contains the same pointer.
8334     * Rust functions which take ownership of an object provided via an argument require
8335     * this to be true and invalidate the object pointed to by inner.
8336     */
8337    bool is_owned;
8338 } LDKUpdateFulfillHTLC;
8339
8340 /**
8341  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8342  * This corresponds to std::vector in C++
8343  */
8344 typedef struct LDKCVec_UpdateFulfillHTLCZ {
8345    /**
8346     * The elements in the array.
8347     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8348     */
8349    struct LDKUpdateFulfillHTLC *data;
8350    /**
8351     * The number of elements pointed to by `data`.
8352     */
8353    uintptr_t datalen;
8354 } LDKCVec_UpdateFulfillHTLCZ;
8355
8356
8357
8358 /**
8359  * An update_fail_htlc message to be sent or received from a peer
8360  */
8361 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
8362    /**
8363     * A pointer to the opaque Rust object.
8364     * Nearly everywhere, inner must be non-null, however in places where
8365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8366     */
8367    LDKnativeUpdateFailHTLC *inner;
8368    /**
8369     * Indicates that this is the only struct which contains the same pointer.
8370     * Rust functions which take ownership of an object provided via an argument require
8371     * this to be true and invalidate the object pointed to by inner.
8372     */
8373    bool is_owned;
8374 } LDKUpdateFailHTLC;
8375
8376 /**
8377  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8378  * This corresponds to std::vector in C++
8379  */
8380 typedef struct LDKCVec_UpdateFailHTLCZ {
8381    /**
8382     * The elements in the array.
8383     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8384     */
8385    struct LDKUpdateFailHTLC *data;
8386    /**
8387     * The number of elements pointed to by `data`.
8388     */
8389    uintptr_t datalen;
8390 } LDKCVec_UpdateFailHTLCZ;
8391
8392
8393
8394 /**
8395  * An update_fail_malformed_htlc message to be sent or received from a peer
8396  */
8397 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
8398    /**
8399     * A pointer to the opaque Rust object.
8400     * Nearly everywhere, inner must be non-null, however in places where
8401     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8402     */
8403    LDKnativeUpdateFailMalformedHTLC *inner;
8404    /**
8405     * Indicates that this is the only struct which contains the same pointer.
8406     * Rust functions which take ownership of an object provided via an argument require
8407     * this to be true and invalidate the object pointed to by inner.
8408     */
8409    bool is_owned;
8410 } LDKUpdateFailMalformedHTLC;
8411
8412 /**
8413  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8414  * This corresponds to std::vector in C++
8415  */
8416 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
8417    /**
8418     * The elements in the array.
8419     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8420     */
8421    struct LDKUpdateFailMalformedHTLC *data;
8422    /**
8423     * The number of elements pointed to by `data`.
8424     */
8425    uintptr_t datalen;
8426 } LDKCVec_UpdateFailMalformedHTLCZ;
8427
8428 /**
8429  * The contents of CResult_AcceptChannelDecodeErrorZ
8430  */
8431 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
8432    /**
8433     * A pointer to the contents in the success state.
8434     * Reading from this pointer when `result_ok` is not set is undefined.
8435     */
8436    struct LDKAcceptChannel *result;
8437    /**
8438     * A pointer to the contents in the error state.
8439     * Reading from this pointer when `result_ok` is set is undefined.
8440     */
8441    struct LDKDecodeError *err;
8442 } LDKCResult_AcceptChannelDecodeErrorZPtr;
8443
8444 /**
8445  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8446  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8448  */
8449 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
8450    /**
8451     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8452     * `err` or `result` depending on the state of `result_ok`.
8453     */
8454    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
8455    /**
8456     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8457     */
8458    bool result_ok;
8459 } LDKCResult_AcceptChannelDecodeErrorZ;
8460
8461 /**
8462  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8463  */
8464 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
8465    /**
8466     * A pointer to the contents in the success state.
8467     * Reading from this pointer when `result_ok` is not set is undefined.
8468     */
8469    struct LDKAnnouncementSignatures *result;
8470    /**
8471     * A pointer to the contents in the error state.
8472     * Reading from this pointer when `result_ok` is set is undefined.
8473     */
8474    struct LDKDecodeError *err;
8475 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
8476
8477 /**
8478  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8479  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8480  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8481  */
8482 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
8483    /**
8484     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8485     * `err` or `result` depending on the state of `result_ok`.
8486     */
8487    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
8488    /**
8489     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8490     */
8491    bool result_ok;
8492 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
8493
8494 /**
8495  * The contents of CResult_ChannelReestablishDecodeErrorZ
8496  */
8497 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
8498    /**
8499     * A pointer to the contents in the success state.
8500     * Reading from this pointer when `result_ok` is not set is undefined.
8501     */
8502    struct LDKChannelReestablish *result;
8503    /**
8504     * A pointer to the contents in the error state.
8505     * Reading from this pointer when `result_ok` is set is undefined.
8506     */
8507    struct LDKDecodeError *err;
8508 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
8509
8510 /**
8511  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8512  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8513  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8514  */
8515 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
8516    /**
8517     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8518     * `err` or `result` depending on the state of `result_ok`.
8519     */
8520    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
8521    /**
8522     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8523     */
8524    bool result_ok;
8525 } LDKCResult_ChannelReestablishDecodeErrorZ;
8526
8527 /**
8528  * The contents of CResult_ClosingSignedDecodeErrorZ
8529  */
8530 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
8531    /**
8532     * A pointer to the contents in the success state.
8533     * Reading from this pointer when `result_ok` is not set is undefined.
8534     */
8535    struct LDKClosingSigned *result;
8536    /**
8537     * A pointer to the contents in the error state.
8538     * Reading from this pointer when `result_ok` is set is undefined.
8539     */
8540    struct LDKDecodeError *err;
8541 } LDKCResult_ClosingSignedDecodeErrorZPtr;
8542
8543 /**
8544  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8545  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8547  */
8548 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
8549    /**
8550     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8551     * `err` or `result` depending on the state of `result_ok`.
8552     */
8553    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
8554    /**
8555     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8556     */
8557    bool result_ok;
8558 } LDKCResult_ClosingSignedDecodeErrorZ;
8559
8560
8561
8562 /**
8563  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
8564  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
8565  * to use.
8566  */
8567 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
8568    /**
8569     * A pointer to the opaque Rust object.
8570     * Nearly everywhere, inner must be non-null, however in places where
8571     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8572     */
8573    LDKnativeClosingSignedFeeRange *inner;
8574    /**
8575     * Indicates that this is the only struct which contains the same pointer.
8576     * Rust functions which take ownership of an object provided via an argument require
8577     * this to be true and invalidate the object pointed to by inner.
8578     */
8579    bool is_owned;
8580 } LDKClosingSignedFeeRange;
8581
8582 /**
8583  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
8584  */
8585 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8586    /**
8587     * A pointer to the contents in the success state.
8588     * Reading from this pointer when `result_ok` is not set is undefined.
8589     */
8590    struct LDKClosingSignedFeeRange *result;
8591    /**
8592     * A pointer to the contents in the error state.
8593     * Reading from this pointer when `result_ok` is set is undefined.
8594     */
8595    struct LDKDecodeError *err;
8596 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
8597
8598 /**
8599  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
8600  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8601  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8602  */
8603 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
8604    /**
8605     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8606     * `err` or `result` depending on the state of `result_ok`.
8607     */
8608    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
8609    /**
8610     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8611     */
8612    bool result_ok;
8613 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
8614
8615
8616
8617 /**
8618  * A commitment_signed message to be sent or received from a peer
8619  */
8620 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
8621    /**
8622     * A pointer to the opaque Rust object.
8623     * Nearly everywhere, inner must be non-null, however in places where
8624     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8625     */
8626    LDKnativeCommitmentSigned *inner;
8627    /**
8628     * Indicates that this is the only struct which contains the same pointer.
8629     * Rust functions which take ownership of an object provided via an argument require
8630     * this to be true and invalidate the object pointed to by inner.
8631     */
8632    bool is_owned;
8633 } LDKCommitmentSigned;
8634
8635 /**
8636  * The contents of CResult_CommitmentSignedDecodeErrorZ
8637  */
8638 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
8639    /**
8640     * A pointer to the contents in the success state.
8641     * Reading from this pointer when `result_ok` is not set is undefined.
8642     */
8643    struct LDKCommitmentSigned *result;
8644    /**
8645     * A pointer to the contents in the error state.
8646     * Reading from this pointer when `result_ok` is set is undefined.
8647     */
8648    struct LDKDecodeError *err;
8649 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
8650
8651 /**
8652  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8653  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8654  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8655  */
8656 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
8657    /**
8658     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8659     * `err` or `result` depending on the state of `result_ok`.
8660     */
8661    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
8662    /**
8663     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8664     */
8665    bool result_ok;
8666 } LDKCResult_CommitmentSignedDecodeErrorZ;
8667
8668 /**
8669  * The contents of CResult_FundingCreatedDecodeErrorZ
8670  */
8671 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
8672    /**
8673     * A pointer to the contents in the success state.
8674     * Reading from this pointer when `result_ok` is not set is undefined.
8675     */
8676    struct LDKFundingCreated *result;
8677    /**
8678     * A pointer to the contents in the error state.
8679     * Reading from this pointer when `result_ok` is set is undefined.
8680     */
8681    struct LDKDecodeError *err;
8682 } LDKCResult_FundingCreatedDecodeErrorZPtr;
8683
8684 /**
8685  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8686  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8687  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8688  */
8689 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
8690    /**
8691     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8692     * `err` or `result` depending on the state of `result_ok`.
8693     */
8694    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
8695    /**
8696     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8697     */
8698    bool result_ok;
8699 } LDKCResult_FundingCreatedDecodeErrorZ;
8700
8701 /**
8702  * The contents of CResult_FundingSignedDecodeErrorZ
8703  */
8704 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
8705    /**
8706     * A pointer to the contents in the success state.
8707     * Reading from this pointer when `result_ok` is not set is undefined.
8708     */
8709    struct LDKFundingSigned *result;
8710    /**
8711     * A pointer to the contents in the error state.
8712     * Reading from this pointer when `result_ok` is set is undefined.
8713     */
8714    struct LDKDecodeError *err;
8715 } LDKCResult_FundingSignedDecodeErrorZPtr;
8716
8717 /**
8718  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8719  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8721  */
8722 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
8723    /**
8724     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8725     * `err` or `result` depending on the state of `result_ok`.
8726     */
8727    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
8728    /**
8729     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8730     */
8731    bool result_ok;
8732 } LDKCResult_FundingSignedDecodeErrorZ;
8733
8734 /**
8735  * The contents of CResult_FundingLockedDecodeErrorZ
8736  */
8737 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
8738    /**
8739     * A pointer to the contents in the success state.
8740     * Reading from this pointer when `result_ok` is not set is undefined.
8741     */
8742    struct LDKFundingLocked *result;
8743    /**
8744     * A pointer to the contents in the error state.
8745     * Reading from this pointer when `result_ok` is set is undefined.
8746     */
8747    struct LDKDecodeError *err;
8748 } LDKCResult_FundingLockedDecodeErrorZPtr;
8749
8750 /**
8751  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8752  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8753  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8754  */
8755 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
8756    /**
8757     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8758     * `err` or `result` depending on the state of `result_ok`.
8759     */
8760    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
8761    /**
8762     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8763     */
8764    bool result_ok;
8765 } LDKCResult_FundingLockedDecodeErrorZ;
8766
8767
8768
8769 /**
8770  * An init message to be sent or received from a peer
8771  */
8772 typedef struct MUST_USE_STRUCT LDKInit {
8773    /**
8774     * A pointer to the opaque Rust object.
8775     * Nearly everywhere, inner must be non-null, however in places where
8776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8777     */
8778    LDKnativeInit *inner;
8779    /**
8780     * Indicates that this is the only struct which contains the same pointer.
8781     * Rust functions which take ownership of an object provided via an argument require
8782     * this to be true and invalidate the object pointed to by inner.
8783     */
8784    bool is_owned;
8785 } LDKInit;
8786
8787 /**
8788  * The contents of CResult_InitDecodeErrorZ
8789  */
8790 typedef union LDKCResult_InitDecodeErrorZPtr {
8791    /**
8792     * A pointer to the contents in the success state.
8793     * Reading from this pointer when `result_ok` is not set is undefined.
8794     */
8795    struct LDKInit *result;
8796    /**
8797     * A pointer to the contents in the error state.
8798     * Reading from this pointer when `result_ok` is set is undefined.
8799     */
8800    struct LDKDecodeError *err;
8801 } LDKCResult_InitDecodeErrorZPtr;
8802
8803 /**
8804  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8805  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8807  */
8808 typedef struct LDKCResult_InitDecodeErrorZ {
8809    /**
8810     * The contents of this CResult_InitDecodeErrorZ, accessible via either
8811     * `err` or `result` depending on the state of `result_ok`.
8812     */
8813    union LDKCResult_InitDecodeErrorZPtr contents;
8814    /**
8815     * Whether this CResult_InitDecodeErrorZ represents a success state.
8816     */
8817    bool result_ok;
8818 } LDKCResult_InitDecodeErrorZ;
8819
8820 /**
8821  * The contents of CResult_OpenChannelDecodeErrorZ
8822  */
8823 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
8824    /**
8825     * A pointer to the contents in the success state.
8826     * Reading from this pointer when `result_ok` is not set is undefined.
8827     */
8828    struct LDKOpenChannel *result;
8829    /**
8830     * A pointer to the contents in the error state.
8831     * Reading from this pointer when `result_ok` is set is undefined.
8832     */
8833    struct LDKDecodeError *err;
8834 } LDKCResult_OpenChannelDecodeErrorZPtr;
8835
8836 /**
8837  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8838  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8840  */
8841 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
8842    /**
8843     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8844     * `err` or `result` depending on the state of `result_ok`.
8845     */
8846    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
8847    /**
8848     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8849     */
8850    bool result_ok;
8851 } LDKCResult_OpenChannelDecodeErrorZ;
8852
8853 /**
8854  * The contents of CResult_RevokeAndACKDecodeErrorZ
8855  */
8856 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
8857    /**
8858     * A pointer to the contents in the success state.
8859     * Reading from this pointer when `result_ok` is not set is undefined.
8860     */
8861    struct LDKRevokeAndACK *result;
8862    /**
8863     * A pointer to the contents in the error state.
8864     * Reading from this pointer when `result_ok` is set is undefined.
8865     */
8866    struct LDKDecodeError *err;
8867 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
8868
8869 /**
8870  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
8871  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
8872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8873  */
8874 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
8875    /**
8876     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
8877     * `err` or `result` depending on the state of `result_ok`.
8878     */
8879    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
8880    /**
8881     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
8882     */
8883    bool result_ok;
8884 } LDKCResult_RevokeAndACKDecodeErrorZ;
8885
8886 /**
8887  * The contents of CResult_ShutdownDecodeErrorZ
8888  */
8889 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
8890    /**
8891     * A pointer to the contents in the success state.
8892     * Reading from this pointer when `result_ok` is not set is undefined.
8893     */
8894    struct LDKShutdown *result;
8895    /**
8896     * A pointer to the contents in the error state.
8897     * Reading from this pointer when `result_ok` is set is undefined.
8898     */
8899    struct LDKDecodeError *err;
8900 } LDKCResult_ShutdownDecodeErrorZPtr;
8901
8902 /**
8903  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
8904  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
8905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8906  */
8907 typedef struct LDKCResult_ShutdownDecodeErrorZ {
8908    /**
8909     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
8910     * `err` or `result` depending on the state of `result_ok`.
8911     */
8912    union LDKCResult_ShutdownDecodeErrorZPtr contents;
8913    /**
8914     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
8915     */
8916    bool result_ok;
8917 } LDKCResult_ShutdownDecodeErrorZ;
8918
8919 /**
8920  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
8921  */
8922 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
8923    /**
8924     * A pointer to the contents in the success state.
8925     * Reading from this pointer when `result_ok` is not set is undefined.
8926     */
8927    struct LDKUpdateFailHTLC *result;
8928    /**
8929     * A pointer to the contents in the error state.
8930     * Reading from this pointer when `result_ok` is set is undefined.
8931     */
8932    struct LDKDecodeError *err;
8933 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
8934
8935 /**
8936  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
8937  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8939  */
8940 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
8941    /**
8942     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
8943     * `err` or `result` depending on the state of `result_ok`.
8944     */
8945    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
8946    /**
8947     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
8948     */
8949    bool result_ok;
8950 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
8951
8952 /**
8953  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
8954  */
8955 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
8956    /**
8957     * A pointer to the contents in the success state.
8958     * Reading from this pointer when `result_ok` is not set is undefined.
8959     */
8960    struct LDKUpdateFailMalformedHTLC *result;
8961    /**
8962     * A pointer to the contents in the error state.
8963     * Reading from this pointer when `result_ok` is set is undefined.
8964     */
8965    struct LDKDecodeError *err;
8966 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
8967
8968 /**
8969  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
8970  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8972  */
8973 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
8974    /**
8975     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
8976     * `err` or `result` depending on the state of `result_ok`.
8977     */
8978    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
8979    /**
8980     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
8981     */
8982    bool result_ok;
8983 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
8984
8985
8986
8987 /**
8988  * An update_fee message to be sent or received from a peer
8989  */
8990 typedef struct MUST_USE_STRUCT LDKUpdateFee {
8991    /**
8992     * A pointer to the opaque Rust object.
8993     * Nearly everywhere, inner must be non-null, however in places where
8994     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8995     */
8996    LDKnativeUpdateFee *inner;
8997    /**
8998     * Indicates that this is the only struct which contains the same pointer.
8999     * Rust functions which take ownership of an object provided via an argument require
9000     * this to be true and invalidate the object pointed to by inner.
9001     */
9002    bool is_owned;
9003 } LDKUpdateFee;
9004
9005 /**
9006  * The contents of CResult_UpdateFeeDecodeErrorZ
9007  */
9008 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9009    /**
9010     * A pointer to the contents in the success state.
9011     * Reading from this pointer when `result_ok` is not set is undefined.
9012     */
9013    struct LDKUpdateFee *result;
9014    /**
9015     * A pointer to the contents in the error state.
9016     * Reading from this pointer when `result_ok` is set is undefined.
9017     */
9018    struct LDKDecodeError *err;
9019 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9020
9021 /**
9022  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9023  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9024  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9025  */
9026 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9027    /**
9028     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9029     * `err` or `result` depending on the state of `result_ok`.
9030     */
9031    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9032    /**
9033     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9034     */
9035    bool result_ok;
9036 } LDKCResult_UpdateFeeDecodeErrorZ;
9037
9038 /**
9039  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9040  */
9041 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9042    /**
9043     * A pointer to the contents in the success state.
9044     * Reading from this pointer when `result_ok` is not set is undefined.
9045     */
9046    struct LDKUpdateFulfillHTLC *result;
9047    /**
9048     * A pointer to the contents in the error state.
9049     * Reading from this pointer when `result_ok` is set is undefined.
9050     */
9051    struct LDKDecodeError *err;
9052 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9053
9054 /**
9055  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9056  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9057  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9058  */
9059 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9060    /**
9061     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9062     * `err` or `result` depending on the state of `result_ok`.
9063     */
9064    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9065    /**
9066     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9067     */
9068    bool result_ok;
9069 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9070
9071 /**
9072  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9073  */
9074 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9075    /**
9076     * A pointer to the contents in the success state.
9077     * Reading from this pointer when `result_ok` is not set is undefined.
9078     */
9079    struct LDKUpdateAddHTLC *result;
9080    /**
9081     * A pointer to the contents in the error state.
9082     * Reading from this pointer when `result_ok` is set is undefined.
9083     */
9084    struct LDKDecodeError *err;
9085 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9086
9087 /**
9088  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9089  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9091  */
9092 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9093    /**
9094     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9095     * `err` or `result` depending on the state of `result_ok`.
9096     */
9097    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9098    /**
9099     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9100     */
9101    bool result_ok;
9102 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
9103
9104
9105
9106 /**
9107  * A ping message to be sent or received from a peer
9108  */
9109 typedef struct MUST_USE_STRUCT LDKPing {
9110    /**
9111     * A pointer to the opaque Rust object.
9112     * Nearly everywhere, inner must be non-null, however in places where
9113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9114     */
9115    LDKnativePing *inner;
9116    /**
9117     * Indicates that this is the only struct which contains the same pointer.
9118     * Rust functions which take ownership of an object provided via an argument require
9119     * this to be true and invalidate the object pointed to by inner.
9120     */
9121    bool is_owned;
9122 } LDKPing;
9123
9124 /**
9125  * The contents of CResult_PingDecodeErrorZ
9126  */
9127 typedef union LDKCResult_PingDecodeErrorZPtr {
9128    /**
9129     * A pointer to the contents in the success state.
9130     * Reading from this pointer when `result_ok` is not set is undefined.
9131     */
9132    struct LDKPing *result;
9133    /**
9134     * A pointer to the contents in the error state.
9135     * Reading from this pointer when `result_ok` is set is undefined.
9136     */
9137    struct LDKDecodeError *err;
9138 } LDKCResult_PingDecodeErrorZPtr;
9139
9140 /**
9141  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9142  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9143  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9144  */
9145 typedef struct LDKCResult_PingDecodeErrorZ {
9146    /**
9147     * The contents of this CResult_PingDecodeErrorZ, accessible via either
9148     * `err` or `result` depending on the state of `result_ok`.
9149     */
9150    union LDKCResult_PingDecodeErrorZPtr contents;
9151    /**
9152     * Whether this CResult_PingDecodeErrorZ represents a success state.
9153     */
9154    bool result_ok;
9155 } LDKCResult_PingDecodeErrorZ;
9156
9157
9158
9159 /**
9160  * A pong message to be sent or received from a peer
9161  */
9162 typedef struct MUST_USE_STRUCT LDKPong {
9163    /**
9164     * A pointer to the opaque Rust object.
9165     * Nearly everywhere, inner must be non-null, however in places where
9166     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9167     */
9168    LDKnativePong *inner;
9169    /**
9170     * Indicates that this is the only struct which contains the same pointer.
9171     * Rust functions which take ownership of an object provided via an argument require
9172     * this to be true and invalidate the object pointed to by inner.
9173     */
9174    bool is_owned;
9175 } LDKPong;
9176
9177 /**
9178  * The contents of CResult_PongDecodeErrorZ
9179  */
9180 typedef union LDKCResult_PongDecodeErrorZPtr {
9181    /**
9182     * A pointer to the contents in the success state.
9183     * Reading from this pointer when `result_ok` is not set is undefined.
9184     */
9185    struct LDKPong *result;
9186    /**
9187     * A pointer to the contents in the error state.
9188     * Reading from this pointer when `result_ok` is set is undefined.
9189     */
9190    struct LDKDecodeError *err;
9191 } LDKCResult_PongDecodeErrorZPtr;
9192
9193 /**
9194  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9195  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9196  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9197  */
9198 typedef struct LDKCResult_PongDecodeErrorZ {
9199    /**
9200     * The contents of this CResult_PongDecodeErrorZ, accessible via either
9201     * `err` or `result` depending on the state of `result_ok`.
9202     */
9203    union LDKCResult_PongDecodeErrorZPtr contents;
9204    /**
9205     * Whether this CResult_PongDecodeErrorZ represents a success state.
9206     */
9207    bool result_ok;
9208 } LDKCResult_PongDecodeErrorZ;
9209
9210 /**
9211  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9212  */
9213 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9214    /**
9215     * A pointer to the contents in the success state.
9216     * Reading from this pointer when `result_ok` is not set is undefined.
9217     */
9218    struct LDKUnsignedChannelAnnouncement *result;
9219    /**
9220     * A pointer to the contents in the error state.
9221     * Reading from this pointer when `result_ok` is set is undefined.
9222     */
9223    struct LDKDecodeError *err;
9224 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
9225
9226 /**
9227  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9228  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9229  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9230  */
9231 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
9232    /**
9233     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9234     * `err` or `result` depending on the state of `result_ok`.
9235     */
9236    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
9237    /**
9238     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9239     */
9240    bool result_ok;
9241 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
9242
9243 /**
9244  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
9245  */
9246 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
9247    /**
9248     * A pointer to the contents in the success state.
9249     * Reading from this pointer when `result_ok` is not set is undefined.
9250     */
9251    struct LDKChannelAnnouncement *result;
9252    /**
9253     * A pointer to the contents in the error state.
9254     * Reading from this pointer when `result_ok` is set is undefined.
9255     */
9256    struct LDKDecodeError *err;
9257 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
9258
9259 /**
9260  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9261  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9263  */
9264 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
9265    /**
9266     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9267     * `err` or `result` depending on the state of `result_ok`.
9268     */
9269    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
9270    /**
9271     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9272     */
9273    bool result_ok;
9274 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
9275
9276
9277
9278 /**
9279  * The unsigned part of a channel_update
9280  */
9281 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9282    /**
9283     * A pointer to the opaque Rust object.
9284     * Nearly everywhere, inner must be non-null, however in places where
9285     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9286     */
9287    LDKnativeUnsignedChannelUpdate *inner;
9288    /**
9289     * Indicates that this is the only struct which contains the same pointer.
9290     * Rust functions which take ownership of an object provided via an argument require
9291     * this to be true and invalidate the object pointed to by inner.
9292     */
9293    bool is_owned;
9294 } LDKUnsignedChannelUpdate;
9295
9296 /**
9297  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
9298  */
9299 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
9300    /**
9301     * A pointer to the contents in the success state.
9302     * Reading from this pointer when `result_ok` is not set is undefined.
9303     */
9304    struct LDKUnsignedChannelUpdate *result;
9305    /**
9306     * A pointer to the contents in the error state.
9307     * Reading from this pointer when `result_ok` is set is undefined.
9308     */
9309    struct LDKDecodeError *err;
9310 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
9311
9312 /**
9313  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9314  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9315  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9316  */
9317 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
9318    /**
9319     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
9320     * `err` or `result` depending on the state of `result_ok`.
9321     */
9322    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
9323    /**
9324     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
9325     */
9326    bool result_ok;
9327 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
9328
9329 /**
9330  * The contents of CResult_ChannelUpdateDecodeErrorZ
9331  */
9332 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
9333    /**
9334     * A pointer to the contents in the success state.
9335     * Reading from this pointer when `result_ok` is not set is undefined.
9336     */
9337    struct LDKChannelUpdate *result;
9338    /**
9339     * A pointer to the contents in the error state.
9340     * Reading from this pointer when `result_ok` is set is undefined.
9341     */
9342    struct LDKDecodeError *err;
9343 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
9344
9345 /**
9346  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9347  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9349  */
9350 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
9351    /**
9352     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
9353     * `err` or `result` depending on the state of `result_ok`.
9354     */
9355    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
9356    /**
9357     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
9358     */
9359    bool result_ok;
9360 } LDKCResult_ChannelUpdateDecodeErrorZ;
9361
9362 /**
9363  * The contents of CResult_ErrorMessageDecodeErrorZ
9364  */
9365 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
9366    /**
9367     * A pointer to the contents in the success state.
9368     * Reading from this pointer when `result_ok` is not set is undefined.
9369     */
9370    struct LDKErrorMessage *result;
9371    /**
9372     * A pointer to the contents in the error state.
9373     * Reading from this pointer when `result_ok` is set is undefined.
9374     */
9375    struct LDKDecodeError *err;
9376 } LDKCResult_ErrorMessageDecodeErrorZPtr;
9377
9378 /**
9379  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
9380  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
9381  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9382  */
9383 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
9384    /**
9385     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
9386     * `err` or `result` depending on the state of `result_ok`.
9387     */
9388    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
9389    /**
9390     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
9391     */
9392    bool result_ok;
9393 } LDKCResult_ErrorMessageDecodeErrorZ;
9394
9395
9396
9397 /**
9398  * The unsigned part of a node_announcement
9399  */
9400 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
9401    /**
9402     * A pointer to the opaque Rust object.
9403     * Nearly everywhere, inner must be non-null, however in places where
9404     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9405     */
9406    LDKnativeUnsignedNodeAnnouncement *inner;
9407    /**
9408     * Indicates that this is the only struct which contains the same pointer.
9409     * Rust functions which take ownership of an object provided via an argument require
9410     * this to be true and invalidate the object pointed to by inner.
9411     */
9412    bool is_owned;
9413 } LDKUnsignedNodeAnnouncement;
9414
9415 /**
9416  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
9417  */
9418 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
9419    /**
9420     * A pointer to the contents in the success state.
9421     * Reading from this pointer when `result_ok` is not set is undefined.
9422     */
9423    struct LDKUnsignedNodeAnnouncement *result;
9424    /**
9425     * A pointer to the contents in the error state.
9426     * Reading from this pointer when `result_ok` is set is undefined.
9427     */
9428    struct LDKDecodeError *err;
9429 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
9430
9431 /**
9432  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
9433  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9434  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9435  */
9436 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
9437    /**
9438     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
9439     * `err` or `result` depending on the state of `result_ok`.
9440     */
9441    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
9442    /**
9443     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
9444     */
9445    bool result_ok;
9446 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
9447
9448 /**
9449  * The contents of CResult_NodeAnnouncementDecodeErrorZ
9450  */
9451 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
9452    /**
9453     * A pointer to the contents in the success state.
9454     * Reading from this pointer when `result_ok` is not set is undefined.
9455     */
9456    struct LDKNodeAnnouncement *result;
9457    /**
9458     * A pointer to the contents in the error state.
9459     * Reading from this pointer when `result_ok` is set is undefined.
9460     */
9461    struct LDKDecodeError *err;
9462 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
9463
9464 /**
9465  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
9466  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9467  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9468  */
9469 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
9470    /**
9471     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
9472     * `err` or `result` depending on the state of `result_ok`.
9473     */
9474    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
9475    /**
9476     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
9477     */
9478    bool result_ok;
9479 } LDKCResult_NodeAnnouncementDecodeErrorZ;
9480
9481 /**
9482  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
9483  */
9484 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
9485    /**
9486     * A pointer to the contents in the success state.
9487     * Reading from this pointer when `result_ok` is not set is undefined.
9488     */
9489    struct LDKQueryShortChannelIds *result;
9490    /**
9491     * A pointer to the contents in the error state.
9492     * Reading from this pointer when `result_ok` is set is undefined.
9493     */
9494    struct LDKDecodeError *err;
9495 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
9496
9497 /**
9498  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
9499  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
9500  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9501  */
9502 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
9503    /**
9504     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
9505     * `err` or `result` depending on the state of `result_ok`.
9506     */
9507    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
9508    /**
9509     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
9510     */
9511    bool result_ok;
9512 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
9513
9514
9515
9516 /**
9517  * A reply_short_channel_ids_end message is sent as a reply to a
9518  * query_short_channel_ids message. The query recipient makes a best
9519  * effort to respond based on their local network view which may not be
9520  * a perfect view of the network.
9521  */
9522 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
9523    /**
9524     * A pointer to the opaque Rust object.
9525     * Nearly everywhere, inner must be non-null, however in places where
9526     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9527     */
9528    LDKnativeReplyShortChannelIdsEnd *inner;
9529    /**
9530     * Indicates that this is the only struct which contains the same pointer.
9531     * Rust functions which take ownership of an object provided via an argument require
9532     * this to be true and invalidate the object pointed to by inner.
9533     */
9534    bool is_owned;
9535 } LDKReplyShortChannelIdsEnd;
9536
9537 /**
9538  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
9539  */
9540 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
9541    /**
9542     * A pointer to the contents in the success state.
9543     * Reading from this pointer when `result_ok` is not set is undefined.
9544     */
9545    struct LDKReplyShortChannelIdsEnd *result;
9546    /**
9547     * A pointer to the contents in the error state.
9548     * Reading from this pointer when `result_ok` is set is undefined.
9549     */
9550    struct LDKDecodeError *err;
9551 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
9552
9553 /**
9554  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
9555  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
9556  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9557  */
9558 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
9559    /**
9560     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
9561     * `err` or `result` depending on the state of `result_ok`.
9562     */
9563    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
9564    /**
9565     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
9566     */
9567    bool result_ok;
9568 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
9569
9570 /**
9571  * The contents of CResult_QueryChannelRangeDecodeErrorZ
9572  */
9573 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
9574    /**
9575     * A pointer to the contents in the success state.
9576     * Reading from this pointer when `result_ok` is not set is undefined.
9577     */
9578    struct LDKQueryChannelRange *result;
9579    /**
9580     * A pointer to the contents in the error state.
9581     * Reading from this pointer when `result_ok` is set is undefined.
9582     */
9583    struct LDKDecodeError *err;
9584 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
9585
9586 /**
9587  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
9588  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9589  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9590  */
9591 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
9592    /**
9593     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
9594     * `err` or `result` depending on the state of `result_ok`.
9595     */
9596    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
9597    /**
9598     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
9599     */
9600    bool result_ok;
9601 } LDKCResult_QueryChannelRangeDecodeErrorZ;
9602
9603 /**
9604  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
9605  */
9606 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
9607    /**
9608     * A pointer to the contents in the success state.
9609     * Reading from this pointer when `result_ok` is not set is undefined.
9610     */
9611    struct LDKReplyChannelRange *result;
9612    /**
9613     * A pointer to the contents in the error state.
9614     * Reading from this pointer when `result_ok` is set is undefined.
9615     */
9616    struct LDKDecodeError *err;
9617 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
9618
9619 /**
9620  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
9621  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9623  */
9624 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
9625    /**
9626     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
9627     * `err` or `result` depending on the state of `result_ok`.
9628     */
9629    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
9630    /**
9631     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
9632     */
9633    bool result_ok;
9634 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
9635
9636
9637
9638 /**
9639  * A gossip_timestamp_filter message is used by a node to request
9640  * gossip relay for messages in the requested time range when the
9641  * gossip_queries feature has been negotiated.
9642  */
9643 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
9644    /**
9645     * A pointer to the opaque Rust object.
9646     * Nearly everywhere, inner must be non-null, however in places where
9647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9648     */
9649    LDKnativeGossipTimestampFilter *inner;
9650    /**
9651     * Indicates that this is the only struct which contains the same pointer.
9652     * Rust functions which take ownership of an object provided via an argument require
9653     * this to be true and invalidate the object pointed to by inner.
9654     */
9655    bool is_owned;
9656 } LDKGossipTimestampFilter;
9657
9658 /**
9659  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
9660  */
9661 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
9662    /**
9663     * A pointer to the contents in the success state.
9664     * Reading from this pointer when `result_ok` is not set is undefined.
9665     */
9666    struct LDKGossipTimestampFilter *result;
9667    /**
9668     * A pointer to the contents in the error state.
9669     * Reading from this pointer when `result_ok` is set is undefined.
9670     */
9671    struct LDKDecodeError *err;
9672 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
9673
9674 /**
9675  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
9676  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
9677  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9678  */
9679 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
9680    /**
9681     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
9682     * `err` or `result` depending on the state of `result_ok`.
9683     */
9684    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
9685    /**
9686     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
9687     */
9688    bool result_ok;
9689 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
9690
9691 /**
9692  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
9693  * may occur.
9694  */
9695 typedef enum LDKSignOrCreationError_Tag {
9696    /**
9697     * An error occurred during signing
9698     */
9699    LDKSignOrCreationError_SignError,
9700    /**
9701     * An error occurred while building the transaction
9702     */
9703    LDKSignOrCreationError_CreationError,
9704    /**
9705     * Must be last for serialization purposes
9706     */
9707    LDKSignOrCreationError_Sentinel,
9708 } LDKSignOrCreationError_Tag;
9709
9710 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
9711    LDKSignOrCreationError_Tag tag;
9712    union {
9713       struct {
9714          enum LDKCreationError creation_error;
9715       };
9716    };
9717 } LDKSignOrCreationError;
9718
9719 /**
9720  * The contents of CResult_InvoiceSignOrCreationErrorZ
9721  */
9722 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
9723    /**
9724     * A pointer to the contents in the success state.
9725     * Reading from this pointer when `result_ok` is not set is undefined.
9726     */
9727    struct LDKInvoice *result;
9728    /**
9729     * A pointer to the contents in the error state.
9730     * Reading from this pointer when `result_ok` is set is undefined.
9731     */
9732    struct LDKSignOrCreationError *err;
9733 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
9734
9735 /**
9736  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9737  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9738  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9739  */
9740 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
9741    /**
9742     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9743     * `err` or `result` depending on the state of `result_ok`.
9744     */
9745    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
9746    /**
9747     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9748     */
9749    bool result_ok;
9750 } LDKCResult_InvoiceSignOrCreationErrorZ;
9751
9752
9753
9754 /**
9755  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
9756  *
9757  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
9758  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
9759  * the return value of [`Filter::register_output`].
9760  *
9761  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
9762  * may have been spent there. See [`Filter::register_output`] for details.
9763  *
9764  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
9765  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
9766  */
9767 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
9768    /**
9769     * A pointer to the opaque Rust object.
9770     * Nearly everywhere, inner must be non-null, however in places where
9771     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9772     */
9773    LDKnativeWatchedOutput *inner;
9774    /**
9775     * Indicates that this is the only struct which contains the same pointer.
9776     * Rust functions which take ownership of an object provided via an argument require
9777     * this to be true and invalidate the object pointed to by inner.
9778     */
9779    bool is_owned;
9780 } LDKWatchedOutput;
9781
9782 /**
9783  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
9784  * channels.
9785  *
9786  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
9787  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
9788  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
9789  * receiving full blocks from a chain source, any further filtering is unnecessary.
9790  *
9791  * After an output has been registered, subsequent block retrievals from the chain source must not
9792  * exclude any transactions matching the new criteria nor any in-block descendants of such
9793  * transactions.
9794  *
9795  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
9796  * should not block on I/O. Implementations should instead queue the newly monitored data to be
9797  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
9798  * invocation that has called the `Filter` must return [`TemporaryFailure`].
9799  *
9800  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
9801  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
9802  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
9803  */
9804 typedef struct LDKFilter {
9805    /**
9806     * An opaque pointer which is passed to your function implementations as an argument.
9807     * This has no meaning in the LDK, and can be NULL or any other value.
9808     */
9809    void *this_arg;
9810    /**
9811     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
9812     * a spending condition.
9813     */
9814    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
9815    /**
9816     * Registers interest in spends of a transaction output.
9817     *
9818     * Optionally, when `output.block_hash` is set, should return any transaction spending the
9819     * output that is found in the corresponding block along with its index.
9820     *
9821     * This return value is useful for Electrum clients in order to supply in-block descendant
9822     * transactions which otherwise were not included. This is not necessary for other clients if
9823     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
9824     * full block).
9825     */
9826    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
9827    /**
9828     * Frees any resources associated with this object given its this_arg pointer.
9829     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9830     */
9831    void (*free)(void *this_arg);
9832 } LDKFilter;
9833
9834 /**
9835  * An enum which can either contain a crate::lightning::chain::Filter or not
9836  */
9837 typedef enum LDKCOption_FilterZ_Tag {
9838    /**
9839     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
9840     */
9841    LDKCOption_FilterZ_Some,
9842    /**
9843     * When we're in this state, this COption_FilterZ contains nothing
9844     */
9845    LDKCOption_FilterZ_None,
9846    /**
9847     * Must be last for serialization purposes
9848     */
9849    LDKCOption_FilterZ_Sentinel,
9850 } LDKCOption_FilterZ_Tag;
9851
9852 typedef struct LDKCOption_FilterZ {
9853    LDKCOption_FilterZ_Tag tag;
9854    union {
9855       struct {
9856          struct LDKFilter some;
9857       };
9858    };
9859 } LDKCOption_FilterZ;
9860
9861
9862
9863 /**
9864  * A read-only reference to a current ChannelMonitor.
9865  *
9866  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
9867  * released.
9868  */
9869 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
9870    /**
9871     * A pointer to the opaque Rust object.
9872     * Nearly everywhere, inner must be non-null, however in places where
9873     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9874     */
9875    LDKnativeLockedChannelMonitor *inner;
9876    /**
9877     * Indicates that this is the only struct which contains the same pointer.
9878     * Rust functions which take ownership of an object provided via an argument require
9879     * this to be true and invalidate the object pointed to by inner.
9880     */
9881    bool is_owned;
9882 } LDKLockedChannelMonitor;
9883
9884 /**
9885  * The contents of CResult_LockedChannelMonitorNoneZ
9886  */
9887 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
9888    /**
9889     * A pointer to the contents in the success state.
9890     * Reading from this pointer when `result_ok` is not set is undefined.
9891     */
9892    struct LDKLockedChannelMonitor *result;
9893    /**
9894     * Note that this value is always NULL, as there are no contents in the Err variant
9895     */
9896    void *err;
9897 } LDKCResult_LockedChannelMonitorNoneZPtr;
9898
9899 /**
9900  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
9901  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
9902  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9903  */
9904 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
9905    /**
9906     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
9907     * `err` or `result` depending on the state of `result_ok`.
9908     */
9909    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
9910    /**
9911     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
9912     */
9913    bool result_ok;
9914 } LDKCResult_LockedChannelMonitorNoneZ;
9915
9916 /**
9917  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
9918  * This corresponds to std::vector in C++
9919  */
9920 typedef struct LDKCVec_OutPointZ {
9921    /**
9922     * The elements in the array.
9923     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9924     */
9925    struct LDKOutPoint *data;
9926    /**
9927     * The number of elements pointed to by `data`.
9928     */
9929    uintptr_t datalen;
9930 } LDKCVec_OutPointZ;
9931
9932 /**
9933  * A trait indicating an object may generate message send events
9934  */
9935 typedef struct LDKMessageSendEventsProvider {
9936    /**
9937     * An opaque pointer which is passed to your function implementations as an argument.
9938     * This has no meaning in the LDK, and can be NULL or any other value.
9939     */
9940    void *this_arg;
9941    /**
9942     * Gets the list of pending events which were generated by previous actions, clearing the list
9943     * in the process.
9944     */
9945    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
9946    /**
9947     * Frees any resources associated with this object given its this_arg pointer.
9948     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9949     */
9950    void (*free)(void *this_arg);
9951 } LDKMessageSendEventsProvider;
9952
9953 /**
9954  * A trait implemented for objects handling events from [`EventsProvider`].
9955  */
9956 typedef struct LDKEventHandler {
9957    /**
9958     * An opaque pointer which is passed to your function implementations as an argument.
9959     * This has no meaning in the LDK, and can be NULL or any other value.
9960     */
9961    void *this_arg;
9962    /**
9963     * Handles the given [`Event`].
9964     *
9965     * See [`EventsProvider`] for details that must be considered when implementing this method.
9966     */
9967    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
9968    /**
9969     * Frees any resources associated with this object given its this_arg pointer.
9970     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9971     */
9972    void (*free)(void *this_arg);
9973 } LDKEventHandler;
9974
9975 /**
9976  * A trait indicating an object may generate events.
9977  *
9978  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
9979  *
9980  * # Requirements
9981  *
9982  * See [`process_pending_events`] for requirements around event processing.
9983  *
9984  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
9985  * event since the last invocation. The handler must either act upon the event immediately
9986  * or preserve it for later handling.
9987  *
9988  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
9989  * consult the provider's documentation on the implication of processing events and how a handler
9990  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
9991  * [`ChainMonitor::process_pending_events`]).
9992  *
9993  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
9994  * own type(s).
9995  *
9996  * [`process_pending_events`]: Self::process_pending_events
9997  * [`handle_event`]: EventHandler::handle_event
9998  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
9999  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10000  */
10001 typedef struct LDKEventsProvider {
10002    /**
10003     * An opaque pointer which is passed to your function implementations as an argument.
10004     * This has no meaning in the LDK, and can be NULL or any other value.
10005     */
10006    void *this_arg;
10007    /**
10008     * Processes any events generated since the last call using the given event handler.
10009     *
10010     * Subsequent calls must only process new events. However, handlers must be capable of handling
10011     * duplicate events across process restarts. This may occur if the provider was recovered from
10012     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10013     */
10014    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10015    /**
10016     * Frees any resources associated with this object given its this_arg pointer.
10017     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10018     */
10019    void (*free)(void *this_arg);
10020 } LDKEventsProvider;
10021
10022
10023
10024 /**
10025  * Configuration we set when applicable.
10026  *
10027  * Default::default() provides sane defaults.
10028  */
10029 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
10030    /**
10031     * A pointer to the opaque Rust object.
10032     * Nearly everywhere, inner must be non-null, however in places where
10033     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10034     */
10035    LDKnativeChannelHandshakeConfig *inner;
10036    /**
10037     * Indicates that this is the only struct which contains the same pointer.
10038     * Rust functions which take ownership of an object provided via an argument require
10039     * this to be true and invalidate the object pointed to by inner.
10040     */
10041    bool is_owned;
10042 } LDKChannelHandshakeConfig;
10043
10044
10045
10046 /**
10047  * Optional channel limits which are applied during channel creation.
10048  *
10049  * These limits are only applied to our counterparty's limits, not our own.
10050  *
10051  * Use 0/<type>::max_value() as appropriate to skip checking.
10052  *
10053  * Provides sane defaults for most configurations.
10054  *
10055  * Most additional limits are disabled except those with which specify a default in individual
10056  * field documentation. Note that this may result in barely-usable channels, but since they
10057  * are applied mostly only to incoming channels that's not much of a problem.
10058  */
10059 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
10060    /**
10061     * A pointer to the opaque Rust object.
10062     * Nearly everywhere, inner must be non-null, however in places where
10063     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10064     */
10065    LDKnativeChannelHandshakeLimits *inner;
10066    /**
10067     * Indicates that this is the only struct which contains the same pointer.
10068     * Rust functions which take ownership of an object provided via an argument require
10069     * this to be true and invalidate the object pointed to by inner.
10070     */
10071    bool is_owned;
10072 } LDKChannelHandshakeLimits;
10073
10074
10075
10076 /**
10077  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
10078  *
10079  * Default::default() provides sane defaults for most configurations
10080  * (but currently with 0 relay fees!)
10081  */
10082 typedef struct MUST_USE_STRUCT LDKUserConfig {
10083    /**
10084     * A pointer to the opaque Rust object.
10085     * Nearly everywhere, inner must be non-null, however in places where
10086     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10087     */
10088    LDKnativeUserConfig *inner;
10089    /**
10090     * Indicates that this is the only struct which contains the same pointer.
10091     * Rust functions which take ownership of an object provided via an argument require
10092     * this to be true and invalidate the object pointed to by inner.
10093     */
10094    bool is_owned;
10095 } LDKUserConfig;
10096
10097
10098
10099 /**
10100  * The best known block as identified by its hash and height.
10101  */
10102 typedef struct MUST_USE_STRUCT LDKBestBlock {
10103    /**
10104     * A pointer to the opaque Rust object.
10105     * Nearly everywhere, inner must be non-null, however in places where
10106     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10107     */
10108    LDKnativeBestBlock *inner;
10109    /**
10110     * Indicates that this is the only struct which contains the same pointer.
10111     * Rust functions which take ownership of an object provided via an argument require
10112     * this to be true and invalidate the object pointed to by inner.
10113     */
10114    bool is_owned;
10115 } LDKBestBlock;
10116
10117 /**
10118  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
10119  * chain.
10120  *
10121  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
10122  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
10123  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
10124  * when needed.
10125  */
10126 typedef struct LDKListen {
10127    /**
10128     * An opaque pointer which is passed to your function implementations as an argument.
10129     * This has no meaning in the LDK, and can be NULL or any other value.
10130     */
10131    void *this_arg;
10132    /**
10133     * Notifies the listener that a block was added at the given height.
10134     */
10135    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
10136    /**
10137     * Notifies the listener that a block was removed at the given height.
10138     */
10139    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10140    /**
10141     * Frees any resources associated with this object given its this_arg pointer.
10142     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10143     */
10144    void (*free)(void *this_arg);
10145 } LDKListen;
10146
10147 /**
10148  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
10149  * unconfirmed during a chain reorganization.
10150  *
10151  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
10152  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
10153  * related to registered transactions and outputs. Upon notification, it would pass along the
10154  * matching transactions using this interface.
10155  *
10156  * # Use
10157  *
10158  * The intended use is as follows:
10159  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
10160  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
10161  *   that has been reorganized out of the chain.
10162  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
10163  *
10164  * # Order
10165  *
10166  * Clients must call these methods in chain order. Specifically:
10167  * - Transactions confirmed in a block must be given before transactions confirmed in a later
10168  *   block.
10169  * - Dependent transactions within the same block must be given in topological order, possibly in
10170  *   separate calls.
10171  * - Unconfirmed transactions must be given after the original confirmations and before any
10172  *   reconfirmation.
10173  *
10174  * See individual method documentation for further details.
10175  *
10176  * [`transactions_confirmed`]: Self::transactions_confirmed
10177  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10178  * [`best_block_updated`]: Self::best_block_updated
10179  * [`get_relevant_txids`]: Self::get_relevant_txids
10180  */
10181 typedef struct LDKConfirm {
10182    /**
10183     * An opaque pointer which is passed to your function implementations as an argument.
10184     * This has no meaning in the LDK, and can be NULL or any other value.
10185     */
10186    void *this_arg;
10187    /**
10188     * Processes transactions confirmed in a block with a given header and height.
10189     *
10190     * Should be called for any transactions registered by [`Filter::register_tx`] or any
10191     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
10192     * appearing in the same block do not need to be included in the same call; instead, multiple
10193     * calls with additional transactions may be made so long as they are made in [chain order].
10194     *
10195     * May be called before or after [`best_block_updated`] for the corresponding block. However,
10196     * in the event of a chain reorganization, it must not be called with a `header` that is no
10197     * longer in the chain as of the last call to [`best_block_updated`].
10198     *
10199     * [chain order]: Confirm#Order
10200     * [`best_block_updated`]: Self::best_block_updated
10201     */
10202    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10203    /**
10204     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
10205     *
10206     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
10207     * reorganized out of the best chain. Once called, the given transaction should not be returned
10208     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
10209     *
10210     * [`get_relevant_txids`]: Self::get_relevant_txids
10211     * [`transactions_confirmed`]: Self::transactions_confirmed
10212     */
10213    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
10214    /**
10215     * Processes an update to the best header connected at the given height.
10216     *
10217     * Should be called when a new header is available but may be skipped for intermediary blocks
10218     * if they become available at the same time.
10219     */
10220    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10221    /**
10222     * Returns transactions that should be monitored for reorganization out of the chain.
10223     *
10224     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
10225     * confirmations to be safe from a chain reorganization. Should not include any transactions
10226     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
10227     *
10228     * May be called to determine the subset of transactions that must still be monitored for
10229     * reorganization. Will be idempotent between calls but may change as a result of calls to the
10230     * other interface methods. Thus, this is useful to determine which transactions may need to be
10231     * given to [`transaction_unconfirmed`].
10232     *
10233     * [`transactions_confirmed`]: Self::transactions_confirmed
10234     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10235     */
10236    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
10237    /**
10238     * Frees any resources associated with this object given its this_arg pointer.
10239     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10240     */
10241    void (*free)(void *this_arg);
10242 } LDKConfirm;
10243
10244
10245
10246 /**
10247  * An opaque identifier describing a specific [`Persist`] method call.
10248  */
10249 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
10250    /**
10251     * A pointer to the opaque Rust object.
10252     * Nearly everywhere, inner must be non-null, however in places where
10253     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10254     */
10255    LDKnativeMonitorUpdateId *inner;
10256    /**
10257     * Indicates that this is the only struct which contains the same pointer.
10258     * Rust functions which take ownership of an object provided via an argument require
10259     * this to be true and invalidate the object pointed to by inner.
10260     */
10261    bool is_owned;
10262 } LDKMonitorUpdateId;
10263
10264 /**
10265  * `Persist` defines behavior for persisting channel monitors: this could mean
10266  * writing once to disk, and/or uploading to one or more backup services.
10267  *
10268  * Each method can return three possible values:
10269  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
10270  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
10271  *  * If persistence happens asynchronously, implementations should first ensure the
10272  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
10273  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
10274  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
10275  *    called with the corresponding [`MonitorUpdateId`].
10276  *
10277  *    Note that unlike the direct [`chain::Watch`] interface,
10278  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
10279  *
10280  *  * If persistence fails for some reason, implementations should return
10281  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
10282  *    closed without broadcasting the latest state. See
10283  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
10284  */
10285 typedef struct LDKPersist {
10286    /**
10287     * An opaque pointer which is passed to your function implementations as an argument.
10288     * This has no meaning in the LDK, and can be NULL or any other value.
10289     */
10290    void *this_arg;
10291    /**
10292     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
10293     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
10294     *
10295     * The data can be stored any way you want, but the identifier provided by LDK is the
10296     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
10297     * and the stored channel data). Note that you **must** persist every new monitor to disk.
10298     *
10299     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10300     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10301     *
10302     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
10303     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10304     *
10305     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10306     * [`Writeable::write`]: crate::util::ser::Writeable::write
10307     */
10308    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10309    /**
10310     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
10311     * update.
10312     *
10313     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
10314     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
10315     * details.
10316     *
10317     * During blockchain synchronization operations, this may be called with no
10318     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
10319     * Note that after the full [`ChannelMonitor`] is persisted any previous
10320     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
10321     * applied to the persisted [`ChannelMonitor`] as they were already applied.
10322     *
10323     * If an implementer chooses to persist the updates only, they need to make
10324     * sure that all the updates are applied to the `ChannelMonitors` *before*
10325     * the set of channel monitors is given to the `ChannelManager`
10326     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
10327     * applying a monitor update to a monitor. If full `ChannelMonitors` are
10328     * persisted, then there is no need to persist individual updates.
10329     *
10330     * Note that there could be a performance tradeoff between persisting complete
10331     * channel monitors on every update vs. persisting only updates and applying
10332     * them in batches. The size of each monitor grows `O(number of state updates)`
10333     * whereas updates are small and `O(1)`.
10334     *
10335     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10336     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10337     *
10338     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
10339     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
10340     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10341     *
10342     * [`Writeable::write`]: crate::util::ser::Writeable::write
10343     *
10344     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
10345     */
10346    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10347    /**
10348     * Frees any resources associated with this object given its this_arg pointer.
10349     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10350     */
10351    void (*free)(void *this_arg);
10352 } LDKPersist;
10353
10354
10355
10356 /**
10357  * An implementation of [`chain::Watch`] for monitoring channels.
10358  *
10359  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
10360  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
10361  * or used independently to monitor channels remotely. See the [module-level documentation] for
10362  * details.
10363  *
10364  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10365  * [module-level documentation]: crate::chain::chainmonitor
10366  */
10367 typedef struct MUST_USE_STRUCT LDKChainMonitor {
10368    /**
10369     * A pointer to the opaque Rust object.
10370     * Nearly everywhere, inner must be non-null, however in places where
10371     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10372     */
10373    LDKnativeChainMonitor *inner;
10374    /**
10375     * Indicates that this is the only struct which contains the same pointer.
10376     * Rust functions which take ownership of an object provided via an argument require
10377     * this to be true and invalidate the object pointed to by inner.
10378     */
10379    bool is_owned;
10380 } LDKChainMonitor;
10381
10382
10383
10384 /**
10385  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
10386  * and derives keys from that.
10387  *
10388  * Your node_id is seed/0'
10389  * ChannelMonitor closes may use seed/1'
10390  * Cooperative closes may use seed/2'
10391  * The two close keys may be needed to claim on-chain funds!
10392  */
10393 typedef struct MUST_USE_STRUCT LDKKeysManager {
10394    /**
10395     * A pointer to the opaque Rust object.
10396     * Nearly everywhere, inner must be non-null, however in places where
10397     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10398     */
10399    LDKnativeKeysManager *inner;
10400    /**
10401     * Indicates that this is the only struct which contains the same pointer.
10402     * Rust functions which take ownership of an object provided via an argument require
10403     * this to be true and invalidate the object pointed to by inner.
10404     */
10405    bool is_owned;
10406 } LDKKeysManager;
10407
10408
10409
10410 /**
10411  * Chain-related parameters used to construct a new `ChannelManager`.
10412  *
10413  * Typically, the block-specific parameters are derived from the best block hash for the network,
10414  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
10415  * are not needed when deserializing a previously constructed `ChannelManager`.
10416  */
10417 typedef struct MUST_USE_STRUCT LDKChainParameters {
10418    /**
10419     * A pointer to the opaque Rust object.
10420     * Nearly everywhere, inner must be non-null, however in places where
10421     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10422     */
10423    LDKnativeChainParameters *inner;
10424    /**
10425     * Indicates that this is the only struct which contains the same pointer.
10426     * Rust functions which take ownership of an object provided via an argument require
10427     * this to be true and invalidate the object pointed to by inner.
10428     */
10429    bool is_owned;
10430 } LDKChainParameters;
10431
10432
10433
10434 /**
10435  * Information needed for constructing an invoice route hint for this channel.
10436  */
10437 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
10438    /**
10439     * A pointer to the opaque Rust object.
10440     * Nearly everywhere, inner must be non-null, however in places where
10441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10442     */
10443    LDKnativeCounterpartyForwardingInfo *inner;
10444    /**
10445     * Indicates that this is the only struct which contains the same pointer.
10446     * Rust functions which take ownership of an object provided via an argument require
10447     * this to be true and invalidate the object pointed to by inner.
10448     */
10449    bool is_owned;
10450 } LDKCounterpartyForwardingInfo;
10451
10452
10453
10454 /**
10455  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
10456  * to better separate parameters.
10457  */
10458 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
10459    /**
10460     * A pointer to the opaque Rust object.
10461     * Nearly everywhere, inner must be non-null, however in places where
10462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10463     */
10464    LDKnativeChannelCounterparty *inner;
10465    /**
10466     * Indicates that this is the only struct which contains the same pointer.
10467     * Rust functions which take ownership of an object provided via an argument require
10468     * this to be true and invalidate the object pointed to by inner.
10469     */
10470    bool is_owned;
10471 } LDKChannelCounterparty;
10472
10473 /**
10474  * A 3-byte byte array.
10475  */
10476 typedef struct LDKThreeBytes {
10477    /**
10478     * The three bytes
10479     */
10480    uint8_t data[3];
10481 } LDKThreeBytes;
10482
10483 /**
10484  * A trait to describe an object which can receive channel messages.
10485  *
10486  * Messages MAY be called in parallel when they originate from different their_node_ids, however
10487  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
10488  */
10489 typedef struct LDKChannelMessageHandler {
10490    /**
10491     * An opaque pointer which is passed to your function implementations as an argument.
10492     * This has no meaning in the LDK, and can be NULL or any other value.
10493     */
10494    void *this_arg;
10495    /**
10496     * Handle an incoming open_channel message from the given peer.
10497     */
10498    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
10499    /**
10500     * Handle an incoming accept_channel message from the given peer.
10501     */
10502    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
10503    /**
10504     * Handle an incoming funding_created message from the given peer.
10505     */
10506    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
10507    /**
10508     * Handle an incoming funding_signed message from the given peer.
10509     */
10510    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
10511    /**
10512     * Handle an incoming funding_locked message from the given peer.
10513     */
10514    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
10515    /**
10516     * Handle an incoming shutdown message from the given peer.
10517     */
10518    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);
10519    /**
10520     * Handle an incoming closing_signed message from the given peer.
10521     */
10522    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
10523    /**
10524     * Handle an incoming update_add_htlc message from the given peer.
10525     */
10526    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
10527    /**
10528     * Handle an incoming update_fulfill_htlc message from the given peer.
10529     */
10530    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
10531    /**
10532     * Handle an incoming update_fail_htlc message from the given peer.
10533     */
10534    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
10535    /**
10536     * Handle an incoming update_fail_malformed_htlc message from the given peer.
10537     */
10538    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
10539    /**
10540     * Handle an incoming commitment_signed message from the given peer.
10541     */
10542    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
10543    /**
10544     * Handle an incoming revoke_and_ack message from the given peer.
10545     */
10546    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
10547    /**
10548     * Handle an incoming update_fee message from the given peer.
10549     */
10550    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
10551    /**
10552     * Handle an incoming announcement_signatures message from the given peer.
10553     */
10554    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
10555    /**
10556     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
10557     * is believed to be possible in the future (eg they're sending us messages we don't
10558     * understand or indicate they require unknown feature bits), no_connection_possible is set
10559     * and any outstanding channels should be failed.
10560     */
10561    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
10562    /**
10563     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
10564     */
10565    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
10566    /**
10567     * Handle an incoming channel_reestablish message from the given peer.
10568     */
10569    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
10570    /**
10571     * Handle an incoming channel update from the given peer.
10572     */
10573    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
10574    /**
10575     * Handle an incoming error message from the given peer.
10576     */
10577    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
10578    /**
10579     * Implementation of MessageSendEventsProvider for this object.
10580     */
10581    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10582    /**
10583     * Frees any resources associated with this object given its this_arg pointer.
10584     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10585     */
10586    void (*free)(void *this_arg);
10587 } LDKChannelMessageHandler;
10588
10589
10590
10591 /**
10592  * Arguments for the creation of a ChannelManager that are not deserialized.
10593  *
10594  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
10595  * is:
10596  * 1) Deserialize all stored [`ChannelMonitor`]s.
10597  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
10598  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
10599  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
10600  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
10601  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
10602  *    same way you would handle a [`chain::Filter`] call using
10603  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
10604  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
10605  * 5) Disconnect/connect blocks on the [`ChannelManager`].
10606  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
10607  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
10608  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
10609  *    the next step.
10610  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
10611  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
10612  *
10613  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
10614  * call any other methods on the newly-deserialized [`ChannelManager`].
10615  *
10616  * Note that because some channels may be closed during deserialization, it is critical that you
10617  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
10618  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
10619  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
10620  * not force-close the same channels but consider them live), you may end up revoking a state for
10621  * which you've already broadcasted the transaction.
10622  *
10623  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
10624  */
10625 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
10626    /**
10627     * A pointer to the opaque Rust object.
10628     * Nearly everywhere, inner must be non-null, however in places where
10629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10630     */
10631    LDKnativeChannelManagerReadArgs *inner;
10632    /**
10633     * Indicates that this is the only struct which contains the same pointer.
10634     * Rust functions which take ownership of an object provided via an argument require
10635     * this to be true and invalidate the object pointed to by inner.
10636     */
10637    bool is_owned;
10638 } LDKChannelManagerReadArgs;
10639
10640
10641
10642 /**
10643  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
10644  * This is used to convince the recipient that the channel is at a certain commitment
10645  * number even if they lost that data due to a local failure.  Of course, the peer may lie
10646  * and even later commitments may have been revoked.
10647  */
10648 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
10649    /**
10650     * A pointer to the opaque Rust object.
10651     * Nearly everywhere, inner must be non-null, however in places where
10652     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10653     */
10654    LDKnativeDataLossProtect *inner;
10655    /**
10656     * Indicates that this is the only struct which contains the same pointer.
10657     * Rust functions which take ownership of an object provided via an argument require
10658     * this to be true and invalidate the object pointed to by inner.
10659     */
10660    bool is_owned;
10661 } LDKDataLossProtect;
10662
10663 /**
10664  * A trait to describe an object which can receive routing messages.
10665  *
10666  * # Implementor DoS Warnings
10667  *
10668  * For `gossip_queries` messages there are potential DoS vectors when handling
10669  * inbound queries. Implementors using an on-disk network graph should be aware of
10670  * repeated disk I/O for queries accessing different parts of the network graph.
10671  */
10672 typedef struct LDKRoutingMessageHandler {
10673    /**
10674     * An opaque pointer which is passed to your function implementations as an argument.
10675     * This has no meaning in the LDK, and can be NULL or any other value.
10676     */
10677    void *this_arg;
10678    /**
10679     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
10680     * false or returning an Err otherwise.
10681     */
10682    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
10683    /**
10684     * Handle a channel_announcement message, returning true if it should be forwarded on, false
10685     * or returning an Err otherwise.
10686     */
10687    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
10688    /**
10689     * Handle an incoming channel_update message, returning true if it should be forwarded on,
10690     * false or returning an Err otherwise.
10691     */
10692    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
10693    /**
10694     * Gets a subset of the channel announcements and updates required to dump our routing table
10695     * to a remote node, starting at the short_channel_id indicated by starting_point and
10696     * including the batch_amount entries immediately higher in numerical value than starting_point.
10697     */
10698    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
10699    /**
10700     * Gets a subset of the node announcements required to dump our routing table to a remote node,
10701     * starting at the node *after* the provided publickey and including batch_amount entries
10702     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
10703     * If None is provided for starting_point, we start at the first node.
10704     *
10705     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
10706     */
10707    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
10708    /**
10709     * Called when a connection is established with a peer. This can be used to
10710     * perform routing table synchronization using a strategy defined by the
10711     * implementor.
10712     */
10713    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
10714    /**
10715     * Handles the reply of a query we initiated to learn about channels
10716     * for a given range of blocks. We can expect to receive one or more
10717     * replies to a single query.
10718     */
10719    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
10720    /**
10721     * Handles the reply of a query we initiated asking for routing gossip
10722     * messages for a list of channels. We should receive this message when
10723     * a node has completed its best effort to send us the pertaining routing
10724     * gossip messages.
10725     */
10726    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
10727    /**
10728     * Handles when a peer asks us to send a list of short_channel_ids
10729     * for the requested range of blocks.
10730     */
10731    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
10732    /**
10733     * Handles when a peer asks us to send routing gossip messages for a
10734     * list of short_channel_ids.
10735     */
10736    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
10737    /**
10738     * Implementation of MessageSendEventsProvider for this object.
10739     */
10740    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10741    /**
10742     * Frees any resources associated with this object given its this_arg pointer.
10743     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10744     */
10745    void (*free)(void *this_arg);
10746 } LDKRoutingMessageHandler;
10747
10748 /**
10749  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
10750  * decoders.
10751  */
10752 typedef struct LDKCustomMessageReader {
10753    /**
10754     * An opaque pointer which is passed to your function implementations as an argument.
10755     * This has no meaning in the LDK, and can be NULL or any other value.
10756     */
10757    void *this_arg;
10758    /**
10759     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
10760     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
10761     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
10762     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
10763     */
10764    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
10765    /**
10766     * Frees any resources associated with this object given its this_arg pointer.
10767     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10768     */
10769    void (*free)(void *this_arg);
10770 } LDKCustomMessageReader;
10771
10772 /**
10773  * Handler for BOLT1-compliant messages.
10774  */
10775 typedef struct LDKCustomMessageHandler {
10776    /**
10777     * An opaque pointer which is passed to your function implementations as an argument.
10778     * This has no meaning in the LDK, and can be NULL or any other value.
10779     */
10780    void *this_arg;
10781    /**
10782     * Called with the message type that was received and the buffer to be read.
10783     * Can return a `MessageHandlingError` if the message could not be handled.
10784     */
10785    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
10786    /**
10787     * Gets the list of pending messages which were generated by the custom message
10788     * handler, clearing the list in the process. The first tuple element must
10789     * correspond to the intended recipients node ids. If no connection to one of the
10790     * specified node does not exist, the message is simply not sent to it.
10791     */
10792    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
10793    /**
10794     * Implementation of CustomMessageReader for this object.
10795     */
10796    struct LDKCustomMessageReader CustomMessageReader;
10797    /**
10798     * Frees any resources associated with this object given its this_arg pointer.
10799     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10800     */
10801    void (*free)(void *this_arg);
10802 } LDKCustomMessageHandler;
10803
10804
10805
10806 /**
10807  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
10808  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
10809  */
10810 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
10811    /**
10812     * A pointer to the opaque Rust object.
10813     * Nearly everywhere, inner must be non-null, however in places where
10814     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10815     */
10816    LDKnativeIgnoringMessageHandler *inner;
10817    /**
10818     * Indicates that this is the only struct which contains the same pointer.
10819     * Rust functions which take ownership of an object provided via an argument require
10820     * this to be true and invalidate the object pointed to by inner.
10821     */
10822    bool is_owned;
10823 } LDKIgnoringMessageHandler;
10824
10825
10826
10827 /**
10828  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
10829  * You can provide one of these as the route_handler in a MessageHandler.
10830  */
10831 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
10832    /**
10833     * A pointer to the opaque Rust object.
10834     * Nearly everywhere, inner must be non-null, however in places where
10835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10836     */
10837    LDKnativeErroringMessageHandler *inner;
10838    /**
10839     * Indicates that this is the only struct which contains the same pointer.
10840     * Rust functions which take ownership of an object provided via an argument require
10841     * this to be true and invalidate the object pointed to by inner.
10842     */
10843    bool is_owned;
10844 } LDKErroringMessageHandler;
10845
10846
10847
10848 /**
10849  * Provides references to trait impls which handle different types of messages.
10850  */
10851 typedef struct MUST_USE_STRUCT LDKMessageHandler {
10852    /**
10853     * A pointer to the opaque Rust object.
10854     * Nearly everywhere, inner must be non-null, however in places where
10855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10856     */
10857    LDKnativeMessageHandler *inner;
10858    /**
10859     * Indicates that this is the only struct which contains the same pointer.
10860     * Rust functions which take ownership of an object provided via an argument require
10861     * this to be true and invalidate the object pointed to by inner.
10862     */
10863    bool is_owned;
10864 } LDKMessageHandler;
10865
10866 /**
10867  * Provides an object which can be used to send data to and which uniquely identifies a connection
10868  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
10869  * implement Hash to meet the PeerManager API.
10870  *
10871  * For efficiency, Clone should be relatively cheap for this type.
10872  *
10873  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
10874  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
10875  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
10876  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
10877  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
10878  * to simply use another value which is guaranteed to be globally unique instead.
10879  */
10880 typedef struct LDKSocketDescriptor {
10881    /**
10882     * An opaque pointer which is passed to your function implementations as an argument.
10883     * This has no meaning in the LDK, and can be NULL or any other value.
10884     */
10885    void *this_arg;
10886    /**
10887     * Attempts to send some data from the given slice to the peer.
10888     *
10889     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
10890     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
10891     * called and further write attempts may occur until that time.
10892     *
10893     * If the returned size is smaller than `data.len()`, a
10894     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
10895     * written. Additionally, until a `send_data` event completes fully, no further
10896     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
10897     * prevent denial-of-service issues, you should not read or buffer any data from the socket
10898     * until then.
10899     *
10900     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
10901     * (indicating that read events should be paused to prevent DoS in the send buffer),
10902     * `resume_read` may be set indicating that read events on this descriptor should resume. A
10903     * `resume_read` of false carries no meaning, and should not cause any action.
10904     */
10905    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
10906    /**
10907     * Disconnect the socket pointed to by this SocketDescriptor.
10908     *
10909     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
10910     * call (doing so is a noop).
10911     */
10912    void (*disconnect_socket)(void *this_arg);
10913    /**
10914     * Checks if two objects are equal given this object's this_arg pointer and another object.
10915     */
10916    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
10917    /**
10918     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
10919     * This is used, for example, for inclusion of this object in a hash map.
10920     */
10921    uint64_t (*hash)(const void *this_arg);
10922    /**
10923     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
10924     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
10925     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
10926     */
10927    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
10928    /**
10929     * Frees any resources associated with this object given its this_arg pointer.
10930     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10931     */
10932    void (*free)(void *this_arg);
10933 } LDKSocketDescriptor;
10934
10935
10936
10937 /**
10938  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
10939  * socket events into messages which it passes on to its [`MessageHandler`].
10940  *
10941  * Locks are taken internally, so you must never assume that reentrancy from a
10942  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
10943  *
10944  * Calls to [`read_event`] will decode relevant messages and pass them to the
10945  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
10946  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
10947  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
10948  * calls only after previous ones have returned.
10949  *
10950  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
10951  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
10952  * essentially you should default to using a SimpleRefPeerManager, and use a
10953  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
10954  * you're using lightning-net-tokio.
10955  *
10956  * [`read_event`]: PeerManager::read_event
10957  */
10958 typedef struct MUST_USE_STRUCT LDKPeerManager {
10959    /**
10960     * A pointer to the opaque Rust object.
10961     * Nearly everywhere, inner must be non-null, however in places where
10962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10963     */
10964    LDKnativePeerManager *inner;
10965    /**
10966     * Indicates that this is the only struct which contains the same pointer.
10967     * Rust functions which take ownership of an object provided via an argument require
10968     * this to be true and invalidate the object pointed to by inner.
10969     */
10970    bool is_owned;
10971 } LDKPeerManager;
10972
10973
10974
10975 /**
10976  * Static channel fields used to build transactions given per-commitment fields, organized by
10977  * broadcaster/countersignatory.
10978  *
10979  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
10980  * as_holder_broadcastable and as_counterparty_broadcastable functions.
10981  */
10982 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
10983    /**
10984     * A pointer to the opaque Rust object.
10985     * Nearly everywhere, inner must be non-null, however in places where
10986     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10987     */
10988    LDKnativeDirectedChannelTransactionParameters *inner;
10989    /**
10990     * Indicates that this is the only struct which contains the same pointer.
10991     * Rust functions which take ownership of an object provided via an argument require
10992     * this to be true and invalidate the object pointed to by inner.
10993     */
10994    bool is_owned;
10995 } LDKDirectedChannelTransactionParameters;
10996
10997
10998
10999 /**
11000  * A read-only view of [`NetworkGraph`].
11001  */
11002 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
11003    /**
11004     * A pointer to the opaque Rust object.
11005     * Nearly everywhere, inner must be non-null, however in places where
11006     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11007     */
11008    LDKnativeReadOnlyNetworkGraph *inner;
11009    /**
11010     * Indicates that this is the only struct which contains the same pointer.
11011     * Rust functions which take ownership of an object provided via an argument require
11012     * this to be true and invalidate the object pointed to by inner.
11013     */
11014    bool is_owned;
11015 } LDKReadOnlyNetworkGraph;
11016
11017
11018
11019 /**
11020  * Receives and validates network updates from peers,
11021  * stores authentic and relevant data as a network graph.
11022  * This network graph is then used for routing payments.
11023  * Provides interface to help with initial routing sync by
11024  * serving historical announcements.
11025  *
11026  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
11027  * [`NetworkGraph`].
11028  */
11029 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
11030    /**
11031     * A pointer to the opaque Rust object.
11032     * Nearly everywhere, inner must be non-null, however in places where
11033     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11034     */
11035    LDKnativeNetGraphMsgHandler *inner;
11036    /**
11037     * Indicates that this is the only struct which contains the same pointer.
11038     * Rust functions which take ownership of an object provided via an argument require
11039     * this to be true and invalidate the object pointed to by inner.
11040     */
11041    bool is_owned;
11042 } LDKNetGraphMsgHandler;
11043
11044 /**
11045  * An interface used to score payment channels for path finding.
11046  *
11047  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11048  */
11049 typedef struct LDKScore {
11050    /**
11051     * An opaque pointer which is passed to your function implementations as an argument.
11052     * This has no meaning in the LDK, and can be NULL or any other value.
11053     */
11054    void *this_arg;
11055    /**
11056     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11057     * given channel in the direction from `source` to `target`.
11058     *
11059     * The channel's capacity (less any other MPP parts which are also being considered for use in
11060     * the same payment) is given by `channel_capacity_msat`. It may be guessed from various
11061     * sources or assumed from no data at all.
11062     *
11063     * For hints provided in the invoice, we assume the channel has sufficient capacity to accept
11064     * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other
11065     * cases it is set to `Some`, even if we're guessing at the channel value.
11066     *
11067     * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC.
11068     */
11069    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
11070    /**
11071     * Handles updating channel penalties after failing to route through a channel.
11072     */
11073    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11074    /**
11075     * Handles updating channel penalties after successfully routing along a path.
11076     */
11077    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11078    /**
11079     * Serialize the object into a byte array
11080     */
11081    struct LDKCVec_u8Z (*write)(const void *this_arg);
11082    /**
11083     * Frees any resources associated with this object given its this_arg pointer.
11084     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11085     */
11086    void (*free)(void *this_arg);
11087 } LDKScore;
11088
11089 /**
11090  * A scorer that is accessed under a lock.
11091  *
11092  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
11093  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
11094  * implementations. Internal locking would be detrimental to route finding performance and could
11095  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
11096  *
11097  * [`find_route`]: crate::routing::router::find_route
11098  */
11099 typedef struct LDKLockableScore {
11100    /**
11101     * An opaque pointer which is passed to your function implementations as an argument.
11102     * This has no meaning in the LDK, and can be NULL or any other value.
11103     */
11104    void *this_arg;
11105    /**
11106     * Returns the locked scorer.
11107     */
11108    struct LDKScore (*lock)(const void *this_arg);
11109    /**
11110     * Frees any resources associated with this object given its this_arg pointer.
11111     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11112     */
11113    void (*free)(void *this_arg);
11114 } LDKLockableScore;
11115
11116
11117
11118 /**
11119  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11120  */
11121 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11122    /**
11123     * A pointer to the opaque Rust object.
11124     * Nearly everywhere, inner must be non-null, however in places where
11125     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11126     */
11127    LDKnativeMultiThreadedLockableScore *inner;
11128    /**
11129     * Indicates that this is the only struct which contains the same pointer.
11130     * Rust functions which take ownership of an object provided via an argument require
11131     * this to be true and invalidate the object pointed to by inner.
11132     */
11133    bool is_owned;
11134 } LDKMultiThreadedLockableScore;
11135
11136
11137
11138 /**
11139  * FilesystemPersister persists channel data on disk, where each channel's
11140  * data is stored in a file named after its funding outpoint.
11141  *
11142  * Warning: this module does the best it can with calls to persist data, but it
11143  * can only guarantee that the data is passed to the drive. It is up to the
11144  * drive manufacturers to do the actual persistence properly, which they often
11145  * don't (especially on consumer-grade hardware). Therefore, it is up to the
11146  * user to validate their entire storage stack, to ensure the writes are
11147  * persistent.
11148  * Corollary: especially when dealing with larger amounts of money, it is best
11149  * practice to have multiple channel data backups and not rely only on one
11150  * FilesystemPersister.
11151  */
11152 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
11153    /**
11154     * A pointer to the opaque Rust object.
11155     * Nearly everywhere, inner must be non-null, however in places where
11156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11157     */
11158    LDKnativeFilesystemPersister *inner;
11159    /**
11160     * Indicates that this is the only struct which contains the same pointer.
11161     * Rust functions which take ownership of an object provided via an argument require
11162     * this to be true and invalidate the object pointed to by inner.
11163     */
11164    bool is_owned;
11165 } LDKFilesystemPersister;
11166
11167
11168
11169 /**
11170  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
11171  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
11172  * responsibilities are:
11173  * * Processing [`Event`]s with a user-provided [`EventHandler`].
11174  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
11175  *   writing it to disk/backups by invoking the callback given to it at startup.
11176  *   [`ChannelManager`] persistence should be done in the background.
11177  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
11178  *   at the appropriate intervals.
11179  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
11180  *   [`BackgroundProcessor::start`]).
11181  *
11182  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
11183  * upon as doing so may result in high latency.
11184  *
11185  * # Note
11186  *
11187  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
11188  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
11189  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
11190  * unilateral chain closure fees are at risk.
11191  *
11192  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
11193  * [`Event`]: lightning::util::events::Event
11194  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
11195  */
11196 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
11197    /**
11198     * A pointer to the opaque Rust object.
11199     * Nearly everywhere, inner must be non-null, however in places where
11200     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11201     */
11202    LDKnativeBackgroundProcessor *inner;
11203    /**
11204     * Indicates that this is the only struct which contains the same pointer.
11205     * Rust functions which take ownership of an object provided via an argument require
11206     * this to be true and invalidate the object pointed to by inner.
11207     */
11208    bool is_owned;
11209 } LDKBackgroundProcessor;
11210
11211 /**
11212  * Trait which handles persisting a [`ChannelManager`] to disk.
11213  *
11214  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11215  */
11216 typedef struct LDKChannelManagerPersister {
11217    /**
11218     * An opaque pointer which is passed to your function implementations as an argument.
11219     * This has no meaning in the LDK, and can be NULL or any other value.
11220     */
11221    void *this_arg;
11222    /**
11223     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
11224     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
11225     *
11226     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11227     */
11228    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11229    /**
11230     * Frees any resources associated with this object given its this_arg pointer.
11231     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11232     */
11233    void (*free)(void *this_arg);
11234 } LDKChannelManagerPersister;
11235
11236
11237
11238 /**
11239  * Data of the `RawInvoice` that is encoded in the data part
11240  */
11241 typedef struct MUST_USE_STRUCT LDKRawDataPart {
11242    /**
11243     * A pointer to the opaque Rust object.
11244     * Nearly everywhere, inner must be non-null, however in places where
11245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11246     */
11247    LDKnativeRawDataPart *inner;
11248    /**
11249     * Indicates that this is the only struct which contains the same pointer.
11250     * Rust functions which take ownership of an object provided via an argument require
11251     * this to be true and invalidate the object pointed to by inner.
11252     */
11253    bool is_owned;
11254 } LDKRawDataPart;
11255
11256
11257
11258 /**
11259  * SHA-256 hash
11260  */
11261 typedef struct MUST_USE_STRUCT LDKSha256 {
11262    /**
11263     * A pointer to the opaque Rust object.
11264     * Nearly everywhere, inner must be non-null, however in places where
11265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11266     */
11267    LDKnativeSha256 *inner;
11268    /**
11269     * Indicates that this is the only struct which contains the same pointer.
11270     * Rust functions which take ownership of an object provided via an argument require
11271     * this to be true and invalidate the object pointed to by inner.
11272     */
11273    bool is_owned;
11274 } LDKSha256;
11275
11276
11277
11278 /**
11279  * `min_final_cltv_expiry` to use for the last HTLC in the route
11280  */
11281 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
11282    /**
11283     * A pointer to the opaque Rust object.
11284     * Nearly everywhere, inner must be non-null, however in places where
11285     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11286     */
11287    LDKnativeMinFinalCltvExpiry *inner;
11288    /**
11289     * Indicates that this is the only struct which contains the same pointer.
11290     * Rust functions which take ownership of an object provided via an argument require
11291     * this to be true and invalidate the object pointed to by inner.
11292     */
11293    bool is_owned;
11294 } LDKMinFinalCltvExpiry;
11295
11296 /**
11297  * Integer in the range `0..32`
11298  */
11299 typedef struct LDKu5 {
11300    uint8_t _0;
11301 } LDKu5;
11302
11303 /**
11304  * A 20-byte byte array.
11305  */
11306 typedef struct LDKTwentyBytes {
11307    /**
11308     * The twenty bytes
11309     */
11310    uint8_t data[20];
11311 } LDKTwentyBytes;
11312
11313 /**
11314  * Fallback address in case no LN payment is possible
11315  */
11316 typedef enum LDKFallback_Tag {
11317    LDKFallback_SegWitProgram,
11318    LDKFallback_PubKeyHash,
11319    LDKFallback_ScriptHash,
11320    /**
11321     * Must be last for serialization purposes
11322     */
11323    LDKFallback_Sentinel,
11324 } LDKFallback_Tag;
11325
11326 typedef struct LDKFallback_LDKSegWitProgram_Body {
11327    struct LDKu5 version;
11328    struct LDKCVec_u8Z program;
11329 } LDKFallback_LDKSegWitProgram_Body;
11330
11331 typedef struct MUST_USE_STRUCT LDKFallback {
11332    LDKFallback_Tag tag;
11333    union {
11334       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
11335       struct {
11336          struct LDKTwentyBytes pub_key_hash;
11337       };
11338       struct {
11339          struct LDKTwentyBytes script_hash;
11340       };
11341    };
11342 } LDKFallback;
11343
11344 /**
11345  * A trait defining behavior of an [`Invoice`] payer.
11346  */
11347 typedef struct LDKPayer {
11348    /**
11349     * An opaque pointer which is passed to your function implementations as an argument.
11350     * This has no meaning in the LDK, and can be NULL or any other value.
11351     */
11352    void *this_arg;
11353    /**
11354     * Returns the payer's node id.
11355     */
11356    struct LDKPublicKey (*node_id)(const void *this_arg);
11357    /**
11358     * Returns the payer's channels.
11359     */
11360    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
11361    /**
11362     * Sends a payment over the Lightning Network using the given [`Route`].
11363     *
11364     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
11365     */
11366    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
11367    /**
11368     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
11369     */
11370    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
11371    /**
11372     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
11373     */
11374    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
11375    /**
11376     * Signals that no further retries for the given payment will occur.
11377     */
11378    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
11379    /**
11380     * Frees any resources associated with this object given its this_arg pointer.
11381     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11382     */
11383    void (*free)(void *this_arg);
11384 } LDKPayer;
11385
11386 /**
11387  * A trait defining behavior for routing an [`Invoice`] payment.
11388  */
11389 typedef struct LDKRouter {
11390    /**
11391     * An opaque pointer which is passed to your function implementations as an argument.
11392     * This has no meaning in the LDK, and can be NULL or any other value.
11393     */
11394    void *this_arg;
11395    /**
11396     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
11397     *
11398     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
11399     */
11400    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
11401    /**
11402     * Frees any resources associated with this object given its this_arg pointer.
11403     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11404     */
11405    void (*free)(void *this_arg);
11406 } LDKRouter;
11407
11408
11409
11410 /**
11411  * A utility for paying [`Invoice`]s and sending spontaneous payments.
11412  *
11413  * See [module-level documentation] for details.
11414  *
11415  * [module-level documentation]: crate::payment
11416  */
11417 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
11418    /**
11419     * A pointer to the opaque Rust object.
11420     * Nearly everywhere, inner must be non-null, however in places where
11421     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11422     */
11423    LDKnativeInvoicePayer *inner;
11424    /**
11425     * Indicates that this is the only struct which contains the same pointer.
11426     * Rust functions which take ownership of an object provided via an argument require
11427     * this to be true and invalidate the object pointed to by inner.
11428     */
11429    bool is_owned;
11430 } LDKInvoicePayer;
11431
11432
11433
11434 /**
11435  * Number of attempts to retry payment path failures for an [`Invoice`].
11436  *
11437  * Note that this is the number of *path* failures, not full payment retries. For multi-path
11438  * payments, if this is less than the total number of paths, we will never even retry all of the
11439  * payment's paths.
11440  */
11441 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
11442    /**
11443     * A pointer to the opaque Rust object.
11444     * Nearly everywhere, inner must be non-null, however in places where
11445     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11446     */
11447    LDKnativeRetryAttempts *inner;
11448    /**
11449     * Indicates that this is the only struct which contains the same pointer.
11450     * Rust functions which take ownership of an object provided via an argument require
11451     * this to be true and invalidate the object pointed to by inner.
11452     */
11453    bool is_owned;
11454 } LDKRetryAttempts;
11455
11456
11457
11458 /**
11459  * A [`Router`] implemented using [`find_route`].
11460  */
11461 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
11462    /**
11463     * A pointer to the opaque Rust object.
11464     * Nearly everywhere, inner must be non-null, however in places where
11465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11466     */
11467    LDKnativeDefaultRouter *inner;
11468    /**
11469     * Indicates that this is the only struct which contains the same pointer.
11470     * Rust functions which take ownership of an object provided via an argument require
11471     * this to be true and invalidate the object pointed to by inner.
11472     */
11473    bool is_owned;
11474 } LDKDefaultRouter;
11475
11476 extern const uintptr_t MAX_BUF_SIZE;
11477
11478 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
11479
11480 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
11481
11482 extern const uint32_t ANTI_REORG_DELAY;
11483
11484 extern const uint16_t BREAKDOWN_TIMEOUT;
11485
11486 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
11487
11488 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
11489
11490 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
11491
11492 extern const uint64_t DEFAULT_EXPIRY_TIME;
11493
11494 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
11495
11496 extern const uint8_t TAG_PAYMENT_HASH;
11497
11498 extern const uint8_t TAG_DESCRIPTION;
11499
11500 extern const uint8_t TAG_PAYEE_PUB_KEY;
11501
11502 extern const uint8_t TAG_DESCRIPTION_HASH;
11503
11504 extern const uint8_t TAG_EXPIRY_TIME;
11505
11506 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
11507
11508 extern const uint8_t TAG_FALLBACK;
11509
11510 extern const uint8_t TAG_PRIVATE_ROUTE;
11511
11512 extern const uint8_t TAG_PAYMENT_SECRET;
11513
11514 extern const uint8_t TAG_FEATURES;
11515
11516 struct LDKStr _ldk_get_compiled_version(void);
11517
11518 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
11519
11520 /**
11521  * Frees the data buffer, if data_is_owned is set and datalen > 0.
11522  */
11523 void Transaction_free(struct LDKTransaction _res);
11524
11525 /**
11526  * Convenience function for constructing a new TxOut
11527  */
11528 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
11529
11530 /**
11531  * Frees the data pointed to by script_pubkey.
11532  */
11533 void TxOut_free(struct LDKTxOut _res);
11534
11535 /**
11536  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
11537  */
11538 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
11539
11540 /**
11541  * Frees the data buffer, if chars_is_owned is set and len > 0.
11542  */
11543 void Str_free(struct LDKStr _res);
11544
11545 #if defined(LDK_DEBUG_BUILD)
11546 /**
11547  * This function exists for memory safety testing purposes. It should never be used in production
11548  * code
11549  */
11550 const void *__unmangle_inner_ptr(const void *ptr);
11551 #endif
11552
11553 /**
11554  * Creates a new CResult_SecretKeyErrorZ in the success state.
11555  */
11556 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
11557
11558 /**
11559  * Creates a new CResult_SecretKeyErrorZ in the error state.
11560  */
11561 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
11562
11563 /**
11564  * Checks if the given object is currently in the success state
11565  */
11566 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
11567
11568 /**
11569  * Frees any resources used by the CResult_SecretKeyErrorZ.
11570  */
11571 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
11572
11573 /**
11574  * Creates a new CResult_PublicKeyErrorZ in the success state.
11575  */
11576 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
11577
11578 /**
11579  * Creates a new CResult_PublicKeyErrorZ in the error state.
11580  */
11581 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
11582
11583 /**
11584  * Checks if the given object is currently in the success state
11585  */
11586 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
11587
11588 /**
11589  * Frees any resources used by the CResult_PublicKeyErrorZ.
11590  */
11591 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
11592
11593 /**
11594  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
11595  * but with all dynamically-allocated buffers duplicated in new buffers.
11596  */
11597 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
11598
11599 /**
11600  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
11601  */
11602 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
11603
11604 /**
11605  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
11606  */
11607 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
11608
11609 /**
11610  * Checks if the given object is currently in the success state
11611  */
11612 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
11613
11614 /**
11615  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
11616  */
11617 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
11618
11619 /**
11620  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
11621  * but with all dynamically-allocated buffers duplicated in new buffers.
11622  */
11623 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
11624
11625 /**
11626  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
11627  */
11628 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
11629
11630 /**
11631  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
11632  */
11633 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
11634
11635 /**
11636  * Checks if the given object is currently in the success state
11637  */
11638 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
11639
11640 /**
11641  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
11642  */
11643 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
11644
11645 /**
11646  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
11647  * but with all dynamically-allocated buffers duplicated in new buffers.
11648  */
11649 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
11650
11651 /**
11652  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
11653  */
11654 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
11655
11656 /**
11657  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
11658  */
11659 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
11660
11661 /**
11662  * Checks if the given object is currently in the success state
11663  */
11664 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
11665
11666 /**
11667  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
11668  */
11669 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
11670
11671 /**
11672  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
11673  * but with all dynamically-allocated buffers duplicated in new buffers.
11674  */
11675 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
11676
11677 /**
11678  * Constructs a new COption_u32Z containing a u32
11679  */
11680 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
11681
11682 /**
11683  * Constructs a new COption_u32Z containing nothing
11684  */
11685 struct LDKCOption_u32Z COption_u32Z_none(void);
11686
11687 /**
11688  * Frees any resources associated with the u32, if we are in the Some state
11689  */
11690 void COption_u32Z_free(struct LDKCOption_u32Z _res);
11691
11692 /**
11693  * Creates a new COption_u32Z which has the same data as `orig`
11694  * but with all dynamically-allocated buffers duplicated in new buffers.
11695  */
11696 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
11697
11698 /**
11699  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
11700  */
11701 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
11702
11703 /**
11704  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
11705  */
11706 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
11707
11708 /**
11709  * Checks if the given object is currently in the success state
11710  */
11711 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
11712
11713 /**
11714  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
11715  */
11716 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
11717
11718 /**
11719  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
11720  * but with all dynamically-allocated buffers duplicated in new buffers.
11721  */
11722 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
11723
11724 /**
11725  * Constructs a new COption_NoneZ containing a
11726  */
11727 enum LDKCOption_NoneZ COption_NoneZ_some(void);
11728
11729 /**
11730  * Constructs a new COption_NoneZ containing nothing
11731  */
11732 enum LDKCOption_NoneZ COption_NoneZ_none(void);
11733
11734 /**
11735  * Frees any resources associated with the , if we are in the Some state
11736  */
11737 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
11738
11739 /**
11740  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
11741  */
11742 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
11743
11744 /**
11745  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
11746  */
11747 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11748
11749 /**
11750  * Checks if the given object is currently in the success state
11751  */
11752 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
11753
11754 /**
11755  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
11756  */
11757 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
11758
11759 /**
11760  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11761  * but with all dynamically-allocated buffers duplicated in new buffers.
11762  */
11763 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11764
11765 /**
11766  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
11767  */
11768 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
11769
11770 /**
11771  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
11772  */
11773 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11774
11775 /**
11776  * Checks if the given object is currently in the success state
11777  */
11778 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
11779
11780 /**
11781  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
11782  */
11783 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
11784
11785 /**
11786  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11787  * but with all dynamically-allocated buffers duplicated in new buffers.
11788  */
11789 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11790
11791 /**
11792  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11793  */
11794 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
11795
11796 /**
11797  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
11798  */
11799 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
11800
11801 /**
11802  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
11803  */
11804 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11805
11806 /**
11807  * Checks if the given object is currently in the success state
11808  */
11809 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11810
11811 /**
11812  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
11813  */
11814 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
11815
11816 /**
11817  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11818  * but with all dynamically-allocated buffers duplicated in new buffers.
11819  */
11820 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11821
11822 /**
11823  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
11824  */
11825 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
11826
11827 /**
11828  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
11829  */
11830 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11831
11832 /**
11833  * Checks if the given object is currently in the success state
11834  */
11835 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11836
11837 /**
11838  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
11839  */
11840 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
11841
11842 /**
11843  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11844  * but with all dynamically-allocated buffers duplicated in new buffers.
11845  */
11846 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11847
11848 /**
11849  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
11850  */
11851 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
11852
11853 /**
11854  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
11855  */
11856 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
11857
11858 /**
11859  * Checks if the given object is currently in the success state
11860  */
11861 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
11862
11863 /**
11864  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
11865  */
11866 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
11867
11868 /**
11869  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
11870  */
11871 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
11872
11873 /**
11874  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
11875  */
11876 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11877
11878 /**
11879  * Checks if the given object is currently in the success state
11880  */
11881 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11882
11883 /**
11884  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
11885  */
11886 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
11887
11888 /**
11889  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
11890  * but with all dynamically-allocated buffers duplicated in new buffers.
11891  */
11892 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11893
11894 /**
11895  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
11896  */
11897 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
11898
11899 /**
11900  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
11901  */
11902 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
11903
11904 /**
11905  * Checks if the given object is currently in the success state
11906  */
11907 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
11908
11909 /**
11910  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
11911  */
11912 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
11913
11914 /**
11915  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
11916  */
11917 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
11918
11919 /**
11920  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
11921  */
11922 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
11923
11924 /**
11925  * Checks if the given object is currently in the success state
11926  */
11927 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
11928
11929 /**
11930  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
11931  */
11932 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
11933
11934 /**
11935  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
11936  * but with all dynamically-allocated buffers duplicated in new buffers.
11937  */
11938 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
11939
11940 /**
11941  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
11942  */
11943 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
11944
11945 /**
11946  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
11947  */
11948 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
11949
11950 /**
11951  * Checks if the given object is currently in the success state
11952  */
11953 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
11954
11955 /**
11956  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
11957  */
11958 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
11959
11960 /**
11961  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
11962  * but with all dynamically-allocated buffers duplicated in new buffers.
11963  */
11964 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
11965
11966 /**
11967  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
11968  */
11969 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
11970
11971 /**
11972  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
11973  */
11974 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
11975
11976 /**
11977  * Checks if the given object is currently in the success state
11978  */
11979 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
11980
11981 /**
11982  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
11983  */
11984 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
11985
11986 /**
11987  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
11988  * but with all dynamically-allocated buffers duplicated in new buffers.
11989  */
11990 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
11991
11992 /**
11993  * Creates a new CResult_NoneErrorZ in the success state.
11994  */
11995 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11996
11997 /**
11998  * Creates a new CResult_NoneErrorZ in the error state.
11999  */
12000 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
12001
12002 /**
12003  * Checks if the given object is currently in the success state
12004  */
12005 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
12006
12007 /**
12008  * Frees any resources used by the CResult_NoneErrorZ.
12009  */
12010 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
12011
12012 /**
12013  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
12014  * but with all dynamically-allocated buffers duplicated in new buffers.
12015  */
12016 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
12017
12018 /**
12019  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
12020  */
12021 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
12022
12023 /**
12024  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
12025  */
12026 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
12027
12028 /**
12029  * Checks if the given object is currently in the success state
12030  */
12031 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
12032
12033 /**
12034  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
12035  */
12036 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
12037
12038 /**
12039  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
12040  * but with all dynamically-allocated buffers duplicated in new buffers.
12041  */
12042 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
12043
12044 /**
12045  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12046  */
12047 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
12048
12049 /**
12050  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12051  */
12052 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
12053
12054 /**
12055  * Creates a new CResult_RouteDecodeErrorZ in the success state.
12056  */
12057 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
12058
12059 /**
12060  * Creates a new CResult_RouteDecodeErrorZ in the error state.
12061  */
12062 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
12063
12064 /**
12065  * Checks if the given object is currently in the success state
12066  */
12067 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
12068
12069 /**
12070  * Frees any resources used by the CResult_RouteDecodeErrorZ.
12071  */
12072 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
12073
12074 /**
12075  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
12076  * but with all dynamically-allocated buffers duplicated in new buffers.
12077  */
12078 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
12079
12080 /**
12081  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
12082  */
12083 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
12084
12085 /**
12086  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
12087  */
12088 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
12089
12090 /**
12091  * Checks if the given object is currently in the success state
12092  */
12093 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
12094
12095 /**
12096  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
12097  */
12098 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
12099
12100 /**
12101  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
12102  * but with all dynamically-allocated buffers duplicated in new buffers.
12103  */
12104 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
12105
12106 /**
12107  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12108  */
12109 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
12110
12111 /**
12112  * Constructs a new COption_u64Z containing a u64
12113  */
12114 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
12115
12116 /**
12117  * Constructs a new COption_u64Z containing nothing
12118  */
12119 struct LDKCOption_u64Z COption_u64Z_none(void);
12120
12121 /**
12122  * Frees any resources associated with the u64, if we are in the Some state
12123  */
12124 void COption_u64Z_free(struct LDKCOption_u64Z _res);
12125
12126 /**
12127  * Creates a new COption_u64Z which has the same data as `orig`
12128  * but with all dynamically-allocated buffers duplicated in new buffers.
12129  */
12130 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
12131
12132 /**
12133  * Creates a new CResult_PayeeDecodeErrorZ in the success state.
12134  */
12135 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
12136
12137 /**
12138  * Creates a new CResult_PayeeDecodeErrorZ in the error state.
12139  */
12140 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
12141
12142 /**
12143  * Checks if the given object is currently in the success state
12144  */
12145 bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o);
12146
12147 /**
12148  * Frees any resources used by the CResult_PayeeDecodeErrorZ.
12149  */
12150 void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
12151
12152 /**
12153  * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
12154  * but with all dynamically-allocated buffers duplicated in new buffers.
12155  */
12156 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
12157
12158 /**
12159  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12160  */
12161 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
12162
12163 /**
12164  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
12165  */
12166 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
12167
12168 /**
12169  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
12170  */
12171 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
12172
12173 /**
12174  * Checks if the given object is currently in the success state
12175  */
12176 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
12177
12178 /**
12179  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
12180  */
12181 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
12182
12183 /**
12184  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
12185  * but with all dynamically-allocated buffers duplicated in new buffers.
12186  */
12187 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
12188
12189 /**
12190  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
12191  */
12192 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
12193
12194 /**
12195  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
12196  */
12197 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
12198
12199 /**
12200  * Checks if the given object is currently in the success state
12201  */
12202 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
12203
12204 /**
12205  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
12206  */
12207 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
12208
12209 /**
12210  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
12211  * but with all dynamically-allocated buffers duplicated in new buffers.
12212  */
12213 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
12214
12215 /**
12216  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12217  */
12218 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
12219
12220 /**
12221  * Creates a new CResult_RouteLightningErrorZ in the success state.
12222  */
12223 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
12224
12225 /**
12226  * Creates a new CResult_RouteLightningErrorZ in the error state.
12227  */
12228 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
12229
12230 /**
12231  * Checks if the given object is currently in the success state
12232  */
12233 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
12234
12235 /**
12236  * Frees any resources used by the CResult_RouteLightningErrorZ.
12237  */
12238 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
12239
12240 /**
12241  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
12242  * but with all dynamically-allocated buffers duplicated in new buffers.
12243  */
12244 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
12245
12246 /**
12247  * Creates a new CResult_TxOutAccessErrorZ in the success state.
12248  */
12249 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
12250
12251 /**
12252  * Creates a new CResult_TxOutAccessErrorZ in the error state.
12253  */
12254 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
12255
12256 /**
12257  * Checks if the given object is currently in the success state
12258  */
12259 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
12260
12261 /**
12262  * Frees any resources used by the CResult_TxOutAccessErrorZ.
12263  */
12264 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
12265
12266 /**
12267  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
12268  * but with all dynamically-allocated buffers duplicated in new buffers.
12269  */
12270 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
12271
12272 /**
12273  * Creates a new tuple which has the same data as `orig`
12274  * but with all dynamically-allocated buffers duplicated in new buffers.
12275  */
12276 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
12277
12278 /**
12279  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
12280  */
12281 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
12282
12283 /**
12284  * Frees any resources used by the C2Tuple_usizeTransactionZ.
12285  */
12286 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
12287
12288 /**
12289  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12290  */
12291 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
12292
12293 /**
12294  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12295  */
12296 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
12297
12298 /**
12299  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
12300  */
12301 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
12302
12303 /**
12304  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
12305  */
12306 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
12307
12308 /**
12309  * Checks if the given object is currently in the success state
12310  */
12311 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
12312
12313 /**
12314  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
12315  */
12316 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
12317
12318 /**
12319  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
12320  * but with all dynamically-allocated buffers duplicated in new buffers.
12321  */
12322 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
12323
12324 /**
12325  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12326  */
12327 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
12328
12329 /**
12330  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
12331  */
12332 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
12333
12334 /**
12335  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
12336  */
12337 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
12338
12339 /**
12340  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
12341  */
12342 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
12343
12344 /**
12345  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
12346  * but with all dynamically-allocated buffers duplicated in new buffers.
12347  */
12348 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
12349
12350 /**
12351  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
12352  */
12353 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
12354
12355 /**
12356  * Constructs a new COption_ClosureReasonZ containing nothing
12357  */
12358 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
12359
12360 /**
12361  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
12362  */
12363 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
12364
12365 /**
12366  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
12367  * but with all dynamically-allocated buffers duplicated in new buffers.
12368  */
12369 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
12370
12371 /**
12372  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
12373  */
12374 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
12375
12376 /**
12377  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
12378  */
12379 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
12380
12381 /**
12382  * Checks if the given object is currently in the success state
12383  */
12384 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
12385
12386 /**
12387  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
12388  */
12389 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
12390
12391 /**
12392  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
12393  * but with all dynamically-allocated buffers duplicated in new buffers.
12394  */
12395 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
12396
12397 /**
12398  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
12399  */
12400 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
12401
12402 /**
12403  * Constructs a new COption_NetworkUpdateZ containing nothing
12404  */
12405 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
12406
12407 /**
12408  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
12409  */
12410 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
12411
12412 /**
12413  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
12414  * but with all dynamically-allocated buffers duplicated in new buffers.
12415  */
12416 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
12417
12418 /**
12419  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12420  */
12421 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
12422
12423 /**
12424  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
12425  */
12426 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
12427
12428 /**
12429  * Constructs a new COption_EventZ containing nothing
12430  */
12431 struct LDKCOption_EventZ COption_EventZ_none(void);
12432
12433 /**
12434  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
12435  */
12436 void COption_EventZ_free(struct LDKCOption_EventZ _res);
12437
12438 /**
12439  * Creates a new COption_EventZ which has the same data as `orig`
12440  * but with all dynamically-allocated buffers duplicated in new buffers.
12441  */
12442 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
12443
12444 /**
12445  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
12446  */
12447 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
12448
12449 /**
12450  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
12451  */
12452 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
12453
12454 /**
12455  * Checks if the given object is currently in the success state
12456  */
12457 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
12458
12459 /**
12460  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
12461  */
12462 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
12463
12464 /**
12465  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
12466  * but with all dynamically-allocated buffers duplicated in new buffers.
12467  */
12468 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
12469
12470 /**
12471  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12472  */
12473 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
12474
12475 /**
12476  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
12477  */
12478 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
12479
12480 /**
12481  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
12482  */
12483 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
12484
12485 /**
12486  * Checks if the given object is currently in the success state
12487  */
12488 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
12489
12490 /**
12491  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
12492  */
12493 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
12494
12495 /**
12496  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
12497  */
12498 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
12499
12500 /**
12501  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
12502  */
12503 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
12504
12505 /**
12506  * Checks if the given object is currently in the success state
12507  */
12508 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
12509
12510 /**
12511  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
12512  */
12513 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
12514
12515 /**
12516  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
12517  */
12518 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
12519
12520 /**
12521  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
12522  */
12523 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12524
12525 /**
12526  * Checks if the given object is currently in the success state
12527  */
12528 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
12529
12530 /**
12531  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
12532  */
12533 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
12534
12535 /**
12536  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
12537  */
12538 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
12539
12540 /**
12541  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
12542  */
12543 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12544
12545 /**
12546  * Checks if the given object is currently in the success state
12547  */
12548 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
12549
12550 /**
12551  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
12552  */
12553 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
12554
12555 /**
12556  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
12557  */
12558 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
12559
12560 /**
12561  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
12562  */
12563 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12564
12565 /**
12566  * Checks if the given object is currently in the success state
12567  */
12568 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
12569
12570 /**
12571  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
12572  */
12573 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
12574
12575 /**
12576  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
12577  */
12578 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
12579
12580 /**
12581  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
12582  */
12583 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12584
12585 /**
12586  * Checks if the given object is currently in the success state
12587  */
12588 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
12589
12590 /**
12591  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
12592  */
12593 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
12594
12595 /**
12596  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
12597  */
12598 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
12599
12600 /**
12601  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
12602  */
12603 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12604
12605 /**
12606  * Checks if the given object is currently in the success state
12607  */
12608 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
12609
12610 /**
12611  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
12612  */
12613 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
12614
12615 /**
12616  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
12617  */
12618 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
12619
12620 /**
12621  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
12622  */
12623 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12624
12625 /**
12626  * Checks if the given object is currently in the success state
12627  */
12628 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12629
12630 /**
12631  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
12632  */
12633 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
12634
12635 /**
12636  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
12637  * but with all dynamically-allocated buffers duplicated in new buffers.
12638  */
12639 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12640
12641 /**
12642  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
12643  */
12644 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
12645
12646 /**
12647  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
12648  */
12649 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12650
12651 /**
12652  * Checks if the given object is currently in the success state
12653  */
12654 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12655
12656 /**
12657  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
12658  */
12659 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
12660
12661 /**
12662  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
12663  * but with all dynamically-allocated buffers duplicated in new buffers.
12664  */
12665 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12666
12667 /**
12668  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
12669  */
12670 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
12671
12672 /**
12673  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
12674  */
12675 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12676
12677 /**
12678  * Checks if the given object is currently in the success state
12679  */
12680 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12681
12682 /**
12683  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
12684  */
12685 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
12686
12687 /**
12688  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
12689  * but with all dynamically-allocated buffers duplicated in new buffers.
12690  */
12691 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12692
12693 /**
12694  * Creates a new CResult_NoneNoneZ in the success state.
12695  */
12696 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12697
12698 /**
12699  * Creates a new CResult_NoneNoneZ in the error state.
12700  */
12701 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12702
12703 /**
12704  * Checks if the given object is currently in the success state
12705  */
12706 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12707
12708 /**
12709  * Frees any resources used by the CResult_NoneNoneZ.
12710  */
12711 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12712
12713 /**
12714  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12715  * but with all dynamically-allocated buffers duplicated in new buffers.
12716  */
12717 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12718
12719 /**
12720  * Creates a new tuple which has the same data as `orig`
12721  * but with all dynamically-allocated buffers duplicated in new buffers.
12722  */
12723 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
12724
12725 /**
12726  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
12727  */
12728 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
12729
12730 /**
12731  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
12732  */
12733 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
12734
12735 /**
12736  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
12737  */
12738 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
12739
12740 /**
12741  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
12742  */
12743 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
12744
12745 /**
12746  * Checks if the given object is currently in the success state
12747  */
12748 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
12749
12750 /**
12751  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
12752  */
12753 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
12754
12755 /**
12756  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
12757  * but with all dynamically-allocated buffers duplicated in new buffers.
12758  */
12759 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
12760
12761 /**
12762  * Creates a new CResult_SignatureNoneZ in the success state.
12763  */
12764 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
12765
12766 /**
12767  * Creates a new CResult_SignatureNoneZ in the error state.
12768  */
12769 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
12770
12771 /**
12772  * Checks if the given object is currently in the success state
12773  */
12774 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
12775
12776 /**
12777  * Frees any resources used by the CResult_SignatureNoneZ.
12778  */
12779 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
12780
12781 /**
12782  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
12783  * but with all dynamically-allocated buffers duplicated in new buffers.
12784  */
12785 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
12786
12787 /**
12788  * Creates a new CResult_SignDecodeErrorZ in the success state.
12789  */
12790 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
12791
12792 /**
12793  * Creates a new CResult_SignDecodeErrorZ in the error state.
12794  */
12795 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
12796
12797 /**
12798  * Checks if the given object is currently in the success state
12799  */
12800 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
12801
12802 /**
12803  * Frees any resources used by the CResult_SignDecodeErrorZ.
12804  */
12805 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
12806
12807 /**
12808  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
12809  * but with all dynamically-allocated buffers duplicated in new buffers.
12810  */
12811 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
12812
12813 /**
12814  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12815  */
12816 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
12817
12818 /**
12819  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
12820  */
12821 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
12822
12823 /**
12824  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
12825  */
12826 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
12827
12828 /**
12829  * Checks if the given object is currently in the success state
12830  */
12831 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
12832
12833 /**
12834  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
12835  */
12836 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
12837
12838 /**
12839  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
12840  * but with all dynamically-allocated buffers duplicated in new buffers.
12841  */
12842 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
12843
12844 /**
12845  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12846  */
12847 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
12848
12849 /**
12850  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
12851  */
12852 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
12853
12854 /**
12855  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
12856  */
12857 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
12858
12859 /**
12860  * Checks if the given object is currently in the success state
12861  */
12862 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
12863
12864 /**
12865  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
12866  */
12867 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
12868
12869 /**
12870  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
12871  * but with all dynamically-allocated buffers duplicated in new buffers.
12872  */
12873 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
12874
12875 /**
12876  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
12877  */
12878 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
12879
12880 /**
12881  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
12882  */
12883 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
12884
12885 /**
12886  * Checks if the given object is currently in the success state
12887  */
12888 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
12889
12890 /**
12891  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
12892  */
12893 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
12894
12895 /**
12896  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
12897  * but with all dynamically-allocated buffers duplicated in new buffers.
12898  */
12899 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
12900
12901 /**
12902  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12903  */
12904 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
12905
12906 /**
12907  * Creates a new CResult_TransactionNoneZ in the success state.
12908  */
12909 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
12910
12911 /**
12912  * Creates a new CResult_TransactionNoneZ in the error state.
12913  */
12914 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
12915
12916 /**
12917  * Checks if the given object is currently in the success state
12918  */
12919 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
12920
12921 /**
12922  * Frees any resources used by the CResult_TransactionNoneZ.
12923  */
12924 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
12925
12926 /**
12927  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
12928  * but with all dynamically-allocated buffers duplicated in new buffers.
12929  */
12930 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
12931
12932 /**
12933  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
12934  */
12935 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
12936
12937 /**
12938  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
12939  */
12940 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
12941
12942 /**
12943  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12944  */
12945 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
12946
12947 /**
12948  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
12949  */
12950 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
12951
12952 /**
12953  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
12954  */
12955 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
12956
12957 /**
12958  * Checks if the given object is currently in the success state
12959  */
12960 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
12961
12962 /**
12963  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
12964  */
12965 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
12966
12967 /**
12968  * Constructs a new COption_u16Z containing a u16
12969  */
12970 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
12971
12972 /**
12973  * Constructs a new COption_u16Z containing nothing
12974  */
12975 struct LDKCOption_u16Z COption_u16Z_none(void);
12976
12977 /**
12978  * Frees any resources associated with the u16, if we are in the Some state
12979  */
12980 void COption_u16Z_free(struct LDKCOption_u16Z _res);
12981
12982 /**
12983  * Creates a new COption_u16Z which has the same data as `orig`
12984  * but with all dynamically-allocated buffers duplicated in new buffers.
12985  */
12986 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
12987
12988 /**
12989  * Creates a new CResult_NoneAPIErrorZ in the success state.
12990  */
12991 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
12992
12993 /**
12994  * Creates a new CResult_NoneAPIErrorZ in the error state.
12995  */
12996 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
12997
12998 /**
12999  * Checks if the given object is currently in the success state
13000  */
13001 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
13002
13003 /**
13004  * Frees any resources used by the CResult_NoneAPIErrorZ.
13005  */
13006 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
13007
13008 /**
13009  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
13010  * but with all dynamically-allocated buffers duplicated in new buffers.
13011  */
13012 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
13013
13014 /**
13015  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13016  */
13017 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
13018
13019 /**
13020  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13021  */
13022 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
13023
13024 /**
13025  * Creates a new CResult__u832APIErrorZ in the success state.
13026  */
13027 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
13028
13029 /**
13030  * Creates a new CResult__u832APIErrorZ in the error state.
13031  */
13032 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
13033
13034 /**
13035  * Checks if the given object is currently in the success state
13036  */
13037 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
13038
13039 /**
13040  * Frees any resources used by the CResult__u832APIErrorZ.
13041  */
13042 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
13043
13044 /**
13045  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
13046  * but with all dynamically-allocated buffers duplicated in new buffers.
13047  */
13048 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
13049
13050 /**
13051  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
13052  */
13053 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
13054
13055 /**
13056  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
13057  */
13058 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13059
13060 /**
13061  * Checks if the given object is currently in the success state
13062  */
13063 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
13064
13065 /**
13066  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
13067  */
13068 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
13069
13070 /**
13071  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
13072  * but with all dynamically-allocated buffers duplicated in new buffers.
13073  */
13074 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
13075
13076 /**
13077  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
13078  */
13079 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
13080
13081 /**
13082  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
13083  */
13084 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13085
13086 /**
13087  * Checks if the given object is currently in the success state
13088  */
13089 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
13090
13091 /**
13092  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
13093  */
13094 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
13095
13096 /**
13097  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
13098  * but with all dynamically-allocated buffers duplicated in new buffers.
13099  */
13100 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
13101
13102 /**
13103  * Creates a new tuple which has the same data as `orig`
13104  * but with all dynamically-allocated buffers duplicated in new buffers.
13105  */
13106 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
13107
13108 /**
13109  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
13110  */
13111 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
13112
13113 /**
13114  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
13115  */
13116 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
13117
13118 /**
13119  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
13120  */
13121 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
13122
13123 /**
13124  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
13125  */
13126 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13127
13128 /**
13129  * Checks if the given object is currently in the success state
13130  */
13131 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
13132
13133 /**
13134  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
13135  */
13136 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
13137
13138 /**
13139  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
13140  * but with all dynamically-allocated buffers duplicated in new buffers.
13141  */
13142 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
13143
13144 /**
13145  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13146  */
13147 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
13148
13149 /**
13150  * Creates a new tuple which has the same data as `orig`
13151  * but with all dynamically-allocated buffers duplicated in new buffers.
13152  */
13153 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
13154
13155 /**
13156  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
13157  */
13158 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
13159
13160 /**
13161  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
13162  */
13163 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
13164
13165 /**
13166  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
13167  */
13168 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
13169
13170 /**
13171  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
13172  */
13173 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
13174
13175 /**
13176  * Checks if the given object is currently in the success state
13177  */
13178 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
13179
13180 /**
13181  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
13182  */
13183 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
13184
13185 /**
13186  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
13187  * but with all dynamically-allocated buffers duplicated in new buffers.
13188  */
13189 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
13190
13191 /**
13192  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
13193  */
13194 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
13195
13196 /**
13197  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
13198  */
13199 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
13200
13201 /**
13202  * Checks if the given object is currently in the success state
13203  */
13204 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
13205
13206 /**
13207  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
13208  */
13209 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
13210
13211 /**
13212  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
13213  * but with all dynamically-allocated buffers duplicated in new buffers.
13214  */
13215 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
13216
13217 /**
13218  * Creates a new CResult_PaymentSecretNoneZ in the success state.
13219  */
13220 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
13221
13222 /**
13223  * Creates a new CResult_PaymentSecretNoneZ in the error state.
13224  */
13225 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
13226
13227 /**
13228  * Checks if the given object is currently in the success state
13229  */
13230 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
13231
13232 /**
13233  * Frees any resources used by the CResult_PaymentSecretNoneZ.
13234  */
13235 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
13236
13237 /**
13238  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
13239  * but with all dynamically-allocated buffers duplicated in new buffers.
13240  */
13241 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
13242
13243 /**
13244  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
13245  */
13246 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
13247
13248 /**
13249  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
13250  */
13251 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
13252
13253 /**
13254  * Checks if the given object is currently in the success state
13255  */
13256 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
13257
13258 /**
13259  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
13260  */
13261 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
13262
13263 /**
13264  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
13265  * but with all dynamically-allocated buffers duplicated in new buffers.
13266  */
13267 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
13268
13269 /**
13270  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
13271  */
13272 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
13273
13274 /**
13275  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
13276  */
13277 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
13278
13279 /**
13280  * Checks if the given object is currently in the success state
13281  */
13282 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
13283
13284 /**
13285  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
13286  */
13287 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
13288
13289 /**
13290  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
13291  * but with all dynamically-allocated buffers duplicated in new buffers.
13292  */
13293 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
13294
13295 /**
13296  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13297  */
13298 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
13299
13300 /**
13301  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
13302  */
13303 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
13304
13305 /**
13306  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
13307  */
13308 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
13309
13310 /**
13311  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
13312  */
13313 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
13314
13315 /**
13316  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
13317  */
13318 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
13319
13320 /**
13321  * Checks if the given object is currently in the success state
13322  */
13323 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
13324
13325 /**
13326  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
13327  */
13328 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
13329
13330 /**
13331  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
13332  */
13333 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
13334
13335 /**
13336  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
13337  */
13338 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
13339
13340 /**
13341  * Checks if the given object is currently in the success state
13342  */
13343 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
13344
13345 /**
13346  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
13347  */
13348 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
13349
13350 /**
13351  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
13352  * but with all dynamically-allocated buffers duplicated in new buffers.
13353  */
13354 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
13355
13356 /**
13357  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
13358  */
13359 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
13360
13361 /**
13362  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
13363  */
13364 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
13365
13366 /**
13367  * Checks if the given object is currently in the success state
13368  */
13369 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
13370
13371 /**
13372  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
13373  */
13374 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
13375
13376 /**
13377  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
13378  * but with all dynamically-allocated buffers duplicated in new buffers.
13379  */
13380 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
13381
13382 /**
13383  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13384  */
13385 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
13386
13387 /**
13388  * Constructs a new COption_TypeZ containing nothing
13389  */
13390 struct LDKCOption_TypeZ COption_TypeZ_none(void);
13391
13392 /**
13393  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13394  */
13395 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
13396
13397 /**
13398  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13399  */
13400 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
13401
13402 /**
13403  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13404  */
13405 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
13406
13407 /**
13408  * Checks if the given object is currently in the success state
13409  */
13410 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
13411
13412 /**
13413  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13414  */
13415 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
13416
13417 /**
13418  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
13419  */
13420 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
13421
13422 /**
13423  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
13424  */
13425 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
13426
13427 /**
13428  * Checks if the given object is currently in the success state
13429  */
13430 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
13431
13432 /**
13433  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
13434  */
13435 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
13436
13437 /**
13438  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
13439  * but with all dynamically-allocated buffers duplicated in new buffers.
13440  */
13441 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
13442
13443 /**
13444  * Creates a new CResult_SiPrefixNoneZ in the success state.
13445  */
13446 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
13447
13448 /**
13449  * Creates a new CResult_SiPrefixNoneZ in the error state.
13450  */
13451 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
13452
13453 /**
13454  * Checks if the given object is currently in the success state
13455  */
13456 bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
13457
13458 /**
13459  * Frees any resources used by the CResult_SiPrefixNoneZ.
13460  */
13461 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
13462
13463 /**
13464  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
13465  * but with all dynamically-allocated buffers duplicated in new buffers.
13466  */
13467 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
13468
13469 /**
13470  * Creates a new CResult_InvoiceNoneZ in the success state.
13471  */
13472 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
13473
13474 /**
13475  * Creates a new CResult_InvoiceNoneZ in the error state.
13476  */
13477 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
13478
13479 /**
13480  * Checks if the given object is currently in the success state
13481  */
13482 bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
13483
13484 /**
13485  * Frees any resources used by the CResult_InvoiceNoneZ.
13486  */
13487 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
13488
13489 /**
13490  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
13491  * but with all dynamically-allocated buffers duplicated in new buffers.
13492  */
13493 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
13494
13495 /**
13496  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
13497  */
13498 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
13499
13500 /**
13501  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
13502  */
13503 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
13504
13505 /**
13506  * Checks if the given object is currently in the success state
13507  */
13508 bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
13509
13510 /**
13511  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
13512  */
13513 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
13514
13515 /**
13516  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
13517  * but with all dynamically-allocated buffers duplicated in new buffers.
13518  */
13519 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
13520
13521 /**
13522  * Creates a new tuple which has the same data as `orig`
13523  * but with all dynamically-allocated buffers duplicated in new buffers.
13524  */
13525 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
13526
13527 /**
13528  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13529  */
13530 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
13531
13532 /**
13533  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13534  */
13535 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
13536
13537 /**
13538  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
13539  */
13540 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
13541
13542 /**
13543  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
13544  */
13545 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
13546
13547 /**
13548  * Checks if the given object is currently in the success state
13549  */
13550 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
13551
13552 /**
13553  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
13554  */
13555 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
13556
13557 /**
13558  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13559  * but with all dynamically-allocated buffers duplicated in new buffers.
13560  */
13561 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
13562
13563 /**
13564  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13565  */
13566 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
13567
13568 /**
13569  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13570  */
13571 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
13572
13573 /**
13574  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13575  */
13576 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
13577
13578 /**
13579  * Checks if the given object is currently in the success state
13580  */
13581 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
13582
13583 /**
13584  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13585  */
13586 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
13587
13588 /**
13589  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13590  * but with all dynamically-allocated buffers duplicated in new buffers.
13591  */
13592 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
13593
13594 /**
13595  * Creates a new CResult_NoneSemanticErrorZ in the success state.
13596  */
13597 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
13598
13599 /**
13600  * Creates a new CResult_NoneSemanticErrorZ in the error state.
13601  */
13602 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
13603
13604 /**
13605  * Checks if the given object is currently in the success state
13606  */
13607 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
13608
13609 /**
13610  * Frees any resources used by the CResult_NoneSemanticErrorZ.
13611  */
13612 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
13613
13614 /**
13615  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13616  * but with all dynamically-allocated buffers duplicated in new buffers.
13617  */
13618 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
13619
13620 /**
13621  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13622  */
13623 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
13624
13625 /**
13626  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13627  */
13628 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
13629
13630 /**
13631  * Checks if the given object is currently in the success state
13632  */
13633 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
13634
13635 /**
13636  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13637  */
13638 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
13639
13640 /**
13641  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
13642  * but with all dynamically-allocated buffers duplicated in new buffers.
13643  */
13644 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
13645
13646 /**
13647  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
13648  */
13649 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
13650
13651 /**
13652  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
13653  */
13654 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
13655
13656 /**
13657  * Checks if the given object is currently in the success state
13658  */
13659 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
13660
13661 /**
13662  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
13663  */
13664 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
13665
13666 /**
13667  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
13668  * but with all dynamically-allocated buffers duplicated in new buffers.
13669  */
13670 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
13671
13672 /**
13673  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
13674  */
13675 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
13676
13677 /**
13678  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
13679  */
13680 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
13681
13682 /**
13683  * Checks if the given object is currently in the success state
13684  */
13685 bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o);
13686
13687 /**
13688  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
13689  */
13690 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
13691
13692 /**
13693  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
13694  * but with all dynamically-allocated buffers duplicated in new buffers.
13695  */
13696 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
13697
13698 /**
13699  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
13700  */
13701 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
13702
13703 /**
13704  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
13705  */
13706 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
13707
13708 /**
13709  * Checks if the given object is currently in the success state
13710  */
13711 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
13712
13713 /**
13714  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
13715  */
13716 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
13717
13718 /**
13719  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13720  * but with all dynamically-allocated buffers duplicated in new buffers.
13721  */
13722 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
13723
13724 /**
13725  * Creates a new CResult_StringErrorZ in the success state.
13726  */
13727 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
13728
13729 /**
13730  * Creates a new CResult_StringErrorZ in the error state.
13731  */
13732 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
13733
13734 /**
13735  * Checks if the given object is currently in the success state
13736  */
13737 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
13738
13739 /**
13740  * Frees any resources used by the CResult_StringErrorZ.
13741  */
13742 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
13743
13744 /**
13745  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
13746  */
13747 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
13748
13749 /**
13750  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
13751  */
13752 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13753
13754 /**
13755  * Checks if the given object is currently in the success state
13756  */
13757 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
13758
13759 /**
13760  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
13761  */
13762 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
13763
13764 /**
13765  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
13766  * but with all dynamically-allocated buffers duplicated in new buffers.
13767  */
13768 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
13769
13770 /**
13771  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
13772  */
13773 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
13774
13775 /**
13776  * Constructs a new COption_MonitorEventZ containing nothing
13777  */
13778 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
13779
13780 /**
13781  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
13782  */
13783 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
13784
13785 /**
13786  * Creates a new COption_MonitorEventZ which has the same data as `orig`
13787  * but with all dynamically-allocated buffers duplicated in new buffers.
13788  */
13789 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
13790
13791 /**
13792  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
13793  */
13794 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
13795
13796 /**
13797  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
13798  */
13799 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
13800
13801 /**
13802  * Checks if the given object is currently in the success state
13803  */
13804 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
13805
13806 /**
13807  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
13808  */
13809 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
13810
13811 /**
13812  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
13813  * but with all dynamically-allocated buffers duplicated in new buffers.
13814  */
13815 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
13816
13817 /**
13818  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
13819  */
13820 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
13821
13822 /**
13823  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
13824  */
13825 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13826
13827 /**
13828  * Checks if the given object is currently in the success state
13829  */
13830 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
13831
13832 /**
13833  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
13834  */
13835 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
13836
13837 /**
13838  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
13839  * but with all dynamically-allocated buffers duplicated in new buffers.
13840  */
13841 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
13842
13843 /**
13844  * Creates a new tuple which has the same data as `orig`
13845  * but with all dynamically-allocated buffers duplicated in new buffers.
13846  */
13847 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
13848
13849 /**
13850  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
13851  */
13852 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
13853
13854 /**
13855  * Frees any resources used by the C2Tuple_OutPointScriptZ.
13856  */
13857 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
13858
13859 /**
13860  * Creates a new tuple which has the same data as `orig`
13861  * but with all dynamically-allocated buffers duplicated in new buffers.
13862  */
13863 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
13864
13865 /**
13866  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
13867  */
13868 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
13869
13870 /**
13871  * Frees any resources used by the C2Tuple_u32ScriptZ.
13872  */
13873 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
13874
13875 /**
13876  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13877  */
13878 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
13879
13880 /**
13881  * Creates a new tuple which has the same data as `orig`
13882  * but with all dynamically-allocated buffers duplicated in new buffers.
13883  */
13884 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
13885
13886 /**
13887  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
13888  */
13889 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
13890
13891 /**
13892  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
13893  */
13894 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
13895
13896 /**
13897  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13898  */
13899 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
13900
13901 /**
13902  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13903  */
13904 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
13905
13906 /**
13907  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13908  */
13909 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
13910
13911 /**
13912  * Creates a new tuple which has the same data as `orig`
13913  * but with all dynamically-allocated buffers duplicated in new buffers.
13914  */
13915 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
13916
13917 /**
13918  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
13919  */
13920 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
13921
13922 /**
13923  * Frees any resources used by the C2Tuple_u32TxOutZ.
13924  */
13925 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
13926
13927 /**
13928  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13929  */
13930 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
13931
13932 /**
13933  * Creates a new tuple which has the same data as `orig`
13934  * but with all dynamically-allocated buffers duplicated in new buffers.
13935  */
13936 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
13937
13938 /**
13939  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
13940  */
13941 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
13942
13943 /**
13944  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
13945  */
13946 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
13947
13948 /**
13949  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13950  */
13951 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
13952
13953 /**
13954  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13955  */
13956 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
13957
13958 /**
13959  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
13960  */
13961 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
13962
13963 /**
13964  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
13965  */
13966 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
13967
13968 /**
13969  * Checks if the given object is currently in the success state
13970  */
13971 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
13972
13973 /**
13974  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
13975  */
13976 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
13977
13978 /**
13979  * Creates a new CResult_NoneLightningErrorZ in the success state.
13980  */
13981 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
13982
13983 /**
13984  * Creates a new CResult_NoneLightningErrorZ in the error state.
13985  */
13986 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
13987
13988 /**
13989  * Checks if the given object is currently in the success state
13990  */
13991 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
13992
13993 /**
13994  * Frees any resources used by the CResult_NoneLightningErrorZ.
13995  */
13996 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
13997
13998 /**
13999  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14000  * but with all dynamically-allocated buffers duplicated in new buffers.
14001  */
14002 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14003
14004 /**
14005  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
14006  */
14007 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
14008
14009 /**
14010  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
14011  */
14012 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
14013
14014 /**
14015  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14016  */
14017 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
14018
14019 /**
14020  * Creates a new CResult_boolLightningErrorZ in the success state.
14021  */
14022 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14023
14024 /**
14025  * Creates a new CResult_boolLightningErrorZ in the error state.
14026  */
14027 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14028
14029 /**
14030  * Checks if the given object is currently in the success state
14031  */
14032 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14033
14034 /**
14035  * Frees any resources used by the CResult_boolLightningErrorZ.
14036  */
14037 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14038
14039 /**
14040  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14041  * but with all dynamically-allocated buffers duplicated in new buffers.
14042  */
14043 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14044
14045 /**
14046  * Creates a new tuple which has the same data as `orig`
14047  * but with all dynamically-allocated buffers duplicated in new buffers.
14048  */
14049 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14050
14051 /**
14052  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14053  */
14054 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14055
14056 /**
14057  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14058  */
14059 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14060
14061 /**
14062  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14063  */
14064 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14065
14066 /**
14067  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14068  */
14069 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14070
14071 /**
14072  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14073  */
14074 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
14075
14076 /**
14077  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
14078  */
14079 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
14080
14081 /**
14082  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
14083  */
14084 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
14085
14086 /**
14087  * Checks if the given object is currently in the success state
14088  */
14089 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
14090
14091 /**
14092  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
14093  */
14094 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
14095
14096 /**
14097  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
14098  * but with all dynamically-allocated buffers duplicated in new buffers.
14099  */
14100 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
14101
14102 /**
14103  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
14104  */
14105 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
14106
14107 /**
14108  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
14109  */
14110 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
14111
14112 /**
14113  * Checks if the given object is currently in the success state
14114  */
14115 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
14116
14117 /**
14118  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
14119  */
14120 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
14121
14122 /**
14123  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
14124  * but with all dynamically-allocated buffers duplicated in new buffers.
14125  */
14126 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
14127
14128 /**
14129  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
14130  */
14131 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
14132
14133 /**
14134  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
14135  */
14136 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
14137
14138 /**
14139  * Checks if the given object is currently in the success state
14140  */
14141 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
14142
14143 /**
14144  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
14145  */
14146 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
14147
14148 /**
14149  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
14150  * but with all dynamically-allocated buffers duplicated in new buffers.
14151  */
14152 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
14153
14154 /**
14155  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
14156  */
14157 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
14158
14159 /**
14160  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
14161  */
14162 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
14163
14164 /**
14165  * Checks if the given object is currently in the success state
14166  */
14167 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
14168
14169 /**
14170  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
14171  */
14172 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
14173
14174 /**
14175  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
14176  * but with all dynamically-allocated buffers duplicated in new buffers.
14177  */
14178 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
14179
14180 /**
14181  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
14182  */
14183 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
14184
14185 /**
14186  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
14187  */
14188 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
14189
14190 /**
14191  * Checks if the given object is currently in the success state
14192  */
14193 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
14194
14195 /**
14196  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
14197  */
14198 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
14199
14200 /**
14201  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
14202  * but with all dynamically-allocated buffers duplicated in new buffers.
14203  */
14204 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
14205
14206 /**
14207  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
14208  */
14209 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
14210
14211 /**
14212  * Constructs a new COption_AccessZ containing nothing
14213  */
14214 struct LDKCOption_AccessZ COption_AccessZ_none(void);
14215
14216 /**
14217  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
14218  */
14219 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
14220
14221 /**
14222  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
14223  */
14224 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
14225
14226 /**
14227  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
14228  */
14229 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14230
14231 /**
14232  * Checks if the given object is currently in the success state
14233  */
14234 bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o);
14235
14236 /**
14237  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
14238  */
14239 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
14240
14241 /**
14242  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
14243  * but with all dynamically-allocated buffers duplicated in new buffers.
14244  */
14245 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14246
14247 /**
14248  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
14249  */
14250 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
14251
14252 /**
14253  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
14254  */
14255 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14256
14257 /**
14258  * Checks if the given object is currently in the success state
14259  */
14260 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
14261
14262 /**
14263  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
14264  */
14265 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
14266
14267 /**
14268  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
14269  * but with all dynamically-allocated buffers duplicated in new buffers.
14270  */
14271 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14272
14273 /**
14274  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
14275  */
14276 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
14277
14278 /**
14279  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
14280  */
14281 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
14282
14283 /**
14284  * Checks if the given object is currently in the success state
14285  */
14286 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
14287
14288 /**
14289  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
14290  */
14291 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
14292
14293 /**
14294  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
14295  * but with all dynamically-allocated buffers duplicated in new buffers.
14296  */
14297 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
14298
14299 /**
14300  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
14301  */
14302 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
14303
14304 /**
14305  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
14306  */
14307 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
14308
14309 /**
14310  * Checks if the given object is currently in the success state
14311  */
14312 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
14313
14314 /**
14315  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
14316  */
14317 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
14318
14319 /**
14320  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
14321  * but with all dynamically-allocated buffers duplicated in new buffers.
14322  */
14323 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
14324
14325 /**
14326  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14327  */
14328 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14329
14330 /**
14331  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
14332  */
14333 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
14334
14335 /**
14336  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
14337  */
14338 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
14339
14340 /**
14341  * Checks if the given object is currently in the success state
14342  */
14343 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
14344
14345 /**
14346  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
14347  */
14348 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
14349
14350 /**
14351  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
14352  * but with all dynamically-allocated buffers duplicated in new buffers.
14353  */
14354 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
14355
14356 /**
14357  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
14358  */
14359 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
14360
14361 /**
14362  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
14363  */
14364 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
14365
14366 /**
14367  * Checks if the given object is currently in the success state
14368  */
14369 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
14370
14371 /**
14372  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
14373  */
14374 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
14375
14376 /**
14377  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
14378  * but with all dynamically-allocated buffers duplicated in new buffers.
14379  */
14380 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
14381
14382 /**
14383  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
14384  */
14385 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
14386
14387 /**
14388  * Constructs a new COption_CVec_NetAddressZZ containing nothing
14389  */
14390 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
14391
14392 /**
14393  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
14394  */
14395 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
14396
14397 /**
14398  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
14399  * but with all dynamically-allocated buffers duplicated in new buffers.
14400  */
14401 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
14402
14403 /**
14404  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
14405  */
14406 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
14407
14408 /**
14409  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
14410  */
14411 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
14412
14413 /**
14414  * Checks if the given object is currently in the success state
14415  */
14416 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
14417
14418 /**
14419  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
14420  */
14421 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
14422
14423 /**
14424  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14425  * but with all dynamically-allocated buffers duplicated in new buffers.
14426  */
14427 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
14428
14429 /**
14430  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14431  */
14432 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
14433
14434 /**
14435  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14436  */
14437 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
14438
14439 /**
14440  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14441  */
14442 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
14443
14444 /**
14445  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14446  */
14447 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
14448
14449 /**
14450  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14451  */
14452 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
14453
14454 /**
14455  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14456  */
14457 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
14458
14459 /**
14460  * Checks if the given object is currently in the success state
14461  */
14462 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
14463
14464 /**
14465  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14466  */
14467 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
14468
14469 /**
14470  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14471  * but with all dynamically-allocated buffers duplicated in new buffers.
14472  */
14473 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
14474
14475 /**
14476  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14477  */
14478 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
14479
14480 /**
14481  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14482  */
14483 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
14484
14485 /**
14486  * Checks if the given object is currently in the success state
14487  */
14488 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
14489
14490 /**
14491  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14492  */
14493 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
14494
14495 /**
14496  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14497  * but with all dynamically-allocated buffers duplicated in new buffers.
14498  */
14499 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
14500
14501 /**
14502  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14503  */
14504 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
14505
14506 /**
14507  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14508  */
14509 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
14510
14511 /**
14512  * Checks if the given object is currently in the success state
14513  */
14514 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
14515
14516 /**
14517  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14518  */
14519 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
14520
14521 /**
14522  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14523  * but with all dynamically-allocated buffers duplicated in new buffers.
14524  */
14525 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
14526
14527 /**
14528  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14529  */
14530 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
14531
14532 /**
14533  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14534  */
14535 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
14536
14537 /**
14538  * Checks if the given object is currently in the success state
14539  */
14540 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
14541
14542 /**
14543  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14544  */
14545 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
14546
14547 /**
14548  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14549  * but with all dynamically-allocated buffers duplicated in new buffers.
14550  */
14551 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
14552
14553 /**
14554  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14555  */
14556 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
14557
14558 /**
14559  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14560  */
14561 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
14562
14563 /**
14564  * Checks if the given object is currently in the success state
14565  */
14566 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
14567
14568 /**
14569  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14570  */
14571 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
14572
14573 /**
14574  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14575  * but with all dynamically-allocated buffers duplicated in new buffers.
14576  */
14577 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
14578
14579 /**
14580  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14581  */
14582 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
14583
14584 /**
14585  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14586  */
14587 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
14588
14589 /**
14590  * Checks if the given object is currently in the success state
14591  */
14592 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
14593
14594 /**
14595  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14596  */
14597 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
14598
14599 /**
14600  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14601  * but with all dynamically-allocated buffers duplicated in new buffers.
14602  */
14603 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
14604
14605 /**
14606  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14607  */
14608 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
14609
14610 /**
14611  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14612  */
14613 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
14614
14615 /**
14616  * Checks if the given object is currently in the success state
14617  */
14618 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
14619
14620 /**
14621  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14622  */
14623 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
14624
14625 /**
14626  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14627  * but with all dynamically-allocated buffers duplicated in new buffers.
14628  */
14629 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
14630
14631 /**
14632  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14633  */
14634 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
14635
14636 /**
14637  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14638  */
14639 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
14640
14641 /**
14642  * Checks if the given object is currently in the success state
14643  */
14644 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
14645
14646 /**
14647  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14648  */
14649 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
14650
14651 /**
14652  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14653  * but with all dynamically-allocated buffers duplicated in new buffers.
14654  */
14655 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
14656
14657 /**
14658  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
14659  */
14660 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
14661
14662 /**
14663  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
14664  */
14665 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
14666
14667 /**
14668  * Checks if the given object is currently in the success state
14669  */
14670 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
14671
14672 /**
14673  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
14674  */
14675 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
14676
14677 /**
14678  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
14679  * but with all dynamically-allocated buffers duplicated in new buffers.
14680  */
14681 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
14682
14683 /**
14684  * Creates a new CResult_InitDecodeErrorZ in the success state.
14685  */
14686 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
14687
14688 /**
14689  * Creates a new CResult_InitDecodeErrorZ in the error state.
14690  */
14691 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
14692
14693 /**
14694  * Checks if the given object is currently in the success state
14695  */
14696 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
14697
14698 /**
14699  * Frees any resources used by the CResult_InitDecodeErrorZ.
14700  */
14701 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
14702
14703 /**
14704  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14705  * but with all dynamically-allocated buffers duplicated in new buffers.
14706  */
14707 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
14708
14709 /**
14710  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14711  */
14712 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
14713
14714 /**
14715  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14716  */
14717 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
14718
14719 /**
14720  * Checks if the given object is currently in the success state
14721  */
14722 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
14723
14724 /**
14725  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14726  */
14727 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
14728
14729 /**
14730  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14731  * but with all dynamically-allocated buffers duplicated in new buffers.
14732  */
14733 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
14734
14735 /**
14736  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14737  */
14738 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
14739
14740 /**
14741  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14742  */
14743 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
14744
14745 /**
14746  * Checks if the given object is currently in the success state
14747  */
14748 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
14749
14750 /**
14751  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14752  */
14753 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
14754
14755 /**
14756  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14757  * but with all dynamically-allocated buffers duplicated in new buffers.
14758  */
14759 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
14760
14761 /**
14762  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14763  */
14764 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
14765
14766 /**
14767  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14768  */
14769 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
14770
14771 /**
14772  * Checks if the given object is currently in the success state
14773  */
14774 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
14775
14776 /**
14777  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14778  */
14779 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
14780
14781 /**
14782  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14783  * but with all dynamically-allocated buffers duplicated in new buffers.
14784  */
14785 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
14786
14787 /**
14788  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14789  */
14790 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
14791
14792 /**
14793  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14794  */
14795 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14796
14797 /**
14798  * Checks if the given object is currently in the success state
14799  */
14800 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
14801
14802 /**
14803  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14804  */
14805 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
14806
14807 /**
14808  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14809  * but with all dynamically-allocated buffers duplicated in new buffers.
14810  */
14811 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
14812
14813 /**
14814  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14815  */
14816 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
14817
14818 /**
14819  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14820  */
14821 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14822
14823 /**
14824  * Checks if the given object is currently in the success state
14825  */
14826 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
14827
14828 /**
14829  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14830  */
14831 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
14832
14833 /**
14834  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14835  * but with all dynamically-allocated buffers duplicated in new buffers.
14836  */
14837 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
14838
14839 /**
14840  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14841  */
14842 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
14843
14844 /**
14845  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14846  */
14847 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
14848
14849 /**
14850  * Checks if the given object is currently in the success state
14851  */
14852 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
14853
14854 /**
14855  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14856  */
14857 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
14858
14859 /**
14860  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14861  * but with all dynamically-allocated buffers duplicated in new buffers.
14862  */
14863 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
14864
14865 /**
14866  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14867  */
14868 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
14869
14870 /**
14871  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14872  */
14873 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14874
14875 /**
14876  * Checks if the given object is currently in the success state
14877  */
14878 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
14879
14880 /**
14881  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14882  */
14883 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
14884
14885 /**
14886  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14887  * but with all dynamically-allocated buffers duplicated in new buffers.
14888  */
14889 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
14890
14891 /**
14892  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14893  */
14894 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
14895
14896 /**
14897  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14898  */
14899 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14900
14901 /**
14902  * Checks if the given object is currently in the success state
14903  */
14904 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
14905
14906 /**
14907  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14908  */
14909 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
14910
14911 /**
14912  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14913  * but with all dynamically-allocated buffers duplicated in new buffers.
14914  */
14915 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
14916
14917 /**
14918  * Creates a new CResult_PingDecodeErrorZ in the success state.
14919  */
14920 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
14921
14922 /**
14923  * Creates a new CResult_PingDecodeErrorZ in the error state.
14924  */
14925 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
14926
14927 /**
14928  * Checks if the given object is currently in the success state
14929  */
14930 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
14931
14932 /**
14933  * Frees any resources used by the CResult_PingDecodeErrorZ.
14934  */
14935 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
14936
14937 /**
14938  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14939  * but with all dynamically-allocated buffers duplicated in new buffers.
14940  */
14941 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
14942
14943 /**
14944  * Creates a new CResult_PongDecodeErrorZ in the success state.
14945  */
14946 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
14947
14948 /**
14949  * Creates a new CResult_PongDecodeErrorZ in the error state.
14950  */
14951 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
14952
14953 /**
14954  * Checks if the given object is currently in the success state
14955  */
14956 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
14957
14958 /**
14959  * Frees any resources used by the CResult_PongDecodeErrorZ.
14960  */
14961 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
14962
14963 /**
14964  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14965  * but with all dynamically-allocated buffers duplicated in new buffers.
14966  */
14967 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
14968
14969 /**
14970  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14971  */
14972 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
14973
14974 /**
14975  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14976  */
14977 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
14978
14979 /**
14980  * Checks if the given object is currently in the success state
14981  */
14982 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
14983
14984 /**
14985  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14986  */
14987 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
14988
14989 /**
14990  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14991  * but with all dynamically-allocated buffers duplicated in new buffers.
14992  */
14993 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
14994
14995 /**
14996  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14997  */
14998 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
14999
15000 /**
15001  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15002  */
15003 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
15004
15005 /**
15006  * Checks if the given object is currently in the success state
15007  */
15008 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
15009
15010 /**
15011  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15012  */
15013 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
15014
15015 /**
15016  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15017  * but with all dynamically-allocated buffers duplicated in new buffers.
15018  */
15019 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
15020
15021 /**
15022  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15023  */
15024 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
15025
15026 /**
15027  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15028  */
15029 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15030
15031 /**
15032  * Checks if the given object is currently in the success state
15033  */
15034 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
15035
15036 /**
15037  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15038  */
15039 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
15040
15041 /**
15042  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15043  * but with all dynamically-allocated buffers duplicated in new buffers.
15044  */
15045 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
15046
15047 /**
15048  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15049  */
15050 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
15051
15052 /**
15053  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15054  */
15055 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15056
15057 /**
15058  * Checks if the given object is currently in the success state
15059  */
15060 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
15061
15062 /**
15063  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15064  */
15065 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
15066
15067 /**
15068  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15069  * but with all dynamically-allocated buffers duplicated in new buffers.
15070  */
15071 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
15072
15073 /**
15074  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15075  */
15076 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
15077
15078 /**
15079  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15080  */
15081 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
15082
15083 /**
15084  * Checks if the given object is currently in the success state
15085  */
15086 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
15087
15088 /**
15089  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15090  */
15091 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
15092
15093 /**
15094  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15095  * but with all dynamically-allocated buffers duplicated in new buffers.
15096  */
15097 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
15098
15099 /**
15100  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15101  */
15102 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
15103
15104 /**
15105  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15106  */
15107 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
15108
15109 /**
15110  * Checks if the given object is currently in the success state
15111  */
15112 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
15113
15114 /**
15115  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15116  */
15117 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
15118
15119 /**
15120  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15121  * but with all dynamically-allocated buffers duplicated in new buffers.
15122  */
15123 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
15124
15125 /**
15126  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15127  */
15128 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
15129
15130 /**
15131  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15132  */
15133 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
15134
15135 /**
15136  * Checks if the given object is currently in the success state
15137  */
15138 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
15139
15140 /**
15141  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15142  */
15143 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
15144
15145 /**
15146  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15147  * but with all dynamically-allocated buffers duplicated in new buffers.
15148  */
15149 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
15150
15151 /**
15152  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15153  */
15154 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
15155
15156 /**
15157  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15158  */
15159 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
15160
15161 /**
15162  * Checks if the given object is currently in the success state
15163  */
15164 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
15165
15166 /**
15167  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15168  */
15169 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
15170
15171 /**
15172  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15173  * but with all dynamically-allocated buffers duplicated in new buffers.
15174  */
15175 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
15176
15177 /**
15178  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15179  */
15180 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
15181
15182 /**
15183  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15184  */
15185 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
15186
15187 /**
15188  * Checks if the given object is currently in the success state
15189  */
15190 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
15191
15192 /**
15193  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15194  */
15195 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
15196
15197 /**
15198  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15199  * but with all dynamically-allocated buffers duplicated in new buffers.
15200  */
15201 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
15202
15203 /**
15204  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15205  */
15206 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
15207
15208 /**
15209  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15210  */
15211 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
15212
15213 /**
15214  * Checks if the given object is currently in the success state
15215  */
15216 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
15217
15218 /**
15219  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15220  */
15221 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
15222
15223 /**
15224  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15225  * but with all dynamically-allocated buffers duplicated in new buffers.
15226  */
15227 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
15228
15229 /**
15230  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15231  */
15232 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
15233
15234 /**
15235  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15236  */
15237 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
15238
15239 /**
15240  * Checks if the given object is currently in the success state
15241  */
15242 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
15243
15244 /**
15245  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15246  */
15247 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
15248
15249 /**
15250  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15251  * but with all dynamically-allocated buffers duplicated in new buffers.
15252  */
15253 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
15254
15255 /**
15256  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15257  */
15258 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
15259
15260 /**
15261  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15262  */
15263 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
15264
15265 /**
15266  * Checks if the given object is currently in the success state
15267  */
15268 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
15269
15270 /**
15271  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15272  */
15273 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
15274
15275 /**
15276  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15277  * but with all dynamically-allocated buffers duplicated in new buffers.
15278  */
15279 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
15280
15281 /**
15282  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15283  */
15284 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
15285
15286 /**
15287  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15288  */
15289 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
15290
15291 /**
15292  * Checks if the given object is currently in the success state
15293  */
15294 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
15295
15296 /**
15297  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15298  */
15299 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
15300
15301 /**
15302  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15303  * but with all dynamically-allocated buffers duplicated in new buffers.
15304  */
15305 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
15306
15307 /**
15308  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15309  */
15310 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
15311
15312 /**
15313  * Constructs a new COption_FilterZ containing nothing
15314  */
15315 struct LDKCOption_FilterZ COption_FilterZ_none(void);
15316
15317 /**
15318  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15319  */
15320 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
15321
15322 /**
15323  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15324  */
15325 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
15326
15327 /**
15328  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15329  */
15330 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
15331
15332 /**
15333  * Checks if the given object is currently in the success state
15334  */
15335 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
15336
15337 /**
15338  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15339  */
15340 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
15341
15342 /**
15343  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15344  */
15345 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
15346
15347 /**
15348  * Frees any resources used by the PaymentPurpose
15349  */
15350 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
15351
15352 /**
15353  * Creates a copy of the PaymentPurpose
15354  */
15355 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
15356
15357 /**
15358  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
15359  */
15360 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
15361
15362 /**
15363  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
15364  */
15365 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
15366
15367 /**
15368  * Frees any resources used by the ClosureReason
15369  */
15370 void ClosureReason_free(struct LDKClosureReason this_ptr);
15371
15372 /**
15373  * Creates a copy of the ClosureReason
15374  */
15375 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
15376
15377 /**
15378  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
15379  */
15380 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
15381
15382 /**
15383  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
15384  */
15385 struct LDKClosureReason ClosureReason_holder_force_closed(void);
15386
15387 /**
15388  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
15389  */
15390 struct LDKClosureReason ClosureReason_cooperative_closure(void);
15391
15392 /**
15393  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
15394  */
15395 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
15396
15397 /**
15398  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
15399  */
15400 struct LDKClosureReason ClosureReason_funding_timed_out(void);
15401
15402 /**
15403  * Utility method to constructs a new ProcessingError-variant ClosureReason
15404  */
15405 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
15406
15407 /**
15408  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
15409  */
15410 struct LDKClosureReason ClosureReason_disconnected_peer(void);
15411
15412 /**
15413  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
15414  */
15415 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
15416
15417 /**
15418  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
15419  */
15420 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
15421
15422 /**
15423  * Read a ClosureReason from a byte array, created by ClosureReason_write
15424  */
15425 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
15426
15427 /**
15428  * Frees any resources used by the Event
15429  */
15430 void Event_free(struct LDKEvent this_ptr);
15431
15432 /**
15433  * Creates a copy of the Event
15434  */
15435 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
15436
15437 /**
15438  * Utility method to constructs a new FundingGenerationReady-variant Event
15439  */
15440 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
15441
15442 /**
15443  * Utility method to constructs a new PaymentReceived-variant Event
15444  */
15445 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
15446
15447 /**
15448  * Utility method to constructs a new PaymentSent-variant Event
15449  */
15450 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
15451
15452 /**
15453  * Utility method to constructs a new PaymentPathFailed-variant Event
15454  */
15455 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
15456
15457 /**
15458  * Utility method to constructs a new PaymentFailed-variant Event
15459  */
15460 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
15461
15462 /**
15463  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
15464  */
15465 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
15466
15467 /**
15468  * Utility method to constructs a new SpendableOutputs-variant Event
15469  */
15470 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
15471
15472 /**
15473  * Utility method to constructs a new PaymentForwarded-variant Event
15474  */
15475 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
15476
15477 /**
15478  * Utility method to constructs a new ChannelClosed-variant Event
15479  */
15480 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
15481
15482 /**
15483  * Utility method to constructs a new DiscardFunding-variant Event
15484  */
15485 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
15486
15487 /**
15488  * Utility method to constructs a new PaymentPathSuccessful-variant Event
15489  */
15490 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
15491
15492 /**
15493  * Serialize the Event object into a byte array which can be read by Event_read
15494  */
15495 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
15496
15497 /**
15498  * Read a Event from a byte array, created by Event_write
15499  */
15500 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
15501
15502 /**
15503  * Frees any resources used by the MessageSendEvent
15504  */
15505 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
15506
15507 /**
15508  * Creates a copy of the MessageSendEvent
15509  */
15510 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
15511
15512 /**
15513  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
15514  */
15515 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
15516
15517 /**
15518  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
15519  */
15520 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
15521
15522 /**
15523  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
15524  */
15525 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
15526
15527 /**
15528  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
15529  */
15530 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
15531
15532 /**
15533  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
15534  */
15535 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
15536
15537 /**
15538  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
15539  */
15540 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
15541
15542 /**
15543  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
15544  */
15545 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
15546
15547 /**
15548  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
15549  */
15550 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
15551
15552 /**
15553  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
15554  */
15555 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
15556
15557 /**
15558  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
15559  */
15560 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
15561
15562 /**
15563  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
15564  */
15565 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
15566
15567 /**
15568  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
15569  */
15570 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
15571
15572 /**
15573  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
15574  */
15575 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
15576
15577 /**
15578  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
15579  */
15580 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
15581
15582 /**
15583  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
15584  */
15585 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
15586
15587 /**
15588  * Utility method to constructs a new HandleError-variant MessageSendEvent
15589  */
15590 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
15591
15592 /**
15593  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
15594  */
15595 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
15596
15597 /**
15598  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
15599  */
15600 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
15601
15602 /**
15603  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
15604  */
15605 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
15606
15607 /**
15608  * Calls the free function if one is set
15609  */
15610 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
15611
15612 /**
15613  * Calls the free function if one is set
15614  */
15615 void EventsProvider_free(struct LDKEventsProvider this_ptr);
15616
15617 /**
15618  * Calls the free function if one is set
15619  */
15620 void EventHandler_free(struct LDKEventHandler this_ptr);
15621
15622 /**
15623  * Frees any resources used by the APIError
15624  */
15625 void APIError_free(struct LDKAPIError this_ptr);
15626
15627 /**
15628  * Creates a copy of the APIError
15629  */
15630 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
15631
15632 /**
15633  * Utility method to constructs a new APIMisuseError-variant APIError
15634  */
15635 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
15636
15637 /**
15638  * Utility method to constructs a new FeeRateTooHigh-variant APIError
15639  */
15640 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
15641
15642 /**
15643  * Utility method to constructs a new RouteError-variant APIError
15644  */
15645 struct LDKAPIError APIError_route_error(struct LDKStr err);
15646
15647 /**
15648  * Utility method to constructs a new ChannelUnavailable-variant APIError
15649  */
15650 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
15651
15652 /**
15653  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
15654  */
15655 struct LDKAPIError APIError_monitor_update_failed(void);
15656
15657 /**
15658  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
15659  */
15660 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
15661
15662 /**
15663  * Creates a digital signature of a message given a SecretKey, like the node's secret.
15664  * 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.
15665  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
15666  */
15667 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
15668
15669 /**
15670  * Recovers the PublicKey of the signer of the message given the message and the signature.
15671  */
15672 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
15673
15674 /**
15675  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
15676  * and the PublicKey.
15677  */
15678 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
15679
15680 /**
15681  * Creates a copy of the Level
15682  */
15683 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
15684
15685 /**
15686  * Utility method to constructs a new Gossip-variant Level
15687  */
15688 enum LDKLevel Level_gossip(void);
15689
15690 /**
15691  * Utility method to constructs a new Trace-variant Level
15692  */
15693 enum LDKLevel Level_trace(void);
15694
15695 /**
15696  * Utility method to constructs a new Debug-variant Level
15697  */
15698 enum LDKLevel Level_debug(void);
15699
15700 /**
15701  * Utility method to constructs a new Info-variant Level
15702  */
15703 enum LDKLevel Level_info(void);
15704
15705 /**
15706  * Utility method to constructs a new Warn-variant Level
15707  */
15708 enum LDKLevel Level_warn(void);
15709
15710 /**
15711  * Utility method to constructs a new Error-variant Level
15712  */
15713 enum LDKLevel Level_error(void);
15714
15715 /**
15716  * Checks if two Levels contain equal inner contents.
15717  * This ignores pointers and is_owned flags and looks at the values in fields.
15718  */
15719 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
15720
15721 /**
15722  * Checks if two Levels contain equal inner contents.
15723  */
15724 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
15725
15726 /**
15727  * Returns the most verbose logging level.
15728  */
15729 MUST_USE_RES enum LDKLevel Level_max(void);
15730
15731 /**
15732  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
15733  */
15734 void Record_free(struct LDKRecord this_obj);
15735
15736 /**
15737  * The verbosity level of the message.
15738  */
15739 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
15740
15741 /**
15742  * The verbosity level of the message.
15743  */
15744 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
15745
15746 /**
15747  * The message body.
15748  */
15749 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
15750
15751 /**
15752  * The message body.
15753  */
15754 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15755
15756 /**
15757  * The module path of the message.
15758  */
15759 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
15760
15761 /**
15762  * The module path of the message.
15763  */
15764 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15765
15766 /**
15767  * The source file containing the message.
15768  */
15769 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
15770
15771 /**
15772  * The source file containing the message.
15773  */
15774 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15775
15776 /**
15777  * The line containing the message.
15778  */
15779 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
15780
15781 /**
15782  * The line containing the message.
15783  */
15784 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
15785
15786 /**
15787  * Creates a copy of the Record
15788  */
15789 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
15790
15791 /**
15792  * Calls the free function if one is set
15793  */
15794 void Logger_free(struct LDKLogger this_ptr);
15795
15796 /**
15797  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
15798  */
15799 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
15800
15801 /**
15802  * Confirmations we will wait for before considering the channel locked in.
15803  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
15804  * equivalent limit applied to outbound channels).
15805  *
15806  * Default value: 6.
15807  */
15808 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15809
15810 /**
15811  * Confirmations we will wait for before considering the channel locked in.
15812  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
15813  * equivalent limit applied to outbound channels).
15814  *
15815  * Default value: 6.
15816  */
15817 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
15818
15819 /**
15820  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
15821  * the number of blocks we have to punish our counterparty if they broadcast a revoked
15822  * transaction).
15823  *
15824  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
15825  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
15826  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
15827  * possibly with time in between to RBF the spending transaction).
15828  *
15829  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
15830  * case of an honest unilateral channel close, which implicitly decrease the economic value of
15831  * our channel.
15832  *
15833  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
15834  * can tweak config to ask for more security, not less.
15835  */
15836 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15837
15838 /**
15839  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
15840  * the number of blocks we have to punish our counterparty if they broadcast a revoked
15841  * transaction).
15842  *
15843  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
15844  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
15845  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
15846  * possibly with time in between to RBF the spending transaction).
15847  *
15848  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
15849  * case of an honest unilateral channel close, which implicitly decrease the economic value of
15850  * our channel.
15851  *
15852  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
15853  * can tweak config to ask for more security, not less.
15854  */
15855 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
15856
15857 /**
15858  * Set to the smallest value HTLC we will accept to process.
15859  *
15860  * This value is sent to our counterparty on channel-open and we close the channel any time
15861  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
15862  *
15863  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
15864  * by the protocol.
15865  */
15866 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15867
15868 /**
15869  * Set to the smallest value HTLC we will accept to process.
15870  *
15871  * This value is sent to our counterparty on channel-open and we close the channel any time
15872  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
15873  *
15874  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
15875  * by the protocol.
15876  */
15877 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
15878
15879 /**
15880  * Constructs a new ChannelHandshakeConfig given each field
15881  */
15882 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);
15883
15884 /**
15885  * Creates a copy of the ChannelHandshakeConfig
15886  */
15887 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
15888
15889 /**
15890  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
15891  */
15892 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
15893
15894 /**
15895  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
15896  */
15897 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
15898
15899 /**
15900  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
15901  * only applies to inbound channels.
15902  *
15903  * Default value: 0.
15904  */
15905 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15906
15907 /**
15908  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
15909  * only applies to inbound channels.
15910  *
15911  * Default value: 0.
15912  */
15913 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15914
15915 /**
15916  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
15917  * you to limit the maximum minimum-size they can require.
15918  *
15919  * Default value: u64::max_value.
15920  */
15921 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15922
15923 /**
15924  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
15925  * you to limit the maximum minimum-size they can require.
15926  *
15927  * Default value: u64::max_value.
15928  */
15929 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15930
15931 /**
15932  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
15933  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
15934  *
15935  * Default value: 0.
15936  */
15937 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15938
15939 /**
15940  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
15941  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
15942  *
15943  * Default value: 0.
15944  */
15945 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15946
15947 /**
15948  * The remote node will require we keep a certain amount in direct payment to ourselves at all
15949  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
15950  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
15951  *
15952  * Default value: u64::max_value.
15953  */
15954 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15955
15956 /**
15957  * The remote node will require we keep a certain amount in direct payment to ourselves at all
15958  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
15959  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
15960  *
15961  * Default value: u64::max_value.
15962  */
15963 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15964
15965 /**
15966  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
15967  * time. This allows you to set a minimum such value.
15968  *
15969  * Default value: 0.
15970  */
15971 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15972
15973 /**
15974  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
15975  * time. This allows you to set a minimum such value.
15976  *
15977  * Default value: 0.
15978  */
15979 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
15980
15981 /**
15982  * Before a channel is usable the funding transaction will need to be confirmed by at least a
15983  * certain number of blocks, specified by the node which is not the funder (as the funder can
15984  * assume they aren't going to double-spend themselves).
15985  * This config allows you to set a limit on the maximum amount of time to wait.
15986  *
15987  * Default value: 144, or roughly one day and only applies to outbound channels.
15988  */
15989 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15990
15991 /**
15992  * Before a channel is usable the funding transaction will need to be confirmed by at least a
15993  * certain number of blocks, specified by the node which is not the funder (as the funder can
15994  * assume they aren't going to double-spend themselves).
15995  * This config allows you to set a limit on the maximum amount of time to wait.
15996  *
15997  * Default value: 144, or roughly one day and only applies to outbound channels.
15998  */
15999 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
16000
16001 /**
16002  * Set to force an incoming channel to match our announced channel preference in
16003  * [`ChannelConfig::announced_channel`].
16004  *
16005  * For a node which is not online reliably, this should be set to true and
16006  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
16007  * channels will ever be opened.
16008  *
16009  * Default value: true.
16010  */
16011 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16012
16013 /**
16014  * Set to force an incoming channel to match our announced channel preference in
16015  * [`ChannelConfig::announced_channel`].
16016  *
16017  * For a node which is not online reliably, this should be set to true and
16018  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
16019  * channels will ever be opened.
16020  *
16021  * Default value: true.
16022  */
16023 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
16024
16025 /**
16026  * Set to the amount of time we're willing to wait to claim money back to us.
16027  *
16028  * Not checking this value would be a security issue, as our peer would be able to set it to
16029  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
16030  *
16031  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
16032  * reduce the loss of having useless locked funds (if your peer accepts)
16033  */
16034 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16035
16036 /**
16037  * Set to the amount of time we're willing to wait to claim money back to us.
16038  *
16039  * Not checking this value would be a security issue, as our peer would be able to set it to
16040  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
16041  *
16042  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
16043  * reduce the loss of having useless locked funds (if your peer accepts)
16044  */
16045 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
16046
16047 /**
16048  * Constructs a new ChannelHandshakeLimits given each field
16049  */
16050 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);
16051
16052 /**
16053  * Creates a copy of the ChannelHandshakeLimits
16054  */
16055 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
16056
16057 /**
16058  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
16059  */
16060 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
16061
16062 /**
16063  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
16064  */
16065 void ChannelConfig_free(struct LDKChannelConfig this_obj);
16066
16067 /**
16068  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
16069  * over the channel.
16070  * This may be allowed to change at runtime in a later update, however doing so must result in
16071  * update messages sent to notify all nodes of our updated relay fee.
16072  *
16073  * Default value: 0.
16074  */
16075 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16076
16077 /**
16078  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
16079  * over the channel.
16080  * This may be allowed to change at runtime in a later update, however doing so must result in
16081  * update messages sent to notify all nodes of our updated relay fee.
16082  *
16083  * Default value: 0.
16084  */
16085 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
16086
16087 /**
16088  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
16089  * excess of [`forwarding_fee_proportional_millionths`].
16090  * This may be allowed to change at runtime in a later update, however doing so must result in
16091  * update messages sent to notify all nodes of our updated relay fee.
16092  *
16093  * The default value of a single satoshi roughly matches the market rate on many routing nodes
16094  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
16095  * this node.
16096  *
16097  * Default value: 1000.
16098  *
16099  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
16100  */
16101 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16102
16103 /**
16104  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
16105  * excess of [`forwarding_fee_proportional_millionths`].
16106  * This may be allowed to change at runtime in a later update, however doing so must result in
16107  * update messages sent to notify all nodes of our updated relay fee.
16108  *
16109  * The default value of a single satoshi roughly matches the market rate on many routing nodes
16110  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
16111  * this node.
16112  *
16113  * Default value: 1000.
16114  *
16115  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
16116  */
16117 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
16118
16119 /**
16120  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
16121  * the channel this config applies to.
16122  *
16123  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
16124  * HTLC balance when a channel appears on-chain whereas
16125  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
16126  * (non-HTLC-encumbered) balance.
16127  *
16128  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
16129  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
16130  * commitment transaction at least once per this many blocks (minus some margin to allow us
16131  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
16132  * the spending transaction).
16133  *
16134  * Default value: 72 (12 hours at an average of 6 blocks/hour).
16135  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
16136  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
16137  *
16138  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
16139  */
16140 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16141
16142 /**
16143  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
16144  * the channel this config applies to.
16145  *
16146  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
16147  * HTLC balance when a channel appears on-chain whereas
16148  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
16149  * (non-HTLC-encumbered) balance.
16150  *
16151  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
16152  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
16153  * commitment transaction at least once per this many blocks (minus some margin to allow us
16154  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
16155  * the spending transaction).
16156  *
16157  * Default value: 72 (12 hours at an average of 6 blocks/hour).
16158  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
16159  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
16160  *
16161  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
16162  */
16163 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
16164
16165 /**
16166  * Set to announce the channel publicly and notify all nodes that they can route via this
16167  * channel.
16168  *
16169  * This should only be set to true for nodes which expect to be online reliably.
16170  *
16171  * As the node which funds a channel picks this value this will only apply for new outbound
16172  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
16173  *
16174  * This cannot be changed after the initial channel handshake.
16175  *
16176  * Default value: false.
16177  */
16178 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16179
16180 /**
16181  * Set to announce the channel publicly and notify all nodes that they can route via this
16182  * channel.
16183  *
16184  * This should only be set to true for nodes which expect to be online reliably.
16185  *
16186  * As the node which funds a channel picks this value this will only apply for new outbound
16187  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
16188  *
16189  * This cannot be changed after the initial channel handshake.
16190  *
16191  * Default value: false.
16192  */
16193 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
16194
16195 /**
16196  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
16197  * supports it, they will then enforce the mutual-close output to us matches what we provided
16198  * at intialization, preventing us from closing to an alternate pubkey.
16199  *
16200  * This is set to true by default to provide a slight increase in security, though ultimately
16201  * any attacker who is able to take control of a channel can just as easily send the funds via
16202  * lightning payments, so we never require that our counterparties support this option.
16203  *
16204  * This cannot be changed after a channel has been initialized.
16205  *
16206  * Default value: true.
16207  */
16208 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16209
16210 /**
16211  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
16212  * supports it, they will then enforce the mutual-close output to us matches what we provided
16213  * at intialization, preventing us from closing to an alternate pubkey.
16214  *
16215  * This is set to true by default to provide a slight increase in security, though ultimately
16216  * any attacker who is able to take control of a channel can just as easily send the funds via
16217  * lightning payments, so we never require that our counterparties support this option.
16218  *
16219  * This cannot be changed after a channel has been initialized.
16220  *
16221  * Default value: true.
16222  */
16223 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
16224
16225 /**
16226  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
16227  * small to claim on-chain.
16228  *
16229  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
16230  * not be claimable on-chain, instead being turned into additional miner fees if either
16231  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
16232  * to such payments may be sustantial if there are many dust HTLCs present when the
16233  * channel is force-closed.
16234  *
16235  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
16236  * exposure across all three types per-channel. Setting this too low may prevent the
16237  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
16238  * important to prevent stealing of dust HTLCs by miners.
16239  *
16240  * Default value: 5_000_000 msat.
16241  */
16242 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16243
16244 /**
16245  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
16246  * small to claim on-chain.
16247  *
16248  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
16249  * not be claimable on-chain, instead being turned into additional miner fees if either
16250  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
16251  * to such payments may be sustantial if there are many dust HTLCs present when the
16252  * channel is force-closed.
16253  *
16254  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
16255  * exposure across all three types per-channel. Setting this too low may prevent the
16256  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
16257  * important to prevent stealing of dust HTLCs by miners.
16258  *
16259  * Default value: 5_000_000 msat.
16260  */
16261 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
16262
16263 /**
16264  * The additional fee we're willing to pay to avoid waiting for the counterparty's
16265  * `to_self_delay` to reclaim funds.
16266  *
16267  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
16268  * closing transaction which both sides find acceptable, ultimately paid by the channel
16269  * funder/initiator.
16270  *
16271  * When we are the funder, because we have to pay the channel closing fee, we bound the
16272  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
16273  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
16274  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
16275  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
16276  * funds.
16277  *
16278  * When we are not the funder, we require the closing transaction fee pay at least our
16279  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
16280  * Thus, this value is ignored when we are not the funder.
16281  *
16282  * Default value: 1000 satoshis.
16283  *
16284  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16285  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16286  */
16287 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
16288
16289 /**
16290  * The additional fee we're willing to pay to avoid waiting for the counterparty's
16291  * `to_self_delay` to reclaim funds.
16292  *
16293  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
16294  * closing transaction which both sides find acceptable, ultimately paid by the channel
16295  * funder/initiator.
16296  *
16297  * When we are the funder, because we have to pay the channel closing fee, we bound the
16298  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
16299  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
16300  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
16301  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
16302  * funds.
16303  *
16304  * When we are not the funder, we require the closing transaction fee pay at least our
16305  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
16306  * Thus, this value is ignored when we are not the funder.
16307  *
16308  * Default value: 1000 satoshis.
16309  *
16310  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16311  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16312  */
16313 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
16314
16315 /**
16316  * Constructs a new ChannelConfig given each field
16317  */
16318 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
16319
16320 /**
16321  * Creates a copy of the ChannelConfig
16322  */
16323 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
16324
16325 /**
16326  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
16327  */
16328 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
16329
16330 /**
16331  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
16332  */
16333 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
16334
16335 /**
16336  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
16337  */
16338 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
16339
16340 /**
16341  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
16342  */
16343 void UserConfig_free(struct LDKUserConfig this_obj);
16344
16345 /**
16346  * Channel config that we propose to our counterparty.
16347  */
16348 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
16349
16350 /**
16351  * Channel config that we propose to our counterparty.
16352  */
16353 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
16354
16355 /**
16356  * Limits applied to our counterparty's proposed channel config settings.
16357  */
16358 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
16359
16360 /**
16361  * Limits applied to our counterparty's proposed channel config settings.
16362  */
16363 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
16364
16365 /**
16366  * Channel config which affects behavior during channel lifetime.
16367  */
16368 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
16369
16370 /**
16371  * Channel config which affects behavior during channel lifetime.
16372  */
16373 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
16374
16375 /**
16376  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
16377  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
16378  * node which is not online reliably.
16379  *
16380  * For nodes which are not online reliably, you should set all channels to *not* be announced
16381  * (using [`ChannelConfig::announced_channel`] and
16382  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
16383  * ensure you are not exposed to any forwarding risk.
16384  *
16385  * Note that because you cannot change a channel's announced state after creation, there is no
16386  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
16387  * from a publicly-announced forwarding node to a private non-forwarding node you must close
16388  * all your channels and open new ones. For privacy, you should also change your node_id
16389  * (swapping all private and public key material for new ones) at that time.
16390  *
16391  * Default value: false.
16392  */
16393 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
16394
16395 /**
16396  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
16397  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
16398  * node which is not online reliably.
16399  *
16400  * For nodes which are not online reliably, you should set all channels to *not* be announced
16401  * (using [`ChannelConfig::announced_channel`] and
16402  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
16403  * ensure you are not exposed to any forwarding risk.
16404  *
16405  * Note that because you cannot change a channel's announced state after creation, there is no
16406  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
16407  * from a publicly-announced forwarding node to a private non-forwarding node you must close
16408  * all your channels and open new ones. For privacy, you should also change your node_id
16409  * (swapping all private and public key material for new ones) at that time.
16410  *
16411  * Default value: false.
16412  */
16413 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
16414
16415 /**
16416  * If this is set to false, we do not accept inbound requests to open a new channel.
16417  * Default value: true.
16418  */
16419 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
16420
16421 /**
16422  * If this is set to false, we do not accept inbound requests to open a new channel.
16423  * Default value: true.
16424  */
16425 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
16426
16427 /**
16428  * Constructs a new UserConfig given each field
16429  */
16430 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg);
16431
16432 /**
16433  * Creates a copy of the UserConfig
16434  */
16435 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
16436
16437 /**
16438  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
16439  */
16440 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
16441
16442 /**
16443  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
16444  */
16445 void BestBlock_free(struct LDKBestBlock this_obj);
16446
16447 /**
16448  * Creates a copy of the BestBlock
16449  */
16450 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
16451
16452 /**
16453  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
16454  * network.
16455  */
16456 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
16457
16458 /**
16459  * Returns a `BestBlock` as identified by the given block hash and height.
16460  */
16461 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
16462
16463 /**
16464  * Returns the best block hash.
16465  */
16466 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
16467
16468 /**
16469  * Returns the best block height.
16470  */
16471 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
16472
16473 /**
16474  * Creates a copy of the AccessError
16475  */
16476 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
16477
16478 /**
16479  * Utility method to constructs a new UnknownChain-variant AccessError
16480  */
16481 enum LDKAccessError AccessError_unknown_chain(void);
16482
16483 /**
16484  * Utility method to constructs a new UnknownTx-variant AccessError
16485  */
16486 enum LDKAccessError AccessError_unknown_tx(void);
16487
16488 /**
16489  * Calls the free function if one is set
16490  */
16491 void Access_free(struct LDKAccess this_ptr);
16492
16493 /**
16494  * Calls the free function if one is set
16495  */
16496 void Listen_free(struct LDKListen this_ptr);
16497
16498 /**
16499  * Calls the free function if one is set
16500  */
16501 void Confirm_free(struct LDKConfirm this_ptr);
16502
16503 /**
16504  * Creates a copy of the ChannelMonitorUpdateErr
16505  */
16506 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
16507
16508 /**
16509  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
16510  */
16511 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
16512
16513 /**
16514  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
16515  */
16516 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
16517
16518 /**
16519  * Calls the free function if one is set
16520  */
16521 void Watch_free(struct LDKWatch this_ptr);
16522
16523 /**
16524  * Calls the free function if one is set
16525  */
16526 void Filter_free(struct LDKFilter this_ptr);
16527
16528 /**
16529  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
16530  */
16531 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
16532
16533 /**
16534  * First block where the transaction output may have been spent.
16535  *
16536  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16537  */
16538 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16539
16540 /**
16541  * First block where the transaction output may have been spent.
16542  *
16543  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16544  */
16545 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16546
16547 /**
16548  * Outpoint identifying the transaction output.
16549  */
16550 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16551
16552 /**
16553  * Outpoint identifying the transaction output.
16554  */
16555 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16556
16557 /**
16558  * Spending condition of the transaction output.
16559  */
16560 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16561
16562 /**
16563  * Spending condition of the transaction output.
16564  */
16565 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
16566
16567 /**
16568  * Constructs a new WatchedOutput given each field
16569  */
16570 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
16571
16572 /**
16573  * Creates a copy of the WatchedOutput
16574  */
16575 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
16576
16577 /**
16578  * Checks if two WatchedOutputs contain equal inner contents.
16579  */
16580 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
16581
16582 /**
16583  * Calls the free function if one is set
16584  */
16585 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
16586
16587 /**
16588  * Creates a copy of the ConfirmationTarget
16589  */
16590 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
16591
16592 /**
16593  * Utility method to constructs a new Background-variant ConfirmationTarget
16594  */
16595 enum LDKConfirmationTarget ConfirmationTarget_background(void);
16596
16597 /**
16598  * Utility method to constructs a new Normal-variant ConfirmationTarget
16599  */
16600 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
16601
16602 /**
16603  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
16604  */
16605 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
16606
16607 /**
16608  * Checks if two ConfirmationTargets contain equal inner contents.
16609  * This ignores pointers and is_owned flags and looks at the values in fields.
16610  */
16611 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
16612
16613 /**
16614  * Calls the free function if one is set
16615  */
16616 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
16617
16618 /**
16619  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
16620  */
16621 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
16622
16623 /**
16624  * Creates a copy of the MonitorUpdateId
16625  */
16626 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
16627
16628 /**
16629  * Checks if two MonitorUpdateIds contain equal inner contents.
16630  */
16631 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
16632
16633 /**
16634  * Checks if two MonitorUpdateIds contain equal inner contents.
16635  * This ignores pointers and is_owned flags and looks at the values in fields.
16636  * Two objects with NULL inner values will be considered "equal" here.
16637  */
16638 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
16639
16640 /**
16641  * Calls the free function if one is set
16642  */
16643 void Persist_free(struct LDKPersist this_ptr);
16644
16645 /**
16646  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
16647  */
16648 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
16649
16650 /**
16651  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
16652  */
16653 void ChainMonitor_free(struct LDKChainMonitor this_obj);
16654
16655 /**
16656  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
16657  *
16658  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
16659  * will call back to it indicating transactions and outputs of interest. This allows clients to
16660  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
16661  * always need to fetch full blocks absent another means for determining which blocks contain
16662  * transactions relevant to the watched channels.
16663  */
16664 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
16665
16666 /**
16667  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
16668  * claims which are awaiting confirmation.
16669  *
16670  * Includes the balances from each [`ChannelMonitor`] *except* those included in
16671  * `ignored_channels`, allowing you to filter out balances from channels which are still open
16672  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
16673  *
16674  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
16675  * inclusion in the return value.
16676  */
16677 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
16678
16679 /**
16680  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
16681  * such [`ChannelMonitor`] is currently being monitored for.
16682  *
16683  * Note that the result holds a mutex over our monitor set, and should not be held
16684  * indefinitely.
16685  */
16686 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
16687
16688 /**
16689  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
16690  *
16691  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
16692  * monitoring for on-chain state resolutions.
16693  */
16694 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16695
16696 /**
16697  * Indicates the persistence of a [`ChannelMonitor`] has completed after
16698  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
16699  *
16700  * Thus, the anticipated use is, at a high level:
16701  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
16702  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
16703  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
16704  *  2) once all remote copies are updated, you call this function with the
16705  *     `completed_update_id` that completed, and once all pending updates have completed the
16706  *     channel will be re-enabled.
16707  *
16708  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
16709  * registered [`ChannelMonitor`]s.
16710  */
16711 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
16712
16713 /**
16714  * Constructs a new Listen which calls the relevant methods on this_arg.
16715  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
16716  */
16717 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16718
16719 /**
16720  * Constructs a new Confirm which calls the relevant methods on this_arg.
16721  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
16722  */
16723 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16724
16725 /**
16726  * Constructs a new Watch which calls the relevant methods on this_arg.
16727  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
16728  */
16729 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16730
16731 /**
16732  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
16733  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
16734  */
16735 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16736
16737 /**
16738  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
16739  */
16740 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
16741
16742 /**
16743  * The sequence number of this update. Updates *must* be replayed in-order according to this
16744  * sequence number (and updates may panic if they are not). The update_id values are strictly
16745  * increasing and increase by one for each new update, with one exception specified below.
16746  *
16747  * This sequence number is also used to track up to which points updates which returned
16748  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
16749  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
16750  *
16751  * The only instance where update_id values are not strictly increasing is the case where we
16752  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
16753  * its docs for more details.
16754  */
16755 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
16756
16757 /**
16758  * The sequence number of this update. Updates *must* be replayed in-order according to this
16759  * sequence number (and updates may panic if they are not). The update_id values are strictly
16760  * increasing and increase by one for each new update, with one exception specified below.
16761  *
16762  * This sequence number is also used to track up to which points updates which returned
16763  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
16764  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
16765  *
16766  * The only instance where update_id values are not strictly increasing is the case where we
16767  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
16768  * its docs for more details.
16769  */
16770 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
16771
16772 /**
16773  * Creates a copy of the ChannelMonitorUpdate
16774  */
16775 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
16776
16777 /**
16778  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
16779  */
16780 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
16781
16782 /**
16783  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
16784  */
16785 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
16786
16787 /**
16788  * Frees any resources used by the MonitorEvent
16789  */
16790 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
16791
16792 /**
16793  * Creates a copy of the MonitorEvent
16794  */
16795 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
16796
16797 /**
16798  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
16799  */
16800 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
16801
16802 /**
16803  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
16804  */
16805 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
16806
16807 /**
16808  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
16809  */
16810 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
16811
16812 /**
16813  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
16814  */
16815 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
16816
16817 /**
16818  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
16819  */
16820 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
16821
16822 /**
16823  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
16824  */
16825 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
16826
16827 /**
16828  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
16829  */
16830 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
16831
16832 /**
16833  * Creates a copy of the HTLCUpdate
16834  */
16835 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
16836
16837 /**
16838  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
16839  */
16840 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
16841
16842 /**
16843  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
16844  */
16845 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
16846
16847 /**
16848  * Frees any resources used by the Balance
16849  */
16850 void Balance_free(struct LDKBalance this_ptr);
16851
16852 /**
16853  * Creates a copy of the Balance
16854  */
16855 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
16856
16857 /**
16858  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
16859  */
16860 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
16861
16862 /**
16863  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
16864  */
16865 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
16866
16867 /**
16868  * Utility method to constructs a new ContentiousClaimable-variant Balance
16869  */
16870 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
16871
16872 /**
16873  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
16874  */
16875 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
16876
16877 /**
16878  * Checks if two Balances contain equal inner contents.
16879  * This ignores pointers and is_owned flags and looks at the values in fields.
16880  */
16881 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
16882
16883 /**
16884  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
16885  */
16886 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
16887
16888 /**
16889  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
16890  */
16891 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
16892
16893 /**
16894  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
16895  * itself.
16896  *
16897  * panics if the given update is not the next update by update_id.
16898  */
16899 MUST_USE_RES struct LDKCResult_NoneNoneZ 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);
16900
16901 /**
16902  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
16903  * ChannelMonitor.
16904  */
16905 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16906
16907 /**
16908  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
16909  */
16910 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16911
16912 /**
16913  * Gets a list of txids, with their output scripts (in the order they appear in the
16914  * transaction), which we must learn about spends of via block_connected().
16915  */
16916 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16917
16918 /**
16919  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
16920  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
16921  * have been registered.
16922  */
16923 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
16924
16925 /**
16926  * Get the list of HTLCs who's status has been updated on chain. This should be called by
16927  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
16928  */
16929 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16930
16931 /**
16932  * Gets the list of pending events which were generated by previous actions, clearing the list
16933  * in the process.
16934  *
16935  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
16936  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
16937  * no internal locking in ChannelMonitors.
16938  */
16939 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16940
16941 /**
16942  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
16943  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
16944  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
16945  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
16946  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
16947  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
16948  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
16949  * out-of-band the other node operator to coordinate with him if option is available to you.
16950  * In any-case, choice is up to the user.
16951  */
16952 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);
16953
16954 /**
16955  * Processes transactions in a newly connected block, which may result in any of the following:
16956  * - update the monitor's state against resolved HTLCs
16957  * - punish the counterparty in the case of seeing a revoked commitment transaction
16958  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
16959  * - detect settled outputs for later spending
16960  * - schedule and bump any in-flight claims
16961  *
16962  * Returns any new outputs to watch from `txdata`; after called, these are also included in
16963  * [`get_outputs_to_watch`].
16964  *
16965  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
16966  */
16967 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);
16968
16969 /**
16970  * Determines if the disconnected block contained any transactions of interest and updates
16971  * appropriately.
16972  */
16973 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);
16974
16975 /**
16976  * Processes transactions confirmed in a block with the given header and height, returning new
16977  * outputs to watch. See [`block_connected`] for details.
16978  *
16979  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
16980  * blocks. See [`chain::Confirm`] for calling expectations.
16981  *
16982  * [`block_connected`]: Self::block_connected
16983  */
16984 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);
16985
16986 /**
16987  * Processes a transaction that was reorganized out of the chain.
16988  *
16989  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
16990  * than blocks. See [`chain::Confirm`] for calling expectations.
16991  *
16992  * [`block_disconnected`]: Self::block_disconnected
16993  */
16994 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);
16995
16996 /**
16997  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
16998  * [`block_connected`] for details.
16999  *
17000  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
17001  * blocks. See [`chain::Confirm`] for calling expectations.
17002  *
17003  * [`block_connected`]: Self::block_connected
17004  */
17005 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);
17006
17007 /**
17008  * Returns the set of txids that should be monitored for re-organization out of the chain.
17009  */
17010 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17011
17012 /**
17013  * Gets the latest best block which was connected either via the [`chain::Listen`] or
17014  * [`chain::Confirm`] interfaces.
17015  */
17016 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17017
17018 /**
17019  * Gets the balances in this channel which are either claimable by us if we were to
17020  * force-close the channel now or which are claimable on-chain (possibly awaiting
17021  * confirmation).
17022  *
17023  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
17024  * included here until an [`Event::SpendableOutputs`] event has been generated for the
17025  * balance, or until our counterparty has claimed the balance and accrued several
17026  * confirmations on the claim transaction.
17027  *
17028  * Note that the balances available when you or your counterparty have broadcasted revoked
17029  * state(s) may not be fully captured here.
17030  *
17031  * See [`Balance`] for additional details on the types of claimable balances which
17032  * may be returned here and their meanings.
17033  */
17034 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17035
17036 /**
17037  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
17038  */
17039 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
17040
17041 /**
17042  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
17043  */
17044 void OutPoint_free(struct LDKOutPoint this_obj);
17045
17046 /**
17047  * The referenced transaction's txid.
17048  */
17049 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
17050
17051 /**
17052  * The referenced transaction's txid.
17053  */
17054 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17055
17056 /**
17057  * The index of the referenced output in its transaction's vout.
17058  */
17059 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
17060
17061 /**
17062  * The index of the referenced output in its transaction's vout.
17063  */
17064 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
17065
17066 /**
17067  * Constructs a new OutPoint given each field
17068  */
17069 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
17070
17071 /**
17072  * Creates a copy of the OutPoint
17073  */
17074 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
17075
17076 /**
17077  * Checks if two OutPoints contain equal inner contents.
17078  * This ignores pointers and is_owned flags and looks at the values in fields.
17079  * Two objects with NULL inner values will be considered "equal" here.
17080  */
17081 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
17082
17083 /**
17084  * Checks if two OutPoints contain equal inner contents.
17085  */
17086 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
17087
17088 /**
17089  * Convert an `OutPoint` to a lightning channel id.
17090  */
17091 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
17092
17093 /**
17094  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
17095  */
17096 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
17097
17098 /**
17099  * Read a OutPoint from a byte array, created by OutPoint_write
17100  */
17101 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
17102
17103 /**
17104  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
17105  */
17106 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
17107
17108 /**
17109  * The outpoint which is spendable
17110  */
17111 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17112
17113 /**
17114  * The outpoint which is spendable
17115  */
17116 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17117
17118 /**
17119  * Per commitment point to derive delayed_payment_key by key holder
17120  */
17121 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17122
17123 /**
17124  * Per commitment point to derive delayed_payment_key by key holder
17125  */
17126 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17127
17128 /**
17129  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
17130  * the witness_script.
17131  */
17132 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17133
17134 /**
17135  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
17136  * the witness_script.
17137  */
17138 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
17139
17140 /**
17141  * The output which is referenced by the given outpoint
17142  */
17143 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
17144
17145 /**
17146  * The revocation point specific to the commitment transaction which was broadcast. Used to
17147  * derive the witnessScript for this output.
17148  */
17149 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17150
17151 /**
17152  * The revocation point specific to the commitment transaction which was broadcast. Used to
17153  * derive the witnessScript for this output.
17154  */
17155 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17156
17157 /**
17158  * Arbitrary identification information returned by a call to
17159  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
17160  * the channel to spend the output.
17161  */
17162 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
17163
17164 /**
17165  * Arbitrary identification information returned by a call to
17166  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
17167  * the channel to spend the output.
17168  */
17169 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17170
17171 /**
17172  * The value of the channel which this output originated from, possibly indirectly.
17173  */
17174 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17175
17176 /**
17177  * The value of the channel which this output originated from, possibly indirectly.
17178  */
17179 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
17180
17181 /**
17182  * Constructs a new DelayedPaymentOutputDescriptor given each field
17183  */
17184 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);
17185
17186 /**
17187  * Creates a copy of the DelayedPaymentOutputDescriptor
17188  */
17189 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
17190
17191 /**
17192  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
17193  */
17194 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
17195
17196 /**
17197  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
17198  */
17199 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
17200
17201 /**
17202  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
17203  */
17204 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
17205
17206 /**
17207  * The outpoint which is spendable
17208  */
17209 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17210
17211 /**
17212  * The outpoint which is spendable
17213  */
17214 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17215
17216 /**
17217  * The output which is referenced by the given outpoint
17218  */
17219 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
17220
17221 /**
17222  * Arbitrary identification information returned by a call to
17223  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
17224  * the channel to spend the output.
17225  */
17226 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
17227
17228 /**
17229  * Arbitrary identification information returned by a call to
17230  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
17231  * the channel to spend the output.
17232  */
17233 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17234
17235 /**
17236  * The value of the channel which this transactions spends.
17237  */
17238 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
17239
17240 /**
17241  * The value of the channel which this transactions spends.
17242  */
17243 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
17244
17245 /**
17246  * Constructs a new StaticPaymentOutputDescriptor given each field
17247  */
17248 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);
17249
17250 /**
17251  * Creates a copy of the StaticPaymentOutputDescriptor
17252  */
17253 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
17254
17255 /**
17256  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
17257  */
17258 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
17259
17260 /**
17261  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
17262  */
17263 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
17264
17265 /**
17266  * Frees any resources used by the SpendableOutputDescriptor
17267  */
17268 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
17269
17270 /**
17271  * Creates a copy of the SpendableOutputDescriptor
17272  */
17273 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
17274
17275 /**
17276  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
17277  */
17278 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
17279
17280 /**
17281  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
17282  */
17283 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
17284
17285 /**
17286  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
17287  */
17288 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
17289
17290 /**
17291  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
17292  */
17293 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
17294
17295 /**
17296  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
17297  */
17298 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
17299
17300 /**
17301  * Calls the free function if one is set
17302  */
17303 void BaseSign_free(struct LDKBaseSign this_ptr);
17304
17305 /**
17306  * Creates a copy of a Sign
17307  */
17308 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
17309
17310 /**
17311  * Calls the free function if one is set
17312  */
17313 void Sign_free(struct LDKSign this_ptr);
17314
17315 /**
17316  * Calls the free function if one is set
17317  */
17318 void KeysInterface_free(struct LDKKeysInterface this_ptr);
17319
17320 /**
17321  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
17322  */
17323 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
17324
17325 /**
17326  * Private key of anchor tx
17327  */
17328 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17329
17330 /**
17331  * Private key of anchor tx
17332  */
17333 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
17334
17335 /**
17336  * Holder secret key for blinded revocation pubkey
17337  */
17338 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17339
17340 /**
17341  * Holder secret key for blinded revocation pubkey
17342  */
17343 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
17344
17345 /**
17346  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
17347  */
17348 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17349
17350 /**
17351  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
17352  */
17353 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
17354
17355 /**
17356  * Holder secret key used in HTLC tx
17357  */
17358 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17359
17360 /**
17361  * Holder secret key used in HTLC tx
17362  */
17363 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
17364
17365 /**
17366  * Holder htlc secret key used in commitment tx htlc outputs
17367  */
17368 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17369
17370 /**
17371  * Holder htlc secret key used in commitment tx htlc outputs
17372  */
17373 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
17374
17375 /**
17376  * Commitment seed
17377  */
17378 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
17379
17380 /**
17381  * Commitment seed
17382  */
17383 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17384
17385 /**
17386  * Creates a copy of the InMemorySigner
17387  */
17388 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
17389
17390 /**
17391  * Create a new InMemorySigner
17392  */
17393 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);
17394
17395 /**
17396  * Counterparty pubkeys.
17397  * Will panic if ready_channel wasn't called.
17398  */
17399 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17400
17401 /**
17402  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
17403  * transactions, ie the amount of time that we have to wait to recover our funds if we
17404  * broadcast a transaction.
17405  * Will panic if ready_channel wasn't called.
17406  */
17407 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17408
17409 /**
17410  * The contest_delay value specified by us and applied on transactions broadcastable
17411  * by our counterparty, ie the amount of time that they have to wait to recover their funds
17412  * if they broadcast a transaction.
17413  * Will panic if ready_channel wasn't called.
17414  */
17415 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17416
17417 /**
17418  * Whether the holder is the initiator
17419  * Will panic if ready_channel wasn't called.
17420  */
17421 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17422
17423 /**
17424  * Funding outpoint
17425  * Will panic if ready_channel wasn't called.
17426  */
17427 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17428
17429 /**
17430  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
17431  * building transactions.
17432  *
17433  * Will panic if ready_channel wasn't called.
17434  */
17435 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17436
17437 /**
17438  * Whether anchors should be used.
17439  * Will panic if ready_channel wasn't called.
17440  */
17441 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17442
17443 /**
17444  * Sign the single input of spend_tx at index `input_idx` which spends the output
17445  * described by descriptor, returning the witness stack for the input.
17446  *
17447  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
17448  * or is not spending the outpoint described by `descriptor.outpoint`.
17449  */
17450 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);
17451
17452 /**
17453  * Sign the single input of spend_tx at index `input_idx` which spends the output
17454  * described by descriptor, returning the witness stack for the input.
17455  *
17456  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
17457  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
17458  * sequence set to `descriptor.to_self_delay`.
17459  */
17460 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);
17461
17462 /**
17463  * Constructs a new BaseSign which calls the relevant methods on this_arg.
17464  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
17465  */
17466 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17467
17468 /**
17469  * Constructs a new Sign which calls the relevant methods on this_arg.
17470  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
17471  */
17472 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17473
17474 /**
17475  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
17476  */
17477 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
17478
17479 /**
17480  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
17481  */
17482 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
17483
17484 /**
17485  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
17486  */
17487 void KeysManager_free(struct LDKKeysManager this_obj);
17488
17489 /**
17490  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
17491  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
17492  * starting_time isn't strictly required to actually be a time, but it must absolutely,
17493  * without a doubt, be unique to this instance. ie if you start multiple times with the same
17494  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
17495  * simply use the current time (with very high precision).
17496  *
17497  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
17498  * obviously, starting_time should be unique every time you reload the library - it is only
17499  * used to generate new ephemeral key data (which will be stored by the individual channel if
17500  * necessary).
17501  *
17502  * Note that the seed is required to recover certain on-chain funds independent of
17503  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
17504  * channel, and some on-chain during-closing funds.
17505  *
17506  * Note that until the 0.1 release there is no guarantee of backward compatibility between
17507  * versions. Once the library is more fully supported, the docs will be updated to include a
17508  * detailed description of the guarantee.
17509  */
17510 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
17511
17512 /**
17513  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
17514  *
17515  * Key derivation parameters are accessible through a per-channel secrets
17516  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
17517  * onchain output detection for which a corresponding delayed_payment_key must be derived.
17518  */
17519 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]);
17520
17521 /**
17522  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
17523  * output to the given change destination (if sufficient change value remains). The
17524  * transaction will have a feerate, at least, of the given value.
17525  *
17526  * Returns `Err(())` if the output value is greater than the input value minus required fee or
17527  * if a descriptor was duplicated.
17528  *
17529  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
17530  *
17531  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
17532  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
17533  */
17534 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);
17535
17536 /**
17537  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
17538  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
17539  */
17540 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
17541
17542 /**
17543  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
17544  */
17545 void ChannelManager_free(struct LDKChannelManager this_obj);
17546
17547 /**
17548  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
17549  */
17550 void ChainParameters_free(struct LDKChainParameters this_obj);
17551
17552 /**
17553  * The network for determining the `chain_hash` in Lightning messages.
17554  */
17555 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
17556
17557 /**
17558  * The network for determining the `chain_hash` in Lightning messages.
17559  */
17560 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
17561
17562 /**
17563  * The hash and height of the latest block successfully connected.
17564  *
17565  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
17566  */
17567 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
17568
17569 /**
17570  * The hash and height of the latest block successfully connected.
17571  *
17572  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
17573  */
17574 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
17575
17576 /**
17577  * Constructs a new ChainParameters given each field
17578  */
17579 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
17580
17581 /**
17582  * Creates a copy of the ChainParameters
17583  */
17584 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
17585
17586 /**
17587  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
17588  */
17589 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
17590
17591 /**
17592  * Base routing fee in millisatoshis.
17593  */
17594 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17595
17596 /**
17597  * Base routing fee in millisatoshis.
17598  */
17599 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
17600
17601 /**
17602  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
17603  */
17604 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17605
17606 /**
17607  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
17608  */
17609 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
17610
17611 /**
17612  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
17613  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
17614  * `cltv_expiry_delta` for more details.
17615  */
17616 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17617
17618 /**
17619  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
17620  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
17621  * `cltv_expiry_delta` for more details.
17622  */
17623 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
17624
17625 /**
17626  * Constructs a new CounterpartyForwardingInfo given each field
17627  */
17628 MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg);
17629
17630 /**
17631  * Creates a copy of the CounterpartyForwardingInfo
17632  */
17633 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
17634
17635 /**
17636  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
17637  */
17638 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
17639
17640 /**
17641  * The node_id of our counterparty
17642  */
17643 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17644
17645 /**
17646  * The node_id of our counterparty
17647  */
17648 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17649
17650 /**
17651  * The Features the channel counterparty provided upon last connection.
17652  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
17653  * many routing-relevant features are present in the init context.
17654  */
17655 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17656
17657 /**
17658  * The Features the channel counterparty provided upon last connection.
17659  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
17660  * many routing-relevant features are present in the init context.
17661  */
17662 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
17663
17664 /**
17665  * The value, in satoshis, that must always be held in the channel for our counterparty. This
17666  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
17667  * claiming at least this value on chain.
17668  *
17669  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
17670  *
17671  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
17672  */
17673 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17674
17675 /**
17676  * The value, in satoshis, that must always be held in the channel for our counterparty. This
17677  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
17678  * claiming at least this value on chain.
17679  *
17680  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
17681  *
17682  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
17683  */
17684 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
17685
17686 /**
17687  * Information on the fees and requirements that the counterparty requires when forwarding
17688  * payments to us through this channel.
17689  *
17690  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17691  */
17692 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17693
17694 /**
17695  * Information on the fees and requirements that the counterparty requires when forwarding
17696  * payments to us through this channel.
17697  *
17698  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17699  */
17700 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
17701
17702 /**
17703  * Constructs a new ChannelCounterparty given each field
17704  */
17705 MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg);
17706
17707 /**
17708  * Creates a copy of the ChannelCounterparty
17709  */
17710 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
17711
17712 /**
17713  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
17714  */
17715 void ChannelDetails_free(struct LDKChannelDetails this_obj);
17716
17717 /**
17718  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
17719  * thereafter this is the txid of the funding transaction xor the funding transaction output).
17720  * Note that this means this value is *not* persistent - it can change once during the
17721  * lifetime of the channel.
17722  */
17723 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
17724
17725 /**
17726  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
17727  * thereafter this is the txid of the funding transaction xor the funding transaction output).
17728  * Note that this means this value is *not* persistent - it can change once during the
17729  * lifetime of the channel.
17730  */
17731 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17732
17733 /**
17734  * Parameters which apply to our counterparty. See individual fields for more information.
17735  */
17736 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17737
17738 /**
17739  * Parameters which apply to our counterparty. See individual fields for more information.
17740  */
17741 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
17742
17743 /**
17744  * The Channel's funding transaction output, if we've negotiated the funding transaction with
17745  * our counterparty already.
17746  *
17747  * Note that, if this has been set, `channel_id` will be equivalent to
17748  * `funding_txo.unwrap().to_channel_id()`.
17749  *
17750  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17751  */
17752 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17753
17754 /**
17755  * The Channel's funding transaction output, if we've negotiated the funding transaction with
17756  * our counterparty already.
17757  *
17758  * Note that, if this has been set, `channel_id` will be equivalent to
17759  * `funding_txo.unwrap().to_channel_id()`.
17760  *
17761  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17762  */
17763 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17764
17765 /**
17766  * The position of the funding transaction in the chain. None if the funding transaction has
17767  * not yet been confirmed and the channel fully opened.
17768  */
17769 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17770
17771 /**
17772  * The position of the funding transaction in the chain. None if the funding transaction has
17773  * not yet been confirmed and the channel fully opened.
17774  */
17775 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17776
17777 /**
17778  * The value, in satoshis, of this channel as appears in the funding output
17779  */
17780 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17781
17782 /**
17783  * The value, in satoshis, of this channel as appears in the funding output
17784  */
17785 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17786
17787 /**
17788  * The value, in satoshis, that must always be held in the channel for us. This value ensures
17789  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
17790  * this value on chain.
17791  *
17792  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
17793  *
17794  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17795  *
17796  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
17797  */
17798 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17799
17800 /**
17801  * The value, in satoshis, that must always be held in the channel for us. This value ensures
17802  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
17803  * this value on chain.
17804  *
17805  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
17806  *
17807  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17808  *
17809  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
17810  */
17811 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17812
17813 /**
17814  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
17815  */
17816 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17817
17818 /**
17819  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
17820  */
17821 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17822
17823 /**
17824  * Our total balance.  This is the amount we would get if we close the channel.
17825  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
17826  * amount is not likely to be recoverable on close.
17827  *
17828  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
17829  * balance is not available for inclusion in new outbound HTLCs). This further does not include
17830  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
17831  * This does not consider any on-chain fees.
17832  *
17833  * See also [`ChannelDetails::outbound_capacity_msat`]
17834  */
17835 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17836
17837 /**
17838  * Our total balance.  This is the amount we would get if we close the channel.
17839  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
17840  * amount is not likely to be recoverable on close.
17841  *
17842  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
17843  * balance is not available for inclusion in new outbound HTLCs). This further does not include
17844  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
17845  * This does not consider any on-chain fees.
17846  *
17847  * See also [`ChannelDetails::outbound_capacity_msat`]
17848  */
17849 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17850
17851 /**
17852  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
17853  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
17854  * available for inclusion in new outbound HTLCs). This further does not include any pending
17855  * outgoing HTLCs which are awaiting some other resolution to be sent.
17856  *
17857  * See also [`ChannelDetails::balance_msat`]
17858  *
17859  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17860  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
17861  * should be able to spend nearly this amount.
17862  */
17863 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17864
17865 /**
17866  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
17867  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
17868  * available for inclusion in new outbound HTLCs). This further does not include any pending
17869  * outgoing HTLCs which are awaiting some other resolution to be sent.
17870  *
17871  * See also [`ChannelDetails::balance_msat`]
17872  *
17873  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17874  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
17875  * should be able to spend nearly this amount.
17876  */
17877 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17878
17879 /**
17880  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
17881  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
17882  * available for inclusion in new inbound HTLCs).
17883  * Note that there are some corner cases not fully handled here, so the actual available
17884  * inbound capacity may be slightly higher than this.
17885  *
17886  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17887  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
17888  * However, our counterparty should be able to spend nearly this amount.
17889  */
17890 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17891
17892 /**
17893  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
17894  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
17895  * available for inclusion in new inbound HTLCs).
17896  * Note that there are some corner cases not fully handled here, so the actual available
17897  * inbound capacity may be slightly higher than this.
17898  *
17899  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17900  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
17901  * However, our counterparty should be able to spend nearly this amount.
17902  */
17903 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17904
17905 /**
17906  * The number of required confirmations on the funding transaction before the funding will be
17907  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
17908  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
17909  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
17910  * [`ChannelHandshakeLimits::max_minimum_depth`].
17911  *
17912  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17913  *
17914  * [`is_outbound`]: ChannelDetails::is_outbound
17915  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
17916  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
17917  */
17918 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17919
17920 /**
17921  * The number of required confirmations on the funding transaction before the funding will be
17922  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
17923  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
17924  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
17925  * [`ChannelHandshakeLimits::max_minimum_depth`].
17926  *
17927  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17928  *
17929  * [`is_outbound`]: ChannelDetails::is_outbound
17930  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
17931  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
17932  */
17933 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
17934
17935 /**
17936  * The number of blocks (after our commitment transaction confirms) that we will need to wait
17937  * until we can claim our funds after we force-close the channel. During this time our
17938  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
17939  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
17940  * time to claim our non-HTLC-encumbered funds.
17941  *
17942  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17943  */
17944 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17945
17946 /**
17947  * The number of blocks (after our commitment transaction confirms) that we will need to wait
17948  * until we can claim our funds after we force-close the channel. During this time our
17949  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
17950  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
17951  * time to claim our non-HTLC-encumbered funds.
17952  *
17953  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17954  */
17955 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
17956
17957 /**
17958  * True if the channel was initiated (and thus funded) by us.
17959  */
17960 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17961
17962 /**
17963  * True if the channel was initiated (and thus funded) by us.
17964  */
17965 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17966
17967 /**
17968  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
17969  * channel is not currently being shut down. `funding_locked` message exchange implies the
17970  * required confirmation count has been reached (and we were connected to the peer at some
17971  * point after the funding transaction received enough confirmations). The required
17972  * confirmation count is provided in [`confirmations_required`].
17973  *
17974  * [`confirmations_required`]: ChannelDetails::confirmations_required
17975  */
17976 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17977
17978 /**
17979  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
17980  * channel is not currently being shut down. `funding_locked` message exchange implies the
17981  * required confirmation count has been reached (and we were connected to the peer at some
17982  * point after the funding transaction received enough confirmations). The required
17983  * confirmation count is provided in [`confirmations_required`].
17984  *
17985  * [`confirmations_required`]: ChannelDetails::confirmations_required
17986  */
17987 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17988
17989 /**
17990  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
17991  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
17992  *
17993  * This is a strict superset of `is_funding_locked`.
17994  */
17995 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17996
17997 /**
17998  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
17999  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
18000  *
18001  * This is a strict superset of `is_funding_locked`.
18002  */
18003 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
18004
18005 /**
18006  * True if this channel is (or will be) publicly-announced.
18007  */
18008 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18009
18010 /**
18011  * True if this channel is (or will be) publicly-announced.
18012  */
18013 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
18014
18015 /**
18016  * Constructs a new ChannelDetails given each field
18017  */
18018 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
18019
18020 /**
18021  * Creates a copy of the ChannelDetails
18022  */
18023 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
18024
18025 /**
18026  * Frees any resources used by the PaymentSendFailure
18027  */
18028 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
18029
18030 /**
18031  * Creates a copy of the PaymentSendFailure
18032  */
18033 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
18034
18035 /**
18036  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
18037  */
18038 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
18039
18040 /**
18041  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
18042  */
18043 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
18044
18045 /**
18046  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
18047  */
18048 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
18049
18050 /**
18051  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
18052  */
18053 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
18054
18055 /**
18056  * Constructs a new ChannelManager to hold several channels and route between them.
18057  *
18058  * This is the main \"logic hub\" for all channel-related actions, and implements
18059  * ChannelMessageHandler.
18060  *
18061  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
18062  *
18063  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
18064  *
18065  * Users need to notify the new ChannelManager when a new block is connected or
18066  * disconnected using its `block_connected` and `block_disconnected` methods, starting
18067  * from after `params.latest_hash`.
18068  */
18069 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);
18070
18071 /**
18072  * Gets the current configuration applied to all new channels,  as
18073  */
18074 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
18075
18076 /**
18077  * Creates a new outbound channel to the given remote node and with the given value.
18078  *
18079  * `user_channel_id` will be provided back as in
18080  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
18081  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
18082  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
18083  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
18084  * ignored.
18085  *
18086  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
18087  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
18088  *
18089  * Note that we do not check if you are currently connected to the given peer. If no
18090  * connection is available, the outbound `open_channel` message may fail to send, resulting in
18091  * the channel eventually being silently forgotten (dropped on reload).
18092  *
18093  * Returns the new Channel's temporary `channel_id`. This ID will appear as
18094  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
18095  * [`ChannelDetails::channel_id`] until after
18096  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
18097  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
18098  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
18099  *
18100  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
18101  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
18102  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
18103  *
18104  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
18105  */
18106 MUST_USE_RES struct LDKCResult__u832APIErrorZ 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_channel_id, struct LDKUserConfig override_config);
18107
18108 /**
18109  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
18110  * more information.
18111  */
18112 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
18113
18114 /**
18115  * Gets the list of usable channels, in random order. Useful as an argument to
18116  * get_route to ensure non-announced channels are used.
18117  *
18118  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
18119  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
18120  * are.
18121  */
18122 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
18123
18124 /**
18125  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
18126  * will be accepted on the given channel, and after additional timeout/the closing of all
18127  * pending HTLCs, the channel will be closed on chain.
18128  *
18129  *  * If we are the channel initiator, we will pay between our [`Background`] and
18130  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
18131  *    estimate.
18132  *  * If our counterparty is the channel initiator, we will require a channel closing
18133  *    transaction feerate of at least our [`Background`] feerate or the feerate which
18134  *    would appear on a force-closure transaction, whichever is lower. We will allow our
18135  *    counterparty to pay as much fee as they'd like, however.
18136  *
18137  * May generate a SendShutdown message event on success, which should be relayed.
18138  *
18139  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
18140  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18141  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18142  */
18143 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
18144
18145 /**
18146  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
18147  * will be accepted on the given channel, and after additional timeout/the closing of all
18148  * pending HTLCs, the channel will be closed on chain.
18149  *
18150  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
18151  * the channel being closed or not:
18152  *  * If we are the channel initiator, we will pay at least this feerate on the closing
18153  *    transaction. The upper-bound is set by
18154  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
18155  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
18156  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
18157  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
18158  *    will appear on a force-closure transaction, whichever is lower).
18159  *
18160  * May generate a SendShutdown message event on success, which should be relayed.
18161  *
18162  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
18163  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18164  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18165  */
18166 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
18167
18168 /**
18169  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
18170  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
18171  */
18172 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
18173
18174 /**
18175  * Force close all channels, immediately broadcasting the latest local commitment transaction
18176  * for each to the chain and rejecting new HTLCs on each.
18177  */
18178 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
18179
18180 /**
18181  * Sends a payment along a given route.
18182  *
18183  * Value parameters are provided via the last hop in route, see documentation for RouteHop
18184  * fields for more info.
18185  *
18186  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
18187  * payment), we don't do anything to stop you! We always try to ensure that if the provided
18188  * next hop knows the preimage to payment_hash they can claim an additional amount as
18189  * specified in the last hop in the route! Thus, you should probably do your own
18190  * payment_preimage tracking (which you should already be doing as they represent \"proof of
18191  * payment\") and prevent double-sends yourself.
18192  *
18193  * May generate SendHTLCs message(s) event on success, which should be relayed.
18194  *
18195  * Each path may have a different return value, and PaymentSendValue may return a Vec with
18196  * each entry matching the corresponding-index entry in the route paths, see
18197  * PaymentSendFailure for more info.
18198  *
18199  * In general, a path may raise:
18200  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
18201  *    node public key) is specified.
18202  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
18203  *    (including due to previous monitor update failure or new permanent monitor update
18204  *    failure).
18205  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
18206  *    relevant updates.
18207  *
18208  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
18209  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
18210  * different route unless you intend to pay twice!
18211  *
18212  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
18213  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
18214  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
18215  * must not contain multiple paths as multi-path payments require a recipient-provided
18216  * payment_secret.
18217  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
18218  * bit set (either as required or as available). If multiple paths are present in the Route,
18219  * we assume the invoice had the basic_mpp feature set.
18220  *
18221  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
18222  */
18223 MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
18224
18225 /**
18226  * Retries a payment along the given [`Route`].
18227  *
18228  * Errors returned are a superset of those returned from [`send_payment`], so see
18229  * [`send_payment`] documentation for more details on errors. This method will also error if the
18230  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
18231  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
18232  * further retries have been disabled with [`abandon_payment`].
18233  *
18234  * [`send_payment`]: [`ChannelManager::send_payment`]
18235  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
18236  */
18237 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
18238
18239 /**
18240  * Signals that no further retries for the given payment will occur.
18241  *
18242  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
18243  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
18244  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
18245  * pending HTLCs for this payment.
18246  *
18247  * Note that calling this method does *not* prevent a payment from succeeding. You must still
18248  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
18249  * determine the ultimate status of a payment.
18250  *
18251  * [`retry_payment`]: Self::retry_payment
18252  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
18253  * [`Event::PaymentSent`]: events::Event::PaymentSent
18254  */
18255 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
18256
18257 /**
18258  * Send a spontaneous payment, which is a payment that does not require the recipient to have
18259  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
18260  * the preimage, it must be a cryptographically secure random value that no intermediate node
18261  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
18262  * never reach the recipient.
18263  *
18264  * See [`send_payment`] documentation for more details on the return value of this function.
18265  *
18266  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
18267  * [`send_payment`] for more information about the risks of duplicate preimage usage.
18268  *
18269  * Note that `route` must have exactly one path.
18270  *
18271  * [`send_payment`]: Self::send_payment
18272  *
18273  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
18274  */
18275 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
18276
18277 /**
18278  * Call this upon creation of a funding transaction for the given channel.
18279  *
18280  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
18281  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
18282  *
18283  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
18284  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
18285  *
18286  * May panic if the output found in the funding transaction is duplicative with some other
18287  * channel (note that this should be trivially prevented by using unique funding transaction
18288  * keys per-channel).
18289  *
18290  * Do NOT broadcast the funding transaction yourself. When we have safely received our
18291  * counterparty's signature the funding transaction will automatically be broadcast via the
18292  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
18293  *
18294  * Note that this includes RBF or similar transaction replacement strategies - lightning does
18295  * not currently support replacing a funding transaction on an existing channel. Instead,
18296  * create a new channel with a conflicting funding transaction.
18297  *
18298  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
18299  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
18300  */
18301 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);
18302
18303 /**
18304  * Regenerates channel_announcements and generates a signed node_announcement from the given
18305  * arguments, providing them in corresponding events via
18306  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
18307  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
18308  * announcement to ensure that the lightning P2P network is aware of the channels we have and
18309  * our network addresses.
18310  *
18311  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
18312  * node to humans. They carry no in-protocol meaning.
18313  *
18314  * `addresses` represent the set (possibly empty) of socket addresses on which this node
18315  * accepts incoming connections. These will be included in the node_announcement, publicly
18316  * tying these addresses together and to this node. If you wish to preserve user privacy,
18317  * addresses should likely contain only Tor Onion addresses.
18318  *
18319  * Panics if `addresses` is absurdly large (more than 500).
18320  *
18321  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
18322  */
18323 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
18324
18325 /**
18326  * Processes HTLCs which are pending waiting on random forward delay.
18327  *
18328  * Should only really ever be called in response to a PendingHTLCsForwardable event.
18329  * Will likely generate further events.
18330  */
18331 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
18332
18333 /**
18334  * Performs actions which should happen on startup and roughly once per minute thereafter.
18335  *
18336  * This currently includes:
18337  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
18338  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
18339  *    than a minute, informing the network that they should no longer attempt to route over
18340  *    the channel.
18341  *
18342  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
18343  * estimate fetches.
18344  */
18345 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
18346
18347 /**
18348  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
18349  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
18350  * along the path (including in our own channel on which we received it).
18351  * Returns false if no payment was found to fail backwards, true if the process of failing the
18352  * HTLC backwards has been started.
18353  */
18354 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
18355
18356 /**
18357  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
18358  * [`MessageSendEvent`]s needed to claim the payment.
18359  *
18360  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
18361  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
18362  * event matches your expectation. If you fail to do so and call this method, you may provide
18363  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
18364  *
18365  * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
18366  * pending for processing via [`get_and_clear_pending_msg_events`].
18367  *
18368  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
18369  * [`create_inbound_payment`]: Self::create_inbound_payment
18370  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
18371  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
18372  */
18373 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
18374
18375 /**
18376  * Gets the node_id held by this ChannelManager
18377  */
18378 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
18379
18380 /**
18381  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
18382  * to pay us.
18383  *
18384  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
18385  * [`PaymentHash`] and [`PaymentPreimage`] for you.
18386  *
18387  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
18388  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
18389  * passed directly to [`claim_funds`].
18390  *
18391  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
18392  *
18393  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
18394  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
18395  *
18396  * # Note
18397  *
18398  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
18399  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
18400  *
18401  * Errors if `min_value_msat` is greater than total bitcoin supply.
18402  *
18403  * [`claim_funds`]: Self::claim_funds
18404  * [`PaymentReceived`]: events::Event::PaymentReceived
18405  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
18406  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
18407  */
18408 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
18409
18410 /**
18411  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
18412  * serialized state with LDK node(s) running 0.0.103 and earlier.
18413  *
18414  * # Note
18415  * This method is deprecated and will be removed soon.
18416  *
18417  * [`create_inbound_payment`]: Self::create_inbound_payment
18418  */
18419 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
18420
18421 /**
18422  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
18423  * stored external to LDK.
18424  *
18425  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
18426  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
18427  * the `min_value_msat` provided here, if one is provided.
18428  *
18429  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
18430  * note that LDK will not stop you from registering duplicate payment hashes for inbound
18431  * payments.
18432  *
18433  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
18434  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
18435  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
18436  * sender \"proof-of-payment\" unless they have paid the required amount.
18437  *
18438  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
18439  * in excess of the current time. This should roughly match the expiry time set in the invoice.
18440  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
18441  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
18442  * invoices when no timeout is set.
18443  *
18444  * Note that we use block header time to time-out pending inbound payments (with some margin
18445  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
18446  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
18447  * If you need exact expiry semantics, you should enforce them upon receipt of
18448  * [`PaymentReceived`].
18449  *
18450  * May panic if `invoice_expiry_delta_secs` is greater than one year.
18451  *
18452  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
18453  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
18454  *
18455  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
18456  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
18457  *
18458  * # Note
18459  *
18460  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
18461  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
18462  *
18463  * Errors if `min_value_msat` is greater than total bitcoin supply.
18464  *
18465  * [`create_inbound_payment`]: Self::create_inbound_payment
18466  * [`PaymentReceived`]: events::Event::PaymentReceived
18467  */
18468 MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ 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);
18469
18470 /**
18471  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
18472  * serialized state with LDK node(s) running 0.0.103 and earlier.
18473  *
18474  * # Note
18475  * This method is deprecated and will be removed soon.
18476  *
18477  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
18478  */
18479 MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
18480
18481 /**
18482  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
18483  * previously returned from [`create_inbound_payment`].
18484  *
18485  * [`create_inbound_payment`]: Self::create_inbound_payment
18486  */
18487 MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
18488
18489 /**
18490  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18491  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18492  */
18493 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
18494
18495 /**
18496  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
18497  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
18498  */
18499 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
18500
18501 /**
18502  * Constructs a new Listen which calls the relevant methods on this_arg.
18503  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
18504  */
18505 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
18506
18507 /**
18508  * Constructs a new Confirm which calls the relevant methods on this_arg.
18509  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
18510  */
18511 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
18512
18513 /**
18514  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
18515  * indicating whether persistence is necessary. Only one listener on
18516  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
18517  * up.
18518  *
18519  * Note that this method is not available with the `no-std` feature.
18520  */
18521 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
18522
18523 /**
18524  * Blocks until ChannelManager needs to be persisted. Only one listener on
18525  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
18526  * up.
18527  */
18528 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
18529
18530 /**
18531  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18532  * [`chain::Confirm`] interfaces.
18533  */
18534 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
18535
18536 /**
18537  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
18538  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
18539  */
18540 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
18541
18542 /**
18543  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
18544  */
18545 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
18546
18547 /**
18548  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
18549  */
18550 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
18551
18552 /**
18553  * The keys provider which will give us relevant keys. Some keys will be loaded during
18554  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
18555  * signing data.
18556  */
18557 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18558
18559 /**
18560  * The keys provider which will give us relevant keys. Some keys will be loaded during
18561  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
18562  * signing data.
18563  */
18564 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
18565
18566 /**
18567  * The fee_estimator for use in the ChannelManager in the future.
18568  *
18569  * No calls to the FeeEstimator will be made during deserialization.
18570  */
18571 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18572
18573 /**
18574  * The fee_estimator for use in the ChannelManager in the future.
18575  *
18576  * No calls to the FeeEstimator will be made during deserialization.
18577  */
18578 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
18579
18580 /**
18581  * The chain::Watch for use in the ChannelManager in the future.
18582  *
18583  * No calls to the chain::Watch will be made during deserialization. It is assumed that
18584  * you have deserialized ChannelMonitors separately and will add them to your
18585  * chain::Watch after deserializing this ChannelManager.
18586  */
18587 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18588
18589 /**
18590  * The chain::Watch for use in the ChannelManager in the future.
18591  *
18592  * No calls to the chain::Watch will be made during deserialization. It is assumed that
18593  * you have deserialized ChannelMonitors separately and will add them to your
18594  * chain::Watch after deserializing this ChannelManager.
18595  */
18596 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
18597
18598 /**
18599  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
18600  * used to broadcast the latest local commitment transactions of channels which must be
18601  * force-closed during deserialization.
18602  */
18603 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18604
18605 /**
18606  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
18607  * used to broadcast the latest local commitment transactions of channels which must be
18608  * force-closed during deserialization.
18609  */
18610 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
18611
18612 /**
18613  * The Logger for use in the ChannelManager and which may be used to log information during
18614  * deserialization.
18615  */
18616 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18617
18618 /**
18619  * The Logger for use in the ChannelManager and which may be used to log information during
18620  * deserialization.
18621  */
18622 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
18623
18624 /**
18625  * Default settings used for new channels. Any existing channels will continue to use the
18626  * runtime settings which were stored when the ChannelManager was serialized.
18627  */
18628 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18629
18630 /**
18631  * Default settings used for new channels. Any existing channels will continue to use the
18632  * runtime settings which were stored when the ChannelManager was serialized.
18633  */
18634 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
18635
18636 /**
18637  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
18638  * HashMap for you. This is primarily useful for C bindings where it is not practical to
18639  * populate a HashMap directly from C.
18640  */
18641 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);
18642
18643 /**
18644  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
18645  */
18646 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
18647
18648 /**
18649  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
18650  */
18651 void DecodeError_free(struct LDKDecodeError this_obj);
18652
18653 /**
18654  * Creates a copy of the DecodeError
18655  */
18656 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
18657
18658 /**
18659  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
18660  */
18661 void Init_free(struct LDKInit this_obj);
18662
18663 /**
18664  * The relevant features which the sender supports
18665  */
18666 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
18667
18668 /**
18669  * The relevant features which the sender supports
18670  */
18671 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
18672
18673 /**
18674  * Constructs a new Init given each field
18675  */
18676 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
18677
18678 /**
18679  * Creates a copy of the Init
18680  */
18681 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
18682
18683 /**
18684  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
18685  */
18686 void ErrorMessage_free(struct LDKErrorMessage this_obj);
18687
18688 /**
18689  * The channel ID involved in the error
18690  */
18691 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
18692
18693 /**
18694  * The channel ID involved in the error
18695  */
18696 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18697
18698 /**
18699  * A possibly human-readable error description.
18700  * The string should be sanitized before it is used (e.g. emitted to logs
18701  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
18702  * vulnerability in the terminal emulator or the logging subsystem.
18703  */
18704 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
18705
18706 /**
18707  * A possibly human-readable error description.
18708  * The string should be sanitized before it is used (e.g. emitted to logs
18709  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
18710  * vulnerability in the terminal emulator or the logging subsystem.
18711  */
18712 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
18713
18714 /**
18715  * Constructs a new ErrorMessage given each field
18716  */
18717 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
18718
18719 /**
18720  * Creates a copy of the ErrorMessage
18721  */
18722 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
18723
18724 /**
18725  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
18726  */
18727 void Ping_free(struct LDKPing this_obj);
18728
18729 /**
18730  * The desired response length
18731  */
18732 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
18733
18734 /**
18735  * The desired response length
18736  */
18737 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
18738
18739 /**
18740  * The ping packet size.
18741  * This field is not sent on the wire. byteslen zeros are sent.
18742  */
18743 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
18744
18745 /**
18746  * The ping packet size.
18747  * This field is not sent on the wire. byteslen zeros are sent.
18748  */
18749 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
18750
18751 /**
18752  * Constructs a new Ping given each field
18753  */
18754 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
18755
18756 /**
18757  * Creates a copy of the Ping
18758  */
18759 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
18760
18761 /**
18762  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
18763  */
18764 void Pong_free(struct LDKPong this_obj);
18765
18766 /**
18767  * The pong packet size.
18768  * This field is not sent on the wire. byteslen zeros are sent.
18769  */
18770 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
18771
18772 /**
18773  * The pong packet size.
18774  * This field is not sent on the wire. byteslen zeros are sent.
18775  */
18776 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
18777
18778 /**
18779  * Constructs a new Pong given each field
18780  */
18781 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
18782
18783 /**
18784  * Creates a copy of the Pong
18785  */
18786 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
18787
18788 /**
18789  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
18790  */
18791 void OpenChannel_free(struct LDKOpenChannel this_obj);
18792
18793 /**
18794  * The genesis hash of the blockchain where the channel is to be opened
18795  */
18796 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
18797
18798 /**
18799  * The genesis hash of the blockchain where the channel is to be opened
18800  */
18801 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18802
18803 /**
18804  * A temporary channel ID, until the funding outpoint is announced
18805  */
18806 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
18807
18808 /**
18809  * A temporary channel ID, until the funding outpoint is announced
18810  */
18811 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18812
18813 /**
18814  * The channel value
18815  */
18816 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18817
18818 /**
18819  * The channel value
18820  */
18821 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18822
18823 /**
18824  * The amount to push to the counterparty as part of the open, in milli-satoshi
18825  */
18826 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18827
18828 /**
18829  * The amount to push to the counterparty as part of the open, in milli-satoshi
18830  */
18831 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18832
18833 /**
18834  * The threshold below which outputs on transactions broadcast by sender will be omitted
18835  */
18836 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18837
18838 /**
18839  * The threshold below which outputs on transactions broadcast by sender will be omitted
18840  */
18841 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18842
18843 /**
18844  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18845  */
18846 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18847
18848 /**
18849  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18850  */
18851 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18852
18853 /**
18854  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18855  */
18856 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18857
18858 /**
18859  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18860  */
18861 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18862
18863 /**
18864  * The minimum HTLC size incoming to sender, in milli-satoshi
18865  */
18866 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18867
18868 /**
18869  * The minimum HTLC size incoming to sender, in milli-satoshi
18870  */
18871 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18872
18873 /**
18874  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
18875  */
18876 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18877
18878 /**
18879  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
18880  */
18881 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
18882
18883 /**
18884  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18885  */
18886 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18887
18888 /**
18889  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18890  */
18891 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
18892
18893 /**
18894  * The maximum number of inbound HTLCs towards sender
18895  */
18896 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18897
18898 /**
18899  * The maximum number of inbound HTLCs towards sender
18900  */
18901 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
18902
18903 /**
18904  * The sender's key controlling the funding transaction
18905  */
18906 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18907
18908 /**
18909  * The sender's key controlling the funding transaction
18910  */
18911 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18912
18913 /**
18914  * Used to derive a revocation key for transactions broadcast by counterparty
18915  */
18916 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18917
18918 /**
18919  * Used to derive a revocation key for transactions broadcast by counterparty
18920  */
18921 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18922
18923 /**
18924  * A payment key to sender for transactions broadcast by counterparty
18925  */
18926 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18927
18928 /**
18929  * A payment key to sender for transactions broadcast by counterparty
18930  */
18931 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18932
18933 /**
18934  * Used to derive a payment key to sender for transactions broadcast by sender
18935  */
18936 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18937
18938 /**
18939  * Used to derive a payment key to sender for transactions broadcast by sender
18940  */
18941 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18942
18943 /**
18944  * Used to derive an HTLC payment key to sender
18945  */
18946 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18947
18948 /**
18949  * Used to derive an HTLC payment key to sender
18950  */
18951 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18952
18953 /**
18954  * The first to-be-broadcast-by-sender transaction's per commitment point
18955  */
18956 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18957
18958 /**
18959  * The first to-be-broadcast-by-sender transaction's per commitment point
18960  */
18961 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18962
18963 /**
18964  * Channel flags
18965  */
18966 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18967
18968 /**
18969  * Channel flags
18970  */
18971 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
18972
18973 /**
18974  * The channel type that this channel will represent. If none is set, we derive the channel
18975  * type from the intersection of our feature bits with our counterparty's feature bits from
18976  * the Init message.
18977  *
18978  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18979  */
18980 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18981
18982 /**
18983  * The channel type that this channel will represent. If none is set, we derive the channel
18984  * type from the intersection of our feature bits with our counterparty's feature bits from
18985  * the Init message.
18986  *
18987  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18988  */
18989 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
18990
18991 /**
18992  * Creates a copy of the OpenChannel
18993  */
18994 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
18995
18996 /**
18997  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
18998  */
18999 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
19000
19001 /**
19002  * A temporary channel ID, until the funding outpoint is announced
19003  */
19004 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
19005
19006 /**
19007  * A temporary channel ID, until the funding outpoint is announced
19008  */
19009 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19010
19011 /**
19012  * The threshold below which outputs on transactions broadcast by sender will be omitted
19013  */
19014 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19015
19016 /**
19017  * The threshold below which outputs on transactions broadcast by sender will be omitted
19018  */
19019 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
19020
19021 /**
19022  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
19023  */
19024 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19025
19026 /**
19027  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
19028  */
19029 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
19030
19031 /**
19032  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
19033  */
19034 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19035
19036 /**
19037  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
19038  */
19039 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
19040
19041 /**
19042  * The minimum HTLC size incoming to sender, in milli-satoshi
19043  */
19044 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19045
19046 /**
19047  * The minimum HTLC size incoming to sender, in milli-satoshi
19048  */
19049 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
19050
19051 /**
19052  * Minimum depth of the funding transaction before the channel is considered open
19053  */
19054 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19055
19056 /**
19057  * Minimum depth of the funding transaction before the channel is considered open
19058  */
19059 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
19060
19061 /**
19062  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
19063  */
19064 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19065
19066 /**
19067  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
19068  */
19069 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
19070
19071 /**
19072  * The maximum number of inbound HTLCs towards sender
19073  */
19074 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19075
19076 /**
19077  * The maximum number of inbound HTLCs towards sender
19078  */
19079 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
19080
19081 /**
19082  * The sender's key controlling the funding transaction
19083  */
19084 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19085
19086 /**
19087  * The sender's key controlling the funding transaction
19088  */
19089 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19090
19091 /**
19092  * Used to derive a revocation key for transactions broadcast by counterparty
19093  */
19094 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19095
19096 /**
19097  * Used to derive a revocation key for transactions broadcast by counterparty
19098  */
19099 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19100
19101 /**
19102  * A payment key to sender for transactions broadcast by counterparty
19103  */
19104 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19105
19106 /**
19107  * A payment key to sender for transactions broadcast by counterparty
19108  */
19109 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19110
19111 /**
19112  * Used to derive a payment key to sender for transactions broadcast by sender
19113  */
19114 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19115
19116 /**
19117  * Used to derive a payment key to sender for transactions broadcast by sender
19118  */
19119 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19120
19121 /**
19122  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
19123  */
19124 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19125
19126 /**
19127  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
19128  */
19129 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19130
19131 /**
19132  * The first to-be-broadcast-by-sender transaction's per commitment point
19133  */
19134 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
19135
19136 /**
19137  * The first to-be-broadcast-by-sender transaction's per commitment point
19138  */
19139 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19140
19141 /**
19142  * Creates a copy of the AcceptChannel
19143  */
19144 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
19145
19146 /**
19147  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
19148  */
19149 void FundingCreated_free(struct LDKFundingCreated this_obj);
19150
19151 /**
19152  * A temporary channel ID, until the funding is established
19153  */
19154 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
19155
19156 /**
19157  * A temporary channel ID, until the funding is established
19158  */
19159 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19160
19161 /**
19162  * The funding transaction ID
19163  */
19164 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
19165
19166 /**
19167  * The funding transaction ID
19168  */
19169 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19170
19171 /**
19172  * The specific output index funding this channel
19173  */
19174 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
19175
19176 /**
19177  * The specific output index funding this channel
19178  */
19179 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
19180
19181 /**
19182  * The signature of the channel initiator (funder) on the initial commitment transaction
19183  */
19184 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
19185
19186 /**
19187  * The signature of the channel initiator (funder) on the initial commitment transaction
19188  */
19189 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
19190
19191 /**
19192  * Constructs a new FundingCreated given each field
19193  */
19194 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);
19195
19196 /**
19197  * Creates a copy of the FundingCreated
19198  */
19199 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
19200
19201 /**
19202  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
19203  */
19204 void FundingSigned_free(struct LDKFundingSigned this_obj);
19205
19206 /**
19207  * The channel ID
19208  */
19209 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
19210
19211 /**
19212  * The channel ID
19213  */
19214 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19215
19216 /**
19217  * The signature of the channel acceptor (fundee) on the initial commitment transaction
19218  */
19219 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
19220
19221 /**
19222  * The signature of the channel acceptor (fundee) on the initial commitment transaction
19223  */
19224 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
19225
19226 /**
19227  * Constructs a new FundingSigned given each field
19228  */
19229 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
19230
19231 /**
19232  * Creates a copy of the FundingSigned
19233  */
19234 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
19235
19236 /**
19237  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
19238  */
19239 void FundingLocked_free(struct LDKFundingLocked this_obj);
19240
19241 /**
19242  * The channel ID
19243  */
19244 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
19245
19246 /**
19247  * The channel ID
19248  */
19249 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19250
19251 /**
19252  * The per-commitment point of the second commitment transaction
19253  */
19254 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
19255
19256 /**
19257  * The per-commitment point of the second commitment transaction
19258  */
19259 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19260
19261 /**
19262  * Constructs a new FundingLocked given each field
19263  */
19264 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
19265
19266 /**
19267  * Creates a copy of the FundingLocked
19268  */
19269 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
19270
19271 /**
19272  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
19273  */
19274 void Shutdown_free(struct LDKShutdown this_obj);
19275
19276 /**
19277  * The channel ID
19278  */
19279 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
19280
19281 /**
19282  * The channel ID
19283  */
19284 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19285
19286 /**
19287  * The destination of this peer's funds on closing.
19288  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
19289  */
19290 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
19291
19292 /**
19293  * The destination of this peer's funds on closing.
19294  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
19295  */
19296 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
19297
19298 /**
19299  * Constructs a new Shutdown given each field
19300  */
19301 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
19302
19303 /**
19304  * Creates a copy of the Shutdown
19305  */
19306 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
19307
19308 /**
19309  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
19310  */
19311 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
19312
19313 /**
19314  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
19315  * transaction.
19316  */
19317 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
19318
19319 /**
19320  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
19321  * transaction.
19322  */
19323 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
19324
19325 /**
19326  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
19327  * transaction.
19328  */
19329 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
19330
19331 /**
19332  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
19333  * transaction.
19334  */
19335 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
19336
19337 /**
19338  * Constructs a new ClosingSignedFeeRange given each field
19339  */
19340 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
19341
19342 /**
19343  * Creates a copy of the ClosingSignedFeeRange
19344  */
19345 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
19346
19347 /**
19348  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
19349  */
19350 void ClosingSigned_free(struct LDKClosingSigned this_obj);
19351
19352 /**
19353  * The channel ID
19354  */
19355 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
19356
19357 /**
19358  * The channel ID
19359  */
19360 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19361
19362 /**
19363  * The proposed total fee for the closing transaction
19364  */
19365 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
19366
19367 /**
19368  * The proposed total fee for the closing transaction
19369  */
19370 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
19371
19372 /**
19373  * A signature on the closing transaction
19374  */
19375 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
19376
19377 /**
19378  * A signature on the closing transaction
19379  */
19380 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
19381
19382 /**
19383  * The minimum and maximum fees which the sender is willing to accept, provided only by new
19384  * nodes.
19385  *
19386  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19387  */
19388 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
19389
19390 /**
19391  * The minimum and maximum fees which the sender is willing to accept, provided only by new
19392  * nodes.
19393  *
19394  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19395  */
19396 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
19397
19398 /**
19399  * Constructs a new ClosingSigned given each field
19400  */
19401 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
19402
19403 /**
19404  * Creates a copy of the ClosingSigned
19405  */
19406 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
19407
19408 /**
19409  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
19410  */
19411 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
19412
19413 /**
19414  * The channel ID
19415  */
19416 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
19417
19418 /**
19419  * The channel ID
19420  */
19421 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19422
19423 /**
19424  * The HTLC ID
19425  */
19426 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
19427
19428 /**
19429  * The HTLC ID
19430  */
19431 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
19432
19433 /**
19434  * The HTLC value in milli-satoshi
19435  */
19436 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
19437
19438 /**
19439  * The HTLC value in milli-satoshi
19440  */
19441 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
19442
19443 /**
19444  * The payment hash, the pre-image of which controls HTLC redemption
19445  */
19446 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
19447
19448 /**
19449  * The payment hash, the pre-image of which controls HTLC redemption
19450  */
19451 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19452
19453 /**
19454  * The expiry height of the HTLC
19455  */
19456 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
19457
19458 /**
19459  * The expiry height of the HTLC
19460  */
19461 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
19462
19463 /**
19464  * Creates a copy of the UpdateAddHTLC
19465  */
19466 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
19467
19468 /**
19469  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
19470  */
19471 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
19472
19473 /**
19474  * The channel ID
19475  */
19476 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
19477
19478 /**
19479  * The channel ID
19480  */
19481 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19482
19483 /**
19484  * The HTLC ID
19485  */
19486 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
19487
19488 /**
19489  * The HTLC ID
19490  */
19491 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
19492
19493 /**
19494  * The pre-image of the payment hash, allowing HTLC redemption
19495  */
19496 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
19497
19498 /**
19499  * The pre-image of the payment hash, allowing HTLC redemption
19500  */
19501 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19502
19503 /**
19504  * Constructs a new UpdateFulfillHTLC given each field
19505  */
19506 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
19507
19508 /**
19509  * Creates a copy of the UpdateFulfillHTLC
19510  */
19511 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
19512
19513 /**
19514  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
19515  */
19516 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
19517
19518 /**
19519  * The channel ID
19520  */
19521 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
19522
19523 /**
19524  * The channel ID
19525  */
19526 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19527
19528 /**
19529  * The HTLC ID
19530  */
19531 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
19532
19533 /**
19534  * The HTLC ID
19535  */
19536 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
19537
19538 /**
19539  * Creates a copy of the UpdateFailHTLC
19540  */
19541 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
19542
19543 /**
19544  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
19545  */
19546 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
19547
19548 /**
19549  * The channel ID
19550  */
19551 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
19552
19553 /**
19554  * The channel ID
19555  */
19556 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19557
19558 /**
19559  * The HTLC ID
19560  */
19561 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
19562
19563 /**
19564  * The HTLC ID
19565  */
19566 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
19567
19568 /**
19569  * The failure code
19570  */
19571 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
19572
19573 /**
19574  * The failure code
19575  */
19576 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
19577
19578 /**
19579  * Creates a copy of the UpdateFailMalformedHTLC
19580  */
19581 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
19582
19583 /**
19584  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
19585  */
19586 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
19587
19588 /**
19589  * The channel ID
19590  */
19591 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
19592
19593 /**
19594  * The channel ID
19595  */
19596 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19597
19598 /**
19599  * A signature on the commitment transaction
19600  */
19601 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
19602
19603 /**
19604  * A signature on the commitment transaction
19605  */
19606 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
19607
19608 /**
19609  * Signatures on the HTLC transactions
19610  */
19611 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
19612
19613 /**
19614  * Constructs a new CommitmentSigned given each field
19615  */
19616 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
19617
19618 /**
19619  * Creates a copy of the CommitmentSigned
19620  */
19621 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
19622
19623 /**
19624  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
19625  */
19626 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
19627
19628 /**
19629  * The channel ID
19630  */
19631 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
19632
19633 /**
19634  * The channel ID
19635  */
19636 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19637
19638 /**
19639  * The secret corresponding to the per-commitment point
19640  */
19641 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
19642
19643 /**
19644  * The secret corresponding to the per-commitment point
19645  */
19646 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19647
19648 /**
19649  * The next sender-broadcast commitment transaction's per-commitment point
19650  */
19651 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
19652
19653 /**
19654  * The next sender-broadcast commitment transaction's per-commitment point
19655  */
19656 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19657
19658 /**
19659  * Constructs a new RevokeAndACK given each field
19660  */
19661 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);
19662
19663 /**
19664  * Creates a copy of the RevokeAndACK
19665  */
19666 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
19667
19668 /**
19669  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
19670  */
19671 void UpdateFee_free(struct LDKUpdateFee this_obj);
19672
19673 /**
19674  * The channel ID
19675  */
19676 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
19677
19678 /**
19679  * The channel ID
19680  */
19681 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19682
19683 /**
19684  * Fee rate per 1000-weight of the transaction
19685  */
19686 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
19687
19688 /**
19689  * Fee rate per 1000-weight of the transaction
19690  */
19691 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
19692
19693 /**
19694  * Constructs a new UpdateFee given each field
19695  */
19696 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
19697
19698 /**
19699  * Creates a copy of the UpdateFee
19700  */
19701 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
19702
19703 /**
19704  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
19705  */
19706 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
19707
19708 /**
19709  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
19710  * belonging to the recipient
19711  */
19712 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
19713
19714 /**
19715  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
19716  * belonging to the recipient
19717  */
19718 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19719
19720 /**
19721  * The sender's per-commitment point for their current commitment transaction
19722  */
19723 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
19724
19725 /**
19726  * The sender's per-commitment point for their current commitment transaction
19727  */
19728 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19729
19730 /**
19731  * Constructs a new DataLossProtect given each field
19732  */
19733 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
19734
19735 /**
19736  * Creates a copy of the DataLossProtect
19737  */
19738 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
19739
19740 /**
19741  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
19742  */
19743 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
19744
19745 /**
19746  * The channel ID
19747  */
19748 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
19749
19750 /**
19751  * The channel ID
19752  */
19753 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19754
19755 /**
19756  * The next commitment number for the sender
19757  */
19758 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
19759
19760 /**
19761  * The next commitment number for the sender
19762  */
19763 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
19764
19765 /**
19766  * The next commitment number for the recipient
19767  */
19768 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
19769
19770 /**
19771  * The next commitment number for the recipient
19772  */
19773 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
19774
19775 /**
19776  * Creates a copy of the ChannelReestablish
19777  */
19778 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
19779
19780 /**
19781  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
19782  */
19783 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
19784
19785 /**
19786  * The channel ID
19787  */
19788 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
19789
19790 /**
19791  * The channel ID
19792  */
19793 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19794
19795 /**
19796  * The short channel ID
19797  */
19798 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19799
19800 /**
19801  * The short channel ID
19802  */
19803 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
19804
19805 /**
19806  * A signature by the node key
19807  */
19808 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19809
19810 /**
19811  * A signature by the node key
19812  */
19813 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
19814
19815 /**
19816  * A signature by the funding key
19817  */
19818 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19819
19820 /**
19821  * A signature by the funding key
19822  */
19823 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
19824
19825 /**
19826  * Constructs a new AnnouncementSignatures given each field
19827  */
19828 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);
19829
19830 /**
19831  * Creates a copy of the AnnouncementSignatures
19832  */
19833 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
19834
19835 /**
19836  * Frees any resources used by the NetAddress
19837  */
19838 void NetAddress_free(struct LDKNetAddress this_ptr);
19839
19840 /**
19841  * Creates a copy of the NetAddress
19842  */
19843 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
19844
19845 /**
19846  * Utility method to constructs a new IPv4-variant NetAddress
19847  */
19848 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
19849
19850 /**
19851  * Utility method to constructs a new IPv6-variant NetAddress
19852  */
19853 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
19854
19855 /**
19856  * Utility method to constructs a new OnionV2-variant NetAddress
19857  */
19858 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
19859
19860 /**
19861  * Utility method to constructs a new OnionV3-variant NetAddress
19862  */
19863 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
19864
19865 /**
19866  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
19867  */
19868 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
19869
19870 /**
19871  * Read a NetAddress from a byte array, created by NetAddress_write
19872  */
19873 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
19874
19875 /**
19876  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
19877  */
19878 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
19879
19880 /**
19881  * The advertised features
19882  */
19883 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19884
19885 /**
19886  * The advertised features
19887  */
19888 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
19889
19890 /**
19891  * A strictly monotonic announcement counter, with gaps allowed
19892  */
19893 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19894
19895 /**
19896  * A strictly monotonic announcement counter, with gaps allowed
19897  */
19898 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
19899
19900 /**
19901  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
19902  * to this node).
19903  */
19904 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19905
19906 /**
19907  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
19908  * to this node).
19909  */
19910 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19911
19912 /**
19913  * An RGB color for UI purposes
19914  */
19915 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
19916
19917 /**
19918  * An RGB color for UI purposes
19919  */
19920 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
19921
19922 /**
19923  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
19924  * of uniqueness.
19925  */
19926 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
19927
19928 /**
19929  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
19930  * of uniqueness.
19931  */
19932 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19933
19934 /**
19935  * List of addresses on which this node is reachable
19936  */
19937 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
19938
19939 /**
19940  * Creates a copy of the UnsignedNodeAnnouncement
19941  */
19942 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
19943
19944 /**
19945  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
19946  */
19947 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
19948
19949 /**
19950  * The signature by the node key
19951  */
19952 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
19953
19954 /**
19955  * The signature by the node key
19956  */
19957 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19958
19959 /**
19960  * The actual content of the announcement
19961  */
19962 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
19963
19964 /**
19965  * The actual content of the announcement
19966  */
19967 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
19968
19969 /**
19970  * Constructs a new NodeAnnouncement given each field
19971  */
19972 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
19973
19974 /**
19975  * Creates a copy of the NodeAnnouncement
19976  */
19977 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
19978
19979 /**
19980  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
19981  */
19982 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
19983
19984 /**
19985  * The advertised channel features
19986  */
19987 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19988
19989 /**
19990  * The advertised channel features
19991  */
19992 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
19993
19994 /**
19995  * The genesis hash of the blockchain where the channel is to be opened
19996  */
19997 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
19998
19999 /**
20000  * The genesis hash of the blockchain where the channel is to be opened
20001  */
20002 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20003
20004 /**
20005  * The short channel ID
20006  */
20007 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
20008
20009 /**
20010  * The short channel ID
20011  */
20012 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
20013
20014 /**
20015  * One of the two node_ids which are endpoints of this channel
20016  */
20017 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
20018
20019 /**
20020  * One of the two node_ids which are endpoints of this channel
20021  */
20022 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20023
20024 /**
20025  * The other of the two node_ids which are endpoints of this channel
20026  */
20027 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
20028
20029 /**
20030  * The other of the two node_ids which are endpoints of this channel
20031  */
20032 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20033
20034 /**
20035  * The funding key for the first node
20036  */
20037 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
20038
20039 /**
20040  * The funding key for the first node
20041  */
20042 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20043
20044 /**
20045  * The funding key for the second node
20046  */
20047 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
20048
20049 /**
20050  * The funding key for the second node
20051  */
20052 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20053
20054 /**
20055  * Creates a copy of the UnsignedChannelAnnouncement
20056  */
20057 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
20058
20059 /**
20060  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
20061  */
20062 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
20063
20064 /**
20065  * Authentication of the announcement by the first public node
20066  */
20067 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
20068
20069 /**
20070  * Authentication of the announcement by the first public node
20071  */
20072 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
20073
20074 /**
20075  * Authentication of the announcement by the second public node
20076  */
20077 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
20078
20079 /**
20080  * Authentication of the announcement by the second public node
20081  */
20082 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
20083
20084 /**
20085  * Proof of funding UTXO ownership by the first public node
20086  */
20087 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
20088
20089 /**
20090  * Proof of funding UTXO ownership by the first public node
20091  */
20092 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
20093
20094 /**
20095  * Proof of funding UTXO ownership by the second public node
20096  */
20097 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
20098
20099 /**
20100  * Proof of funding UTXO ownership by the second public node
20101  */
20102 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
20103
20104 /**
20105  * The actual announcement
20106  */
20107 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
20108
20109 /**
20110  * The actual announcement
20111  */
20112 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
20113
20114 /**
20115  * Constructs a new ChannelAnnouncement given each field
20116  */
20117 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);
20118
20119 /**
20120  * Creates a copy of the ChannelAnnouncement
20121  */
20122 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
20123
20124 /**
20125  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
20126  */
20127 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
20128
20129 /**
20130  * The genesis hash of the blockchain where the channel is to be opened
20131  */
20132 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
20133
20134 /**
20135  * The genesis hash of the blockchain where the channel is to be opened
20136  */
20137 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20138
20139 /**
20140  * The short channel ID
20141  */
20142 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20143
20144 /**
20145  * The short channel ID
20146  */
20147 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
20148
20149 /**
20150  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
20151  */
20152 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20153
20154 /**
20155  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
20156  */
20157 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
20158
20159 /**
20160  * Channel flags
20161  */
20162 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20163
20164 /**
20165  * Channel flags
20166  */
20167 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
20168
20169 /**
20170  * The number of blocks such that if:
20171  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
20172  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
20173  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
20174  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
20175  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
20176  * forwarding. Note that the HTLC sender is the one who originally sets this value when
20177  * constructing the route.
20178  */
20179 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20180
20181 /**
20182  * The number of blocks such that if:
20183  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
20184  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
20185  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
20186  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
20187  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
20188  * forwarding. Note that the HTLC sender is the one who originally sets this value when
20189  * constructing the route.
20190  */
20191 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
20192
20193 /**
20194  * The minimum HTLC size incoming to sender, in milli-satoshi
20195  */
20196 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20197
20198 /**
20199  * The minimum HTLC size incoming to sender, in milli-satoshi
20200  */
20201 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
20202
20203 /**
20204  * The base HTLC fee charged by sender, in milli-satoshi
20205  */
20206 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20207
20208 /**
20209  * The base HTLC fee charged by sender, in milli-satoshi
20210  */
20211 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
20212
20213 /**
20214  * The amount to fee multiplier, in micro-satoshi
20215  */
20216 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
20217
20218 /**
20219  * The amount to fee multiplier, in micro-satoshi
20220  */
20221 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
20222
20223 /**
20224  * Creates a copy of the UnsignedChannelUpdate
20225  */
20226 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
20227
20228 /**
20229  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
20230  */
20231 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
20232
20233 /**
20234  * A signature of the channel update
20235  */
20236 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
20237
20238 /**
20239  * A signature of the channel update
20240  */
20241 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
20242
20243 /**
20244  * The actual channel update
20245  */
20246 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
20247
20248 /**
20249  * The actual channel update
20250  */
20251 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
20252
20253 /**
20254  * Constructs a new ChannelUpdate given each field
20255  */
20256 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
20257
20258 /**
20259  * Creates a copy of the ChannelUpdate
20260  */
20261 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
20262
20263 /**
20264  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
20265  */
20266 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
20267
20268 /**
20269  * The genesis hash of the blockchain being queried
20270  */
20271 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
20272
20273 /**
20274  * The genesis hash of the blockchain being queried
20275  */
20276 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20277
20278 /**
20279  * The height of the first block for the channel UTXOs being queried
20280  */
20281 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
20282
20283 /**
20284  * The height of the first block for the channel UTXOs being queried
20285  */
20286 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
20287
20288 /**
20289  * The number of blocks to include in the query results
20290  */
20291 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
20292
20293 /**
20294  * The number of blocks to include in the query results
20295  */
20296 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
20297
20298 /**
20299  * Constructs a new QueryChannelRange given each field
20300  */
20301 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
20302
20303 /**
20304  * Creates a copy of the QueryChannelRange
20305  */
20306 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
20307
20308 /**
20309  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
20310  */
20311 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
20312
20313 /**
20314  * The genesis hash of the blockchain being queried
20315  */
20316 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
20317
20318 /**
20319  * The genesis hash of the blockchain being queried
20320  */
20321 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20322
20323 /**
20324  * The height of the first block in the range of the reply
20325  */
20326 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
20327
20328 /**
20329  * The height of the first block in the range of the reply
20330  */
20331 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
20332
20333 /**
20334  * The number of blocks included in the range of the reply
20335  */
20336 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
20337
20338 /**
20339  * The number of blocks included in the range of the reply
20340  */
20341 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
20342
20343 /**
20344  * True when this is the final reply for a query
20345  */
20346 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
20347
20348 /**
20349  * True when this is the final reply for a query
20350  */
20351 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
20352
20353 /**
20354  * The short_channel_ids in the channel range
20355  */
20356 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
20357
20358 /**
20359  * Constructs a new ReplyChannelRange given each field
20360  */
20361 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);
20362
20363 /**
20364  * Creates a copy of the ReplyChannelRange
20365  */
20366 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
20367
20368 /**
20369  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
20370  */
20371 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
20372
20373 /**
20374  * The genesis hash of the blockchain being queried
20375  */
20376 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
20377
20378 /**
20379  * The genesis hash of the blockchain being queried
20380  */
20381 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20382
20383 /**
20384  * The short_channel_ids that are being queried
20385  */
20386 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
20387
20388 /**
20389  * Constructs a new QueryShortChannelIds given each field
20390  */
20391 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
20392
20393 /**
20394  * Creates a copy of the QueryShortChannelIds
20395  */
20396 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
20397
20398 /**
20399  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
20400  */
20401 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
20402
20403 /**
20404  * The genesis hash of the blockchain that was queried
20405  */
20406 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
20407
20408 /**
20409  * The genesis hash of the blockchain that was queried
20410  */
20411 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20412
20413 /**
20414  * Indicates if the query recipient maintains up-to-date channel
20415  * information for the chain_hash
20416  */
20417 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
20418
20419 /**
20420  * Indicates if the query recipient maintains up-to-date channel
20421  * information for the chain_hash
20422  */
20423 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
20424
20425 /**
20426  * Constructs a new ReplyShortChannelIdsEnd given each field
20427  */
20428 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
20429
20430 /**
20431  * Creates a copy of the ReplyShortChannelIdsEnd
20432  */
20433 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
20434
20435 /**
20436  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
20437  */
20438 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
20439
20440 /**
20441  * The genesis hash of the blockchain for channel and node information
20442  */
20443 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
20444
20445 /**
20446  * The genesis hash of the blockchain for channel and node information
20447  */
20448 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20449
20450 /**
20451  * The starting unix timestamp
20452  */
20453 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
20454
20455 /**
20456  * The starting unix timestamp
20457  */
20458 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
20459
20460 /**
20461  * The range of information in seconds
20462  */
20463 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
20464
20465 /**
20466  * The range of information in seconds
20467  */
20468 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
20469
20470 /**
20471  * Constructs a new GossipTimestampFilter given each field
20472  */
20473 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
20474
20475 /**
20476  * Creates a copy of the GossipTimestampFilter
20477  */
20478 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
20479
20480 /**
20481  * Frees any resources used by the ErrorAction
20482  */
20483 void ErrorAction_free(struct LDKErrorAction this_ptr);
20484
20485 /**
20486  * Creates a copy of the ErrorAction
20487  */
20488 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
20489
20490 /**
20491  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
20492  */
20493 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
20494
20495 /**
20496  * Utility method to constructs a new IgnoreError-variant ErrorAction
20497  */
20498 struct LDKErrorAction ErrorAction_ignore_error(void);
20499
20500 /**
20501  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
20502  */
20503 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
20504
20505 /**
20506  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
20507  */
20508 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
20509
20510 /**
20511  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
20512  */
20513 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
20514
20515 /**
20516  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
20517  */
20518 void LightningError_free(struct LDKLightningError this_obj);
20519
20520 /**
20521  * A human-readable message describing the error
20522  */
20523 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
20524
20525 /**
20526  * A human-readable message describing the error
20527  */
20528 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
20529
20530 /**
20531  * The action which should be taken against the offending peer.
20532  */
20533 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
20534
20535 /**
20536  * The action which should be taken against the offending peer.
20537  */
20538 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
20539
20540 /**
20541  * Constructs a new LightningError given each field
20542  */
20543 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
20544
20545 /**
20546  * Creates a copy of the LightningError
20547  */
20548 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
20549
20550 /**
20551  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
20552  */
20553 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
20554
20555 /**
20556  * update_add_htlc messages which should be sent
20557  */
20558 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20559
20560 /**
20561  * update_add_htlc messages which should be sent
20562  */
20563 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
20564
20565 /**
20566  * update_fulfill_htlc messages which should be sent
20567  */
20568 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20569
20570 /**
20571  * update_fulfill_htlc messages which should be sent
20572  */
20573 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
20574
20575 /**
20576  * update_fail_htlc messages which should be sent
20577  */
20578 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20579
20580 /**
20581  * update_fail_htlc messages which should be sent
20582  */
20583 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
20584
20585 /**
20586  * update_fail_malformed_htlc messages which should be sent
20587  */
20588 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20589
20590 /**
20591  * update_fail_malformed_htlc messages which should be sent
20592  */
20593 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
20594
20595 /**
20596  * An update_fee message which should be sent
20597  *
20598  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20599  */
20600 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20601
20602 /**
20603  * An update_fee message which should be sent
20604  *
20605  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20606  */
20607 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
20608
20609 /**
20610  * Finally, the commitment_signed message which should be sent
20611  */
20612 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20613
20614 /**
20615  * Finally, the commitment_signed message which should be sent
20616  */
20617 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
20618
20619 /**
20620  * Constructs a new CommitmentUpdate given each field
20621  */
20622 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);
20623
20624 /**
20625  * Creates a copy of the CommitmentUpdate
20626  */
20627 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
20628
20629 /**
20630  * Calls the free function if one is set
20631  */
20632 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
20633
20634 /**
20635  * Calls the free function if one is set
20636  */
20637 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
20638
20639 /**
20640  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
20641  */
20642 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
20643
20644 /**
20645  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
20646  */
20647 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
20648
20649 /**
20650  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
20651  */
20652 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
20653
20654 /**
20655  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
20656  */
20657 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
20658
20659 /**
20660  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
20661  */
20662 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
20663
20664 /**
20665  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
20666  */
20667 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
20668
20669 /**
20670  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
20671  */
20672 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
20673
20674 /**
20675  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
20676  */
20677 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
20678
20679 /**
20680  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
20681  */
20682 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
20683
20684 /**
20685  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
20686  */
20687 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
20688
20689 /**
20690  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
20691  */
20692 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
20693
20694 /**
20695  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
20696  */
20697 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
20698
20699 /**
20700  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
20701  */
20702 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
20703
20704 /**
20705  * Read a FundingCreated from a byte array, created by FundingCreated_write
20706  */
20707 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
20708
20709 /**
20710  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
20711  */
20712 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
20713
20714 /**
20715  * Read a FundingSigned from a byte array, created by FundingSigned_write
20716  */
20717 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
20718
20719 /**
20720  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
20721  */
20722 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
20723
20724 /**
20725  * Read a FundingLocked from a byte array, created by FundingLocked_write
20726  */
20727 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
20728
20729 /**
20730  * Serialize the Init object into a byte array which can be read by Init_read
20731  */
20732 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
20733
20734 /**
20735  * Read a Init from a byte array, created by Init_write
20736  */
20737 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
20738
20739 /**
20740  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
20741  */
20742 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
20743
20744 /**
20745  * Read a OpenChannel from a byte array, created by OpenChannel_write
20746  */
20747 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
20748
20749 /**
20750  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
20751  */
20752 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
20753
20754 /**
20755  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
20756  */
20757 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
20758
20759 /**
20760  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
20761  */
20762 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
20763
20764 /**
20765  * Read a Shutdown from a byte array, created by Shutdown_write
20766  */
20767 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
20768
20769 /**
20770  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
20771  */
20772 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
20773
20774 /**
20775  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
20776  */
20777 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
20778
20779 /**
20780  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
20781  */
20782 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
20783
20784 /**
20785  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
20786  */
20787 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
20788
20789 /**
20790  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
20791  */
20792 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
20793
20794 /**
20795  * Read a UpdateFee from a byte array, created by UpdateFee_write
20796  */
20797 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
20798
20799 /**
20800  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
20801  */
20802 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
20803
20804 /**
20805  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
20806  */
20807 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
20808
20809 /**
20810  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
20811  */
20812 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
20813
20814 /**
20815  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
20816  */
20817 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
20818
20819 /**
20820  * Serialize the Ping object into a byte array which can be read by Ping_read
20821  */
20822 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
20823
20824 /**
20825  * Read a Ping from a byte array, created by Ping_write
20826  */
20827 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
20828
20829 /**
20830  * Serialize the Pong object into a byte array which can be read by Pong_read
20831  */
20832 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
20833
20834 /**
20835  * Read a Pong from a byte array, created by Pong_write
20836  */
20837 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
20838
20839 /**
20840  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
20841  */
20842 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
20843
20844 /**
20845  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
20846  */
20847 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
20848
20849 /**
20850  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
20851  */
20852 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
20853
20854 /**
20855  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
20856  */
20857 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
20858
20859 /**
20860  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
20861  */
20862 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
20863
20864 /**
20865  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
20866  */
20867 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
20868
20869 /**
20870  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
20871  */
20872 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
20873
20874 /**
20875  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
20876  */
20877 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
20878
20879 /**
20880  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
20881  */
20882 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
20883
20884 /**
20885  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
20886  */
20887 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
20888
20889 /**
20890  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
20891  */
20892 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
20893
20894 /**
20895  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
20896  */
20897 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
20898
20899 /**
20900  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
20901  */
20902 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
20903
20904 /**
20905  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
20906  */
20907 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
20908
20909 /**
20910  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
20911  */
20912 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
20913
20914 /**
20915  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
20916  */
20917 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
20918
20919 /**
20920  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
20921  */
20922 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
20923
20924 /**
20925  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
20926  */
20927 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
20928
20929 /**
20930  *\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
20931  */
20932 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
20933
20934 /**
20935  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
20936  */
20937 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
20938
20939 /**
20940  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
20941  */
20942 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
20943
20944 /**
20945  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
20946  */
20947 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
20948
20949 /**
20950  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
20951  */
20952 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
20953
20954 /**
20955  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
20956  */
20957 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
20958
20959 /**
20960  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
20961  */
20962 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
20963
20964 /**
20965  * Calls the free function if one is set
20966  */
20967 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
20968
20969 /**
20970  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
20971  */
20972 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
20973
20974 /**
20975  * Constructs a new IgnoringMessageHandler given each field
20976  */
20977 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
20978
20979 /**
20980  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20981  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20982  */
20983 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20984
20985 /**
20986  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
20987  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
20988  */
20989 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20990
20991 /**
20992  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
20993  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
20994  */
20995 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20996
20997 /**
20998  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
20999  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
21000  */
21001 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
21002
21003 /**
21004  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
21005  */
21006 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
21007
21008 /**
21009  * Constructs a new ErroringMessageHandler
21010  */
21011 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
21012
21013 /**
21014  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
21015  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
21016  */
21017 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
21018
21019 /**
21020  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
21021  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
21022  */
21023 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
21024
21025 /**
21026  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
21027  */
21028 void MessageHandler_free(struct LDKMessageHandler this_obj);
21029
21030 /**
21031  * A message handler which handles messages specific to channels. Usually this is just a
21032  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
21033  *
21034  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21035  */
21036 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
21037
21038 /**
21039  * A message handler which handles messages specific to channels. Usually this is just a
21040  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
21041  *
21042  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21043  */
21044 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
21045
21046 /**
21047  * A message handler which handles messages updating our knowledge of the network channel
21048  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
21049  * [`IgnoringMessageHandler`].
21050  *
21051  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
21052  */
21053 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
21054
21055 /**
21056  * A message handler which handles messages updating our knowledge of the network channel
21057  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
21058  * [`IgnoringMessageHandler`].
21059  *
21060  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
21061  */
21062 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
21063
21064 /**
21065  * Constructs a new MessageHandler given each field
21066  */
21067 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
21068
21069 /**
21070  * Creates a copy of a SocketDescriptor
21071  */
21072 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
21073
21074 /**
21075  * Calls the free function if one is set
21076  */
21077 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
21078
21079 /**
21080  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
21081  */
21082 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
21083
21084 /**
21085  * Used to indicate that we probably can't make any future connections to this peer, implying
21086  * we should go ahead and force-close any channels we have with it.
21087  */
21088 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
21089
21090 /**
21091  * Used to indicate that we probably can't make any future connections to this peer, implying
21092  * we should go ahead and force-close any channels we have with it.
21093  */
21094 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
21095
21096 /**
21097  * Constructs a new PeerHandleError given each field
21098  */
21099 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
21100
21101 /**
21102  * Creates a copy of the PeerHandleError
21103  */
21104 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
21105
21106 /**
21107  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
21108  */
21109 void PeerManager_free(struct LDKPeerManager this_obj);
21110
21111 /**
21112  * Constructs a new PeerManager with the given message handlers and node_id secret key
21113  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
21114  * cryptographically secure random bytes.
21115  */
21116 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, struct LDKCustomMessageHandler custom_message_handler);
21117
21118 /**
21119  * Get the list of node ids for peers which have completed the initial handshake.
21120  *
21121  * For outbound connections, this will be the same as the their_node_id parameter passed in to
21122  * new_outbound_connection, however entries will only appear once the initial handshake has
21123  * completed and we are sure the remote peer has the private key for the given node_id.
21124  */
21125 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
21126
21127 /**
21128  * Indicates a new outbound connection has been established to a node with the given node_id.
21129  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
21130  * descriptor but must disconnect the connection immediately.
21131  *
21132  * Returns a small number of bytes to send to the remote node (currently always 50).
21133  *
21134  * Panics if descriptor is duplicative with some other descriptor which has not yet been
21135  * [`socket_disconnected()`].
21136  *
21137  * [`socket_disconnected()`]: PeerManager::socket_disconnected
21138  */
21139 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);
21140
21141 /**
21142  * Indicates a new inbound connection has been established.
21143  *
21144  * May refuse the connection by returning an Err, but will never write bytes to the remote end
21145  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
21146  * call socket_disconnected for the new descriptor but must disconnect the connection
21147  * immediately.
21148  *
21149  * Panics if descriptor is duplicative with some other descriptor which has not yet been
21150  * [`socket_disconnected()`].
21151  *
21152  * [`socket_disconnected()`]: PeerManager::socket_disconnected
21153  */
21154 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
21155
21156 /**
21157  * Indicates that there is room to write data to the given socket descriptor.
21158  *
21159  * May return an Err to indicate that the connection should be closed.
21160  *
21161  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
21162  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
21163  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
21164  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
21165  * sufficient!
21166  *
21167  * [`send_data`]: SocketDescriptor::send_data
21168  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
21169  */
21170 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
21171
21172 /**
21173  * Indicates that data was read from the given socket descriptor.
21174  *
21175  * May return an Err to indicate that the connection should be closed.
21176  *
21177  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
21178  * Thus, however, you should call [`process_events`] after any `read_event` to generate
21179  * [`send_data`] calls to handle responses.
21180  *
21181  * If `Ok(true)` is returned, further read_events should not be triggered until a
21182  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
21183  * send buffer).
21184  *
21185  * [`send_data`]: SocketDescriptor::send_data
21186  * [`process_events`]: PeerManager::process_events
21187  */
21188 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);
21189
21190 /**
21191  * Checks for any events generated by our handlers and processes them. Includes sending most
21192  * response messages as well as messages generated by calls to handler functions directly (eg
21193  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
21194  *
21195  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
21196  * issues!
21197  *
21198  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
21199  * or one of the other clients provided in our language bindings.
21200  *
21201  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
21202  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
21203  * [`send_data`]: SocketDescriptor::send_data
21204  */
21205 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
21206
21207 /**
21208  * Indicates that the given socket descriptor's connection is now closed.
21209  */
21210 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
21211
21212 /**
21213  * Disconnect a peer given its node id.
21214  *
21215  * Set `no_connection_possible` to true to prevent any further connection with this peer,
21216  * force-closing any channels we have with it.
21217  *
21218  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
21219  * peer. Thus, be very careful about reentrancy issues.
21220  *
21221  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
21222  */
21223 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
21224
21225 /**
21226  * Disconnects all currently-connected peers. This is useful on platforms where there may be
21227  * an indication that TCP sockets have stalled even if we weren't around to time them out
21228  * using regular ping/pongs.
21229  */
21230 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
21231
21232 /**
21233  * Send pings to each peer and disconnect those which did not respond to the last round of
21234  * pings.
21235  *
21236  * This may be called on any timescale you want, however, roughly once every five to ten
21237  * seconds is preferred. The call rate determines both how often we send a ping to our peers
21238  * and how much time they have to respond before we disconnect them.
21239  *
21240  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
21241  * issues!
21242  *
21243  * [`send_data`]: SocketDescriptor::send_data
21244  */
21245 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
21246
21247 /**
21248  * Gets the weight for an HTLC-Success transaction.
21249  */
21250 uint64_t htlc_success_tx_weight(bool opt_anchors);
21251
21252 /**
21253  * Gets the weight for an HTLC-Timeout transaction.
21254  */
21255 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
21256
21257 /**
21258  * Build the commitment secret from the seed and the commitment number
21259  */
21260 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
21261
21262 /**
21263  * Build a closing transaction
21264  */
21265 struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
21266
21267 /**
21268  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
21269  * from the base secret and the per_commitment_point.
21270  *
21271  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
21272  * generated (ie our own).
21273  */
21274 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
21275
21276 /**
21277  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
21278  * from the base point and the per_commitment_key. This is the public equivalent of
21279  * derive_private_key - using only public keys to derive a public key instead of private keys.
21280  *
21281  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
21282  * generated (ie our own).
21283  */
21284 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
21285
21286 /**
21287  * Derives a per-commitment-transaction revocation key from its constituent parts.
21288  *
21289  * Only the cheating participant owns a valid witness to propagate a revoked
21290  * commitment transaction, thus per_commitment_secret always come from cheater
21291  * and revocation_base_secret always come from punisher, which is the broadcaster
21292  * of the transaction spending with this key knowledge.
21293  *
21294  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
21295  * generated (ie our own).
21296  */
21297 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
21298
21299 /**
21300  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
21301  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
21302  * public key instead of private keys.
21303  *
21304  * Only the cheating participant owns a valid witness to propagate a revoked
21305  * commitment transaction, thus per_commitment_point always come from cheater
21306  * and revocation_base_point always come from punisher, which is the broadcaster
21307  * of the transaction spending with this key knowledge.
21308  *
21309  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
21310  * generated (ie our own).
21311  */
21312 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
21313
21314 /**
21315  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
21316  */
21317 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
21318
21319 /**
21320  * The broadcaster's per-commitment public key which was used to derive the other keys.
21321  */
21322 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
21323
21324 /**
21325  * The broadcaster's per-commitment public key which was used to derive the other keys.
21326  */
21327 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21328
21329 /**
21330  * The revocation key which is used to allow the broadcaster of the commitment
21331  * transaction to provide their counterparty the ability to punish them if they broadcast
21332  * an old state.
21333  */
21334 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
21335
21336 /**
21337  * The revocation key which is used to allow the broadcaster of the commitment
21338  * transaction to provide their counterparty the ability to punish them if they broadcast
21339  * an old state.
21340  */
21341 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21342
21343 /**
21344  * Broadcaster's HTLC Key
21345  */
21346 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
21347
21348 /**
21349  * Broadcaster's HTLC Key
21350  */
21351 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21352
21353 /**
21354  * Countersignatory's HTLC Key
21355  */
21356 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
21357
21358 /**
21359  * Countersignatory's HTLC Key
21360  */
21361 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21362
21363 /**
21364  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
21365  */
21366 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
21367
21368 /**
21369  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
21370  */
21371 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21372
21373 /**
21374  * Constructs a new TxCreationKeys given each field
21375  */
21376 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);
21377
21378 /**
21379  * Creates a copy of the TxCreationKeys
21380  */
21381 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
21382
21383 /**
21384  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
21385  */
21386 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
21387
21388 /**
21389  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
21390  */
21391 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
21392
21393 /**
21394  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
21395  */
21396 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
21397
21398 /**
21399  * The public key which is used to sign all commitment transactions, as it appears in the
21400  * on-chain channel lock-in 2-of-2 multisig output.
21401  */
21402 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
21403
21404 /**
21405  * The public key which is used to sign all commitment transactions, as it appears in the
21406  * on-chain channel lock-in 2-of-2 multisig output.
21407  */
21408 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21409
21410 /**
21411  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
21412  * revocation keys. This is combined with the per-commitment-secret generated by the
21413  * counterparty to create a secret which the counterparty can reveal to revoke previous
21414  * states.
21415  */
21416 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
21417
21418 /**
21419  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
21420  * revocation keys. This is combined with the per-commitment-secret generated by the
21421  * counterparty to create a secret which the counterparty can reveal to revoke previous
21422  * states.
21423  */
21424 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21425
21426 /**
21427  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
21428  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
21429  * static across every commitment transaction.
21430  */
21431 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
21432
21433 /**
21434  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
21435  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
21436  * static across every commitment transaction.
21437  */
21438 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21439
21440 /**
21441  * The base point which is used (with derive_public_key) to derive a per-commitment payment
21442  * public key which receives non-HTLC-encumbered funds which are only available for spending
21443  * after some delay (or can be claimed via the revocation path).
21444  */
21445 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
21446
21447 /**
21448  * The base point which is used (with derive_public_key) to derive a per-commitment payment
21449  * public key which receives non-HTLC-encumbered funds which are only available for spending
21450  * after some delay (or can be claimed via the revocation path).
21451  */
21452 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21453
21454 /**
21455  * The base point which is used (with derive_public_key) to derive a per-commitment public key
21456  * which is used to encumber HTLC-in-flight outputs.
21457  */
21458 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
21459
21460 /**
21461  * The base point which is used (with derive_public_key) to derive a per-commitment public key
21462  * which is used to encumber HTLC-in-flight outputs.
21463  */
21464 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21465
21466 /**
21467  * Constructs a new ChannelPublicKeys given each field
21468  */
21469 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);
21470
21471 /**
21472  * Creates a copy of the ChannelPublicKeys
21473  */
21474 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
21475
21476 /**
21477  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
21478  */
21479 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
21480
21481 /**
21482  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
21483  */
21484 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
21485
21486 /**
21487  * Create per-state keys from channel base points and the per-commitment point.
21488  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
21489  */
21490 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);
21491
21492 /**
21493  * Generate per-state keys from channel static keys.
21494  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
21495  */
21496 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);
21497
21498 /**
21499  * A script either spendable by the revocation
21500  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
21501  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
21502  */
21503 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
21504
21505 /**
21506  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
21507  */
21508 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
21509
21510 /**
21511  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
21512  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
21513  * need to compare this value to whether the commitment transaction in question is that of
21514  * the counterparty or our own.
21515  */
21516 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
21517
21518 /**
21519  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
21520  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
21521  * need to compare this value to whether the commitment transaction in question is that of
21522  * the counterparty or our own.
21523  */
21524 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
21525
21526 /**
21527  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
21528  * this divided by 1000.
21529  */
21530 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
21531
21532 /**
21533  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
21534  * this divided by 1000.
21535  */
21536 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
21537
21538 /**
21539  * The CLTV lock-time at which this HTLC expires.
21540  */
21541 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
21542
21543 /**
21544  * The CLTV lock-time at which this HTLC expires.
21545  */
21546 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
21547
21548 /**
21549  * The hash of the preimage which unlocks this HTLC.
21550  */
21551 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
21552
21553 /**
21554  * The hash of the preimage which unlocks this HTLC.
21555  */
21556 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21557
21558 /**
21559  * The position within the commitment transactions' outputs. This may be None if the value is
21560  * below the dust limit (in which case no output appears in the commitment transaction and the
21561  * value is spent to additional transaction fees).
21562  */
21563 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
21564
21565 /**
21566  * The position within the commitment transactions' outputs. This may be None if the value is
21567  * below the dust limit (in which case no output appears in the commitment transaction and the
21568  * value is spent to additional transaction fees).
21569  */
21570 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
21571
21572 /**
21573  * Constructs a new HTLCOutputInCommitment given each field
21574  */
21575 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);
21576
21577 /**
21578  * Creates a copy of the HTLCOutputInCommitment
21579  */
21580 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
21581
21582 /**
21583  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
21584  */
21585 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
21586
21587 /**
21588  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
21589  */
21590 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
21591
21592 /**
21593  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
21594  * does not need to have its previous_output_index filled.
21595  */
21596 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
21597
21598 /**
21599  * Gets the redeemscript for a funding output from the two funding public keys.
21600  * Note that the order of funding public keys does not matter.
21601  */
21602 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
21603
21604 /**
21605  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
21606  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
21607  * transaction which needs signing, and can be used to construct an HTLC transaction which is
21608  * broadcastable given a counterparty HTLC signature.
21609  *
21610  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
21611  * commitment transaction).
21612  */
21613 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, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
21614
21615 /**
21616  * Gets the witnessScript for an anchor output from the funding public key.
21617  * The witness in the spending input must be:
21618  * <BIP 143 funding_signature>
21619  * After 16 blocks of confirmation, an alternative satisfying witness could be:
21620  * <>
21621  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
21622  */
21623 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
21624
21625 /**
21626  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21627  */
21628 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
21629
21630 /**
21631  * Holder public keys
21632  */
21633 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21634
21635 /**
21636  * Holder public keys
21637  */
21638 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
21639
21640 /**
21641  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
21642  */
21643 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21644
21645 /**
21646  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
21647  */
21648 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
21649
21650 /**
21651  * Whether the holder is the initiator of this channel.
21652  * This is an input to the commitment number obscure factor computation.
21653  */
21654 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21655
21656 /**
21657  * Whether the holder is the initiator of this channel.
21658  * This is an input to the commitment number obscure factor computation.
21659  */
21660 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
21661
21662 /**
21663  * The late-bound counterparty channel transaction parameters.
21664  * These parameters are populated at the point in the protocol where the counterparty provides them.
21665  *
21666  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21667  */
21668 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21669
21670 /**
21671  * The late-bound counterparty channel transaction parameters.
21672  * These parameters are populated at the point in the protocol where the counterparty provides them.
21673  *
21674  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21675  */
21676 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
21677
21678 /**
21679  * The late-bound funding outpoint
21680  *
21681  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21682  */
21683 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21684
21685 /**
21686  * The late-bound funding outpoint
21687  *
21688  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21689  */
21690 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21691
21692 /**
21693  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
21694  */
21695 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21696
21697 /**
21698  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
21699  */
21700 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
21701
21702 /**
21703  * Constructs a new ChannelTransactionParameters given each field
21704  */
21705 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, enum LDKCOption_NoneZ opt_anchors_arg);
21706
21707 /**
21708  * Creates a copy of the ChannelTransactionParameters
21709  */
21710 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
21711
21712 /**
21713  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21714  */
21715 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
21716
21717 /**
21718  * Counter-party public keys
21719  */
21720 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
21721
21722 /**
21723  * Counter-party public keys
21724  */
21725 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
21726
21727 /**
21728  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
21729  */
21730 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
21731
21732 /**
21733  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
21734  */
21735 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
21736
21737 /**
21738  * Constructs a new CounterpartyChannelTransactionParameters given each field
21739  */
21740 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
21741
21742 /**
21743  * Creates a copy of the CounterpartyChannelTransactionParameters
21744  */
21745 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
21746
21747 /**
21748  * Whether the late bound parameters are populated.
21749  */
21750 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21751
21752 /**
21753  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
21754  * given that the holder is the broadcaster.
21755  *
21756  * self.is_populated() must be true before calling this function.
21757  */
21758 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21759
21760 /**
21761  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
21762  * given that the counterparty is the broadcaster.
21763  *
21764  * self.is_populated() must be true before calling this function.
21765  */
21766 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21767
21768 /**
21769  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
21770  */
21771 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
21772
21773 /**
21774  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
21775  */
21776 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
21777
21778 /**
21779  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
21780  */
21781 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
21782
21783 /**
21784  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
21785  */
21786 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
21787
21788 /**
21789  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21790  */
21791 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
21792
21793 /**
21794  * Get the channel pubkeys for the broadcaster
21795  */
21796 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21797
21798 /**
21799  * Get the channel pubkeys for the countersignatory
21800  */
21801 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21802
21803 /**
21804  * Get the contest delay applicable to the transactions.
21805  * Note that the contest delay was selected by the countersignatory.
21806  */
21807 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21808
21809 /**
21810  * Whether the channel is outbound from the broadcaster.
21811  *
21812  * The boolean representing the side that initiated the channel is
21813  * an input to the commitment number obscure factor computation.
21814  */
21815 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21816
21817 /**
21818  * The funding outpoint
21819  */
21820 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21821
21822 /**
21823  * Whether to use anchors for this channel
21824  */
21825 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21826
21827 /**
21828  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
21829  */
21830 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
21831
21832 /**
21833  * Our counterparty's signature for the transaction
21834  */
21835 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
21836
21837 /**
21838  * Our counterparty's signature for the transaction
21839  */
21840 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
21841
21842 /**
21843  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
21844  */
21845 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
21846
21847 /**
21848  * Creates a copy of the HolderCommitmentTransaction
21849  */
21850 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
21851
21852 /**
21853  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
21854  */
21855 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
21856
21857 /**
21858  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
21859  */
21860 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
21861
21862 /**
21863  * Create a new holder transaction with the given counterparty signatures.
21864  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
21865  */
21866 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);
21867
21868 /**
21869  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
21870  */
21871 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
21872
21873 /**
21874  * The commitment transaction
21875  */
21876 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
21877
21878 /**
21879  * The commitment transaction
21880  */
21881 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
21882
21883 /**
21884  * The txid for the commitment transaction.
21885  *
21886  * This is provided as a performance optimization, instead of calling transaction.txid()
21887  * multiple times.
21888  */
21889 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
21890
21891 /**
21892  * The txid for the commitment transaction.
21893  *
21894  * This is provided as a performance optimization, instead of calling transaction.txid()
21895  * multiple times.
21896  */
21897 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21898
21899 /**
21900  * Constructs a new BuiltCommitmentTransaction given each field
21901  */
21902 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
21903
21904 /**
21905  * Creates a copy of the BuiltCommitmentTransaction
21906  */
21907 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
21908
21909 /**
21910  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
21911  */
21912 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
21913
21914 /**
21915  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
21916  */
21917 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
21918
21919 /**
21920  * Get the SIGHASH_ALL sighash value of the transaction.
21921  *
21922  * This can be used to verify a signature.
21923  */
21924 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);
21925
21926 /**
21927  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
21928  * because we are about to broadcast a holder transaction.
21929  */
21930 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);
21931
21932 /**
21933  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
21934  */
21935 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
21936
21937 /**
21938  * Creates a copy of the ClosingTransaction
21939  */
21940 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
21941
21942 /**
21943  * Checks if two ClosingTransactions contain equal inner contents.
21944  */
21945 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
21946
21947 /**
21948  * Construct an object of the class
21949  */
21950 MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
21951
21952 /**
21953  * Trust our pre-built transaction.
21954  *
21955  * Applies a wrapper which allows access to the transaction.
21956  *
21957  * This should only be used if you fully trust the builder of this object. It should not
21958  * be used by an external signer - instead use the verify function.
21959  */
21960 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21961
21962 /**
21963  * Verify our pre-built transaction.
21964  *
21965  * Applies a wrapper which allows access to the transaction.
21966  *
21967  * An external validating signer must call this method before signing
21968  * or using the built transaction.
21969  */
21970 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
21971
21972 /**
21973  * The value to be sent to the holder, or zero if the output will be omitted
21974  */
21975 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21976
21977 /**
21978  * The value to be sent to the counterparty, or zero if the output will be omitted
21979  */
21980 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21981
21982 /**
21983  * The destination of the holder's output
21984  */
21985 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21986
21987 /**
21988  * The destination of the counterparty's output
21989  */
21990 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21991
21992 /**
21993  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
21994  */
21995 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
21996
21997 /**
21998  * The pre-built Bitcoin commitment transaction
21999  */
22000 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
22001
22002 /**
22003  * Get the SIGHASH_ALL sighash value of the transaction.
22004  *
22005  * This can be used to verify a signature.
22006  */
22007 MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
22008
22009 /**
22010  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
22011  * because we are about to broadcast a holder transaction.
22012  */
22013 MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
22014
22015 /**
22016  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
22017  */
22018 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
22019
22020 /**
22021  * Creates a copy of the CommitmentTransaction
22022  */
22023 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
22024
22025 /**
22026  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
22027  */
22028 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
22029
22030 /**
22031  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
22032  */
22033 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
22034
22035 /**
22036  * The backwards-counting commitment number
22037  */
22038 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
22039
22040 /**
22041  * The value to be sent to the broadcaster
22042  */
22043 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
22044
22045 /**
22046  * The value to be sent to the counterparty
22047  */
22048 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
22049
22050 /**
22051  * The feerate paid per 1000-weight-unit in this commitment transaction.
22052  */
22053 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
22054
22055 /**
22056  * Trust our pre-built transaction and derived transaction creation public keys.
22057  *
22058  * Applies a wrapper which allows access to these fields.
22059  *
22060  * This should only be used if you fully trust the builder of this object.  It should not
22061  * be used by an external signer - instead use the verify function.
22062  */
22063 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
22064
22065 /**
22066  * Verify our pre-built transaction and derived transaction creation public keys.
22067  *
22068  * Applies a wrapper which allows access to these fields.
22069  *
22070  * An external validating signer must call this method before signing
22071  * or using the built transaction.
22072  */
22073 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);
22074
22075 /**
22076  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
22077  */
22078 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
22079
22080 /**
22081  * The transaction ID of the built Bitcoin transaction
22082  */
22083 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
22084
22085 /**
22086  * The pre-built Bitcoin commitment transaction
22087  */
22088 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
22089
22090 /**
22091  * The pre-calculated transaction creation public keys.
22092  */
22093 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
22094
22095 /**
22096  * Should anchors be used.
22097  */
22098 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
22099
22100 /**
22101  * Get a signature for each HTLC which was included in the commitment transaction (ie for
22102  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
22103  *
22104  * The returned Vec has one entry for each HTLC, and in the same order.
22105  */
22106 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);
22107
22108 /**
22109  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
22110  * shared secret first. This prevents on-chain observers from discovering how many commitment
22111  * transactions occurred in a channel before it was closed.
22112  *
22113  * This function gets the shared secret from relevant channel public keys and can be used to
22114  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
22115  */
22116 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
22117
22118 /**
22119  * Checks if two InitFeaturess contain equal inner contents.
22120  * This ignores pointers and is_owned flags and looks at the values in fields.
22121  * Two objects with NULL inner values will be considered "equal" here.
22122  */
22123 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
22124
22125 /**
22126  * Checks if two NodeFeaturess contain equal inner contents.
22127  * This ignores pointers and is_owned flags and looks at the values in fields.
22128  * Two objects with NULL inner values will be considered "equal" here.
22129  */
22130 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
22131
22132 /**
22133  * Checks if two ChannelFeaturess contain equal inner contents.
22134  * This ignores pointers and is_owned flags and looks at the values in fields.
22135  * Two objects with NULL inner values will be considered "equal" here.
22136  */
22137 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
22138
22139 /**
22140  * Checks if two InvoiceFeaturess contain equal inner contents.
22141  * This ignores pointers and is_owned flags and looks at the values in fields.
22142  * Two objects with NULL inner values will be considered "equal" here.
22143  */
22144 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
22145
22146 /**
22147  * Checks if two ChannelTypeFeaturess contain equal inner contents.
22148  * This ignores pointers and is_owned flags and looks at the values in fields.
22149  * Two objects with NULL inner values will be considered "equal" here.
22150  */
22151 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
22152
22153 /**
22154  * Creates a copy of the InitFeatures
22155  */
22156 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
22157
22158 /**
22159  * Creates a copy of the NodeFeatures
22160  */
22161 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
22162
22163 /**
22164  * Creates a copy of the ChannelFeatures
22165  */
22166 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
22167
22168 /**
22169  * Creates a copy of the InvoiceFeatures
22170  */
22171 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
22172
22173 /**
22174  * Creates a copy of the ChannelTypeFeatures
22175  */
22176 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
22177
22178 /**
22179  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
22180  */
22181 void InitFeatures_free(struct LDKInitFeatures this_obj);
22182
22183 /**
22184  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
22185  */
22186 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
22187
22188 /**
22189  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
22190  */
22191 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
22192
22193 /**
22194  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
22195  */
22196 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
22197
22198 /**
22199  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
22200  */
22201 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
22202
22203 /**
22204  * Create a blank Features with no features set
22205  */
22206 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
22207
22208 /**
22209  * Creates a Features with the bits set which are known by the implementation
22210  */
22211 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
22212
22213 /**
22214  * Returns true if this `Features` object contains unknown feature flags which are set as
22215  * \"required\".
22216  */
22217 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
22218
22219 /**
22220  * Create a blank Features with no features set
22221  */
22222 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
22223
22224 /**
22225  * Creates a Features with the bits set which are known by the implementation
22226  */
22227 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
22228
22229 /**
22230  * Returns true if this `Features` object contains unknown feature flags which are set as
22231  * \"required\".
22232  */
22233 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
22234
22235 /**
22236  * Create a blank Features with no features set
22237  */
22238 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
22239
22240 /**
22241  * Creates a Features with the bits set which are known by the implementation
22242  */
22243 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
22244
22245 /**
22246  * Returns true if this `Features` object contains unknown feature flags which are set as
22247  * \"required\".
22248  */
22249 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
22250
22251 /**
22252  * Create a blank Features with no features set
22253  */
22254 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
22255
22256 /**
22257  * Creates a Features with the bits set which are known by the implementation
22258  */
22259 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
22260
22261 /**
22262  * Returns true if this `Features` object contains unknown feature flags which are set as
22263  * \"required\".
22264  */
22265 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
22266
22267 /**
22268  * Create a blank Features with no features set
22269  */
22270 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
22271
22272 /**
22273  * Creates a Features with the bits set which are known by the implementation
22274  */
22275 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
22276
22277 /**
22278  * Returns true if this `Features` object contains unknown feature flags which are set as
22279  * \"required\".
22280  */
22281 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
22282
22283 /**
22284  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
22285  */
22286 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
22287
22288 /**
22289  * Read a InitFeatures from a byte array, created by InitFeatures_write
22290  */
22291 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
22292
22293 /**
22294  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
22295  */
22296 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
22297
22298 /**
22299  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
22300  */
22301 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
22302
22303 /**
22304  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
22305  */
22306 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
22307
22308 /**
22309  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
22310  */
22311 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
22312
22313 /**
22314  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
22315  */
22316 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
22317
22318 /**
22319  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
22320  */
22321 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
22322
22323 /**
22324  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
22325  */
22326 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
22327
22328 /**
22329  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
22330  */
22331 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
22332
22333 /**
22334  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
22335  */
22336 void ShutdownScript_free(struct LDKShutdownScript this_obj);
22337
22338 /**
22339  * Creates a copy of the ShutdownScript
22340  */
22341 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
22342
22343 /**
22344  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
22345  */
22346 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
22347
22348 /**
22349  * The script that did not meet the requirements from [BOLT #2].
22350  *
22351  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
22352  */
22353 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
22354
22355 /**
22356  * The script that did not meet the requirements from [BOLT #2].
22357  *
22358  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
22359  */
22360 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22361
22362 /**
22363  * Constructs a new InvalidShutdownScript given each field
22364  */
22365 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
22366
22367 /**
22368  * Creates a copy of the InvalidShutdownScript
22369  */
22370 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
22371
22372 /**
22373  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
22374  */
22375 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
22376
22377 /**
22378  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
22379  */
22380 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
22381
22382 /**
22383  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
22384  */
22385 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
22386
22387 /**
22388  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
22389  */
22390 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
22391
22392 /**
22393  * Generates a witness script pubkey from the given segwit version and program.
22394  *
22395  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
22396  * [`ShutdownScript::new_p2wsh`] instead.
22397  *
22398  * # Errors
22399  *
22400  * This function may return an error if `program` is invalid for the segwit `version`.
22401  */
22402 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
22403
22404 /**
22405  * Converts the shutdown script into the underlying [`Script`].
22406  */
22407 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
22408
22409 /**
22410  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
22411  *
22412  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22413  */
22414 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
22415
22416 /**
22417  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
22418  *
22419  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
22420  */
22421 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
22422
22423 /**
22424  * Calls the free function if one is set
22425  */
22426 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
22427
22428 /**
22429  * Calls the free function if one is set
22430  */
22431 void Type_free(struct LDKType this_ptr);
22432
22433 /**
22434  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
22435  */
22436 void NodeId_free(struct LDKNodeId this_obj);
22437
22438 /**
22439  * Creates a copy of the NodeId
22440  */
22441 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
22442
22443 /**
22444  * Create a new NodeId from a public key
22445  */
22446 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
22447
22448 /**
22449  * Get the public key slice from this NodeId
22450  */
22451 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
22452
22453 /**
22454  * Checks if two NodeIds contain equal inner contents.
22455  */
22456 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
22457
22458 /**
22459  * Serialize the NodeId object into a byte array which can be read by NodeId_read
22460  */
22461 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
22462
22463 /**
22464  * Read a NodeId from a byte array, created by NodeId_write
22465  */
22466 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
22467
22468 /**
22469  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
22470  */
22471 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
22472
22473 /**
22474  * Creates a copy of the NetworkGraph
22475  */
22476 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
22477
22478 /**
22479  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
22480  */
22481 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
22482
22483 /**
22484  * Frees any resources used by the NetworkUpdate
22485  */
22486 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
22487
22488 /**
22489  * Creates a copy of the NetworkUpdate
22490  */
22491 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
22492
22493 /**
22494  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
22495  */
22496 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
22497
22498 /**
22499  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
22500  */
22501 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
22502
22503 /**
22504  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
22505  */
22506 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
22507
22508 /**
22509  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
22510  */
22511 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
22512
22513 /**
22514  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
22515  */
22516 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
22517
22518 /**
22519  * Constructs a new EventHandler which calls the relevant methods on this_arg.
22520  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
22521  */
22522 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
22523
22524 /**
22525  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
22526  */
22527 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
22528
22529 /**
22530  * Creates a new tracker of the actual state of the network of channels and nodes,
22531  * assuming an existing Network Graph.
22532  * Chain monitor is used to make sure announced channels exist on-chain,
22533  * channel data is correct, and that the announcement is signed with
22534  * channel owners' keys.
22535  */
22536 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
22537
22538 /**
22539  * Adds a provider used to check new announcements. Does not affect
22540  * existing announcements unless they are updated.
22541  * Add, update or remove the provider would replace the current one.
22542  */
22543 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
22544
22545 /**
22546  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
22547  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
22548  */
22549 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
22550
22551 /**
22552  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22553  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22554  */
22555 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
22556
22557 /**
22558  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
22559  */
22560 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
22561
22562 /**
22563  * When the last update to the channel direction was issued.
22564  * Value is opaque, as set in the announcement.
22565  */
22566 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22567
22568 /**
22569  * When the last update to the channel direction was issued.
22570  * Value is opaque, as set in the announcement.
22571  */
22572 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
22573
22574 /**
22575  * Whether the channel can be currently used for payments (in this one direction).
22576  */
22577 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22578
22579 /**
22580  * Whether the channel can be currently used for payments (in this one direction).
22581  */
22582 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
22583
22584 /**
22585  * The difference in CLTV values that you must have when routing through this channel.
22586  */
22587 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22588
22589 /**
22590  * The difference in CLTV values that you must have when routing through this channel.
22591  */
22592 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
22593
22594 /**
22595  * The minimum value, which must be relayed to the next hop via the channel
22596  */
22597 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22598
22599 /**
22600  * The minimum value, which must be relayed to the next hop via the channel
22601  */
22602 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
22603
22604 /**
22605  * The maximum value which may be relayed to the next hop via the channel.
22606  */
22607 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22608
22609 /**
22610  * The maximum value which may be relayed to the next hop via the channel.
22611  */
22612 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22613
22614 /**
22615  * Fees charged when the channel is used for routing
22616  */
22617 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22618
22619 /**
22620  * Fees charged when the channel is used for routing
22621  */
22622 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
22623
22624 /**
22625  * Most recent update for the channel received from the network
22626  * Mostly redundant with the data we store in fields explicitly.
22627  * Everything else is useful only for sending out for initial routing sync.
22628  * Not stored if contains excess data to prevent DoS.
22629  *
22630  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22631  */
22632 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22633
22634 /**
22635  * Most recent update for the channel received from the network
22636  * Mostly redundant with the data we store in fields explicitly.
22637  * Everything else is useful only for sending out for initial routing sync.
22638  * Not stored if contains excess data to prevent DoS.
22639  *
22640  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22641  */
22642 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
22643
22644 /**
22645  * Constructs a new DirectionalChannelInfo given each field
22646  */
22647 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);
22648
22649 /**
22650  * Creates a copy of the DirectionalChannelInfo
22651  */
22652 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
22653
22654 /**
22655  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
22656  */
22657 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
22658
22659 /**
22660  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
22661  */
22662 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
22663
22664 /**
22665  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
22666  */
22667 void ChannelInfo_free(struct LDKChannelInfo this_obj);
22668
22669 /**
22670  * Protocol features of a channel communicated during its announcement
22671  */
22672 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22673
22674 /**
22675  * Protocol features of a channel communicated during its announcement
22676  */
22677 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22678
22679 /**
22680  * Source node of the first direction of a channel
22681  */
22682 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22683
22684 /**
22685  * Source node of the first direction of a channel
22686  */
22687 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
22688
22689 /**
22690  * Details about the first direction of a channel
22691  *
22692  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22693  */
22694 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22695
22696 /**
22697  * Details about the first direction of a channel
22698  *
22699  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22700  */
22701 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
22702
22703 /**
22704  * Source node of the second direction of a channel
22705  */
22706 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22707
22708 /**
22709  * Source node of the second direction of a channel
22710  */
22711 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
22712
22713 /**
22714  * Details about the second direction of a channel
22715  *
22716  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22717  */
22718 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22719
22720 /**
22721  * Details about the second direction of a channel
22722  *
22723  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22724  */
22725 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
22726
22727 /**
22728  * The channel capacity as seen on-chain, if chain lookup is available.
22729  */
22730 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22731
22732 /**
22733  * The channel capacity as seen on-chain, if chain lookup is available.
22734  */
22735 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22736
22737 /**
22738  * An initial announcement of the channel
22739  * Mostly redundant with the data we store in fields explicitly.
22740  * Everything else is useful only for sending out for initial routing sync.
22741  * Not stored if contains excess data to prevent DoS.
22742  *
22743  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22744  */
22745 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22746
22747 /**
22748  * An initial announcement of the channel
22749  * Mostly redundant with the data we store in fields explicitly.
22750  * Everything else is useful only for sending out for initial routing sync.
22751  * Not stored if contains excess data to prevent DoS.
22752  *
22753  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22754  */
22755 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
22756
22757 /**
22758  * Creates a copy of the ChannelInfo
22759  */
22760 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
22761
22762 /**
22763  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
22764  */
22765 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
22766
22767 /**
22768  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
22769  */
22770 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
22771
22772 /**
22773  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
22774  */
22775 void RoutingFees_free(struct LDKRoutingFees this_obj);
22776
22777 /**
22778  * Flat routing fee in satoshis
22779  */
22780 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
22781
22782 /**
22783  * Flat routing fee in satoshis
22784  */
22785 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
22786
22787 /**
22788  * Liquidity-based routing fee in millionths of a routed amount.
22789  * In other words, 10000 is 1%.
22790  */
22791 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
22792
22793 /**
22794  * Liquidity-based routing fee in millionths of a routed amount.
22795  * In other words, 10000 is 1%.
22796  */
22797 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
22798
22799 /**
22800  * Constructs a new RoutingFees given each field
22801  */
22802 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
22803
22804 /**
22805  * Checks if two RoutingFeess contain equal inner contents.
22806  * This ignores pointers and is_owned flags and looks at the values in fields.
22807  * Two objects with NULL inner values will be considered "equal" here.
22808  */
22809 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
22810
22811 /**
22812  * Creates a copy of the RoutingFees
22813  */
22814 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
22815
22816 /**
22817  * Checks if two RoutingFeess contain equal inner contents.
22818  */
22819 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
22820
22821 /**
22822  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
22823  */
22824 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
22825
22826 /**
22827  * Read a RoutingFees from a byte array, created by RoutingFees_write
22828  */
22829 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
22830
22831 /**
22832  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
22833  */
22834 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
22835
22836 /**
22837  * Protocol features the node announced support for
22838  */
22839 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22840
22841 /**
22842  * Protocol features the node announced support for
22843  */
22844 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22845
22846 /**
22847  * When the last known update to the node state was issued.
22848  * Value is opaque, as set in the announcement.
22849  */
22850 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22851
22852 /**
22853  * When the last known update to the node state was issued.
22854  * Value is opaque, as set in the announcement.
22855  */
22856 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
22857
22858 /**
22859  * Color assigned to the node
22860  */
22861 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
22862
22863 /**
22864  * Color assigned to the node
22865  */
22866 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22867
22868 /**
22869  * Moniker assigned to the node.
22870  * May be invalid or malicious (eg control chars),
22871  * should not be exposed to the user.
22872  */
22873 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
22874
22875 /**
22876  * Moniker assigned to the node.
22877  * May be invalid or malicious (eg control chars),
22878  * should not be exposed to the user.
22879  */
22880 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22881
22882 /**
22883  * Internet-level addresses via which one can connect to the node
22884  */
22885 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22886
22887 /**
22888  * An initial announcement of the node
22889  * Mostly redundant with the data we store in fields explicitly.
22890  * Everything else is useful only for sending out for initial routing sync.
22891  * Not stored if contains excess data to prevent DoS.
22892  *
22893  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22894  */
22895 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22896
22897 /**
22898  * An initial announcement of the node
22899  * Mostly redundant with the data we store in fields explicitly.
22900  * Everything else is useful only for sending out for initial routing sync.
22901  * Not stored if contains excess data to prevent DoS.
22902  *
22903  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22904  */
22905 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
22906
22907 /**
22908  * Constructs a new NodeAnnouncementInfo given each field
22909  */
22910 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);
22911
22912 /**
22913  * Creates a copy of the NodeAnnouncementInfo
22914  */
22915 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
22916
22917 /**
22918  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
22919  */
22920 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
22921
22922 /**
22923  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
22924  */
22925 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
22926
22927 /**
22928  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
22929  */
22930 void NodeInfo_free(struct LDKNodeInfo this_obj);
22931
22932 /**
22933  * All valid channels a node has announced
22934  */
22935 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22936
22937 /**
22938  * Lowest fees enabling routing via any of the enabled, known channels to a node.
22939  * The two fields (flat and proportional fee) are independent,
22940  * meaning they don't have to refer to the same channel.
22941  *
22942  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22943  */
22944 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
22945
22946 /**
22947  * Lowest fees enabling routing via any of the enabled, known channels to a node.
22948  * The two fields (flat and proportional fee) are independent,
22949  * meaning they don't have to refer to the same channel.
22950  *
22951  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22952  */
22953 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
22954
22955 /**
22956  * More information about a node from node_announcement.
22957  * Optional because we store a Node entry after learning about it from
22958  * a channel announcement, but before receiving a node announcement.
22959  *
22960  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22961  */
22962 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
22963
22964 /**
22965  * More information about a node from node_announcement.
22966  * Optional because we store a Node entry after learning about it from
22967  * a channel announcement, but before receiving a node announcement.
22968  *
22969  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22970  */
22971 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
22972
22973 /**
22974  * Constructs a new NodeInfo given each field
22975  */
22976 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
22977
22978 /**
22979  * Creates a copy of the NodeInfo
22980  */
22981 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
22982
22983 /**
22984  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
22985  */
22986 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
22987
22988 /**
22989  * Read a NodeInfo from a byte array, created by NodeInfo_write
22990  */
22991 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
22992
22993 /**
22994  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
22995  */
22996 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
22997
22998 /**
22999  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
23000  */
23001 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
23002
23003 /**
23004  * Creates a new, empty, network graph.
23005  */
23006 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
23007
23008 /**
23009  * Returns a read-only view of the network graph.
23010  */
23011 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
23012
23013 /**
23014  * For an already known node (from channel announcements), update its stored properties from a
23015  * given node announcement.
23016  *
23017  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
23018  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
23019  * routing messages from a source using a protocol other than the lightning P2P protocol.
23020  */
23021 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
23022
23023 /**
23024  * For an already known node (from channel announcements), update its stored properties from a
23025  * given node announcement without verifying the associated signatures. Because we aren't
23026  * given the associated signatures here we cannot relay the node announcement to any of our
23027  * peers.
23028  */
23029 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
23030
23031 /**
23032  * Store or update channel info from a channel announcement.
23033  *
23034  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
23035  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
23036  * routing messages from a source using a protocol other than the lightning P2P protocol.
23037  *
23038  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
23039  * the corresponding UTXO exists on chain and is correctly-formatted.
23040  */
23041 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
23042
23043 /**
23044  * Store or update channel info from a channel announcement without verifying the associated
23045  * signatures. Because we aren't given the associated signatures here we cannot relay the
23046  * channel announcement to any of our peers.
23047  *
23048  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
23049  * the corresponding UTXO exists on chain and is correctly-formatted.
23050  */
23051 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
23052
23053 /**
23054  * Close a channel if a corresponding HTLC fail was sent.
23055  * If permanent, removes a channel from the local storage.
23056  * May cause the removal of nodes too, if this was their last channel.
23057  * If not permanent, makes channels unavailable for routing.
23058  */
23059 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
23060
23061 /**
23062  * Marks a node in the graph as failed.
23063  */
23064 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
23065
23066 /**
23067  * Removes information about channels that we haven't heard any updates about in some time.
23068  * This can be used regularly to prune the network graph of channels that likely no longer
23069  * exist.
23070  *
23071  * While there is no formal requirement that nodes regularly re-broadcast their channel
23072  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
23073  * pruning occur for updates which are at least two weeks old, which we implement here.
23074  *
23075  * This function takes the current unix time as an argument. For users with the `std` feature
23076  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
23077  */
23078 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
23079
23080 /**
23081  * For an already known (from announcement) channel, update info about one of the directions
23082  * of the channel.
23083  *
23084  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
23085  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
23086  * routing messages from a source using a protocol other than the lightning P2P protocol.
23087  *
23088  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
23089  * materially in the future will be rejected.
23090  */
23091 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
23092
23093 /**
23094  * For an already known (from announcement) channel, update info about one of the directions
23095  * of the channel without verifying the associated signatures. Because we aren't given the
23096  * associated signatures here we cannot relay the channel update to any of our peers.
23097  *
23098  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
23099  * materially in the future will be rejected.
23100  */
23101 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
23102
23103 /**
23104  * Get network addresses by node id.
23105  * Returns None if the requested node is completely unknown,
23106  * or if node announcement for the node was never received.
23107  */
23108 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
23109
23110 /**
23111  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
23112  */
23113 void RouteHop_free(struct LDKRouteHop this_obj);
23114
23115 /**
23116  * The node_id of the node at this hop.
23117  */
23118 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23119
23120 /**
23121  * The node_id of the node at this hop.
23122  */
23123 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23124
23125 /**
23126  * The node_announcement features of the node at this hop. For the last hop, these may be
23127  * amended to match the features present in the invoice this node generated.
23128  */
23129 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23130
23131 /**
23132  * The node_announcement features of the node at this hop. For the last hop, these may be
23133  * amended to match the features present in the invoice this node generated.
23134  */
23135 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
23136
23137 /**
23138  * The channel that should be used from the previous hop to reach this node.
23139  */
23140 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23141
23142 /**
23143  * The channel that should be used from the previous hop to reach this node.
23144  */
23145 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
23146
23147 /**
23148  * The channel_announcement features of the channel that should be used from the previous hop
23149  * to reach this node.
23150  */
23151 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23152
23153 /**
23154  * The channel_announcement features of the channel that should be used from the previous hop
23155  * to reach this node.
23156  */
23157 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
23158
23159 /**
23160  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
23161  * For the last hop, this should be the full value of the payment (might be more than
23162  * requested if we had to match htlc_minimum_msat).
23163  */
23164 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23165
23166 /**
23167  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
23168  * For the last hop, this should be the full value of the payment (might be more than
23169  * requested if we had to match htlc_minimum_msat).
23170  */
23171 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
23172
23173 /**
23174  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
23175  * expected at the destination, in excess of the current block height.
23176  */
23177 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
23178
23179 /**
23180  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
23181  * expected at the destination, in excess of the current block height.
23182  */
23183 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
23184
23185 /**
23186  * Constructs a new RouteHop given each field
23187  */
23188 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);
23189
23190 /**
23191  * Creates a copy of the RouteHop
23192  */
23193 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
23194
23195 /**
23196  * Checks if two RouteHops contain equal inner contents.
23197  */
23198 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
23199
23200 /**
23201  * Checks if two RouteHops contain equal inner contents.
23202  * This ignores pointers and is_owned flags and looks at the values in fields.
23203  * Two objects with NULL inner values will be considered "equal" here.
23204  */
23205 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
23206
23207 /**
23208  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
23209  */
23210 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
23211
23212 /**
23213  * Read a RouteHop from a byte array, created by RouteHop_write
23214  */
23215 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
23216
23217 /**
23218  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
23219  */
23220 void Route_free(struct LDKRoute this_obj);
23221
23222 /**
23223  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
23224  * last RouteHop in each path must be the same.
23225  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
23226  * destination. Thus, this must always be at least length one. While the maximum length of any
23227  * given path is variable, keeping the length of any path to less than 20 should currently
23228  * ensure it is viable.
23229  */
23230 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
23231
23232 /**
23233  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
23234  * last RouteHop in each path must be the same.
23235  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
23236  * destination. Thus, this must always be at least length one. While the maximum length of any
23237  * given path is variable, keeping the length of any path to less than 20 should currently
23238  * ensure it is viable.
23239  */
23240 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
23241
23242 /**
23243  * The `payee` parameter passed to [`find_route`].
23244  * This is used by `ChannelManager` to track information which may be required for retries,
23245  * provided back to you via [`Event::PaymentPathFailed`].
23246  *
23247  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
23248  *
23249  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23250  */
23251 struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
23252
23253 /**
23254  * The `payee` parameter passed to [`find_route`].
23255  * This is used by `ChannelManager` to track information which may be required for retries,
23256  * provided back to you via [`Event::PaymentPathFailed`].
23257  *
23258  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
23259  *
23260  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23261  */
23262 void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
23263
23264 /**
23265  * Constructs a new Route given each field
23266  */
23267 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
23268
23269 /**
23270  * Creates a copy of the Route
23271  */
23272 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
23273
23274 /**
23275  * Checks if two Routes contain equal inner contents.
23276  */
23277 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
23278
23279 /**
23280  * Checks if two Routes contain equal inner contents.
23281  * This ignores pointers and is_owned flags and looks at the values in fields.
23282  * Two objects with NULL inner values will be considered "equal" here.
23283  */
23284 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
23285
23286 /**
23287  * Returns the total amount of fees paid on this [`Route`].
23288  *
23289  * This doesn't include any extra payment made to the recipient, which can happen in excess of
23290  * the amount passed to [`find_route`]'s `params.final_value_msat`.
23291  */
23292 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
23293
23294 /**
23295  * Returns the total amount paid on this [`Route`], excluding the fees.
23296  */
23297 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
23298
23299 /**
23300  * Serialize the Route object into a byte array which can be read by Route_read
23301  */
23302 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
23303
23304 /**
23305  * Read a Route from a byte array, created by Route_write
23306  */
23307 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
23308
23309 /**
23310  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
23311  */
23312 void RouteParameters_free(struct LDKRouteParameters this_obj);
23313
23314 /**
23315  * The recipient of the failed payment path.
23316  */
23317 struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
23318
23319 /**
23320  * The recipient of the failed payment path.
23321  */
23322 void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
23323
23324 /**
23325  * The amount in msats sent on the failed payment path.
23326  */
23327 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
23328
23329 /**
23330  * The amount in msats sent on the failed payment path.
23331  */
23332 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
23333
23334 /**
23335  * The CLTV on the final hop of the failed payment path.
23336  */
23337 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
23338
23339 /**
23340  * The CLTV on the final hop of the failed payment path.
23341  */
23342 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
23343
23344 /**
23345  * Constructs a new RouteParameters given each field
23346  */
23347 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
23348
23349 /**
23350  * Creates a copy of the RouteParameters
23351  */
23352 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
23353
23354 /**
23355  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
23356  */
23357 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
23358
23359 /**
23360  * Read a RouteParameters from a byte array, created by RouteParameters_write
23361  */
23362 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
23363
23364 /**
23365  * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
23366  */
23367 void Payee_free(struct LDKPayee this_obj);
23368
23369 /**
23370  * The node id of the payee.
23371  */
23372 struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
23373
23374 /**
23375  * The node id of the payee.
23376  */
23377 void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23378
23379 /**
23380  * Features supported by the payee.
23381  *
23382  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
23383  * does not contain any features.
23384  *
23385  * [`for_keysend`]: Self::for_keysend
23386  *
23387  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23388  */
23389 struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
23390
23391 /**
23392  * Features supported by the payee.
23393  *
23394  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
23395  * does not contain any features.
23396  *
23397  * [`for_keysend`]: Self::for_keysend
23398  *
23399  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23400  */
23401 void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
23402
23403 /**
23404  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
23405  */
23406 struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
23407
23408 /**
23409  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
23410  */
23411 void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
23412
23413 /**
23414  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
23415  */
23416 struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
23417
23418 /**
23419  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
23420  */
23421 void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23422
23423 /**
23424  * Constructs a new Payee given each field
23425  */
23426 MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg);
23427
23428 /**
23429  * Creates a copy of the Payee
23430  */
23431 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
23432
23433 /**
23434  * Checks if two Payees contain equal inner contents.
23435  */
23436 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
23437
23438 /**
23439  * Checks if two Payees contain equal inner contents.
23440  * This ignores pointers and is_owned flags and looks at the values in fields.
23441  * Two objects with NULL inner values will be considered "equal" here.
23442  */
23443 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
23444
23445 /**
23446  * Serialize the Payee object into a byte array which can be read by Payee_read
23447  */
23448 struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
23449
23450 /**
23451  * Read a Payee from a byte array, created by Payee_write
23452  */
23453 struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
23454
23455 /**
23456  * Creates a payee with the node id of the given `pubkey`.
23457  */
23458 MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
23459
23460 /**
23461  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
23462  */
23463 MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
23464
23465 /**
23466  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
23467  */
23468 void RouteHint_free(struct LDKRouteHint this_obj);
23469
23470 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
23471
23472 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
23473
23474 /**
23475  * Constructs a new RouteHint given each field
23476  */
23477 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
23478
23479 /**
23480  * Creates a copy of the RouteHint
23481  */
23482 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
23483
23484 /**
23485  * Checks if two RouteHints contain equal inner contents.
23486  */
23487 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
23488
23489 /**
23490  * Checks if two RouteHints contain equal inner contents.
23491  * This ignores pointers and is_owned flags and looks at the values in fields.
23492  * Two objects with NULL inner values will be considered "equal" here.
23493  */
23494 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
23495
23496 /**
23497  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
23498  */
23499 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
23500
23501 /**
23502  * Read a RouteHint from a byte array, created by RouteHint_write
23503  */
23504 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
23505
23506 /**
23507  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
23508  */
23509 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
23510
23511 /**
23512  * The node_id of the non-target end of the route
23513  */
23514 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23515
23516 /**
23517  * The node_id of the non-target end of the route
23518  */
23519 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23520
23521 /**
23522  * The short_channel_id of this channel
23523  */
23524 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23525
23526 /**
23527  * The short_channel_id of this channel
23528  */
23529 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
23530
23531 /**
23532  * The fees which must be paid to use this channel
23533  */
23534 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23535
23536 /**
23537  * The fees which must be paid to use this channel
23538  */
23539 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
23540
23541 /**
23542  * The difference in CLTV values between this node and the next node.
23543  */
23544 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23545
23546 /**
23547  * The difference in CLTV values between this node and the next node.
23548  */
23549 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
23550
23551 /**
23552  * The minimum value, in msat, which must be relayed to the next hop.
23553  */
23554 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23555
23556 /**
23557  * The minimum value, in msat, which must be relayed to the next hop.
23558  */
23559 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23560
23561 /**
23562  * The maximum value in msat available for routing with a single HTLC.
23563  */
23564 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
23565
23566 /**
23567  * The maximum value in msat available for routing with a single HTLC.
23568  */
23569 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23570
23571 /**
23572  * Constructs a new RouteHintHop given each field
23573  */
23574 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);
23575
23576 /**
23577  * Creates a copy of the RouteHintHop
23578  */
23579 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
23580
23581 /**
23582  * Checks if two RouteHintHops contain equal inner contents.
23583  */
23584 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
23585
23586 /**
23587  * Checks if two RouteHintHops contain equal inner contents.
23588  * This ignores pointers and is_owned flags and looks at the values in fields.
23589  * Two objects with NULL inner values will be considered "equal" here.
23590  */
23591 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
23592
23593 /**
23594  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
23595  */
23596 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
23597
23598 /**
23599  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
23600  */
23601 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
23602
23603 /**
23604  * Finds a route from us (payer) to the given target node (payee).
23605  *
23606  * If the payee provided features in their invoice, they should be provided via `params.payee`.
23607  * Without this, MPP will only be used if the payee's features are available in the network graph.
23608  *
23609  * Private routing paths between a public node and the target may be included in `params.payee`.
23610  *
23611  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
23612  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
23613  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
23614  *
23615  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
23616  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
23617  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
23618  *
23619  * # Note
23620  *
23621  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
23622  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
23623  * function.
23624  *
23625  * # Panics
23626  *
23627  * Panics if first_hops contains channels without short_channel_ids;
23628  * [`ChannelManager::list_usable_channels`] will never include such channels.
23629  *
23630  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
23631  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
23632  *
23633  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
23634  */
23635 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
23636
23637 /**
23638  * Calls the free function if one is set
23639  */
23640 void Score_free(struct LDKScore this_ptr);
23641
23642 /**
23643  * Calls the free function if one is set
23644  */
23645 void LockableScore_free(struct LDKLockableScore this_ptr);
23646
23647 /**
23648  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
23649  */
23650 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
23651
23652 /**
23653  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
23654  */
23655 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
23656
23657 /**
23658  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
23659  */
23660 void Scorer_free(struct LDKScorer this_obj);
23661
23662 /**
23663  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
23664  */
23665 void ScoringParameters_free(struct LDKScoringParameters this_obj);
23666
23667 /**
23668  * A fixed penalty in msats to apply to each channel.
23669  *
23670  * Default value: 500 msat
23671  */
23672 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23673
23674 /**
23675  * A fixed penalty in msats to apply to each channel.
23676  *
23677  * Default value: 500 msat
23678  */
23679 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23680
23681 /**
23682  * A penalty in msats to apply to a channel upon failing to relay a payment.
23683  *
23684  * This accumulates for each failure but may be reduced over time based on
23685  * [`failure_penalty_half_life`] or when successfully routing through a channel.
23686  *
23687  * Default value: 1,024,000 msat
23688  *
23689  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
23690  */
23691 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23692
23693 /**
23694  * A penalty in msats to apply to a channel upon failing to relay a payment.
23695  *
23696  * This accumulates for each failure but may be reduced over time based on
23697  * [`failure_penalty_half_life`] or when successfully routing through a channel.
23698  *
23699  * Default value: 1,024,000 msat
23700  *
23701  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
23702  */
23703 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23704
23705 /**
23706  * When the amount being sent over a channel is this many 1024ths of the total channel
23707  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
23708  *
23709  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
23710  *
23711  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
23712  */
23713 uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23714
23715 /**
23716  * When the amount being sent over a channel is this many 1024ths of the total channel
23717  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
23718  *
23719  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
23720  *
23721  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
23722  */
23723 void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
23724
23725 /**
23726  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
23727  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
23728  *
23729  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
23730  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
23731  *
23732  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
23733  */
23734 uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23735
23736 /**
23737  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
23738  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
23739  *
23740  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
23741  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
23742  *
23743  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
23744  */
23745 void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23746
23747 /**
23748  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
23749  * cut in half.
23750  *
23751  * Successfully routing through a channel will immediately cut the penalty in half as well.
23752  *
23753  * # Note
23754  *
23755  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
23756  * never decay.
23757  *
23758  * [`failure_penalty_msat`]: Self::failure_penalty_msat
23759  */
23760 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23761
23762 /**
23763  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
23764  * cut in half.
23765  *
23766  * Successfully routing through a channel will immediately cut the penalty in half as well.
23767  *
23768  * # Note
23769  *
23770  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
23771  * never decay.
23772  *
23773  * [`failure_penalty_msat`]: Self::failure_penalty_msat
23774  */
23775 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23776
23777 /**
23778  * Constructs a new ScoringParameters given each field
23779  */
23780 MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg);
23781
23782 /**
23783  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
23784  */
23785 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
23786
23787 /**
23788  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
23789  */
23790 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
23791
23792 /**
23793  * Creates a new scorer using the given scoring parameters.
23794  */
23795 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
23796
23797 /**
23798  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
23799  */
23800 MUST_USE_RES struct LDKScorer Scorer_default(void);
23801
23802 /**
23803  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
23804  */
23805 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
23806
23807 /**
23808  * Constructs a new Score which calls the relevant methods on this_arg.
23809  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
23810  */
23811 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
23812
23813 /**
23814  * Serialize the Scorer object into a byte array which can be read by Scorer_read
23815  */
23816 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
23817
23818 /**
23819  * Read a Scorer from a byte array, created by Scorer_write
23820  */
23821 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
23822
23823 /**
23824  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
23825  */
23826 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
23827
23828 /**
23829  * Initialize a new FilesystemPersister and set the path to the individual channels'
23830  * files.
23831  */
23832 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
23833
23834 /**
23835  * Get the directory which was provided when this persister was initialized.
23836  */
23837 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
23838
23839 /**
23840  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
23841  * initialization, within a file called \"manager\".
23842  */
23843 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
23844
23845 /**
23846  * Read `ChannelMonitor`s from disk.
23847  */
23848 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
23849
23850 /**
23851  * Constructs a new Persist which calls the relevant methods on this_arg.
23852  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
23853  */
23854 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
23855
23856 /**
23857  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
23858  */
23859 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
23860
23861 /**
23862  * Calls the free function if one is set
23863  */
23864 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
23865
23866 /**
23867  * Start a background thread that takes care of responsibilities enumerated in the [top-level
23868  * documentation].
23869  *
23870  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
23871  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
23872  * either [`join`] or [`stop`].
23873  *
23874  * # Data Persistence
23875  *
23876  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
23877  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
23878  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
23879  * provided implementation.
23880  *
23881  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
23882  * error or call [`join`] and handle any error that may arise. For the latter case,
23883  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
23884  *
23885  * # Event Handling
23886  *
23887  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
23888  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
23889  * functionality implemented by other handlers.
23890  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
23891  *
23892  * [top-level documentation]: BackgroundProcessor
23893  * [`join`]: Self::join
23894  * [`stop`]: Self::stop
23895  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23896  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
23897  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
23898  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
23899  *
23900  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
23901  */
23902 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, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
23903
23904 /**
23905  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
23906  * [`ChannelManager`].
23907  *
23908  * # Panics
23909  *
23910  * This function panics if the background thread has panicked such as while persisting or
23911  * handling events.
23912  *
23913  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23914  */
23915 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
23916
23917 /**
23918  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
23919  * [`ChannelManager`].
23920  *
23921  * # Panics
23922  *
23923  * This function panics if the background thread has panicked such as while persisting or
23924  * handling events.
23925  *
23926  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23927  */
23928 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
23929
23930 /**
23931  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
23932  *
23933  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
23934  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
23935  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
23936  * since this check is fast we recommend to do it anyway.
23937  *
23938  * If this function fails this is considered a bug. Please open an issue describing your
23939  * platform and stating your current system time.
23940  *
23941  * # Panics
23942  * If the check fails this function panics. By calling this function on startup you ensure that
23943  * this wont happen at an arbitrary later point in time.
23944  */
23945 void check_platform(void);
23946
23947 /**
23948  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
23949  */
23950 void Invoice_free(struct LDKInvoice this_obj);
23951
23952 /**
23953  * Checks if two Invoices contain equal inner contents.
23954  * This ignores pointers and is_owned flags and looks at the values in fields.
23955  * Two objects with NULL inner values will be considered "equal" here.
23956  */
23957 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
23958
23959 /**
23960  * Creates a copy of the Invoice
23961  */
23962 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
23963
23964 /**
23965  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
23966  */
23967 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
23968
23969 /**
23970  * Checks if two SignedRawInvoices contain equal inner contents.
23971  * This ignores pointers and is_owned flags and looks at the values in fields.
23972  * Two objects with NULL inner values will be considered "equal" here.
23973  */
23974 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
23975
23976 /**
23977  * Creates a copy of the SignedRawInvoice
23978  */
23979 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
23980
23981 /**
23982  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
23983  */
23984 void RawInvoice_free(struct LDKRawInvoice this_obj);
23985
23986 /**
23987  * data part
23988  */
23989 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
23990
23991 /**
23992  * data part
23993  */
23994 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
23995
23996 /**
23997  * Checks if two RawInvoices contain equal inner contents.
23998  * This ignores pointers and is_owned flags and looks at the values in fields.
23999  * Two objects with NULL inner values will be considered "equal" here.
24000  */
24001 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
24002
24003 /**
24004  * Creates a copy of the RawInvoice
24005  */
24006 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
24007
24008 /**
24009  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
24010  */
24011 void RawDataPart_free(struct LDKRawDataPart this_obj);
24012
24013 /**
24014  * generation time of the invoice
24015  */
24016 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
24017
24018 /**
24019  * generation time of the invoice
24020  */
24021 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
24022
24023 /**
24024  * Checks if two RawDataParts contain equal inner contents.
24025  * This ignores pointers and is_owned flags and looks at the values in fields.
24026  * Two objects with NULL inner values will be considered "equal" here.
24027  */
24028 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
24029
24030 /**
24031  * Creates a copy of the RawDataPart
24032  */
24033 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
24034
24035 /**
24036  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
24037  */
24038 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
24039
24040 /**
24041  * Checks if two PositiveTimestamps contain equal inner contents.
24042  * This ignores pointers and is_owned flags and looks at the values in fields.
24043  * Two objects with NULL inner values will be considered "equal" here.
24044  */
24045 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
24046
24047 /**
24048  * Creates a copy of the PositiveTimestamp
24049  */
24050 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
24051
24052 /**
24053  * Creates a copy of the SiPrefix
24054  */
24055 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
24056
24057 /**
24058  * Utility method to constructs a new Milli-variant SiPrefix
24059  */
24060 enum LDKSiPrefix SiPrefix_milli(void);
24061
24062 /**
24063  * Utility method to constructs a new Micro-variant SiPrefix
24064  */
24065 enum LDKSiPrefix SiPrefix_micro(void);
24066
24067 /**
24068  * Utility method to constructs a new Nano-variant SiPrefix
24069  */
24070 enum LDKSiPrefix SiPrefix_nano(void);
24071
24072 /**
24073  * Utility method to constructs a new Pico-variant SiPrefix
24074  */
24075 enum LDKSiPrefix SiPrefix_pico(void);
24076
24077 /**
24078  * Checks if two SiPrefixs contain equal inner contents.
24079  * This ignores pointers and is_owned flags and looks at the values in fields.
24080  */
24081 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
24082
24083 /**
24084  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
24085  * This is effectively 10^12 * the prefix multiplier
24086  */
24087 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
24088
24089 /**
24090  * Creates a copy of the Currency
24091  */
24092 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
24093
24094 /**
24095  * Utility method to constructs a new Bitcoin-variant Currency
24096  */
24097 enum LDKCurrency Currency_bitcoin(void);
24098
24099 /**
24100  * Utility method to constructs a new BitcoinTestnet-variant Currency
24101  */
24102 enum LDKCurrency Currency_bitcoin_testnet(void);
24103
24104 /**
24105  * Utility method to constructs a new Regtest-variant Currency
24106  */
24107 enum LDKCurrency Currency_regtest(void);
24108
24109 /**
24110  * Utility method to constructs a new Simnet-variant Currency
24111  */
24112 enum LDKCurrency Currency_simnet(void);
24113
24114 /**
24115  * Utility method to constructs a new Signet-variant Currency
24116  */
24117 enum LDKCurrency Currency_signet(void);
24118
24119 /**
24120  * Checks if two Currencys contain equal inner contents.
24121  */
24122 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
24123
24124 /**
24125  * Checks if two Currencys contain equal inner contents.
24126  * This ignores pointers and is_owned flags and looks at the values in fields.
24127  */
24128 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
24129
24130 /**
24131  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
24132  */
24133 void Sha256_free(struct LDKSha256 this_obj);
24134
24135 /**
24136  * Creates a copy of the Sha256
24137  */
24138 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
24139
24140 /**
24141  * Checks if two Sha256s contain equal inner contents.
24142  */
24143 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
24144
24145 /**
24146  * Checks if two Sha256s contain equal inner contents.
24147  * This ignores pointers and is_owned flags and looks at the values in fields.
24148  * Two objects with NULL inner values will be considered "equal" here.
24149  */
24150 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
24151
24152 /**
24153  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
24154  */
24155 void Description_free(struct LDKDescription this_obj);
24156
24157 /**
24158  * Creates a copy of the Description
24159  */
24160 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
24161
24162 /**
24163  * Checks if two Descriptions contain equal inner contents.
24164  */
24165 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
24166
24167 /**
24168  * Checks if two Descriptions contain equal inner contents.
24169  * This ignores pointers and is_owned flags and looks at the values in fields.
24170  * Two objects with NULL inner values will be considered "equal" here.
24171  */
24172 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
24173
24174 /**
24175  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
24176  */
24177 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
24178
24179 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
24180
24181 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24182
24183 /**
24184  * Constructs a new PayeePubKey given each field
24185  */
24186 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
24187
24188 /**
24189  * Creates a copy of the PayeePubKey
24190  */
24191 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
24192
24193 /**
24194  * Checks if two PayeePubKeys contain equal inner contents.
24195  */
24196 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
24197
24198 /**
24199  * Checks if two PayeePubKeys contain equal inner contents.
24200  * This ignores pointers and is_owned flags and looks at the values in fields.
24201  * Two objects with NULL inner values will be considered "equal" here.
24202  */
24203 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
24204
24205 /**
24206  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
24207  */
24208 void ExpiryTime_free(struct LDKExpiryTime this_obj);
24209
24210 /**
24211  * Creates a copy of the ExpiryTime
24212  */
24213 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
24214
24215 /**
24216  * Checks if two ExpiryTimes contain equal inner contents.
24217  */
24218 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
24219
24220 /**
24221  * Checks if two ExpiryTimes contain equal inner contents.
24222  * This ignores pointers and is_owned flags and looks at the values in fields.
24223  * Two objects with NULL inner values will be considered "equal" here.
24224  */
24225 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
24226
24227 /**
24228  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
24229  */
24230 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
24231
24232 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
24233
24234 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
24235
24236 /**
24237  * Constructs a new MinFinalCltvExpiry given each field
24238  */
24239 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
24240
24241 /**
24242  * Creates a copy of the MinFinalCltvExpiry
24243  */
24244 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
24245
24246 /**
24247  * Checks if two MinFinalCltvExpirys contain equal inner contents.
24248  */
24249 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
24250
24251 /**
24252  * Checks if two MinFinalCltvExpirys contain equal inner contents.
24253  * This ignores pointers and is_owned flags and looks at the values in fields.
24254  * Two objects with NULL inner values will be considered "equal" here.
24255  */
24256 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
24257
24258 /**
24259  * Frees any resources used by the Fallback
24260  */
24261 void Fallback_free(struct LDKFallback this_ptr);
24262
24263 /**
24264  * Creates a copy of the Fallback
24265  */
24266 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
24267
24268 /**
24269  * Utility method to constructs a new SegWitProgram-variant Fallback
24270  */
24271 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
24272
24273 /**
24274  * Utility method to constructs a new PubKeyHash-variant Fallback
24275  */
24276 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
24277
24278 /**
24279  * Utility method to constructs a new ScriptHash-variant Fallback
24280  */
24281 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
24282
24283 /**
24284  * Checks if two Fallbacks contain equal inner contents.
24285  */
24286 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
24287
24288 /**
24289  * Checks if two Fallbacks contain equal inner contents.
24290  * This ignores pointers and is_owned flags and looks at the values in fields.
24291  */
24292 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
24293
24294 /**
24295  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
24296  */
24297 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
24298
24299 /**
24300  * Creates a copy of the InvoiceSignature
24301  */
24302 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
24303
24304 /**
24305  * Checks if two InvoiceSignatures contain equal inner contents.
24306  * This ignores pointers and is_owned flags and looks at the values in fields.
24307  * Two objects with NULL inner values will be considered "equal" here.
24308  */
24309 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
24310
24311 /**
24312  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
24313  */
24314 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
24315
24316 /**
24317  * Creates a copy of the PrivateRoute
24318  */
24319 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
24320
24321 /**
24322  * Checks if two PrivateRoutes contain equal inner contents.
24323  */
24324 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
24325
24326 /**
24327  * Checks if two PrivateRoutes contain equal inner contents.
24328  * This ignores pointers and is_owned flags and looks at the values in fields.
24329  * Two objects with NULL inner values will be considered "equal" here.
24330  */
24331 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
24332
24333 /**
24334  * Disassembles the `SignedRawInvoice` into its three parts:
24335  *  1. raw invoice
24336  *  2. hash of the raw invoice
24337  *  3. signature
24338  */
24339 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
24340
24341 /**
24342  * The `RawInvoice` which was signed.
24343  */
24344 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
24345
24346 /**
24347  * The hash of the `RawInvoice` that was signed.
24348  */
24349 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
24350
24351 /**
24352  * InvoiceSignature for the invoice.
24353  */
24354 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
24355
24356 /**
24357  * Recovers the public key used for signing the invoice from the recoverable signature.
24358  */
24359 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
24360
24361 /**
24362  * Checks if the signature is valid for the included payee public key or if none exists if it's
24363  * valid for the recovered signature (which should always be true?).
24364  */
24365 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
24366
24367 /**
24368  * Calculate the hash of the encoded `RawInvoice`
24369  */
24370 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24371
24372 /**
24373  *
24374  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24375  */
24376 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24377
24378 /**
24379  *
24380  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24381  */
24382 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24383
24384 /**
24385  *
24386  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24387  */
24388 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24389
24390 /**
24391  *
24392  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24393  */
24394 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24395
24396 /**
24397  *
24398  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24399  */
24400 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24401
24402 /**
24403  *
24404  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24405  */
24406 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24407
24408 /**
24409  *
24410  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24411  */
24412 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24413
24414 /**
24415  *
24416  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24417  */
24418 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24419
24420 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24421
24422 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24423
24424 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
24425
24426 /**
24427  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
24428  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
24429  * `CreationError::TimestampOutOfBounds`.
24430  */
24431 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
24432
24433 /**
24434  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
24435  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
24436  * `CreationError::TimestampOutOfBounds`.
24437  */
24438 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
24439
24440 /**
24441  * Returns the UNIX timestamp representing the stored time
24442  */
24443 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
24444
24445 /**
24446  * Returns a reference to the internal `SystemTime` time representation
24447  */
24448 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
24449
24450 /**
24451  * Transform the `Invoice` into it's unchecked version
24452  */
24453 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
24454
24455 /**
24456  * Check that the invoice is signed correctly and that key recovery works
24457  */
24458 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
24459
24460 /**
24461  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
24462  * ```
24463  * use lightning_invoice::*;
24464  *
24465  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
24466  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
24467  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
24468  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
24469  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
24470  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
24471  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
24472  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
24473  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
24474  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
24475  * j5r6drg6k6zcqj0fcwg\";
24476  *
24477  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
24478  *
24479  * assert!(Invoice::from_signed(signed).is_ok());
24480  * ```
24481  */
24482 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
24483
24484 /**
24485  * Returns the `Invoice`'s timestamp (should equal it's creation time)
24486  */
24487 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
24488
24489 /**
24490  * Returns the hash to which we will receive the preimage on completion of the payment
24491  */
24492 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
24493
24494 /**
24495  * Get the payee's public key if one was included in the invoice
24496  *
24497  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24498  */
24499 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
24500
24501 /**
24502  * Get the payment secret if one was included in the invoice
24503  */
24504 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
24505
24506 /**
24507  * Get the invoice features if they were included in the invoice
24508  *
24509  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24510  */
24511 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
24512
24513 /**
24514  * Recover the payee's public key (only to be used if none was included in the invoice)
24515  */
24516 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
24517
24518 /**
24519  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
24520  */
24521 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
24522
24523 /**
24524  * Returns whether the invoice has expired.
24525  */
24526 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
24527
24528 /**
24529  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
24530  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
24531  */
24532 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
24533
24534 /**
24535  * Returns a list of all routes included in the invoice
24536  */
24537 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
24538
24539 /**
24540  * Returns a list of all routes included in the invoice as the underlying hints
24541  */
24542 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
24543
24544 /**
24545  * Returns the currency for which the invoice was issued
24546  */
24547 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
24548
24549 /**
24550  * Returns the amount if specified in the invoice as millisatoshis.
24551  */
24552 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
24553
24554 /**
24555  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
24556  * returns `CreationError::DescriptionTooLong` otherwise
24557  *
24558  * Please note that single characters may use more than one byte due to UTF8 encoding.
24559  */
24560 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
24561
24562 /**
24563  * Returns the underlying description `String`
24564  */
24565 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
24566
24567 /**
24568  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
24569  * overflow on adding the `EpiryTime` to it then this function will return a
24570  * `CreationError::ExpiryTimeOutOfBounds`.
24571  */
24572 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
24573
24574 /**
24575  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
24576  * would overflow on adding the `EpiryTime` to it then this function will return a
24577  * `CreationError::ExpiryTimeOutOfBounds`.
24578  */
24579 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
24580
24581 /**
24582  * Returns the expiry time in seconds
24583  */
24584 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
24585
24586 /**
24587  * Returns a reference to the underlying `Duration` (=expiry time)
24588  */
24589 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
24590
24591 /**
24592  * Creates a new (partial) route from a list of hops
24593  */
24594 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
24595
24596 /**
24597  * Returns the underlying list of hops
24598  */
24599 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
24600
24601 /**
24602  * Creates a copy of the CreationError
24603  */
24604 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
24605
24606 /**
24607  * Utility method to constructs a new DescriptionTooLong-variant CreationError
24608  */
24609 enum LDKCreationError CreationError_description_too_long(void);
24610
24611 /**
24612  * Utility method to constructs a new RouteTooLong-variant CreationError
24613  */
24614 enum LDKCreationError CreationError_route_too_long(void);
24615
24616 /**
24617  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
24618  */
24619 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
24620
24621 /**
24622  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
24623  */
24624 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
24625
24626 /**
24627  * Utility method to constructs a new InvalidAmount-variant CreationError
24628  */
24629 enum LDKCreationError CreationError_invalid_amount(void);
24630
24631 /**
24632  * Checks if two CreationErrors contain equal inner contents.
24633  * This ignores pointers and is_owned flags and looks at the values in fields.
24634  */
24635 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
24636
24637 /**
24638  * Get the string representation of a CreationError object
24639  */
24640 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
24641
24642 /**
24643  * Creates a copy of the SemanticError
24644  */
24645 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
24646
24647 /**
24648  * Utility method to constructs a new NoPaymentHash-variant SemanticError
24649  */
24650 enum LDKSemanticError SemanticError_no_payment_hash(void);
24651
24652 /**
24653  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
24654  */
24655 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
24656
24657 /**
24658  * Utility method to constructs a new NoDescription-variant SemanticError
24659  */
24660 enum LDKSemanticError SemanticError_no_description(void);
24661
24662 /**
24663  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
24664  */
24665 enum LDKSemanticError SemanticError_multiple_descriptions(void);
24666
24667 /**
24668  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
24669  */
24670 enum LDKSemanticError SemanticError_no_payment_secret(void);
24671
24672 /**
24673  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
24674  */
24675 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
24676
24677 /**
24678  * Utility method to constructs a new InvalidFeatures-variant SemanticError
24679  */
24680 enum LDKSemanticError SemanticError_invalid_features(void);
24681
24682 /**
24683  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
24684  */
24685 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
24686
24687 /**
24688  * Utility method to constructs a new InvalidSignature-variant SemanticError
24689  */
24690 enum LDKSemanticError SemanticError_invalid_signature(void);
24691
24692 /**
24693  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
24694  */
24695 enum LDKSemanticError SemanticError_imprecise_amount(void);
24696
24697 /**
24698  * Checks if two SemanticErrors contain equal inner contents.
24699  * This ignores pointers and is_owned flags and looks at the values in fields.
24700  */
24701 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
24702
24703 /**
24704  * Get the string representation of a SemanticError object
24705  */
24706 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
24707
24708 /**
24709  * Frees any resources used by the SignOrCreationError
24710  */
24711 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
24712
24713 /**
24714  * Creates a copy of the SignOrCreationError
24715  */
24716 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
24717
24718 /**
24719  * Utility method to constructs a new SignError-variant SignOrCreationError
24720  */
24721 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
24722
24723 /**
24724  * Utility method to constructs a new CreationError-variant SignOrCreationError
24725  */
24726 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
24727
24728 /**
24729  * Checks if two SignOrCreationErrors contain equal inner contents.
24730  * This ignores pointers and is_owned flags and looks at the values in fields.
24731  */
24732 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
24733
24734 /**
24735  * Get the string representation of a SignOrCreationError object
24736  */
24737 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
24738
24739 /**
24740  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
24741  */
24742 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
24743
24744 /**
24745  * Calls the free function if one is set
24746  */
24747 void Payer_free(struct LDKPayer this_ptr);
24748
24749 /**
24750  * Calls the free function if one is set
24751  */
24752 void Router_free(struct LDKRouter this_ptr);
24753
24754 /**
24755  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
24756  */
24757 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
24758
24759 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
24760
24761 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
24762
24763 /**
24764  * Constructs a new RetryAttempts given each field
24765  */
24766 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
24767
24768 /**
24769  * Creates a copy of the RetryAttempts
24770  */
24771 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
24772
24773 /**
24774  * Checks if two RetryAttemptss contain equal inner contents.
24775  * This ignores pointers and is_owned flags and looks at the values in fields.
24776  * Two objects with NULL inner values will be considered "equal" here.
24777  */
24778 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
24779
24780 /**
24781  * Checks if two RetryAttemptss contain equal inner contents.
24782  */
24783 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
24784
24785 /**
24786  * Frees any resources used by the PaymentError
24787  */
24788 void PaymentError_free(struct LDKPaymentError this_ptr);
24789
24790 /**
24791  * Creates a copy of the PaymentError
24792  */
24793 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
24794
24795 /**
24796  * Utility method to constructs a new Invoice-variant PaymentError
24797  */
24798 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
24799
24800 /**
24801  * Utility method to constructs a new Routing-variant PaymentError
24802  */
24803 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
24804
24805 /**
24806  * Utility method to constructs a new Sending-variant PaymentError
24807  */
24808 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
24809
24810 /**
24811  * Creates an invoice payer that retries failed payment paths.
24812  *
24813  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
24814  * `retry_attempts` has been exceeded for a given [`Invoice`].
24815  */
24816 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
24817
24818 /**
24819  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
24820  *
24821  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
24822  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
24823  * for you.
24824  */
24825 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
24826
24827 /**
24828  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
24829  * case a retry is needed.
24830  *
24831  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
24832  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
24833  * for you.
24834  */
24835 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats);
24836
24837 /**
24838  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
24839  * case a retry is needed.
24840  *
24841  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
24842  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
24843  */
24844 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta);
24845
24846 /**
24847  * Removes the payment cached by the given payment hash.
24848  *
24849  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
24850  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
24851  */
24852 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
24853
24854 /**
24855  * Constructs a new EventHandler which calls the relevant methods on this_arg.
24856  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
24857  */
24858 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
24859
24860 /**
24861  * Utility to construct an invoice. Generally, unless you want to do something like a custom
24862  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
24863  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
24864  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
24865  * that the payment secret is valid when the invoice is paid.
24866  */
24867 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);
24868
24869 /**
24870  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
24871  */
24872 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
24873
24874 /**
24875  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
24876  */
24877 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
24878
24879 /**
24880  * Constructs a new Router which calls the relevant methods on this_arg.
24881  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
24882  */
24883 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
24884
24885 /**
24886  * Constructs a new Payer which calls the relevant methods on this_arg.
24887  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
24888  */
24889 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
24890
24891 /**
24892  * Read a SiPrefix object from a string
24893  */
24894 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
24895
24896 /**
24897  * Read a Invoice object from a string
24898  */
24899 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
24900
24901 /**
24902  * Read a SignedRawInvoice object from a string
24903  */
24904 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
24905
24906 /**
24907  * Get the string representation of a Invoice object
24908  */
24909 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
24910
24911 /**
24912  * Get the string representation of a SignedRawInvoice object
24913  */
24914 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
24915
24916 /**
24917  * Get the string representation of a Currency object
24918  */
24919 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
24920
24921 /**
24922  * Get the string representation of a SiPrefix object
24923  */
24924 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
24925
24926 #endif /* LDK_C_BINDINGS_H */
24927
24928 #include "ldk_ver.h"