Update auto-generated bindings to latest upstream
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Bitcoin signet
172     */
173    LDKCurrency_Signet,
174    /**
175     * Must be last for serialization purposes
176     */
177    LDKCurrency_Sentinel,
178 } LDKCurrency;
179
180 /**
181  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
182  */
183 typedef enum LDKIOError {
184    LDKIOError_NotFound,
185    LDKIOError_PermissionDenied,
186    LDKIOError_ConnectionRefused,
187    LDKIOError_ConnectionReset,
188    LDKIOError_ConnectionAborted,
189    LDKIOError_NotConnected,
190    LDKIOError_AddrInUse,
191    LDKIOError_AddrNotAvailable,
192    LDKIOError_BrokenPipe,
193    LDKIOError_AlreadyExists,
194    LDKIOError_WouldBlock,
195    LDKIOError_InvalidInput,
196    LDKIOError_InvalidData,
197    LDKIOError_TimedOut,
198    LDKIOError_WriteZero,
199    LDKIOError_Interrupted,
200    LDKIOError_Other,
201    LDKIOError_UnexpectedEof,
202    /**
203     * Must be last for serialization purposes
204     */
205    LDKIOError_Sentinel,
206 } LDKIOError;
207
208 /**
209  * An enum representing the available verbosity levels of the logger.
210  */
211 typedef enum LDKLevel {
212    /**
213     * Designates very low priority, often extremely verbose, information
214     */
215    LDKLevel_Trace,
216    /**
217     * Designates lower priority information
218     */
219    LDKLevel_Debug,
220    /**
221     * Designates useful information
222     */
223    LDKLevel_Info,
224    /**
225     * Designates hazardous situations
226     */
227    LDKLevel_Warn,
228    /**
229     * Designates very serious errors
230     */
231    LDKLevel_Error,
232    /**
233     * Must be last for serialization purposes
234     */
235    LDKLevel_Sentinel,
236 } LDKLevel;
237
238 /**
239  * An enum representing the possible Bitcoin or test networks which we can run on
240  */
241 typedef enum LDKNetwork {
242    /**
243     * The main Bitcoin blockchain.
244     */
245    LDKNetwork_Bitcoin,
246    /**
247     * The testnet3 blockchain.
248     */
249    LDKNetwork_Testnet,
250    /**
251     * A local test blockchain.
252     */
253    LDKNetwork_Regtest,
254    /**
255     * A blockchain on which blocks are signed instead of mined.
256     */
257    LDKNetwork_Signet,
258    /**
259     * Must be last for serialization purposes
260     */
261    LDKNetwork_Sentinel,
262 } LDKNetwork;
263
264 /**
265  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
266  */
267 typedef enum LDKSecp256k1Error {
268    /**
269     * Signature failed verification
270     */
271    LDKSecp256k1Error_IncorrectSignature,
272    /**
273     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
274     */
275    LDKSecp256k1Error_InvalidMessage,
276    /**
277     * Bad public key
278     */
279    LDKSecp256k1Error_InvalidPublicKey,
280    /**
281     * Bad signature
282     */
283    LDKSecp256k1Error_InvalidSignature,
284    /**
285     * Bad secret key
286     */
287    LDKSecp256k1Error_InvalidSecretKey,
288    /**
289     * Bad recovery id
290     */
291    LDKSecp256k1Error_InvalidRecoveryId,
292    /**
293     * Invalid tweak for add_assign or mul_assign
294     */
295    LDKSecp256k1Error_InvalidTweak,
296    /**
297     * tweak_add_check failed on an xonly public key
298     */
299    LDKSecp256k1Error_TweakCheckFailed,
300    /**
301     * Didn't pass enough memory to context creation with preallocated memory
302     */
303    LDKSecp256k1Error_NotEnoughMemory,
304    /**
305     * Must be last for serialization purposes
306     */
307    LDKSecp256k1Error_Sentinel,
308 } LDKSecp256k1Error;
309
310 /**
311  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
312  * requirements sections in BOLT #11
313  */
314 typedef enum LDKSemanticError {
315    /**
316     * The invoice is missing the mandatory payment hash
317     */
318    LDKSemanticError_NoPaymentHash,
319    /**
320     * The invoice has multiple payment hashes which isn't allowed
321     */
322    LDKSemanticError_MultiplePaymentHashes,
323    /**
324     * No description or description hash are part of the invoice
325     */
326    LDKSemanticError_NoDescription,
327    /**
328     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
329     */
330    LDKSemanticError_MultipleDescriptions,
331    /**
332     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
333     * should provide.
334     */
335    LDKSemanticError_NoPaymentSecret,
336    /**
337     * The invoice contains multiple payment secrets
338     */
339    LDKSemanticError_MultiplePaymentSecrets,
340    /**
341     * The invoice's features are invalid
342     */
343    LDKSemanticError_InvalidFeatures,
344    /**
345     * The recovery id doesn't fit the signature/pub key
346     */
347    LDKSemanticError_InvalidRecoveryId,
348    /**
349     * The invoice's signature is invalid
350     */
351    LDKSemanticError_InvalidSignature,
352    /**
353     * The invoice's amount was not a whole number of millisatoshis
354     */
355    LDKSemanticError_ImpreciseAmount,
356    /**
357     * Must be last for serialization purposes
358     */
359    LDKSemanticError_Sentinel,
360 } LDKSemanticError;
361
362 /**
363  * SI prefixes for the human readable part
364  */
365 typedef enum LDKSiPrefix {
366    /**
367     * 10^-3
368     */
369    LDKSiPrefix_Milli,
370    /**
371     * 10^-6
372     */
373    LDKSiPrefix_Micro,
374    /**
375     * 10^-9
376     */
377    LDKSiPrefix_Nano,
378    /**
379     * 10^-12
380     */
381    LDKSiPrefix_Pico,
382    /**
383     * Must be last for serialization purposes
384     */
385    LDKSiPrefix_Sentinel,
386 } LDKSiPrefix;
387
388 /**
389  * A Rust str object, ie a reference to a UTF8-valid string.
390  * This is *not* null-terminated so cannot be used directly as a C string!
391  */
392 typedef struct LDKStr {
393    /**
394     * A pointer to the string's bytes, in UTF8 encoding
395     */
396    const uint8_t *chars;
397    /**
398     * The number of bytes (not characters!) pointed to by `chars`
399     */
400    uintptr_t len;
401    /**
402     * Whether the data pointed to by `chars` should be freed or not.
403     */
404    bool chars_is_owned;
405 } LDKStr;
406
407 /**
408  * A serialized transaction, in (pointer, length) form.
409  *
410  * This type optionally owns its own memory, and thus the semantics around access change based on
411  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
412  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
413  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
414  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
415  * you would be invalid.
416  *
417  * Note that, while it may change in the future, because transactions on the Rust side are stored
418  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
419  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
420  * `data_is_owned` either set or unset at your discretion.
421  */
422 typedef struct LDKTransaction {
423    /**
424     * The serialized transaction data.
425     *
426     * This is non-const for your convenience, an object passed to Rust is never written to.
427     */
428    uint8_t *data;
429    /**
430     * The length of the serialized transaction
431     */
432    uintptr_t datalen;
433    /**
434     * Whether the data pointed to by `data` should be freed or not.
435     */
436    bool data_is_owned;
437 } LDKTransaction;
438
439 /**
440  * A dynamically-allocated array of u8s of arbitrary size.
441  * This corresponds to std::vector in C++
442  */
443 typedef struct LDKCVec_u8Z {
444    /**
445     * The elements in the array.
446     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
447     */
448    uint8_t *data;
449    /**
450     * The number of elements pointed to by `data`.
451     */
452    uintptr_t datalen;
453 } LDKCVec_u8Z;
454
455 /**
456  * A transaction output including a scriptPubKey and value.
457  * This type *does* own its own memory, so must be free'd appropriately.
458  */
459 typedef struct LDKTxOut {
460    /**
461     * The script_pubkey in this output
462     */
463    struct LDKCVec_u8Z script_pubkey;
464    /**
465     * The value, in satoshis, of this output
466     */
467    uint64_t value;
468 } LDKTxOut;
469
470 /**
471  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
472  */
473 typedef struct LDKSecretKey {
474    /**
475     * The bytes of the secret key
476     */
477    uint8_t bytes[32];
478 } LDKSecretKey;
479
480 /**
481  * The contents of CResult_SecretKeyErrorZ
482  */
483 typedef union LDKCResult_SecretKeyErrorZPtr {
484    /**
485     * A pointer to the contents in the success state.
486     * Reading from this pointer when `result_ok` is not set is undefined.
487     */
488    struct LDKSecretKey *result;
489    /**
490     * A pointer to the contents in the error state.
491     * Reading from this pointer when `result_ok` is set is undefined.
492     */
493    enum LDKSecp256k1Error *err;
494 } LDKCResult_SecretKeyErrorZPtr;
495
496 /**
497  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
498  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
499  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
500  */
501 typedef struct LDKCResult_SecretKeyErrorZ {
502    /**
503     * The contents of this CResult_SecretKeyErrorZ, accessible via either
504     * `err` or `result` depending on the state of `result_ok`.
505     */
506    union LDKCResult_SecretKeyErrorZPtr contents;
507    /**
508     * Whether this CResult_SecretKeyErrorZ represents a success state.
509     */
510    bool result_ok;
511 } LDKCResult_SecretKeyErrorZ;
512
513 /**
514  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
515  */
516 typedef struct LDKPublicKey {
517    /**
518     * The bytes of the public key
519     */
520    uint8_t compressed_form[33];
521 } LDKPublicKey;
522
523 /**
524  * The contents of CResult_PublicKeyErrorZ
525  */
526 typedef union LDKCResult_PublicKeyErrorZPtr {
527    /**
528     * A pointer to the contents in the success state.
529     * Reading from this pointer when `result_ok` is not set is undefined.
530     */
531    struct LDKPublicKey *result;
532    /**
533     * A pointer to the contents in the error state.
534     * Reading from this pointer when `result_ok` is set is undefined.
535     */
536    enum LDKSecp256k1Error *err;
537 } LDKCResult_PublicKeyErrorZPtr;
538
539 /**
540  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
541  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
543  */
544 typedef struct LDKCResult_PublicKeyErrorZ {
545    /**
546     * The contents of this CResult_PublicKeyErrorZ, accessible via either
547     * `err` or `result` depending on the state of `result_ok`.
548     */
549    union LDKCResult_PublicKeyErrorZPtr contents;
550    /**
551     * Whether this CResult_PublicKeyErrorZ represents a success state.
552     */
553    bool result_ok;
554 } LDKCResult_PublicKeyErrorZ;
555
556
557
558 /**
559  * The set of public keys which are used in the creation of one commitment transaction.
560  * These are derived from the channel base keys and per-commitment data.
561  *
562  * A broadcaster key is provided from potential broadcaster of the computed transaction.
563  * A countersignatory key is coming from a protocol participant unable to broadcast the
564  * transaction.
565  *
566  * These keys are assumed to be good, either because the code derived them from
567  * channel basepoints via the new function, or they were obtained via
568  * CommitmentTransaction.trust().keys() because we trusted the source of the
569  * pre-calculated keys.
570  */
571 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
572    /**
573     * A pointer to the opaque Rust object.
574     * Nearly everywhere, inner must be non-null, however in places where
575     * the Rust equivalent takes an Option, it may be set to null to indicate None.
576     */
577    LDKnativeTxCreationKeys *inner;
578    /**
579     * Indicates that this is the only struct which contains the same pointer.
580     * Rust functions which take ownership of an object provided via an argument require
581     * this to be true and invalidate the object pointed to by inner.
582     */
583    bool is_owned;
584 } LDKTxCreationKeys;
585
586
587
588 /**
589  * An error in decoding a message or struct.
590  */
591 typedef struct MUST_USE_STRUCT LDKDecodeError {
592    /**
593     * A pointer to the opaque Rust object.
594     * Nearly everywhere, inner must be non-null, however in places where
595     * the Rust equivalent takes an Option, it may be set to null to indicate None.
596     */
597    LDKnativeDecodeError *inner;
598    /**
599     * Indicates that this is the only struct which contains the same pointer.
600     * Rust functions which take ownership of an object provided via an argument require
601     * this to be true and invalidate the object pointed to by inner.
602     */
603    bool is_owned;
604 } LDKDecodeError;
605
606 /**
607  * The contents of CResult_TxCreationKeysDecodeErrorZ
608  */
609 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
610    /**
611     * A pointer to the contents in the success state.
612     * Reading from this pointer when `result_ok` is not set is undefined.
613     */
614    struct LDKTxCreationKeys *result;
615    /**
616     * A pointer to the contents in the error state.
617     * Reading from this pointer when `result_ok` is set is undefined.
618     */
619    struct LDKDecodeError *err;
620 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
621
622 /**
623  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
624  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
625  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
626  */
627 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
628    /**
629     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
630     * `err` or `result` depending on the state of `result_ok`.
631     */
632    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
633    /**
634     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
635     */
636    bool result_ok;
637 } LDKCResult_TxCreationKeysDecodeErrorZ;
638
639
640
641 /**
642  * One counterparty's public keys which do not change over the life of a channel.
643  */
644 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
645    /**
646     * A pointer to the opaque Rust object.
647     * Nearly everywhere, inner must be non-null, however in places where
648     * the Rust equivalent takes an Option, it may be set to null to indicate None.
649     */
650    LDKnativeChannelPublicKeys *inner;
651    /**
652     * Indicates that this is the only struct which contains the same pointer.
653     * Rust functions which take ownership of an object provided via an argument require
654     * this to be true and invalidate the object pointed to by inner.
655     */
656    bool is_owned;
657 } LDKChannelPublicKeys;
658
659 /**
660  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
661  */
662 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
663    /**
664     * A pointer to the contents in the success state.
665     * Reading from this pointer when `result_ok` is not set is undefined.
666     */
667    struct LDKChannelPublicKeys *result;
668    /**
669     * A pointer to the contents in the error state.
670     * Reading from this pointer when `result_ok` is set is undefined.
671     */
672    struct LDKDecodeError *err;
673 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
674
675 /**
676  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
677  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
679  */
680 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
681    /**
682     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
683     * `err` or `result` depending on the state of `result_ok`.
684     */
685    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
686    /**
687     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
688     */
689    bool result_ok;
690 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
691
692 /**
693  * The contents of CResult_TxCreationKeysErrorZ
694  */
695 typedef union LDKCResult_TxCreationKeysErrorZPtr {
696    /**
697     * A pointer to the contents in the success state.
698     * Reading from this pointer when `result_ok` is not set is undefined.
699     */
700    struct LDKTxCreationKeys *result;
701    /**
702     * A pointer to the contents in the error state.
703     * Reading from this pointer when `result_ok` is set is undefined.
704     */
705    enum LDKSecp256k1Error *err;
706 } LDKCResult_TxCreationKeysErrorZPtr;
707
708 /**
709  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
710  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
712  */
713 typedef struct LDKCResult_TxCreationKeysErrorZ {
714    /**
715     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
716     * `err` or `result` depending on the state of `result_ok`.
717     */
718    union LDKCResult_TxCreationKeysErrorZPtr contents;
719    /**
720     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
721     */
722    bool result_ok;
723 } LDKCResult_TxCreationKeysErrorZ;
724
725 /**
726  * An enum which can either contain a u32 or not
727  */
728 typedef enum LDKCOption_u32Z_Tag {
729    /**
730     * When we're in this state, this COption_u32Z contains a u32
731     */
732    LDKCOption_u32Z_Some,
733    /**
734     * When we're in this state, this COption_u32Z contains nothing
735     */
736    LDKCOption_u32Z_None,
737    /**
738     * Must be last for serialization purposes
739     */
740    LDKCOption_u32Z_Sentinel,
741 } LDKCOption_u32Z_Tag;
742
743 typedef struct LDKCOption_u32Z {
744    LDKCOption_u32Z_Tag tag;
745    union {
746       struct {
747          uint32_t some;
748       };
749    };
750 } LDKCOption_u32Z;
751
752
753
754 /**
755  * Information about an HTLC as it appears in a commitment transaction
756  */
757 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
758    /**
759     * A pointer to the opaque Rust object.
760     * Nearly everywhere, inner must be non-null, however in places where
761     * the Rust equivalent takes an Option, it may be set to null to indicate None.
762     */
763    LDKnativeHTLCOutputInCommitment *inner;
764    /**
765     * Indicates that this is the only struct which contains the same pointer.
766     * Rust functions which take ownership of an object provided via an argument require
767     * this to be true and invalidate the object pointed to by inner.
768     */
769    bool is_owned;
770 } LDKHTLCOutputInCommitment;
771
772 /**
773  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
774  */
775 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
776    /**
777     * A pointer to the contents in the success state.
778     * Reading from this pointer when `result_ok` is not set is undefined.
779     */
780    struct LDKHTLCOutputInCommitment *result;
781    /**
782     * A pointer to the contents in the error state.
783     * Reading from this pointer when `result_ok` is set is undefined.
784     */
785    struct LDKDecodeError *err;
786 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
787
788 /**
789  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
790  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
791  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
792  */
793 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
794    /**
795     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
796     * `err` or `result` depending on the state of `result_ok`.
797     */
798    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
799    /**
800     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
801     */
802    bool result_ok;
803 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
804
805
806
807 /**
808  * Late-bound per-channel counterparty data used to build transactions.
809  */
810 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
811    /**
812     * A pointer to the opaque Rust object.
813     * Nearly everywhere, inner must be non-null, however in places where
814     * the Rust equivalent takes an Option, it may be set to null to indicate None.
815     */
816    LDKnativeCounterpartyChannelTransactionParameters *inner;
817    /**
818     * Indicates that this is the only struct which contains the same pointer.
819     * Rust functions which take ownership of an object provided via an argument require
820     * this to be true and invalidate the object pointed to by inner.
821     */
822    bool is_owned;
823 } LDKCounterpartyChannelTransactionParameters;
824
825 /**
826  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
827  */
828 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
829    /**
830     * A pointer to the contents in the success state.
831     * Reading from this pointer when `result_ok` is not set is undefined.
832     */
833    struct LDKCounterpartyChannelTransactionParameters *result;
834    /**
835     * A pointer to the contents in the error state.
836     * Reading from this pointer when `result_ok` is set is undefined.
837     */
838    struct LDKDecodeError *err;
839 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
840
841 /**
842  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
843  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
844  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
845  */
846 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
847    /**
848     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
849     * `err` or `result` depending on the state of `result_ok`.
850     */
851    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
852    /**
853     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
854     */
855    bool result_ok;
856 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
857
858
859
860 /**
861  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
862  * The fields are organized by holder/counterparty.
863  *
864  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
865  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
866  */
867 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
868    /**
869     * A pointer to the opaque Rust object.
870     * Nearly everywhere, inner must be non-null, however in places where
871     * the Rust equivalent takes an Option, it may be set to null to indicate None.
872     */
873    LDKnativeChannelTransactionParameters *inner;
874    /**
875     * Indicates that this is the only struct which contains the same pointer.
876     * Rust functions which take ownership of an object provided via an argument require
877     * this to be true and invalidate the object pointed to by inner.
878     */
879    bool is_owned;
880 } LDKChannelTransactionParameters;
881
882 /**
883  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
884  */
885 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
886    /**
887     * A pointer to the contents in the success state.
888     * Reading from this pointer when `result_ok` is not set is undefined.
889     */
890    struct LDKChannelTransactionParameters *result;
891    /**
892     * A pointer to the contents in the error state.
893     * Reading from this pointer when `result_ok` is set is undefined.
894     */
895    struct LDKDecodeError *err;
896 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
897
898 /**
899  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
900  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
901  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
902  */
903 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
904    /**
905     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
906     * `err` or `result` depending on the state of `result_ok`.
907     */
908    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
909    /**
910     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
911     */
912    bool result_ok;
913 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
914
915 /**
916  * Represents a secp256k1 signature serialized as two 32-byte numbers
917  */
918 typedef struct LDKSignature {
919    /**
920     * The bytes of the signature in "compact" form
921     */
922    uint8_t compact_form[64];
923 } LDKSignature;
924
925 /**
926  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
927  * This corresponds to std::vector in C++
928  */
929 typedef struct LDKCVec_SignatureZ {
930    /**
931     * The elements in the array.
932     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
933     */
934    struct LDKSignature *data;
935    /**
936     * The number of elements pointed to by `data`.
937     */
938    uintptr_t datalen;
939 } LDKCVec_SignatureZ;
940
941
942
943 /**
944  * Information needed to build and sign a holder's commitment transaction.
945  *
946  * The transaction is only signed once we are ready to broadcast.
947  */
948 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
949    /**
950     * A pointer to the opaque Rust object.
951     * Nearly everywhere, inner must be non-null, however in places where
952     * the Rust equivalent takes an Option, it may be set to null to indicate None.
953     */
954    LDKnativeHolderCommitmentTransaction *inner;
955    /**
956     * Indicates that this is the only struct which contains the same pointer.
957     * Rust functions which take ownership of an object provided via an argument require
958     * this to be true and invalidate the object pointed to by inner.
959     */
960    bool is_owned;
961 } LDKHolderCommitmentTransaction;
962
963 /**
964  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
965  */
966 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
967    /**
968     * A pointer to the contents in the success state.
969     * Reading from this pointer when `result_ok` is not set is undefined.
970     */
971    struct LDKHolderCommitmentTransaction *result;
972    /**
973     * A pointer to the contents in the error state.
974     * Reading from this pointer when `result_ok` is set is undefined.
975     */
976    struct LDKDecodeError *err;
977 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
978
979 /**
980  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
981  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
982  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
983  */
984 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
985    /**
986     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
987     * `err` or `result` depending on the state of `result_ok`.
988     */
989    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
990    /**
991     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
992     */
993    bool result_ok;
994 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
995
996
997
998 /**
999  * A pre-built Bitcoin commitment transaction and its txid.
1000  */
1001 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1002    /**
1003     * A pointer to the opaque Rust object.
1004     * Nearly everywhere, inner must be non-null, however in places where
1005     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1006     */
1007    LDKnativeBuiltCommitmentTransaction *inner;
1008    /**
1009     * Indicates that this is the only struct which contains the same pointer.
1010     * Rust functions which take ownership of an object provided via an argument require
1011     * this to be true and invalidate the object pointed to by inner.
1012     */
1013    bool is_owned;
1014 } LDKBuiltCommitmentTransaction;
1015
1016 /**
1017  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1018  */
1019 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1020    /**
1021     * A pointer to the contents in the success state.
1022     * Reading from this pointer when `result_ok` is not set is undefined.
1023     */
1024    struct LDKBuiltCommitmentTransaction *result;
1025    /**
1026     * A pointer to the contents in the error state.
1027     * Reading from this pointer when `result_ok` is set is undefined.
1028     */
1029    struct LDKDecodeError *err;
1030 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1031
1032 /**
1033  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1034  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1036  */
1037 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1038    /**
1039     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1040     * `err` or `result` depending on the state of `result_ok`.
1041     */
1042    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1043    /**
1044     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1045     */
1046    bool result_ok;
1047 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1048
1049
1050
1051 /**
1052  * A wrapper on ClosingTransaction indicating that the built bitcoin
1053  * transaction is trusted.
1054  *
1055  * See trust() and verify() functions on CommitmentTransaction.
1056  *
1057  * This structure implements Deref.
1058  */
1059 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1060    /**
1061     * A pointer to the opaque Rust object.
1062     * Nearly everywhere, inner must be non-null, however in places where
1063     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1064     */
1065    LDKnativeTrustedClosingTransaction *inner;
1066    /**
1067     * Indicates that this is the only struct which contains the same pointer.
1068     * Rust functions which take ownership of an object provided via an argument require
1069     * this to be true and invalidate the object pointed to by inner.
1070     */
1071    bool is_owned;
1072 } LDKTrustedClosingTransaction;
1073
1074 /**
1075  * The contents of CResult_TrustedClosingTransactionNoneZ
1076  */
1077 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1078    /**
1079     * A pointer to the contents in the success state.
1080     * Reading from this pointer when `result_ok` is not set is undefined.
1081     */
1082    struct LDKTrustedClosingTransaction *result;
1083    /**
1084     * Note that this value is always NULL, as there are no contents in the Err variant
1085     */
1086    void *err;
1087 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1088
1089 /**
1090  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1091  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1093  */
1094 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1095    /**
1096     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1097     * `err` or `result` depending on the state of `result_ok`.
1098     */
1099    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1100    /**
1101     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1102     */
1103    bool result_ok;
1104 } LDKCResult_TrustedClosingTransactionNoneZ;
1105
1106
1107
1108 /**
1109  * This class tracks the per-transaction information needed to build a commitment transaction and will
1110  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1111  * and for transactions we sign for the counterparty.
1112  *
1113  * This class can be used inside a signer implementation to generate a signature given the relevant
1114  * secret key.
1115  */
1116 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1117    /**
1118     * A pointer to the opaque Rust object.
1119     * Nearly everywhere, inner must be non-null, however in places where
1120     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1121     */
1122    LDKnativeCommitmentTransaction *inner;
1123    /**
1124     * Indicates that this is the only struct which contains the same pointer.
1125     * Rust functions which take ownership of an object provided via an argument require
1126     * this to be true and invalidate the object pointed to by inner.
1127     */
1128    bool is_owned;
1129 } LDKCommitmentTransaction;
1130
1131 /**
1132  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1133  */
1134 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1135    /**
1136     * A pointer to the contents in the success state.
1137     * Reading from this pointer when `result_ok` is not set is undefined.
1138     */
1139    struct LDKCommitmentTransaction *result;
1140    /**
1141     * A pointer to the contents in the error state.
1142     * Reading from this pointer when `result_ok` is set is undefined.
1143     */
1144    struct LDKDecodeError *err;
1145 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1146
1147 /**
1148  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1149  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1150  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151  */
1152 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1153    /**
1154     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1155     * `err` or `result` depending on the state of `result_ok`.
1156     */
1157    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1158    /**
1159     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1160     */
1161    bool result_ok;
1162 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1163
1164
1165
1166 /**
1167  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1168  * transaction and the transaction creation keys) are trusted.
1169  *
1170  * See trust() and verify() functions on CommitmentTransaction.
1171  *
1172  * This structure implements Deref.
1173  */
1174 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1175    /**
1176     * A pointer to the opaque Rust object.
1177     * Nearly everywhere, inner must be non-null, however in places where
1178     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1179     */
1180    LDKnativeTrustedCommitmentTransaction *inner;
1181    /**
1182     * Indicates that this is the only struct which contains the same pointer.
1183     * Rust functions which take ownership of an object provided via an argument require
1184     * this to be true and invalidate the object pointed to by inner.
1185     */
1186    bool is_owned;
1187 } LDKTrustedCommitmentTransaction;
1188
1189 /**
1190  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1191  */
1192 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1193    /**
1194     * A pointer to the contents in the success state.
1195     * Reading from this pointer when `result_ok` is not set is undefined.
1196     */
1197    struct LDKTrustedCommitmentTransaction *result;
1198    /**
1199     * Note that this value is always NULL, as there are no contents in the Err variant
1200     */
1201    void *err;
1202 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1203
1204 /**
1205  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1206  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1207  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1208  */
1209 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1210    /**
1211     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1212     * `err` or `result` depending on the state of `result_ok`.
1213     */
1214    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1215    /**
1216     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1217     */
1218    bool result_ok;
1219 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1220
1221 /**
1222  * The contents of CResult_CVec_SignatureZNoneZ
1223  */
1224 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1225    /**
1226     * A pointer to the contents in the success state.
1227     * Reading from this pointer when `result_ok` is not set is undefined.
1228     */
1229    struct LDKCVec_SignatureZ *result;
1230    /**
1231     * Note that this value is always NULL, as there are no contents in the Err variant
1232     */
1233    void *err;
1234 } LDKCResult_CVec_SignatureZNoneZPtr;
1235
1236 /**
1237  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1238  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1239  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1240  */
1241 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1242    /**
1243     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1244     * `err` or `result` depending on the state of `result_ok`.
1245     */
1246    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1247    /**
1248     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1249     */
1250    bool result_ok;
1251 } LDKCResult_CVec_SignatureZNoneZ;
1252
1253
1254
1255 /**
1256  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1257  *
1258  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1259  */
1260 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1261    /**
1262     * A pointer to the opaque Rust object.
1263     * Nearly everywhere, inner must be non-null, however in places where
1264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1265     */
1266    LDKnativeShutdownScript *inner;
1267    /**
1268     * Indicates that this is the only struct which contains the same pointer.
1269     * Rust functions which take ownership of an object provided via an argument require
1270     * this to be true and invalidate the object pointed to by inner.
1271     */
1272    bool is_owned;
1273 } LDKShutdownScript;
1274
1275 /**
1276  * The contents of CResult_ShutdownScriptDecodeErrorZ
1277  */
1278 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1279    /**
1280     * A pointer to the contents in the success state.
1281     * Reading from this pointer when `result_ok` is not set is undefined.
1282     */
1283    struct LDKShutdownScript *result;
1284    /**
1285     * A pointer to the contents in the error state.
1286     * Reading from this pointer when `result_ok` is set is undefined.
1287     */
1288    struct LDKDecodeError *err;
1289 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1290
1291 /**
1292  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1293  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1294  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1295  */
1296 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1297    /**
1298     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1299     * `err` or `result` depending on the state of `result_ok`.
1300     */
1301    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1302    /**
1303     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1304     */
1305    bool result_ok;
1306 } LDKCResult_ShutdownScriptDecodeErrorZ;
1307
1308
1309
1310 /**
1311  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1312  */
1313 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1314    /**
1315     * A pointer to the opaque Rust object.
1316     * Nearly everywhere, inner must be non-null, however in places where
1317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1318     */
1319    LDKnativeInvalidShutdownScript *inner;
1320    /**
1321     * Indicates that this is the only struct which contains the same pointer.
1322     * Rust functions which take ownership of an object provided via an argument require
1323     * this to be true and invalidate the object pointed to by inner.
1324     */
1325    bool is_owned;
1326 } LDKInvalidShutdownScript;
1327
1328 /**
1329  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1330  */
1331 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1332    /**
1333     * A pointer to the contents in the success state.
1334     * Reading from this pointer when `result_ok` is not set is undefined.
1335     */
1336    struct LDKShutdownScript *result;
1337    /**
1338     * A pointer to the contents in the error state.
1339     * Reading from this pointer when `result_ok` is set is undefined.
1340     */
1341    struct LDKInvalidShutdownScript *err;
1342 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1343
1344 /**
1345  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1346  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1347  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1348  */
1349 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1350    /**
1351     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1352     * `err` or `result` depending on the state of `result_ok`.
1353     */
1354    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1355    /**
1356     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1357     */
1358    bool result_ok;
1359 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1360
1361 /**
1362  * The contents of CResult_NoneErrorZ
1363  */
1364 typedef union LDKCResult_NoneErrorZPtr {
1365    /**
1366     * Note that this value is always NULL, as there are no contents in the OK variant
1367     */
1368    void *result;
1369    /**
1370     * A pointer to the contents in the error state.
1371     * Reading from this pointer when `result_ok` is set is undefined.
1372     */
1373    enum LDKIOError *err;
1374 } LDKCResult_NoneErrorZPtr;
1375
1376 /**
1377  * A CResult_NoneErrorZ represents the result of a fallible operation,
1378  * containing a () on success and a crate::c_types::IOError on failure.
1379  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1380  */
1381 typedef struct LDKCResult_NoneErrorZ {
1382    /**
1383     * The contents of this CResult_NoneErrorZ, accessible via either
1384     * `err` or `result` depending on the state of `result_ok`.
1385     */
1386    union LDKCResult_NoneErrorZPtr contents;
1387    /**
1388     * Whether this CResult_NoneErrorZ represents a success state.
1389     */
1390    bool result_ok;
1391 } LDKCResult_NoneErrorZ;
1392
1393
1394
1395 /**
1396  * A hop in a route
1397  */
1398 typedef struct MUST_USE_STRUCT LDKRouteHop {
1399    /**
1400     * A pointer to the opaque Rust object.
1401     * Nearly everywhere, inner must be non-null, however in places where
1402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1403     */
1404    LDKnativeRouteHop *inner;
1405    /**
1406     * Indicates that this is the only struct which contains the same pointer.
1407     * Rust functions which take ownership of an object provided via an argument require
1408     * this to be true and invalidate the object pointed to by inner.
1409     */
1410    bool is_owned;
1411 } LDKRouteHop;
1412
1413 /**
1414  * The contents of CResult_RouteHopDecodeErrorZ
1415  */
1416 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1417    /**
1418     * A pointer to the contents in the success state.
1419     * Reading from this pointer when `result_ok` is not set is undefined.
1420     */
1421    struct LDKRouteHop *result;
1422    /**
1423     * A pointer to the contents in the error state.
1424     * Reading from this pointer when `result_ok` is set is undefined.
1425     */
1426    struct LDKDecodeError *err;
1427 } LDKCResult_RouteHopDecodeErrorZPtr;
1428
1429 /**
1430  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1431  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1432  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1433  */
1434 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1435    /**
1436     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1437     * `err` or `result` depending on the state of `result_ok`.
1438     */
1439    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1440    /**
1441     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1442     */
1443    bool result_ok;
1444 } LDKCResult_RouteHopDecodeErrorZ;
1445
1446 /**
1447  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1448  * This corresponds to std::vector in C++
1449  */
1450 typedef struct LDKCVec_RouteHopZ {
1451    /**
1452     * The elements in the array.
1453     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1454     */
1455    struct LDKRouteHop *data;
1456    /**
1457     * The number of elements pointed to by `data`.
1458     */
1459    uintptr_t datalen;
1460 } LDKCVec_RouteHopZ;
1461
1462 /**
1463  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1464  * This corresponds to std::vector in C++
1465  */
1466 typedef struct LDKCVec_CVec_RouteHopZZ {
1467    /**
1468     * The elements in the array.
1469     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1470     */
1471    struct LDKCVec_RouteHopZ *data;
1472    /**
1473     * The number of elements pointed to by `data`.
1474     */
1475    uintptr_t datalen;
1476 } LDKCVec_CVec_RouteHopZZ;
1477
1478
1479
1480 /**
1481  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1482  * it can take multiple paths. Each path is composed of one or more hops through the network.
1483  */
1484 typedef struct MUST_USE_STRUCT LDKRoute {
1485    /**
1486     * A pointer to the opaque Rust object.
1487     * Nearly everywhere, inner must be non-null, however in places where
1488     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1489     */
1490    LDKnativeRoute *inner;
1491    /**
1492     * Indicates that this is the only struct which contains the same pointer.
1493     * Rust functions which take ownership of an object provided via an argument require
1494     * this to be true and invalidate the object pointed to by inner.
1495     */
1496    bool is_owned;
1497 } LDKRoute;
1498
1499 /**
1500  * The contents of CResult_RouteDecodeErrorZ
1501  */
1502 typedef union LDKCResult_RouteDecodeErrorZPtr {
1503    /**
1504     * A pointer to the contents in the success state.
1505     * Reading from this pointer when `result_ok` is not set is undefined.
1506     */
1507    struct LDKRoute *result;
1508    /**
1509     * A pointer to the contents in the error state.
1510     * Reading from this pointer when `result_ok` is set is undefined.
1511     */
1512    struct LDKDecodeError *err;
1513 } LDKCResult_RouteDecodeErrorZPtr;
1514
1515 /**
1516  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1517  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1518  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1519  */
1520 typedef struct LDKCResult_RouteDecodeErrorZ {
1521    /**
1522     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1523     * `err` or `result` depending on the state of `result_ok`.
1524     */
1525    union LDKCResult_RouteDecodeErrorZPtr contents;
1526    /**
1527     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1528     */
1529    bool result_ok;
1530 } LDKCResult_RouteDecodeErrorZ;
1531
1532 /**
1533  * An enum which can either contain a u64 or not
1534  */
1535 typedef enum LDKCOption_u64Z_Tag {
1536    /**
1537     * When we're in this state, this COption_u64Z contains a u64
1538     */
1539    LDKCOption_u64Z_Some,
1540    /**
1541     * When we're in this state, this COption_u64Z contains nothing
1542     */
1543    LDKCOption_u64Z_None,
1544    /**
1545     * Must be last for serialization purposes
1546     */
1547    LDKCOption_u64Z_Sentinel,
1548 } LDKCOption_u64Z_Tag;
1549
1550 typedef struct LDKCOption_u64Z {
1551    LDKCOption_u64Z_Tag tag;
1552    union {
1553       struct {
1554          uint64_t some;
1555       };
1556    };
1557 } LDKCOption_u64Z;
1558
1559
1560
1561 /**
1562  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1563  */
1564 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1565    /**
1566     * A pointer to the opaque Rust object.
1567     * Nearly everywhere, inner must be non-null, however in places where
1568     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1569     */
1570    LDKnativeChannelDetails *inner;
1571    /**
1572     * Indicates that this is the only struct which contains the same pointer.
1573     * Rust functions which take ownership of an object provided via an argument require
1574     * this to be true and invalidate the object pointed to by inner.
1575     */
1576    bool is_owned;
1577 } LDKChannelDetails;
1578
1579 /**
1580  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1581  * This corresponds to std::vector in C++
1582  */
1583 typedef struct LDKCVec_ChannelDetailsZ {
1584    /**
1585     * The elements in the array.
1586     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1587     */
1588    struct LDKChannelDetails *data;
1589    /**
1590     * The number of elements pointed to by `data`.
1591     */
1592    uintptr_t datalen;
1593 } LDKCVec_ChannelDetailsZ;
1594
1595
1596
1597 /**
1598  * A list of hops along a payment path terminating with a channel to the recipient.
1599  */
1600 typedef struct MUST_USE_STRUCT LDKRouteHint {
1601    /**
1602     * A pointer to the opaque Rust object.
1603     * Nearly everywhere, inner must be non-null, however in places where
1604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1605     */
1606    LDKnativeRouteHint *inner;
1607    /**
1608     * Indicates that this is the only struct which contains the same pointer.
1609     * Rust functions which take ownership of an object provided via an argument require
1610     * this to be true and invalidate the object pointed to by inner.
1611     */
1612    bool is_owned;
1613 } LDKRouteHint;
1614
1615 /**
1616  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1617  * This corresponds to std::vector in C++
1618  */
1619 typedef struct LDKCVec_RouteHintZ {
1620    /**
1621     * The elements in the array.
1622     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1623     */
1624    struct LDKRouteHint *data;
1625    /**
1626     * The number of elements pointed to by `data`.
1627     */
1628    uintptr_t datalen;
1629 } LDKCVec_RouteHintZ;
1630
1631
1632
1633 /**
1634  * An Err type for failure to process messages.
1635  */
1636 typedef struct MUST_USE_STRUCT LDKLightningError {
1637    /**
1638     * A pointer to the opaque Rust object.
1639     * Nearly everywhere, inner must be non-null, however in places where
1640     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1641     */
1642    LDKnativeLightningError *inner;
1643    /**
1644     * Indicates that this is the only struct which contains the same pointer.
1645     * Rust functions which take ownership of an object provided via an argument require
1646     * this to be true and invalidate the object pointed to by inner.
1647     */
1648    bool is_owned;
1649 } LDKLightningError;
1650
1651 /**
1652  * The contents of CResult_RouteLightningErrorZ
1653  */
1654 typedef union LDKCResult_RouteLightningErrorZPtr {
1655    /**
1656     * A pointer to the contents in the success state.
1657     * Reading from this pointer when `result_ok` is not set is undefined.
1658     */
1659    struct LDKRoute *result;
1660    /**
1661     * A pointer to the contents in the error state.
1662     * Reading from this pointer when `result_ok` is set is undefined.
1663     */
1664    struct LDKLightningError *err;
1665 } LDKCResult_RouteLightningErrorZPtr;
1666
1667 /**
1668  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1669  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1670  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1671  */
1672 typedef struct LDKCResult_RouteLightningErrorZ {
1673    /**
1674     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1675     * `err` or `result` depending on the state of `result_ok`.
1676     */
1677    union LDKCResult_RouteLightningErrorZPtr contents;
1678    /**
1679     * Whether this CResult_RouteLightningErrorZ represents a success state.
1680     */
1681    bool result_ok;
1682 } LDKCResult_RouteLightningErrorZ;
1683
1684 /**
1685  * The contents of CResult_TxOutAccessErrorZ
1686  */
1687 typedef union LDKCResult_TxOutAccessErrorZPtr {
1688    /**
1689     * A pointer to the contents in the success state.
1690     * Reading from this pointer when `result_ok` is not set is undefined.
1691     */
1692    struct LDKTxOut *result;
1693    /**
1694     * A pointer to the contents in the error state.
1695     * Reading from this pointer when `result_ok` is set is undefined.
1696     */
1697    enum LDKAccessError *err;
1698 } LDKCResult_TxOutAccessErrorZPtr;
1699
1700 /**
1701  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1702  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1704  */
1705 typedef struct LDKCResult_TxOutAccessErrorZ {
1706    /**
1707     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1708     * `err` or `result` depending on the state of `result_ok`.
1709     */
1710    union LDKCResult_TxOutAccessErrorZPtr contents;
1711    /**
1712     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1713     */
1714    bool result_ok;
1715 } LDKCResult_TxOutAccessErrorZ;
1716
1717 /**
1718  * A tuple of 2 elements. See the individual fields for the types contained.
1719  */
1720 typedef struct LDKC2Tuple_usizeTransactionZ {
1721    /**
1722     * The element at position 0
1723     */
1724    uintptr_t a;
1725    /**
1726     * The element at position 1
1727     */
1728    struct LDKTransaction b;
1729 } LDKC2Tuple_usizeTransactionZ;
1730
1731 /**
1732  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1733  * This corresponds to std::vector in C++
1734  */
1735 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1736    /**
1737     * The elements in the array.
1738     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1739     */
1740    struct LDKC2Tuple_usizeTransactionZ *data;
1741    /**
1742     * The number of elements pointed to by `data`.
1743     */
1744    uintptr_t datalen;
1745 } LDKCVec_C2Tuple_usizeTransactionZZ;
1746
1747 /**
1748  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1749  * look up the corresponding function in rust-lightning's docs.
1750  */
1751 typedef struct LDKThirtyTwoBytes {
1752    /**
1753     * The thirty-two bytes
1754     */
1755    uint8_t data[32];
1756 } LDKThirtyTwoBytes;
1757
1758 /**
1759  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1760  * This corresponds to std::vector in C++
1761  */
1762 typedef struct LDKCVec_TxidZ {
1763    /**
1764     * The elements in the array.
1765     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1766     */
1767    struct LDKThirtyTwoBytes *data;
1768    /**
1769     * The number of elements pointed to by `data`.
1770     */
1771    uintptr_t datalen;
1772 } LDKCVec_TxidZ;
1773
1774 /**
1775  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1776  */
1777 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1778    /**
1779     * Note that this value is always NULL, as there are no contents in the OK variant
1780     */
1781    void *result;
1782    /**
1783     * A pointer to the contents in the error state.
1784     * Reading from this pointer when `result_ok` is set is undefined.
1785     */
1786    enum LDKChannelMonitorUpdateErr *err;
1787 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1788
1789 /**
1790  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1791  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1793  */
1794 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1795    /**
1796     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1797     * `err` or `result` depending on the state of `result_ok`.
1798     */
1799    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1800    /**
1801     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1802     */
1803    bool result_ok;
1804 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1805
1806
1807
1808 /**
1809  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1810  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1811  * preimage claim backward will lead to loss of funds.
1812  */
1813 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1814    /**
1815     * A pointer to the opaque Rust object.
1816     * Nearly everywhere, inner must be non-null, however in places where
1817     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1818     */
1819    LDKnativeHTLCUpdate *inner;
1820    /**
1821     * Indicates that this is the only struct which contains the same pointer.
1822     * Rust functions which take ownership of an object provided via an argument require
1823     * this to be true and invalidate the object pointed to by inner.
1824     */
1825    bool is_owned;
1826 } LDKHTLCUpdate;
1827
1828
1829
1830 /**
1831  * A reference to a transaction output.
1832  *
1833  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1834  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1835  */
1836 typedef struct MUST_USE_STRUCT LDKOutPoint {
1837    /**
1838     * A pointer to the opaque Rust object.
1839     * Nearly everywhere, inner must be non-null, however in places where
1840     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1841     */
1842    LDKnativeOutPoint *inner;
1843    /**
1844     * Indicates that this is the only struct which contains the same pointer.
1845     * Rust functions which take ownership of an object provided via an argument require
1846     * this to be true and invalidate the object pointed to by inner.
1847     */
1848    bool is_owned;
1849 } LDKOutPoint;
1850
1851 /**
1852  * An event to be processed by the ChannelManager.
1853  */
1854 typedef enum LDKMonitorEvent_Tag {
1855    /**
1856     * A monitor event containing an HTLCUpdate.
1857     */
1858    LDKMonitorEvent_HTLCEvent,
1859    /**
1860     * A monitor event that the Channel's commitment transaction was confirmed.
1861     */
1862    LDKMonitorEvent_CommitmentTxConfirmed,
1863    /**
1864     * Must be last for serialization purposes
1865     */
1866    LDKMonitorEvent_Sentinel,
1867 } LDKMonitorEvent_Tag;
1868
1869 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1870    LDKMonitorEvent_Tag tag;
1871    union {
1872       struct {
1873          struct LDKHTLCUpdate htlc_event;
1874       };
1875       struct {
1876          struct LDKOutPoint commitment_tx_confirmed;
1877       };
1878    };
1879 } LDKMonitorEvent;
1880
1881 /**
1882  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1883  * This corresponds to std::vector in C++
1884  */
1885 typedef struct LDKCVec_MonitorEventZ {
1886    /**
1887     * The elements in the array.
1888     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1889     */
1890    struct LDKMonitorEvent *data;
1891    /**
1892     * The number of elements pointed to by `data`.
1893     */
1894    uintptr_t datalen;
1895 } LDKCVec_MonitorEventZ;
1896
1897 /**
1898  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
1899  */
1900 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
1901    /**
1902     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
1903     */
1904    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
1905    /**
1906     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
1907     */
1908    LDKCOption_C2Tuple_usizeTransactionZZ_None,
1909    /**
1910     * Must be last for serialization purposes
1911     */
1912    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
1913 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
1914
1915 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
1916    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
1917    union {
1918       struct {
1919          struct LDKC2Tuple_usizeTransactionZ some;
1920       };
1921    };
1922 } LDKCOption_C2Tuple_usizeTransactionZZ;
1923
1924
1925
1926 /**
1927  * A channel_update message to be sent or received from a peer
1928  */
1929 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
1930    /**
1931     * A pointer to the opaque Rust object.
1932     * Nearly everywhere, inner must be non-null, however in places where
1933     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1934     */
1935    LDKnativeChannelUpdate *inner;
1936    /**
1937     * Indicates that this is the only struct which contains the same pointer.
1938     * Rust functions which take ownership of an object provided via an argument require
1939     * this to be true and invalidate the object pointed to by inner.
1940     */
1941    bool is_owned;
1942 } LDKChannelUpdate;
1943
1944 /**
1945  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
1946  * return packet by a node along the route. See [BOLT #4] for details.
1947  *
1948  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
1949  */
1950 typedef enum LDKNetworkUpdate_Tag {
1951    /**
1952     * An error indicating a `channel_update` messages should be applied via
1953     * [`NetworkGraph::update_channel`].
1954     */
1955    LDKNetworkUpdate_ChannelUpdateMessage,
1956    /**
1957     * An error indicating only that a channel has been closed, which should be applied via
1958     * [`NetworkGraph::close_channel_from_update`].
1959     */
1960    LDKNetworkUpdate_ChannelClosed,
1961    /**
1962     * An error indicating only that a node has failed, which should be applied via
1963     * [`NetworkGraph::fail_node`].
1964     */
1965    LDKNetworkUpdate_NodeFailure,
1966    /**
1967     * Must be last for serialization purposes
1968     */
1969    LDKNetworkUpdate_Sentinel,
1970 } LDKNetworkUpdate_Tag;
1971
1972 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
1973    /**
1974     * The update to apply via [`NetworkGraph::update_channel`].
1975     */
1976    struct LDKChannelUpdate msg;
1977 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
1978
1979 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
1980    /**
1981     * The short channel id of the closed channel.
1982     */
1983    uint64_t short_channel_id;
1984    /**
1985     * Whether the channel should be permanently removed or temporarily disabled until a new
1986     * `channel_update` message is received.
1987     */
1988    bool is_permanent;
1989 } LDKNetworkUpdate_LDKChannelClosed_Body;
1990
1991 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
1992    /**
1993     * The node id of the failed node.
1994     */
1995    struct LDKPublicKey node_id;
1996    /**
1997     * Whether the node should be permanently removed from consideration or can be restored
1998     * when a new `channel_update` message is received.
1999     */
2000    bool is_permanent;
2001 } LDKNetworkUpdate_LDKNodeFailure_Body;
2002
2003 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2004    LDKNetworkUpdate_Tag tag;
2005    union {
2006       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2007       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2008       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2009    };
2010 } LDKNetworkUpdate;
2011
2012 /**
2013  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2014  */
2015 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2016    /**
2017     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2018     */
2019    LDKCOption_NetworkUpdateZ_Some,
2020    /**
2021     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2022     */
2023    LDKCOption_NetworkUpdateZ_None,
2024    /**
2025     * Must be last for serialization purposes
2026     */
2027    LDKCOption_NetworkUpdateZ_Sentinel,
2028 } LDKCOption_NetworkUpdateZ_Tag;
2029
2030 typedef struct LDKCOption_NetworkUpdateZ {
2031    LDKCOption_NetworkUpdateZ_Tag tag;
2032    union {
2033       struct {
2034          struct LDKNetworkUpdate some;
2035       };
2036    };
2037 } LDKCOption_NetworkUpdateZ;
2038
2039
2040
2041 /**
2042  * Information about a spendable output to a P2WSH script. See
2043  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2044  */
2045 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2046    /**
2047     * A pointer to the opaque Rust object.
2048     * Nearly everywhere, inner must be non-null, however in places where
2049     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2050     */
2051    LDKnativeDelayedPaymentOutputDescriptor *inner;
2052    /**
2053     * Indicates that this is the only struct which contains the same pointer.
2054     * Rust functions which take ownership of an object provided via an argument require
2055     * this to be true and invalidate the object pointed to by inner.
2056     */
2057    bool is_owned;
2058 } LDKDelayedPaymentOutputDescriptor;
2059
2060
2061
2062 /**
2063  * Information about a spendable output to our \"payment key\". See
2064  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2065  */
2066 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2067    /**
2068     * A pointer to the opaque Rust object.
2069     * Nearly everywhere, inner must be non-null, however in places where
2070     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2071     */
2072    LDKnativeStaticPaymentOutputDescriptor *inner;
2073    /**
2074     * Indicates that this is the only struct which contains the same pointer.
2075     * Rust functions which take ownership of an object provided via an argument require
2076     * this to be true and invalidate the object pointed to by inner.
2077     */
2078    bool is_owned;
2079 } LDKStaticPaymentOutputDescriptor;
2080
2081 /**
2082  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2083  * claim at any point in the future) an event is generated which you must track and be able to
2084  * spend on-chain. The information needed to do this is provided in this enum, including the
2085  * outpoint describing which txid and output index is available, the full output which exists at
2086  * that txid/index, and any keys or other information required to sign.
2087  */
2088 typedef enum LDKSpendableOutputDescriptor_Tag {
2089    /**
2090     * An output to a script which was provided via KeysInterface directly, either from
2091     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2092     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2093     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2094     * on-chain using the payment preimage or after it has timed out.
2095     */
2096    LDKSpendableOutputDescriptor_StaticOutput,
2097    /**
2098     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2099     *
2100     * The witness in the spending input should be:
2101     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2102     *
2103     * Note that the nSequence field in the spending input must be set to to_self_delay
2104     * (which means the transaction is not broadcastable until at least to_self_delay
2105     * blocks after the outpoint confirms).
2106     *
2107     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2108     * it is an output from an old state which we broadcast (which should never happen).
2109     *
2110     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2111     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2112     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2113     * chan_utils::derive_private_key. The public key can be generated without the secret key
2114     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2115     * Sign::pubkeys().
2116     *
2117     * To derive the revocation_pubkey provided here (which is used in the witness
2118     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2119     * call to Sign::ready_channel) and the provided per_commitment point
2120     * to chan_utils::derive_public_revocation_key.
2121     *
2122     * The witness script which is hashed and included in the output script_pubkey may be
2123     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2124     * (derived as above), and the to_self_delay contained here to
2125     * chan_utils::get_revokeable_redeemscript.
2126     */
2127    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2128    /**
2129     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2130     * corresponds to the public key in Sign::pubkeys().payment_point).
2131     * The witness in the spending input, is, thus, simply:
2132     * <BIP 143 signature> <payment key>
2133     *
2134     * These are generally the result of our counterparty having broadcast the current state,
2135     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2136     */
2137    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2138    /**
2139     * Must be last for serialization purposes
2140     */
2141    LDKSpendableOutputDescriptor_Sentinel,
2142 } LDKSpendableOutputDescriptor_Tag;
2143
2144 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2145    /**
2146     * The outpoint which is spendable
2147     */
2148    struct LDKOutPoint outpoint;
2149    /**
2150     * The output which is referenced by the given outpoint.
2151     */
2152    struct LDKTxOut output;
2153 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2154
2155 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2156    LDKSpendableOutputDescriptor_Tag tag;
2157    union {
2158       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2159       struct {
2160          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2161       };
2162       struct {
2163          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2164       };
2165    };
2166 } LDKSpendableOutputDescriptor;
2167
2168 /**
2169  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2170  * This corresponds to std::vector in C++
2171  */
2172 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2173    /**
2174     * The elements in the array.
2175     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2176     */
2177    struct LDKSpendableOutputDescriptor *data;
2178    /**
2179     * The number of elements pointed to by `data`.
2180     */
2181    uintptr_t datalen;
2182 } LDKCVec_SpendableOutputDescriptorZ;
2183
2184
2185
2186 /**
2187  * An accept_channel message to be sent or received from a peer
2188  */
2189 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2190    /**
2191     * A pointer to the opaque Rust object.
2192     * Nearly everywhere, inner must be non-null, however in places where
2193     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2194     */
2195    LDKnativeAcceptChannel *inner;
2196    /**
2197     * Indicates that this is the only struct which contains the same pointer.
2198     * Rust functions which take ownership of an object provided via an argument require
2199     * this to be true and invalidate the object pointed to by inner.
2200     */
2201    bool is_owned;
2202 } LDKAcceptChannel;
2203
2204
2205
2206 /**
2207  * An open_channel message to be sent or received from a peer
2208  */
2209 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2210    /**
2211     * A pointer to the opaque Rust object.
2212     * Nearly everywhere, inner must be non-null, however in places where
2213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2214     */
2215    LDKnativeOpenChannel *inner;
2216    /**
2217     * Indicates that this is the only struct which contains the same pointer.
2218     * Rust functions which take ownership of an object provided via an argument require
2219     * this to be true and invalidate the object pointed to by inner.
2220     */
2221    bool is_owned;
2222 } LDKOpenChannel;
2223
2224
2225
2226 /**
2227  * A funding_created message to be sent or received from a peer
2228  */
2229 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2230    /**
2231     * A pointer to the opaque Rust object.
2232     * Nearly everywhere, inner must be non-null, however in places where
2233     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2234     */
2235    LDKnativeFundingCreated *inner;
2236    /**
2237     * Indicates that this is the only struct which contains the same pointer.
2238     * Rust functions which take ownership of an object provided via an argument require
2239     * this to be true and invalidate the object pointed to by inner.
2240     */
2241    bool is_owned;
2242 } LDKFundingCreated;
2243
2244
2245
2246 /**
2247  * A funding_signed message to be sent or received from a peer
2248  */
2249 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2250    /**
2251     * A pointer to the opaque Rust object.
2252     * Nearly everywhere, inner must be non-null, however in places where
2253     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2254     */
2255    LDKnativeFundingSigned *inner;
2256    /**
2257     * Indicates that this is the only struct which contains the same pointer.
2258     * Rust functions which take ownership of an object provided via an argument require
2259     * this to be true and invalidate the object pointed to by inner.
2260     */
2261    bool is_owned;
2262 } LDKFundingSigned;
2263
2264
2265
2266 /**
2267  * A funding_locked message to be sent or received from a peer
2268  */
2269 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2270    /**
2271     * A pointer to the opaque Rust object.
2272     * Nearly everywhere, inner must be non-null, however in places where
2273     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2274     */
2275    LDKnativeFundingLocked *inner;
2276    /**
2277     * Indicates that this is the only struct which contains the same pointer.
2278     * Rust functions which take ownership of an object provided via an argument require
2279     * this to be true and invalidate the object pointed to by inner.
2280     */
2281    bool is_owned;
2282 } LDKFundingLocked;
2283
2284
2285
2286 /**
2287  * An announcement_signatures message to be sent or received from a peer
2288  */
2289 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2290    /**
2291     * A pointer to the opaque Rust object.
2292     * Nearly everywhere, inner must be non-null, however in places where
2293     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2294     */
2295    LDKnativeAnnouncementSignatures *inner;
2296    /**
2297     * Indicates that this is the only struct which contains the same pointer.
2298     * Rust functions which take ownership of an object provided via an argument require
2299     * this to be true and invalidate the object pointed to by inner.
2300     */
2301    bool is_owned;
2302 } LDKAnnouncementSignatures;
2303
2304
2305
2306 /**
2307  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2308  * transaction updates if they were pending.
2309  */
2310 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2311    /**
2312     * A pointer to the opaque Rust object.
2313     * Nearly everywhere, inner must be non-null, however in places where
2314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2315     */
2316    LDKnativeCommitmentUpdate *inner;
2317    /**
2318     * Indicates that this is the only struct which contains the same pointer.
2319     * Rust functions which take ownership of an object provided via an argument require
2320     * this to be true and invalidate the object pointed to by inner.
2321     */
2322    bool is_owned;
2323 } LDKCommitmentUpdate;
2324
2325
2326
2327 /**
2328  * A revoke_and_ack message to be sent or received from a peer
2329  */
2330 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2331    /**
2332     * A pointer to the opaque Rust object.
2333     * Nearly everywhere, inner must be non-null, however in places where
2334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2335     */
2336    LDKnativeRevokeAndACK *inner;
2337    /**
2338     * Indicates that this is the only struct which contains the same pointer.
2339     * Rust functions which take ownership of an object provided via an argument require
2340     * this to be true and invalidate the object pointed to by inner.
2341     */
2342    bool is_owned;
2343 } LDKRevokeAndACK;
2344
2345
2346
2347 /**
2348  * A closing_signed message to be sent or received from a peer
2349  */
2350 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2351    /**
2352     * A pointer to the opaque Rust object.
2353     * Nearly everywhere, inner must be non-null, however in places where
2354     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2355     */
2356    LDKnativeClosingSigned *inner;
2357    /**
2358     * Indicates that this is the only struct which contains the same pointer.
2359     * Rust functions which take ownership of an object provided via an argument require
2360     * this to be true and invalidate the object pointed to by inner.
2361     */
2362    bool is_owned;
2363 } LDKClosingSigned;
2364
2365
2366
2367 /**
2368  * A shutdown message to be sent or received from a peer
2369  */
2370 typedef struct MUST_USE_STRUCT LDKShutdown {
2371    /**
2372     * A pointer to the opaque Rust object.
2373     * Nearly everywhere, inner must be non-null, however in places where
2374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2375     */
2376    LDKnativeShutdown *inner;
2377    /**
2378     * Indicates that this is the only struct which contains the same pointer.
2379     * Rust functions which take ownership of an object provided via an argument require
2380     * this to be true and invalidate the object pointed to by inner.
2381     */
2382    bool is_owned;
2383 } LDKShutdown;
2384
2385
2386
2387 /**
2388  * A channel_reestablish message to be sent or received from a peer
2389  */
2390 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2391    /**
2392     * A pointer to the opaque Rust object.
2393     * Nearly everywhere, inner must be non-null, however in places where
2394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2395     */
2396    LDKnativeChannelReestablish *inner;
2397    /**
2398     * Indicates that this is the only struct which contains the same pointer.
2399     * Rust functions which take ownership of an object provided via an argument require
2400     * this to be true and invalidate the object pointed to by inner.
2401     */
2402    bool is_owned;
2403 } LDKChannelReestablish;
2404
2405
2406
2407 /**
2408  * A channel_announcement message to be sent or received from a peer
2409  */
2410 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2411    /**
2412     * A pointer to the opaque Rust object.
2413     * Nearly everywhere, inner must be non-null, however in places where
2414     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2415     */
2416    LDKnativeChannelAnnouncement *inner;
2417    /**
2418     * Indicates that this is the only struct which contains the same pointer.
2419     * Rust functions which take ownership of an object provided via an argument require
2420     * this to be true and invalidate the object pointed to by inner.
2421     */
2422    bool is_owned;
2423 } LDKChannelAnnouncement;
2424
2425
2426
2427 /**
2428  * A node_announcement message to be sent or received from a peer
2429  */
2430 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2431    /**
2432     * A pointer to the opaque Rust object.
2433     * Nearly everywhere, inner must be non-null, however in places where
2434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2435     */
2436    LDKnativeNodeAnnouncement *inner;
2437    /**
2438     * Indicates that this is the only struct which contains the same pointer.
2439     * Rust functions which take ownership of an object provided via an argument require
2440     * this to be true and invalidate the object pointed to by inner.
2441     */
2442    bool is_owned;
2443 } LDKNodeAnnouncement;
2444
2445
2446
2447 /**
2448  * An error message to be sent or received from a peer
2449  */
2450 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2451    /**
2452     * A pointer to the opaque Rust object.
2453     * Nearly everywhere, inner must be non-null, however in places where
2454     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2455     */
2456    LDKnativeErrorMessage *inner;
2457    /**
2458     * Indicates that this is the only struct which contains the same pointer.
2459     * Rust functions which take ownership of an object provided via an argument require
2460     * this to be true and invalidate the object pointed to by inner.
2461     */
2462    bool is_owned;
2463 } LDKErrorMessage;
2464
2465 /**
2466  * Used to put an error message in a LightningError
2467  */
2468 typedef enum LDKErrorAction_Tag {
2469    /**
2470     * The peer took some action which made us think they were useless. Disconnect them.
2471     */
2472    LDKErrorAction_DisconnectPeer,
2473    /**
2474     * The peer did something harmless that we weren't able to process, just log and ignore
2475     */
2476    LDKErrorAction_IgnoreError,
2477    /**
2478     * The peer did something harmless that we weren't able to meaningfully process.
2479     * If the error is logged, log it at the given level.
2480     */
2481    LDKErrorAction_IgnoreAndLog,
2482    /**
2483     * The peer did something incorrect. Tell them.
2484     */
2485    LDKErrorAction_SendErrorMessage,
2486    /**
2487     * Must be last for serialization purposes
2488     */
2489    LDKErrorAction_Sentinel,
2490 } LDKErrorAction_Tag;
2491
2492 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2493    /**
2494     * An error message which we should make an effort to send before we disconnect.
2495     *
2496     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2497     */
2498    struct LDKErrorMessage msg;
2499 } LDKErrorAction_LDKDisconnectPeer_Body;
2500
2501 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2502    /**
2503     * The message to send.
2504     */
2505    struct LDKErrorMessage msg;
2506 } LDKErrorAction_LDKSendErrorMessage_Body;
2507
2508 typedef struct MUST_USE_STRUCT LDKErrorAction {
2509    LDKErrorAction_Tag tag;
2510    union {
2511       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2512       struct {
2513          enum LDKLevel ignore_and_log;
2514       };
2515       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2516    };
2517 } LDKErrorAction;
2518
2519
2520
2521 /**
2522  * A query_channel_range message is used to query a peer for channel
2523  * UTXOs in a range of blocks. The recipient of a query makes a best
2524  * effort to reply to the query using one or more reply_channel_range
2525  * messages.
2526  */
2527 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2528    /**
2529     * A pointer to the opaque Rust object.
2530     * Nearly everywhere, inner must be non-null, however in places where
2531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2532     */
2533    LDKnativeQueryChannelRange *inner;
2534    /**
2535     * Indicates that this is the only struct which contains the same pointer.
2536     * Rust functions which take ownership of an object provided via an argument require
2537     * this to be true and invalidate the object pointed to by inner.
2538     */
2539    bool is_owned;
2540 } LDKQueryChannelRange;
2541
2542
2543
2544 /**
2545  * A query_short_channel_ids message is used to query a peer for
2546  * routing gossip messages related to one or more short_channel_ids.
2547  * The query recipient will reply with the latest, if available,
2548  * channel_announcement, channel_update and node_announcement messages
2549  * it maintains for the requested short_channel_ids followed by a
2550  * reply_short_channel_ids_end message. The short_channel_ids sent in
2551  * this query are encoded. We only support encoding_type=0 uncompressed
2552  * serialization and do not support encoding_type=1 zlib serialization.
2553  */
2554 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2555    /**
2556     * A pointer to the opaque Rust object.
2557     * Nearly everywhere, inner must be non-null, however in places where
2558     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2559     */
2560    LDKnativeQueryShortChannelIds *inner;
2561    /**
2562     * Indicates that this is the only struct which contains the same pointer.
2563     * Rust functions which take ownership of an object provided via an argument require
2564     * this to be true and invalidate the object pointed to by inner.
2565     */
2566    bool is_owned;
2567 } LDKQueryShortChannelIds;
2568
2569
2570
2571 /**
2572  * A reply_channel_range message is a reply to a query_channel_range
2573  * message. Multiple reply_channel_range messages can be sent in reply
2574  * to a single query_channel_range message. The query recipient makes a
2575  * best effort to respond based on their local network view which may
2576  * not be a perfect view of the network. The short_channel_ids in the
2577  * reply are encoded. We only support encoding_type=0 uncompressed
2578  * serialization and do not support encoding_type=1 zlib serialization.
2579  */
2580 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2581    /**
2582     * A pointer to the opaque Rust object.
2583     * Nearly everywhere, inner must be non-null, however in places where
2584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2585     */
2586    LDKnativeReplyChannelRange *inner;
2587    /**
2588     * Indicates that this is the only struct which contains the same pointer.
2589     * Rust functions which take ownership of an object provided via an argument require
2590     * this to be true and invalidate the object pointed to by inner.
2591     */
2592    bool is_owned;
2593 } LDKReplyChannelRange;
2594
2595 /**
2596  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2597  * broadcast to most peers).
2598  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2599  */
2600 typedef enum LDKMessageSendEvent_Tag {
2601    /**
2602     * Used to indicate that we've accepted a channel open and should send the accept_channel
2603     * message provided to the given peer.
2604     */
2605    LDKMessageSendEvent_SendAcceptChannel,
2606    /**
2607     * Used to indicate that we've initiated a channel open and should send the open_channel
2608     * message provided to the given peer.
2609     */
2610    LDKMessageSendEvent_SendOpenChannel,
2611    /**
2612     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2613     */
2614    LDKMessageSendEvent_SendFundingCreated,
2615    /**
2616     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2617     */
2618    LDKMessageSendEvent_SendFundingSigned,
2619    /**
2620     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2621     */
2622    LDKMessageSendEvent_SendFundingLocked,
2623    /**
2624     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2625     */
2626    LDKMessageSendEvent_SendAnnouncementSignatures,
2627    /**
2628     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2629     * message should be sent to the peer with the given node_id.
2630     */
2631    LDKMessageSendEvent_UpdateHTLCs,
2632    /**
2633     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2634     */
2635    LDKMessageSendEvent_SendRevokeAndACK,
2636    /**
2637     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2638     */
2639    LDKMessageSendEvent_SendClosingSigned,
2640    /**
2641     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2642     */
2643    LDKMessageSendEvent_SendShutdown,
2644    /**
2645     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2646     */
2647    LDKMessageSendEvent_SendChannelReestablish,
2648    /**
2649     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2650     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2651     *
2652     * Note that after doing so, you very likely (unless you did so very recently) want to call
2653     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2654     * This ensures that any nodes which see our channel_announcement also have a relevant
2655     * node_announcement, including relevant feature flags which may be important for routing
2656     * through or to us.
2657     */
2658    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2659    /**
2660     * Used to indicate that a node_announcement should be broadcast to all peers.
2661     */
2662    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2663    /**
2664     * Used to indicate that a channel_update should be broadcast to all peers.
2665     */
2666    LDKMessageSendEvent_BroadcastChannelUpdate,
2667    /**
2668     * Used to indicate that a channel_update should be sent to a single peer.
2669     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
2670     * private channel and we shouldn't be informing all of our peers of channel parameters.
2671     */
2672    LDKMessageSendEvent_SendChannelUpdate,
2673    /**
2674     * Broadcast an error downstream to be handled
2675     */
2676    LDKMessageSendEvent_HandleError,
2677    /**
2678     * Query a peer for channels with funding transaction UTXOs in a block range.
2679     */
2680    LDKMessageSendEvent_SendChannelRangeQuery,
2681    /**
2682     * Request routing gossip messages from a peer for a list of channels identified by
2683     * their short_channel_ids.
2684     */
2685    LDKMessageSendEvent_SendShortIdsQuery,
2686    /**
2687     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2688     * emitted during processing of the query.
2689     */
2690    LDKMessageSendEvent_SendReplyChannelRange,
2691    /**
2692     * Must be last for serialization purposes
2693     */
2694    LDKMessageSendEvent_Sentinel,
2695 } LDKMessageSendEvent_Tag;
2696
2697 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2698    /**
2699     * The node_id of the node which should receive this message
2700     */
2701    struct LDKPublicKey node_id;
2702    /**
2703     * The message which should be sent.
2704     */
2705    struct LDKAcceptChannel msg;
2706 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2707
2708 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2709    /**
2710     * The node_id of the node which should receive this message
2711     */
2712    struct LDKPublicKey node_id;
2713    /**
2714     * The message which should be sent.
2715     */
2716    struct LDKOpenChannel msg;
2717 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2718
2719 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2720    /**
2721     * The node_id of the node which should receive this message
2722     */
2723    struct LDKPublicKey node_id;
2724    /**
2725     * The message which should be sent.
2726     */
2727    struct LDKFundingCreated msg;
2728 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2729
2730 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2731    /**
2732     * The node_id of the node which should receive this message
2733     */
2734    struct LDKPublicKey node_id;
2735    /**
2736     * The message which should be sent.
2737     */
2738    struct LDKFundingSigned msg;
2739 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2740
2741 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2742    /**
2743     * The node_id of the node which should receive these message(s)
2744     */
2745    struct LDKPublicKey node_id;
2746    /**
2747     * The funding_locked message which should be sent.
2748     */
2749    struct LDKFundingLocked msg;
2750 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2751
2752 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2753    /**
2754     * The node_id of the node which should receive these message(s)
2755     */
2756    struct LDKPublicKey node_id;
2757    /**
2758     * The announcement_signatures message which should be sent.
2759     */
2760    struct LDKAnnouncementSignatures msg;
2761 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2762
2763 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2764    /**
2765     * The node_id of the node which should receive these message(s)
2766     */
2767    struct LDKPublicKey node_id;
2768    /**
2769     * The update messages which should be sent. ALL messages in the struct should be sent!
2770     */
2771    struct LDKCommitmentUpdate updates;
2772 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2773
2774 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2775    /**
2776     * The node_id of the node which should receive this message
2777     */
2778    struct LDKPublicKey node_id;
2779    /**
2780     * The message which should be sent.
2781     */
2782    struct LDKRevokeAndACK msg;
2783 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2784
2785 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2786    /**
2787     * The node_id of the node which should receive this message
2788     */
2789    struct LDKPublicKey node_id;
2790    /**
2791     * The message which should be sent.
2792     */
2793    struct LDKClosingSigned msg;
2794 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2795
2796 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2797    /**
2798     * The node_id of the node which should receive this message
2799     */
2800    struct LDKPublicKey node_id;
2801    /**
2802     * The message which should be sent.
2803     */
2804    struct LDKShutdown msg;
2805 } LDKMessageSendEvent_LDKSendShutdown_Body;
2806
2807 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
2808    /**
2809     * The node_id of the node which should receive this message
2810     */
2811    struct LDKPublicKey node_id;
2812    /**
2813     * The message which should be sent.
2814     */
2815    struct LDKChannelReestablish msg;
2816 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2817
2818 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2819    /**
2820     * The channel_announcement which should be sent.
2821     */
2822    struct LDKChannelAnnouncement msg;
2823    /**
2824     * The followup channel_update which should be sent.
2825     */
2826    struct LDKChannelUpdate update_msg;
2827 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2828
2829 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2830    /**
2831     * The node_announcement which should be sent.
2832     */
2833    struct LDKNodeAnnouncement msg;
2834 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2835
2836 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2837    /**
2838     * The channel_update which should be sent.
2839     */
2840    struct LDKChannelUpdate msg;
2841 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2842
2843 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
2844    /**
2845     * The node_id of the node which should receive this message
2846     */
2847    struct LDKPublicKey node_id;
2848    /**
2849     * The channel_update which should be sent.
2850     */
2851    struct LDKChannelUpdate msg;
2852 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
2853
2854 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2855    /**
2856     * The node_id of the node which should receive this message
2857     */
2858    struct LDKPublicKey node_id;
2859    /**
2860     * The action which should be taken.
2861     */
2862    struct LDKErrorAction action;
2863 } LDKMessageSendEvent_LDKHandleError_Body;
2864
2865 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2866    /**
2867     * The node_id of this message recipient
2868     */
2869    struct LDKPublicKey node_id;
2870    /**
2871     * The query_channel_range which should be sent.
2872     */
2873    struct LDKQueryChannelRange msg;
2874 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2875
2876 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2877    /**
2878     * The node_id of this message recipient
2879     */
2880    struct LDKPublicKey node_id;
2881    /**
2882     * The query_short_channel_ids which should be sent.
2883     */
2884    struct LDKQueryShortChannelIds msg;
2885 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2886
2887 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
2888    /**
2889     * The node_id of this message recipient
2890     */
2891    struct LDKPublicKey node_id;
2892    /**
2893     * The reply_channel_range which should be sent.
2894     */
2895    struct LDKReplyChannelRange msg;
2896 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
2897
2898 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2899    LDKMessageSendEvent_Tag tag;
2900    union {
2901       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2902       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2903       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2904       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2905       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2906       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2907       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2908       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2909       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2910       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2911       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2912       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2913       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2914       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2915       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
2916       LDKMessageSendEvent_LDKHandleError_Body handle_error;
2917       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2918       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2919       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
2920    };
2921 } LDKMessageSendEvent;
2922
2923 /**
2924  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2925  * This corresponds to std::vector in C++
2926  */
2927 typedef struct LDKCVec_MessageSendEventZ {
2928    /**
2929     * The elements in the array.
2930     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2931     */
2932    struct LDKMessageSendEvent *data;
2933    /**
2934     * The number of elements pointed to by `data`.
2935     */
2936    uintptr_t datalen;
2937 } LDKCVec_MessageSendEventZ;
2938
2939
2940
2941 /**
2942  * Features used within an `init` message.
2943  */
2944 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2945    /**
2946     * A pointer to the opaque Rust object.
2947     * Nearly everywhere, inner must be non-null, however in places where
2948     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2949     */
2950    LDKnativeInitFeatures *inner;
2951    /**
2952     * Indicates that this is the only struct which contains the same pointer.
2953     * Rust functions which take ownership of an object provided via an argument require
2954     * this to be true and invalidate the object pointed to by inner.
2955     */
2956    bool is_owned;
2957 } LDKInitFeatures;
2958
2959 /**
2960  * The contents of CResult_InitFeaturesDecodeErrorZ
2961  */
2962 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2963    /**
2964     * A pointer to the contents in the success state.
2965     * Reading from this pointer when `result_ok` is not set is undefined.
2966     */
2967    struct LDKInitFeatures *result;
2968    /**
2969     * A pointer to the contents in the error state.
2970     * Reading from this pointer when `result_ok` is set is undefined.
2971     */
2972    struct LDKDecodeError *err;
2973 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2974
2975 /**
2976  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2977  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2978  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2979  */
2980 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2981    /**
2982     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2983     * `err` or `result` depending on the state of `result_ok`.
2984     */
2985    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2986    /**
2987     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2988     */
2989    bool result_ok;
2990 } LDKCResult_InitFeaturesDecodeErrorZ;
2991
2992
2993
2994 /**
2995  * Features used within a `node_announcement` message.
2996  */
2997 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2998    /**
2999     * A pointer to the opaque Rust object.
3000     * Nearly everywhere, inner must be non-null, however in places where
3001     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3002     */
3003    LDKnativeNodeFeatures *inner;
3004    /**
3005     * Indicates that this is the only struct which contains the same pointer.
3006     * Rust functions which take ownership of an object provided via an argument require
3007     * this to be true and invalidate the object pointed to by inner.
3008     */
3009    bool is_owned;
3010 } LDKNodeFeatures;
3011
3012 /**
3013  * The contents of CResult_NodeFeaturesDecodeErrorZ
3014  */
3015 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
3016    /**
3017     * A pointer to the contents in the success state.
3018     * Reading from this pointer when `result_ok` is not set is undefined.
3019     */
3020    struct LDKNodeFeatures *result;
3021    /**
3022     * A pointer to the contents in the error state.
3023     * Reading from this pointer when `result_ok` is set is undefined.
3024     */
3025    struct LDKDecodeError *err;
3026 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
3027
3028 /**
3029  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3030  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3031  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3032  */
3033 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
3034    /**
3035     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3036     * `err` or `result` depending on the state of `result_ok`.
3037     */
3038    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
3039    /**
3040     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3041     */
3042    bool result_ok;
3043 } LDKCResult_NodeFeaturesDecodeErrorZ;
3044
3045
3046
3047 /**
3048  * Features used within a `channel_announcement` message.
3049  */
3050 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3051    /**
3052     * A pointer to the opaque Rust object.
3053     * Nearly everywhere, inner must be non-null, however in places where
3054     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3055     */
3056    LDKnativeChannelFeatures *inner;
3057    /**
3058     * Indicates that this is the only struct which contains the same pointer.
3059     * Rust functions which take ownership of an object provided via an argument require
3060     * this to be true and invalidate the object pointed to by inner.
3061     */
3062    bool is_owned;
3063 } LDKChannelFeatures;
3064
3065 /**
3066  * The contents of CResult_ChannelFeaturesDecodeErrorZ
3067  */
3068 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
3069    /**
3070     * A pointer to the contents in the success state.
3071     * Reading from this pointer when `result_ok` is not set is undefined.
3072     */
3073    struct LDKChannelFeatures *result;
3074    /**
3075     * A pointer to the contents in the error state.
3076     * Reading from this pointer when `result_ok` is set is undefined.
3077     */
3078    struct LDKDecodeError *err;
3079 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
3080
3081 /**
3082  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3083  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3085  */
3086 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
3087    /**
3088     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3089     * `err` or `result` depending on the state of `result_ok`.
3090     */
3091    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
3092    /**
3093     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3094     */
3095    bool result_ok;
3096 } LDKCResult_ChannelFeaturesDecodeErrorZ;
3097
3098
3099
3100 /**
3101  * Features used within an invoice.
3102  */
3103 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
3104    /**
3105     * A pointer to the opaque Rust object.
3106     * Nearly everywhere, inner must be non-null, however in places where
3107     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3108     */
3109    LDKnativeInvoiceFeatures *inner;
3110    /**
3111     * Indicates that this is the only struct which contains the same pointer.
3112     * Rust functions which take ownership of an object provided via an argument require
3113     * this to be true and invalidate the object pointed to by inner.
3114     */
3115    bool is_owned;
3116 } LDKInvoiceFeatures;
3117
3118 /**
3119  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
3120  */
3121 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
3122    /**
3123     * A pointer to the contents in the success state.
3124     * Reading from this pointer when `result_ok` is not set is undefined.
3125     */
3126    struct LDKInvoiceFeatures *result;
3127    /**
3128     * A pointer to the contents in the error state.
3129     * Reading from this pointer when `result_ok` is set is undefined.
3130     */
3131    struct LDKDecodeError *err;
3132 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
3133
3134 /**
3135  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3136  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3137  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3138  */
3139 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
3140    /**
3141     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3142     * `err` or `result` depending on the state of `result_ok`.
3143     */
3144    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
3145    /**
3146     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3147     */
3148    bool result_ok;
3149 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
3150
3151 /**
3152  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3153  */
3154 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3155    /**
3156     * A pointer to the contents in the success state.
3157     * Reading from this pointer when `result_ok` is not set is undefined.
3158     */
3159    struct LDKDelayedPaymentOutputDescriptor *result;
3160    /**
3161     * A pointer to the contents in the error state.
3162     * Reading from this pointer when `result_ok` is set is undefined.
3163     */
3164    struct LDKDecodeError *err;
3165 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
3166
3167 /**
3168  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3169  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3171  */
3172 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3173    /**
3174     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3175     * `err` or `result` depending on the state of `result_ok`.
3176     */
3177    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
3178    /**
3179     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3180     */
3181    bool result_ok;
3182 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
3183
3184 /**
3185  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3186  */
3187 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3188    /**
3189     * A pointer to the contents in the success state.
3190     * Reading from this pointer when `result_ok` is not set is undefined.
3191     */
3192    struct LDKStaticPaymentOutputDescriptor *result;
3193    /**
3194     * A pointer to the contents in the error state.
3195     * Reading from this pointer when `result_ok` is set is undefined.
3196     */
3197    struct LDKDecodeError *err;
3198 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
3199
3200 /**
3201  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3202  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3204  */
3205 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3206    /**
3207     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3208     * `err` or `result` depending on the state of `result_ok`.
3209     */
3210    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
3211    /**
3212     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3213     */
3214    bool result_ok;
3215 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3216
3217 /**
3218  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3219  */
3220 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3221    /**
3222     * A pointer to the contents in the success state.
3223     * Reading from this pointer when `result_ok` is not set is undefined.
3224     */
3225    struct LDKSpendableOutputDescriptor *result;
3226    /**
3227     * A pointer to the contents in the error state.
3228     * Reading from this pointer when `result_ok` is set is undefined.
3229     */
3230    struct LDKDecodeError *err;
3231 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3232
3233 /**
3234  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3235  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3237  */
3238 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3239    /**
3240     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3241     * `err` or `result` depending on the state of `result_ok`.
3242     */
3243    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3244    /**
3245     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3246     */
3247    bool result_ok;
3248 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3249
3250 /**
3251  * The contents of CResult_NoneNoneZ
3252  */
3253 typedef union LDKCResult_NoneNoneZPtr {
3254    /**
3255     * Note that this value is always NULL, as there are no contents in the OK variant
3256     */
3257    void *result;
3258    /**
3259     * Note that this value is always NULL, as there are no contents in the Err variant
3260     */
3261    void *err;
3262 } LDKCResult_NoneNoneZPtr;
3263
3264 /**
3265  * A CResult_NoneNoneZ represents the result of a fallible operation,
3266  * containing a () on success and a () on failure.
3267  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3268  */
3269 typedef struct LDKCResult_NoneNoneZ {
3270    /**
3271     * The contents of this CResult_NoneNoneZ, accessible via either
3272     * `err` or `result` depending on the state of `result_ok`.
3273     */
3274    union LDKCResult_NoneNoneZPtr contents;
3275    /**
3276     * Whether this CResult_NoneNoneZ represents a success state.
3277     */
3278    bool result_ok;
3279 } LDKCResult_NoneNoneZ;
3280
3281 /**
3282  * A tuple of 2 elements. See the individual fields for the types contained.
3283  */
3284 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3285    /**
3286     * The element at position 0
3287     */
3288    struct LDKSignature a;
3289    /**
3290     * The element at position 1
3291     */
3292    struct LDKCVec_SignatureZ b;
3293 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3294
3295 /**
3296  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3297  */
3298 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3299    /**
3300     * A pointer to the contents in the success state.
3301     * Reading from this pointer when `result_ok` is not set is undefined.
3302     */
3303    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3304    /**
3305     * Note that this value is always NULL, as there are no contents in the Err variant
3306     */
3307    void *err;
3308 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3309
3310 /**
3311  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3312  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3313  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3314  */
3315 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3316    /**
3317     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3318     * `err` or `result` depending on the state of `result_ok`.
3319     */
3320    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3321    /**
3322     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3323     */
3324    bool result_ok;
3325 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3326
3327 /**
3328  * The contents of CResult_SignatureNoneZ
3329  */
3330 typedef union LDKCResult_SignatureNoneZPtr {
3331    /**
3332     * A pointer to the contents in the success state.
3333     * Reading from this pointer when `result_ok` is not set is undefined.
3334     */
3335    struct LDKSignature *result;
3336    /**
3337     * Note that this value is always NULL, as there are no contents in the Err variant
3338     */
3339    void *err;
3340 } LDKCResult_SignatureNoneZPtr;
3341
3342 /**
3343  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3344  * containing a crate::c_types::Signature on success and a () on failure.
3345  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3346  */
3347 typedef struct LDKCResult_SignatureNoneZ {
3348    /**
3349     * The contents of this CResult_SignatureNoneZ, accessible via either
3350     * `err` or `result` depending on the state of `result_ok`.
3351     */
3352    union LDKCResult_SignatureNoneZPtr contents;
3353    /**
3354     * Whether this CResult_SignatureNoneZ represents a success state.
3355     */
3356    bool result_ok;
3357 } LDKCResult_SignatureNoneZ;
3358
3359
3360
3361 /**
3362  * This class tracks the per-transaction information needed to build a closing transaction and will
3363  * actually build it and sign.
3364  *
3365  * This class can be used inside a signer implementation to generate a signature given the relevant
3366  * secret key.
3367  */
3368 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
3369    /**
3370     * A pointer to the opaque Rust object.
3371     * Nearly everywhere, inner must be non-null, however in places where
3372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3373     */
3374    LDKnativeClosingTransaction *inner;
3375    /**
3376     * Indicates that this is the only struct which contains the same pointer.
3377     * Rust functions which take ownership of an object provided via an argument require
3378     * this to be true and invalidate the object pointed to by inner.
3379     */
3380    bool is_owned;
3381 } LDKClosingTransaction;
3382
3383
3384
3385 /**
3386  * The unsigned part of a channel_announcement
3387  */
3388 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3389    /**
3390     * A pointer to the opaque Rust object.
3391     * Nearly everywhere, inner must be non-null, however in places where
3392     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3393     */
3394    LDKnativeUnsignedChannelAnnouncement *inner;
3395    /**
3396     * Indicates that this is the only struct which contains the same pointer.
3397     * Rust functions which take ownership of an object provided via an argument require
3398     * this to be true and invalidate the object pointed to by inner.
3399     */
3400    bool is_owned;
3401 } LDKUnsignedChannelAnnouncement;
3402
3403 /**
3404  * A trait to sign lightning channel transactions as described in BOLT 3.
3405  *
3406  * Signing services could be implemented on a hardware wallet. In this case,
3407  * the current Sign would be a front-end on top of a communication
3408  * channel connected to your secure device and lightning key material wouldn't
3409  * reside on a hot server. Nevertheless, a this deployment would still need
3410  * to trust the ChannelManager to avoid loss of funds as this latest component
3411  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3412  *
3413  * A more secure iteration would be to use hashlock (or payment points) to pair
3414  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3415  * at the price of more state and computation on the hardware wallet side. In the future,
3416  * we are looking forward to design such interface.
3417  *
3418  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3419  * to act, as liveness and breach reply correctness are always going to be hard requirements
3420  * of LN security model, orthogonal of key management issues.
3421  */
3422 typedef struct LDKBaseSign {
3423    /**
3424     * An opaque pointer which is passed to your function implementations as an argument.
3425     * This has no meaning in the LDK, and can be NULL or any other value.
3426     */
3427    void *this_arg;
3428    /**
3429     * Gets the per-commitment point for a specific commitment number
3430     *
3431     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3432     */
3433    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3434    /**
3435     * Gets the commitment secret for a specific commitment number as part of the revocation process
3436     *
3437     * An external signer implementation should error here if the commitment was already signed
3438     * and should refuse to sign it in the future.
3439     *
3440     * May be called more than once for the same index.
3441     *
3442     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3443     */
3444    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3445    /**
3446     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
3447     *
3448     * This is required in order for the signer to make sure that releasing a commitment
3449     * secret won't leave us without a broadcastable holder transaction.
3450     * Policy checks should be implemented in this function, including checking the amount
3451     * sent to us and checking the HTLCs.
3452     */
3453    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
3454    /**
3455     * Gets the holder's channel public keys and basepoints
3456     */
3457    struct LDKChannelPublicKeys pubkeys;
3458    /**
3459     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3460     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3461     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3462     */
3463    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3464    /**
3465     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3466     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3467     * Sign object uniquely and lookup or re-derive its keys.
3468     */
3469    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3470    /**
3471     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3472     *
3473     * Note that if signing fails or is rejected, the channel will be force-closed.
3474     *
3475     * Policy checks should be implemented in this function, including checking the amount
3476     * sent to us and checking the HTLCs.
3477     */
3478    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3479    /**
3480     * Validate the counterparty's revocation.
3481     *
3482     * This is required in order for the signer to make sure that the state has moved
3483     * forward and it is safe to sign the next counterparty commitment.
3484     */
3485    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
3486    /**
3487     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3488     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3489     * latest commitment_tx when we initiate a force-close.
3490     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3491     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3492     * the latest.
3493     * This may be called multiple times for the same transaction.
3494     *
3495     * An external signer implementation should check that the commitment has not been revoked.
3496     *
3497     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3498     */
3499    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3500    /**
3501     * Create a signature for the given input in a transaction spending an HTLC transaction output
3502     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3503     *
3504     * A justice transaction may claim multiple outputs at the same time if timelocks are
3505     * similar, but only a signature for the input at index `input` should be signed for here.
3506     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3507     * to an upcoming timelock expiration.
3508     *
3509     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3510     *
3511     * per_commitment_key is revocation secret which was provided by our counterparty when they
3512     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3513     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3514     * so).
3515     */
3516    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]);
3517    /**
3518     * Create a signature for the given input in a transaction spending a commitment transaction
3519     * HTLC output when our counterparty broadcasts an old state.
3520     *
3521     * A justice transaction may claim multiple outputs at the same time if timelocks are
3522     * similar, but only a signature for the input at index `input` should be signed for here.
3523     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3524     * to an upcoming timelock expiration.
3525     *
3526     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3527     *
3528     * per_commitment_key is revocation secret which was provided by our counterparty when they
3529     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3530     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3531     * so).
3532     *
3533     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3534     * (which is committed to in the BIP 143 signatures).
3535     */
3536    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);
3537    /**
3538     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3539     * transaction, either offered or received.
3540     *
3541     * Such a transaction may claim multiples offered outputs at same time if we know the
3542     * preimage for each when we create it, but only the input at index `input` should be
3543     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3544     * needed with regards to an upcoming timelock expiration.
3545     *
3546     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3547     * outputs.
3548     *
3549     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3550     *
3551     * Per_commitment_point is the dynamic point corresponding to the channel state
3552     * detected onchain. It has been generated by our counterparty and is used to derive
3553     * channel state keys, which are then included in the witness script and committed to in the
3554     * BIP 143 signature.
3555     */
3556    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);
3557    /**
3558     * Create a signature for a (proposed) closing transaction.
3559     *
3560     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3561     * chosen to forgo their output as dust.
3562     */
3563    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
3564    /**
3565     * Signs a channel announcement message with our funding key, proving it comes from one
3566     * of the channel participants.
3567     *
3568     * Note that if this fails or is rejected, the channel will not be publicly announced and
3569     * our counterparty may (though likely will not) close the channel on us for violating the
3570     * protocol.
3571     */
3572    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3573    /**
3574     * Set the counterparty static channel data, including basepoints,
3575     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3576     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3577     * they MUST NOT be allowed to change to different values once set.
3578     *
3579     * channel_parameters.is_populated() MUST be true.
3580     *
3581     * We bind holder_selected_contest_delay late here for API convenience.
3582     *
3583     * Will be called before any signatures are applied.
3584     */
3585    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3586    /**
3587     * Frees any resources associated with this object given its this_arg pointer.
3588     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3589     */
3590    void (*free)(void *this_arg);
3591 } LDKBaseSign;
3592
3593 /**
3594  * A cloneable signer.
3595  *
3596  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3597  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3598  * which implies Sized, into this derived trait.
3599  */
3600 typedef struct LDKSign {
3601    /**
3602     * An opaque pointer which is passed to your function implementations as an argument.
3603     * This has no meaning in the LDK, and can be NULL or any other value.
3604     */
3605    void *this_arg;
3606    /**
3607     * Implementation of BaseSign for this object.
3608     */
3609    struct LDKBaseSign BaseSign;
3610    /**
3611     * Serialize the object into a byte array
3612     */
3613    struct LDKCVec_u8Z (*write)(const void *this_arg);
3614    /**
3615     * Called, if set, after this Sign has been cloned into a duplicate object.
3616     * The new Sign is provided, and should be mutated as needed to perform a
3617     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3618     */
3619    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
3620    /**
3621     * Frees any resources associated with this object given its this_arg pointer.
3622     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3623     */
3624    void (*free)(void *this_arg);
3625 } LDKSign;
3626
3627 /**
3628  * The contents of CResult_SignDecodeErrorZ
3629  */
3630 typedef union LDKCResult_SignDecodeErrorZPtr {
3631    /**
3632     * A pointer to the contents in the success state.
3633     * Reading from this pointer when `result_ok` is not set is undefined.
3634     */
3635    struct LDKSign *result;
3636    /**
3637     * A pointer to the contents in the error state.
3638     * Reading from this pointer when `result_ok` is set is undefined.
3639     */
3640    struct LDKDecodeError *err;
3641 } LDKCResult_SignDecodeErrorZPtr;
3642
3643 /**
3644  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3645  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3647  */
3648 typedef struct LDKCResult_SignDecodeErrorZ {
3649    /**
3650     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3651     * `err` or `result` depending on the state of `result_ok`.
3652     */
3653    union LDKCResult_SignDecodeErrorZPtr contents;
3654    /**
3655     * Whether this CResult_SignDecodeErrorZ represents a success state.
3656     */
3657    bool result_ok;
3658 } LDKCResult_SignDecodeErrorZ;
3659
3660 /**
3661  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3662  * allows recovering the exact public key which created the signature given the message.
3663  */
3664 typedef struct LDKRecoverableSignature {
3665    /**
3666     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3667     * recovery.
3668     */
3669    uint8_t serialized_form[68];
3670 } LDKRecoverableSignature;
3671
3672 /**
3673  * The contents of CResult_RecoverableSignatureNoneZ
3674  */
3675 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3676    /**
3677     * A pointer to the contents in the success state.
3678     * Reading from this pointer when `result_ok` is not set is undefined.
3679     */
3680    struct LDKRecoverableSignature *result;
3681    /**
3682     * Note that this value is always NULL, as there are no contents in the Err variant
3683     */
3684    void *err;
3685 } LDKCResult_RecoverableSignatureNoneZPtr;
3686
3687 /**
3688  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3689  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3690  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3691  */
3692 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3693    /**
3694     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3695     * `err` or `result` depending on the state of `result_ok`.
3696     */
3697    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3698    /**
3699     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3700     */
3701    bool result_ok;
3702 } LDKCResult_RecoverableSignatureNoneZ;
3703
3704 /**
3705  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3706  * This corresponds to std::vector in C++
3707  */
3708 typedef struct LDKCVec_CVec_u8ZZ {
3709    /**
3710     * The elements in the array.
3711     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3712     */
3713    struct LDKCVec_u8Z *data;
3714    /**
3715     * The number of elements pointed to by `data`.
3716     */
3717    uintptr_t datalen;
3718 } LDKCVec_CVec_u8ZZ;
3719
3720 /**
3721  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3722  */
3723 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3724    /**
3725     * A pointer to the contents in the success state.
3726     * Reading from this pointer when `result_ok` is not set is undefined.
3727     */
3728    struct LDKCVec_CVec_u8ZZ *result;
3729    /**
3730     * Note that this value is always NULL, as there are no contents in the Err variant
3731     */
3732    void *err;
3733 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3734
3735 /**
3736  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3737  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3738  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3739  */
3740 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3741    /**
3742     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3743     * `err` or `result` depending on the state of `result_ok`.
3744     */
3745    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3746    /**
3747     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3748     */
3749    bool result_ok;
3750 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3751
3752
3753
3754 /**
3755  * A simple implementation of Sign that just keeps the private keys in memory.
3756  *
3757  * This implementation performs no policy checks and is insufficient by itself as
3758  * a secure external signer.
3759  */
3760 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3761    /**
3762     * A pointer to the opaque Rust object.
3763     * Nearly everywhere, inner must be non-null, however in places where
3764     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3765     */
3766    LDKnativeInMemorySigner *inner;
3767    /**
3768     * Indicates that this is the only struct which contains the same pointer.
3769     * Rust functions which take ownership of an object provided via an argument require
3770     * this to be true and invalidate the object pointed to by inner.
3771     */
3772    bool is_owned;
3773 } LDKInMemorySigner;
3774
3775 /**
3776  * The contents of CResult_InMemorySignerDecodeErrorZ
3777  */
3778 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3779    /**
3780     * A pointer to the contents in the success state.
3781     * Reading from this pointer when `result_ok` is not set is undefined.
3782     */
3783    struct LDKInMemorySigner *result;
3784    /**
3785     * A pointer to the contents in the error state.
3786     * Reading from this pointer when `result_ok` is set is undefined.
3787     */
3788    struct LDKDecodeError *err;
3789 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3790
3791 /**
3792  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3793  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3794  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3795  */
3796 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3797    /**
3798     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3799     * `err` or `result` depending on the state of `result_ok`.
3800     */
3801    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3802    /**
3803     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3804     */
3805    bool result_ok;
3806 } LDKCResult_InMemorySignerDecodeErrorZ;
3807
3808 /**
3809  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3810  * This corresponds to std::vector in C++
3811  */
3812 typedef struct LDKCVec_TxOutZ {
3813    /**
3814     * The elements in the array.
3815     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3816     */
3817    struct LDKTxOut *data;
3818    /**
3819     * The number of elements pointed to by `data`.
3820     */
3821    uintptr_t datalen;
3822 } LDKCVec_TxOutZ;
3823
3824 /**
3825  * The contents of CResult_TransactionNoneZ
3826  */
3827 typedef union LDKCResult_TransactionNoneZPtr {
3828    /**
3829     * A pointer to the contents in the success state.
3830     * Reading from this pointer when `result_ok` is not set is undefined.
3831     */
3832    struct LDKTransaction *result;
3833    /**
3834     * Note that this value is always NULL, as there are no contents in the Err variant
3835     */
3836    void *err;
3837 } LDKCResult_TransactionNoneZPtr;
3838
3839 /**
3840  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3841  * containing a crate::c_types::Transaction on success and a () on failure.
3842  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3843  */
3844 typedef struct LDKCResult_TransactionNoneZ {
3845    /**
3846     * The contents of this CResult_TransactionNoneZ, accessible via either
3847     * `err` or `result` depending on the state of `result_ok`.
3848     */
3849    union LDKCResult_TransactionNoneZPtr contents;
3850    /**
3851     * Whether this CResult_TransactionNoneZ represents a success state.
3852     */
3853    bool result_ok;
3854 } LDKCResult_TransactionNoneZ;
3855
3856
3857
3858 /**
3859  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3860  * on-chain transactions to ensure no loss of funds occurs.
3861  *
3862  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3863  * information and are actively monitoring the chain.
3864  *
3865  * Pending Events or updated HTLCs which have not yet been read out by
3866  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3867  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3868  * gotten are fully handled before re-serializing the new state.
3869  *
3870  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3871  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3872  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3873  * returned block hash and the the current chain and then reconnecting blocks to get to the
3874  * best chain) upon deserializing the object!
3875  */
3876 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3877    /**
3878     * A pointer to the opaque Rust object.
3879     * Nearly everywhere, inner must be non-null, however in places where
3880     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3881     */
3882    LDKnativeChannelMonitor *inner;
3883    /**
3884     * Indicates that this is the only struct which contains the same pointer.
3885     * Rust functions which take ownership of an object provided via an argument require
3886     * this to be true and invalidate the object pointed to by inner.
3887     */
3888    bool is_owned;
3889 } LDKChannelMonitor;
3890
3891 /**
3892  * A tuple of 2 elements. See the individual fields for the types contained.
3893  */
3894 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3895    /**
3896     * The element at position 0
3897     */
3898    struct LDKThirtyTwoBytes a;
3899    /**
3900     * The element at position 1
3901     */
3902    struct LDKChannelMonitor b;
3903 } LDKC2Tuple_BlockHashChannelMonitorZ;
3904
3905 /**
3906  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3907  * This corresponds to std::vector in C++
3908  */
3909 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
3910    /**
3911     * The elements in the array.
3912     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3913     */
3914    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
3915    /**
3916     * The number of elements pointed to by `data`.
3917     */
3918    uintptr_t datalen;
3919 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
3920
3921 /**
3922  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3923  */
3924 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3925    /**
3926     * A pointer to the contents in the success state.
3927     * Reading from this pointer when `result_ok` is not set is undefined.
3928     */
3929    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
3930    /**
3931     * A pointer to the contents in the error state.
3932     * Reading from this pointer when `result_ok` is set is undefined.
3933     */
3934    enum LDKIOError *err;
3935 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
3936
3937 /**
3938  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3939  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3941  */
3942 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3943    /**
3944     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3945     * `err` or `result` depending on the state of `result_ok`.
3946     */
3947    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
3948    /**
3949     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3950     */
3951    bool result_ok;
3952 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
3953
3954 /**
3955  * An enum which can either contain a u16 or not
3956  */
3957 typedef enum LDKCOption_u16Z_Tag {
3958    /**
3959     * When we're in this state, this COption_u16Z contains a u16
3960     */
3961    LDKCOption_u16Z_Some,
3962    /**
3963     * When we're in this state, this COption_u16Z contains nothing
3964     */
3965    LDKCOption_u16Z_None,
3966    /**
3967     * Must be last for serialization purposes
3968     */
3969    LDKCOption_u16Z_Sentinel,
3970 } LDKCOption_u16Z_Tag;
3971
3972 typedef struct LDKCOption_u16Z {
3973    LDKCOption_u16Z_Tag tag;
3974    union {
3975       struct {
3976          uint16_t some;
3977       };
3978    };
3979 } LDKCOption_u16Z;
3980
3981 /**
3982  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
3983  * too-high values)
3984  */
3985 typedef enum LDKAPIError_Tag {
3986    /**
3987     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
3988     * are documented, but generally indicates some precondition of a function was violated.
3989     */
3990    LDKAPIError_APIMisuseError,
3991    /**
3992     * Due to a high feerate, we were unable to complete the request.
3993     * For example, this may be returned if the feerate implies we cannot open a channel at the
3994     * requested value, but opening a larger channel would succeed.
3995     */
3996    LDKAPIError_FeeRateTooHigh,
3997    /**
3998     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3999     * too-many-hops, etc).
4000     */
4001    LDKAPIError_RouteError,
4002    /**
4003     * We were unable to complete the request as the Channel required to do so is unable to
4004     * complete the request (or was not found). This can take many forms, including disconnected
4005     * peer, channel at capacity, channel shutting down, etc.
4006     */
4007    LDKAPIError_ChannelUnavailable,
4008    /**
4009     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4010     * attempted action to fail.
4011     */
4012    LDKAPIError_MonitorUpdateFailed,
4013    /**
4014     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
4015     * with the channel counterparty as negotiated in [`InitFeatures`].
4016     *
4017     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
4018     * a channel or cooperatively close one with this peer (and will have to force-close instead).
4019     *
4020     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
4021     * [`InitFeatures`]: crate::ln::features::InitFeatures
4022     */
4023    LDKAPIError_IncompatibleShutdownScript,
4024    /**
4025     * Must be last for serialization purposes
4026     */
4027    LDKAPIError_Sentinel,
4028 } LDKAPIError_Tag;
4029
4030 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4031    /**
4032     * A human-readable error message
4033     */
4034    struct LDKStr err;
4035 } LDKAPIError_LDKAPIMisuseError_Body;
4036
4037 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4038    /**
4039     * A human-readable error message
4040     */
4041    struct LDKStr err;
4042    /**
4043     * The feerate which was too high.
4044     */
4045    uint32_t feerate;
4046 } LDKAPIError_LDKFeeRateTooHigh_Body;
4047
4048 typedef struct LDKAPIError_LDKRouteError_Body {
4049    /**
4050     * A human-readable error message
4051     */
4052    struct LDKStr err;
4053 } LDKAPIError_LDKRouteError_Body;
4054
4055 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4056    /**
4057     * A human-readable error message
4058     */
4059    struct LDKStr err;
4060 } LDKAPIError_LDKChannelUnavailable_Body;
4061
4062 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
4063    /**
4064     * The incompatible shutdown script.
4065     */
4066    struct LDKShutdownScript script;
4067 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
4068
4069 typedef struct MUST_USE_STRUCT LDKAPIError {
4070    LDKAPIError_Tag tag;
4071    union {
4072       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
4073       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
4074       LDKAPIError_LDKRouteError_Body route_error;
4075       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
4076       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
4077    };
4078 } LDKAPIError;
4079
4080 /**
4081  * The contents of CResult_NoneAPIErrorZ
4082  */
4083 typedef union LDKCResult_NoneAPIErrorZPtr {
4084    /**
4085     * Note that this value is always NULL, as there are no contents in the OK variant
4086     */
4087    void *result;
4088    /**
4089     * A pointer to the contents in the error state.
4090     * Reading from this pointer when `result_ok` is set is undefined.
4091     */
4092    struct LDKAPIError *err;
4093 } LDKCResult_NoneAPIErrorZPtr;
4094
4095 /**
4096  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4097  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
4098  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4099  */
4100 typedef struct LDKCResult_NoneAPIErrorZ {
4101    /**
4102     * The contents of this CResult_NoneAPIErrorZ, accessible via either
4103     * `err` or `result` depending on the state of `result_ok`.
4104     */
4105    union LDKCResult_NoneAPIErrorZPtr contents;
4106    /**
4107     * Whether this CResult_NoneAPIErrorZ represents a success state.
4108     */
4109    bool result_ok;
4110 } LDKCResult_NoneAPIErrorZ;
4111
4112 /**
4113  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4114  * This corresponds to std::vector in C++
4115  */
4116 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
4117    /**
4118     * The elements in the array.
4119     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4120     */
4121    struct LDKCResult_NoneAPIErrorZ *data;
4122    /**
4123     * The number of elements pointed to by `data`.
4124     */
4125    uintptr_t datalen;
4126 } LDKCVec_CResult_NoneAPIErrorZZ;
4127
4128 /**
4129  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4130  * This corresponds to std::vector in C++
4131  */
4132 typedef struct LDKCVec_APIErrorZ {
4133    /**
4134     * The elements in the array.
4135     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4136     */
4137    struct LDKAPIError *data;
4138    /**
4139     * The number of elements pointed to by `data`.
4140     */
4141    uintptr_t datalen;
4142 } LDKCVec_APIErrorZ;
4143
4144 /**
4145  * If a payment fails to send, it can be in one of several states. This enum is returned as the
4146  * Err() type describing which state the payment is in, see the description of individual enum
4147  * states for more.
4148  */
4149 typedef enum LDKPaymentSendFailure_Tag {
4150    /**
4151     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
4152     * send the payment at all. No channel state has been changed or messages sent to peers, and
4153     * once you've changed the parameter at error, you can freely retry the payment in full.
4154     */
4155    LDKPaymentSendFailure_ParameterError,
4156    /**
4157     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4158     * from attempting to send the payment at all. No channel state has been changed or messages
4159     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4160     * payment in full.
4161     *
4162     * The results here are ordered the same as the paths in the route object which was passed to
4163     * send_payment.
4164     */
4165    LDKPaymentSendFailure_PathParameterError,
4166    /**
4167     * All paths which were attempted failed to send, with no channel state change taking place.
4168     * You can freely retry the payment in full (though you probably want to do so over different
4169     * paths than the ones selected).
4170     */
4171    LDKPaymentSendFailure_AllFailedRetrySafe,
4172    /**
4173     * Some paths which were attempted failed to send, though possibly not all. At least some
4174     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4175     * in over-/re-payment.
4176     *
4177     * The results here are ordered the same as the paths in the route object which was passed to
4178     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4179     * retried (though there is currently no API with which to do so).
4180     *
4181     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4182     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4183     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4184     * with the latest update_id.
4185     */
4186    LDKPaymentSendFailure_PartialFailure,
4187    /**
4188     * Must be last for serialization purposes
4189     */
4190    LDKPaymentSendFailure_Sentinel,
4191 } LDKPaymentSendFailure_Tag;
4192
4193 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4194    LDKPaymentSendFailure_Tag tag;
4195    union {
4196       struct {
4197          struct LDKAPIError parameter_error;
4198       };
4199       struct {
4200          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4201       };
4202       struct {
4203          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4204       };
4205       struct {
4206          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
4207       };
4208    };
4209 } LDKPaymentSendFailure;
4210
4211 /**
4212  * The contents of CResult_NonePaymentSendFailureZ
4213  */
4214 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4215    /**
4216     * Note that this value is always NULL, as there are no contents in the OK variant
4217     */
4218    void *result;
4219    /**
4220     * A pointer to the contents in the error state.
4221     * Reading from this pointer when `result_ok` is set is undefined.
4222     */
4223    struct LDKPaymentSendFailure *err;
4224 } LDKCResult_NonePaymentSendFailureZPtr;
4225
4226 /**
4227  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4228  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4229  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4230  */
4231 typedef struct LDKCResult_NonePaymentSendFailureZ {
4232    /**
4233     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4234     * `err` or `result` depending on the state of `result_ok`.
4235     */
4236    union LDKCResult_NonePaymentSendFailureZPtr contents;
4237    /**
4238     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4239     */
4240    bool result_ok;
4241 } LDKCResult_NonePaymentSendFailureZ;
4242
4243 /**
4244  * The contents of CResult_PaymentHashPaymentSendFailureZ
4245  */
4246 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
4247    /**
4248     * A pointer to the contents in the success state.
4249     * Reading from this pointer when `result_ok` is not set is undefined.
4250     */
4251    struct LDKThirtyTwoBytes *result;
4252    /**
4253     * A pointer to the contents in the error state.
4254     * Reading from this pointer when `result_ok` is set is undefined.
4255     */
4256    struct LDKPaymentSendFailure *err;
4257 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
4258
4259 /**
4260  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4261  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4263  */
4264 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
4265    /**
4266     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4267     * `err` or `result` depending on the state of `result_ok`.
4268     */
4269    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
4270    /**
4271     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4272     */
4273    bool result_ok;
4274 } LDKCResult_PaymentHashPaymentSendFailureZ;
4275
4276 /**
4277  * A 4-byte byte array.
4278  */
4279 typedef struct LDKFourBytes {
4280    /**
4281     * The four bytes
4282     */
4283    uint8_t data[4];
4284 } LDKFourBytes;
4285
4286 /**
4287  * A 16-byte byte array.
4288  */
4289 typedef struct LDKSixteenBytes {
4290    /**
4291     * The sixteen bytes
4292     */
4293    uint8_t data[16];
4294 } LDKSixteenBytes;
4295
4296 /**
4297  * A 10-byte byte array.
4298  */
4299 typedef struct LDKTenBytes {
4300    /**
4301     * The ten bytes
4302     */
4303    uint8_t data[10];
4304 } LDKTenBytes;
4305
4306 /**
4307  * An address which can be used to connect to a remote peer
4308  */
4309 typedef enum LDKNetAddress_Tag {
4310    /**
4311     * An IPv4 address/port on which the peer is listening.
4312     */
4313    LDKNetAddress_IPv4,
4314    /**
4315     * An IPv6 address/port on which the peer is listening.
4316     */
4317    LDKNetAddress_IPv6,
4318    /**
4319     * An old-style Tor onion address/port on which the peer is listening.
4320     */
4321    LDKNetAddress_OnionV2,
4322    /**
4323     * A new-style Tor onion address/port on which the peer is listening.
4324     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4325     * wrap as base32 and append \".onion\".
4326     */
4327    LDKNetAddress_OnionV3,
4328    /**
4329     * Must be last for serialization purposes
4330     */
4331    LDKNetAddress_Sentinel,
4332 } LDKNetAddress_Tag;
4333
4334 typedef struct LDKNetAddress_LDKIPv4_Body {
4335    /**
4336     * The 4-byte IPv4 address
4337     */
4338    struct LDKFourBytes addr;
4339    /**
4340     * The port on which the node is listening
4341     */
4342    uint16_t port;
4343 } LDKNetAddress_LDKIPv4_Body;
4344
4345 typedef struct LDKNetAddress_LDKIPv6_Body {
4346    /**
4347     * The 16-byte IPv6 address
4348     */
4349    struct LDKSixteenBytes addr;
4350    /**
4351     * The port on which the node is listening
4352     */
4353    uint16_t port;
4354 } LDKNetAddress_LDKIPv6_Body;
4355
4356 typedef struct LDKNetAddress_LDKOnionV2_Body {
4357    /**
4358     * The bytes (usually encoded in base32 with \".onion\" appended)
4359     */
4360    struct LDKTenBytes addr;
4361    /**
4362     * The port on which the node is listening
4363     */
4364    uint16_t port;
4365 } LDKNetAddress_LDKOnionV2_Body;
4366
4367 typedef struct LDKNetAddress_LDKOnionV3_Body {
4368    /**
4369     * The ed25519 long-term public key of the peer
4370     */
4371    struct LDKThirtyTwoBytes ed25519_pubkey;
4372    /**
4373     * The checksum of the pubkey and version, as included in the onion address
4374     */
4375    uint16_t checksum;
4376    /**
4377     * The version byte, as defined by the Tor Onion v3 spec.
4378     */
4379    uint8_t version;
4380    /**
4381     * The port on which the node is listening
4382     */
4383    uint16_t port;
4384 } LDKNetAddress_LDKOnionV3_Body;
4385
4386 typedef struct MUST_USE_STRUCT LDKNetAddress {
4387    LDKNetAddress_Tag tag;
4388    union {
4389       LDKNetAddress_LDKIPv4_Body i_pv4;
4390       LDKNetAddress_LDKIPv6_Body i_pv6;
4391       LDKNetAddress_LDKOnionV2_Body onion_v2;
4392       LDKNetAddress_LDKOnionV3_Body onion_v3;
4393    };
4394 } LDKNetAddress;
4395
4396 /**
4397  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4398  * This corresponds to std::vector in C++
4399  */
4400 typedef struct LDKCVec_NetAddressZ {
4401    /**
4402     * The elements in the array.
4403     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4404     */
4405    struct LDKNetAddress *data;
4406    /**
4407     * The number of elements pointed to by `data`.
4408     */
4409    uintptr_t datalen;
4410 } LDKCVec_NetAddressZ;
4411
4412 /**
4413  * A tuple of 2 elements. See the individual fields for the types contained.
4414  */
4415 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4416    /**
4417     * The element at position 0
4418     */
4419    struct LDKThirtyTwoBytes a;
4420    /**
4421     * The element at position 1
4422     */
4423    struct LDKThirtyTwoBytes b;
4424 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4425
4426 /**
4427  * The contents of CResult_PaymentSecretAPIErrorZ
4428  */
4429 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4430    /**
4431     * A pointer to the contents in the success state.
4432     * Reading from this pointer when `result_ok` is not set is undefined.
4433     */
4434    struct LDKThirtyTwoBytes *result;
4435    /**
4436     * A pointer to the contents in the error state.
4437     * Reading from this pointer when `result_ok` is set is undefined.
4438     */
4439    struct LDKAPIError *err;
4440 } LDKCResult_PaymentSecretAPIErrorZPtr;
4441
4442 /**
4443  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4444  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4445  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4446  */
4447 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4448    /**
4449     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4450     * `err` or `result` depending on the state of `result_ok`.
4451     */
4452    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4453    /**
4454     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4455     */
4456    bool result_ok;
4457 } LDKCResult_PaymentSecretAPIErrorZ;
4458
4459 /**
4460  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4461  * This corresponds to std::vector in C++
4462  */
4463 typedef struct LDKCVec_ChannelMonitorZ {
4464    /**
4465     * The elements in the array.
4466     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4467     */
4468    struct LDKChannelMonitor *data;
4469    /**
4470     * The number of elements pointed to by `data`.
4471     */
4472    uintptr_t datalen;
4473 } LDKCVec_ChannelMonitorZ;
4474
4475
4476
4477 /**
4478  * An update generated by the underlying Channel itself which contains some new information the
4479  * ChannelMonitor should be made aware of.
4480  */
4481 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4482    /**
4483     * A pointer to the opaque Rust object.
4484     * Nearly everywhere, inner must be non-null, however in places where
4485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4486     */
4487    LDKnativeChannelMonitorUpdate *inner;
4488    /**
4489     * Indicates that this is the only struct which contains the same pointer.
4490     * Rust functions which take ownership of an object provided via an argument require
4491     * this to be true and invalidate the object pointed to by inner.
4492     */
4493    bool is_owned;
4494 } LDKChannelMonitorUpdate;
4495
4496 /**
4497  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4498  * blocks are connected and disconnected.
4499  *
4500  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4501  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4502  * channel state changes and HTLCs are resolved. See method documentation for specific
4503  * requirements.
4504  *
4505  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4506  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4507  * without taking any further action such as persisting the current state.
4508  *
4509  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4510  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4511  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4512  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4513  * multiple instances.
4514  *
4515  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4516  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4517  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4518  */
4519 typedef struct LDKWatch {
4520    /**
4521     * An opaque pointer which is passed to your function implementations as an argument.
4522     * This has no meaning in the LDK, and can be NULL or any other value.
4523     */
4524    void *this_arg;
4525    /**
4526     * Watches a channel identified by `funding_txo` using `monitor`.
4527     *
4528     * Implementations are responsible for watching the chain for the funding transaction along
4529     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4530     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4531     *
4532     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4533     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4534     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4535     */
4536    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4537    /**
4538     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4539     *
4540     * Implementations must call [`update_monitor`] with the given update. See
4541     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4542     *
4543     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4544     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4545     */
4546    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4547    /**
4548     * Returns any monitor events since the last call. Subsequent calls must only return new
4549     * events.
4550     */
4551    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4552    /**
4553     * Frees any resources associated with this object given its this_arg pointer.
4554     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4555     */
4556    void (*free)(void *this_arg);
4557 } LDKWatch;
4558
4559 /**
4560  * An interface to send a transaction to the Bitcoin network.
4561  */
4562 typedef struct LDKBroadcasterInterface {
4563    /**
4564     * An opaque pointer which is passed to your function implementations as an argument.
4565     * This has no meaning in the LDK, and can be NULL or any other value.
4566     */
4567    void *this_arg;
4568    /**
4569     * Sends a transaction out to (hopefully) be mined.
4570     */
4571    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4572    /**
4573     * Frees any resources associated with this object given its this_arg pointer.
4574     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4575     */
4576    void (*free)(void *this_arg);
4577 } LDKBroadcasterInterface;
4578
4579 /**
4580  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4581  * own the memory pointed to by data.
4582  */
4583 typedef struct LDKu8slice {
4584    /**
4585     * A pointer to the byte buffer
4586     */
4587    const uint8_t *data;
4588    /**
4589     * The number of bytes pointed to by `data`.
4590     */
4591    uintptr_t datalen;
4592 } LDKu8slice;
4593
4594 /**
4595  * A trait to describe an object which can get user secrets and key material.
4596  */
4597 typedef struct LDKKeysInterface {
4598    /**
4599     * An opaque pointer which is passed to your function implementations as an argument.
4600     * This has no meaning in the LDK, and can be NULL or any other value.
4601     */
4602    void *this_arg;
4603    /**
4604     * Get node secret key (aka node_id or network_key).
4605     *
4606     * This method must return the same value each time it is called.
4607     */
4608    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4609    /**
4610     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4611     *
4612     * This method should return a different value each time it is called, to avoid linking
4613     * on-chain funds across channels as controlled to the same user.
4614     */
4615    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4616    /**
4617     * Get a script pubkey which we will send funds to when closing a channel.
4618     *
4619     * This method should return a different value each time it is called, to avoid linking
4620     * on-chain funds across channels as controlled to the same user.
4621     */
4622    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
4623    /**
4624     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4625     * restarted with some stale data!
4626     *
4627     * This method must return a different value each time it is called.
4628     */
4629    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4630    /**
4631     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4632     * onion packets and for temporary channel IDs. There is no requirement that these be
4633     * persisted anywhere, though they must be unique across restarts.
4634     *
4635     * This method must return a different value each time it is called.
4636     */
4637    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4638    /**
4639     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4640     * This is only called during deserialization of other objects which contain
4641     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4642     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4643     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4644     * you've read all of the provided bytes to ensure no corruption occurred.
4645     */
4646    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4647    /**
4648     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4649     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4650     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4651     * blindly signing the hash.
4652     */
4653    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4654    /**
4655     * Frees any resources associated with this object given its this_arg pointer.
4656     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4657     */
4658    void (*free)(void *this_arg);
4659 } LDKKeysInterface;
4660
4661 /**
4662  * A trait which should be implemented to provide feerate information on a number of time
4663  * horizons.
4664  *
4665  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4666  * called from inside the library in response to chain events, P2P events, or timer events).
4667  */
4668 typedef struct LDKFeeEstimator {
4669    /**
4670     * An opaque pointer which is passed to your function implementations as an argument.
4671     * This has no meaning in the LDK, and can be NULL or any other value.
4672     */
4673    void *this_arg;
4674    /**
4675     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4676     *
4677     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4678     * don't put us below 1 satoshi-per-byte).
4679     *
4680     * This translates to:
4681     *  * satoshis-per-byte * 250
4682     *  * ceil(satoshis-per-kbyte / 4)
4683     */
4684    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4685    /**
4686     * Frees any resources associated with this object given its this_arg pointer.
4687     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4688     */
4689    void (*free)(void *this_arg);
4690 } LDKFeeEstimator;
4691
4692 /**
4693  * A trait encapsulating the operations required of a logger
4694  */
4695 typedef struct LDKLogger {
4696    /**
4697     * An opaque pointer which is passed to your function implementations as an argument.
4698     * This has no meaning in the LDK, and can be NULL or any other value.
4699     */
4700    void *this_arg;
4701    /**
4702     * Logs the `Record`
4703     */
4704    void (*log)(const void *this_arg, const char *record);
4705    /**
4706     * Frees any resources associated with this object given its this_arg pointer.
4707     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4708     */
4709    void (*free)(void *this_arg);
4710 } LDKLogger;
4711
4712
4713
4714 /**
4715  * Manager which keeps track of a number of channels and sends messages to the appropriate
4716  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4717  *
4718  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4719  * to individual Channels.
4720  *
4721  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4722  * all peers during write/read (though does not modify this instance, only the instance being
4723  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4724  * called funding_transaction_generated for outbound channels).
4725  *
4726  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4727  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4728  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4729  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4730  * the serialization process). If the deserialized version is out-of-date compared to the
4731  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4732  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4733  *
4734  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4735  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4736  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4737  * block_connected() to step towards your best block) upon deserialization before using the
4738  * object!
4739  *
4740  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4741  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4742  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4743  * offline for a full minute. In order to track this, you must call
4744  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4745  *
4746  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4747  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4748  * essentially you should default to using a SimpleRefChannelManager, and use a
4749  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4750  * you're using lightning-net-tokio.
4751  */
4752 typedef struct MUST_USE_STRUCT LDKChannelManager {
4753    /**
4754     * A pointer to the opaque Rust object.
4755     * Nearly everywhere, inner must be non-null, however in places where
4756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4757     */
4758    LDKnativeChannelManager *inner;
4759    /**
4760     * Indicates that this is the only struct which contains the same pointer.
4761     * Rust functions which take ownership of an object provided via an argument require
4762     * this to be true and invalidate the object pointed to by inner.
4763     */
4764    bool is_owned;
4765 } LDKChannelManager;
4766
4767 /**
4768  * A tuple of 2 elements. See the individual fields for the types contained.
4769  */
4770 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4771    /**
4772     * The element at position 0
4773     */
4774    struct LDKThirtyTwoBytes a;
4775    /**
4776     * The element at position 1
4777     */
4778    struct LDKChannelManager b;
4779 } LDKC2Tuple_BlockHashChannelManagerZ;
4780
4781 /**
4782  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4783  */
4784 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4785    /**
4786     * A pointer to the contents in the success state.
4787     * Reading from this pointer when `result_ok` is not set is undefined.
4788     */
4789    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4790    /**
4791     * A pointer to the contents in the error state.
4792     * Reading from this pointer when `result_ok` is set is undefined.
4793     */
4794    struct LDKDecodeError *err;
4795 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4796
4797 /**
4798  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4799  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4800  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4801  */
4802 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4803    /**
4804     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4805     * `err` or `result` depending on the state of `result_ok`.
4806     */
4807    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4808    /**
4809     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4810     */
4811    bool result_ok;
4812 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4813
4814
4815
4816 /**
4817  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4818  * with our counterparty.
4819  */
4820 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4821    /**
4822     * A pointer to the opaque Rust object.
4823     * Nearly everywhere, inner must be non-null, however in places where
4824     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4825     */
4826    LDKnativeChannelConfig *inner;
4827    /**
4828     * Indicates that this is the only struct which contains the same pointer.
4829     * Rust functions which take ownership of an object provided via an argument require
4830     * this to be true and invalidate the object pointed to by inner.
4831     */
4832    bool is_owned;
4833 } LDKChannelConfig;
4834
4835 /**
4836  * The contents of CResult_ChannelConfigDecodeErrorZ
4837  */
4838 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4839    /**
4840     * A pointer to the contents in the success state.
4841     * Reading from this pointer when `result_ok` is not set is undefined.
4842     */
4843    struct LDKChannelConfig *result;
4844    /**
4845     * A pointer to the contents in the error state.
4846     * Reading from this pointer when `result_ok` is set is undefined.
4847     */
4848    struct LDKDecodeError *err;
4849 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4850
4851 /**
4852  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4853  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4855  */
4856 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4857    /**
4858     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4859     * `err` or `result` depending on the state of `result_ok`.
4860     */
4861    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4862    /**
4863     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4864     */
4865    bool result_ok;
4866 } LDKCResult_ChannelConfigDecodeErrorZ;
4867
4868 /**
4869  * The contents of CResult_OutPointDecodeErrorZ
4870  */
4871 typedef union LDKCResult_OutPointDecodeErrorZPtr {
4872    /**
4873     * A pointer to the contents in the success state.
4874     * Reading from this pointer when `result_ok` is not set is undefined.
4875     */
4876    struct LDKOutPoint *result;
4877    /**
4878     * A pointer to the contents in the error state.
4879     * Reading from this pointer when `result_ok` is set is undefined.
4880     */
4881    struct LDKDecodeError *err;
4882 } LDKCResult_OutPointDecodeErrorZPtr;
4883
4884 /**
4885  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4886  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4888  */
4889 typedef struct LDKCResult_OutPointDecodeErrorZ {
4890    /**
4891     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4892     * `err` or `result` depending on the state of `result_ok`.
4893     */
4894    union LDKCResult_OutPointDecodeErrorZPtr contents;
4895    /**
4896     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
4897     */
4898    bool result_ok;
4899 } LDKCResult_OutPointDecodeErrorZ;
4900
4901 /**
4902  * Defines a type identifier for sending messages over the wire.
4903  *
4904  * Messages implementing this trait specify a type and must be [`Writeable`].
4905  */
4906 typedef struct LDKType {
4907    /**
4908     * An opaque pointer which is passed to your function implementations as an argument.
4909     * This has no meaning in the LDK, and can be NULL or any other value.
4910     */
4911    void *this_arg;
4912    /**
4913     * Returns the type identifying the message payload.
4914     */
4915    uint16_t (*type_id)(const void *this_arg);
4916    /**
4917     * Return a human-readable "debug" string describing this object
4918     */
4919    struct LDKStr (*debug_str)(const void *this_arg);
4920    /**
4921     * Serialize the object into a byte array
4922     */
4923    struct LDKCVec_u8Z (*write)(const void *this_arg);
4924    /**
4925     * Frees any resources associated with this object given its this_arg pointer.
4926     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4927     */
4928    void (*free)(void *this_arg);
4929 } LDKType;
4930
4931 /**
4932  * An enum which can either contain a crate::lightning::ln::wire::Type or not
4933  */
4934 typedef enum LDKCOption_TypeZ_Tag {
4935    /**
4936     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
4937     */
4938    LDKCOption_TypeZ_Some,
4939    /**
4940     * When we're in this state, this COption_TypeZ contains nothing
4941     */
4942    LDKCOption_TypeZ_None,
4943    /**
4944     * Must be last for serialization purposes
4945     */
4946    LDKCOption_TypeZ_Sentinel,
4947 } LDKCOption_TypeZ_Tag;
4948
4949 typedef struct LDKCOption_TypeZ {
4950    LDKCOption_TypeZ_Tag tag;
4951    union {
4952       struct {
4953          struct LDKType some;
4954       };
4955    };
4956 } LDKCOption_TypeZ;
4957
4958 /**
4959  * The contents of CResult_COption_TypeZDecodeErrorZ
4960  */
4961 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
4962    /**
4963     * A pointer to the contents in the success state.
4964     * Reading from this pointer when `result_ok` is not set is undefined.
4965     */
4966    struct LDKCOption_TypeZ *result;
4967    /**
4968     * A pointer to the contents in the error state.
4969     * Reading from this pointer when `result_ok` is set is undefined.
4970     */
4971    struct LDKDecodeError *err;
4972 } LDKCResult_COption_TypeZDecodeErrorZPtr;
4973
4974 /**
4975  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
4976  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4977  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4978  */
4979 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
4980    /**
4981     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
4982     * `err` or `result` depending on the state of `result_ok`.
4983     */
4984    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
4985    /**
4986     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
4987     */
4988    bool result_ok;
4989 } LDKCResult_COption_TypeZDecodeErrorZ;
4990
4991 /**
4992  * The contents of CResult_SiPrefixNoneZ
4993  */
4994 typedef union LDKCResult_SiPrefixNoneZPtr {
4995    /**
4996     * A pointer to the contents in the success state.
4997     * Reading from this pointer when `result_ok` is not set is undefined.
4998     */
4999    enum LDKSiPrefix *result;
5000    /**
5001     * Note that this value is always NULL, as there are no contents in the Err variant
5002     */
5003    void *err;
5004 } LDKCResult_SiPrefixNoneZPtr;
5005
5006 /**
5007  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5008  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5010  */
5011 typedef struct LDKCResult_SiPrefixNoneZ {
5012    /**
5013     * The contents of this CResult_SiPrefixNoneZ, accessible via either
5014     * `err` or `result` depending on the state of `result_ok`.
5015     */
5016    union LDKCResult_SiPrefixNoneZPtr contents;
5017    /**
5018     * Whether this CResult_SiPrefixNoneZ represents a success state.
5019     */
5020    bool result_ok;
5021 } LDKCResult_SiPrefixNoneZ;
5022
5023
5024
5025 /**
5026  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
5027  *
5028  * There are three ways to construct an `Invoice`:
5029  *  1. using `InvoiceBuilder`
5030  *  2. using `Invoice::from_signed(SignedRawInvoice)`
5031  *  3. using `str::parse::<Invoice>(&str)`
5032  */
5033 typedef struct MUST_USE_STRUCT LDKInvoice {
5034    /**
5035     * A pointer to the opaque Rust object.
5036     * Nearly everywhere, inner must be non-null, however in places where
5037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5038     */
5039    LDKnativeInvoice *inner;
5040    /**
5041     * Indicates that this is the only struct which contains the same pointer.
5042     * Rust functions which take ownership of an object provided via an argument require
5043     * this to be true and invalidate the object pointed to by inner.
5044     */
5045    bool is_owned;
5046 } LDKInvoice;
5047
5048 /**
5049  * The contents of CResult_InvoiceNoneZ
5050  */
5051 typedef union LDKCResult_InvoiceNoneZPtr {
5052    /**
5053     * A pointer to the contents in the success state.
5054     * Reading from this pointer when `result_ok` is not set is undefined.
5055     */
5056    struct LDKInvoice *result;
5057    /**
5058     * Note that this value is always NULL, as there are no contents in the Err variant
5059     */
5060    void *err;
5061 } LDKCResult_InvoiceNoneZPtr;
5062
5063 /**
5064  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
5065  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
5066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5067  */
5068 typedef struct LDKCResult_InvoiceNoneZ {
5069    /**
5070     * The contents of this CResult_InvoiceNoneZ, accessible via either
5071     * `err` or `result` depending on the state of `result_ok`.
5072     */
5073    union LDKCResult_InvoiceNoneZPtr contents;
5074    /**
5075     * Whether this CResult_InvoiceNoneZ represents a success state.
5076     */
5077    bool result_ok;
5078 } LDKCResult_InvoiceNoneZ;
5079
5080
5081
5082 /**
5083  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
5084  * invalid.
5085  *
5086  * # Invariants
5087  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
5088  */
5089 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
5090    /**
5091     * A pointer to the opaque Rust object.
5092     * Nearly everywhere, inner must be non-null, however in places where
5093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5094     */
5095    LDKnativeSignedRawInvoice *inner;
5096    /**
5097     * Indicates that this is the only struct which contains the same pointer.
5098     * Rust functions which take ownership of an object provided via an argument require
5099     * this to be true and invalidate the object pointed to by inner.
5100     */
5101    bool is_owned;
5102 } LDKSignedRawInvoice;
5103
5104 /**
5105  * The contents of CResult_SignedRawInvoiceNoneZ
5106  */
5107 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
5108    /**
5109     * A pointer to the contents in the success state.
5110     * Reading from this pointer when `result_ok` is not set is undefined.
5111     */
5112    struct LDKSignedRawInvoice *result;
5113    /**
5114     * Note that this value is always NULL, as there are no contents in the Err variant
5115     */
5116    void *err;
5117 } LDKCResult_SignedRawInvoiceNoneZPtr;
5118
5119 /**
5120  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5121  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5123  */
5124 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
5125    /**
5126     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5127     * `err` or `result` depending on the state of `result_ok`.
5128     */
5129    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
5130    /**
5131     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5132     */
5133    bool result_ok;
5134 } LDKCResult_SignedRawInvoiceNoneZ;
5135
5136
5137
5138 /**
5139  * Represents an syntactically correct Invoice for a payment on the lightning network,
5140  * but without the signature information.
5141  * De- and encoding should not lead to information loss but may lead to different hashes.
5142  *
5143  * For methods without docs see the corresponding methods in `Invoice`.
5144  */
5145 typedef struct MUST_USE_STRUCT LDKRawInvoice {
5146    /**
5147     * A pointer to the opaque Rust object.
5148     * Nearly everywhere, inner must be non-null, however in places where
5149     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5150     */
5151    LDKnativeRawInvoice *inner;
5152    /**
5153     * Indicates that this is the only struct which contains the same pointer.
5154     * Rust functions which take ownership of an object provided via an argument require
5155     * this to be true and invalidate the object pointed to by inner.
5156     */
5157    bool is_owned;
5158 } LDKRawInvoice;
5159
5160
5161
5162 /**
5163  * Recoverable signature
5164  */
5165 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
5166    /**
5167     * A pointer to the opaque Rust object.
5168     * Nearly everywhere, inner must be non-null, however in places where
5169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5170     */
5171    LDKnativeInvoiceSignature *inner;
5172    /**
5173     * Indicates that this is the only struct which contains the same pointer.
5174     * Rust functions which take ownership of an object provided via an argument require
5175     * this to be true and invalidate the object pointed to by inner.
5176     */
5177    bool is_owned;
5178 } LDKInvoiceSignature;
5179
5180 /**
5181  * A tuple of 3 elements. See the individual fields for the types contained.
5182  */
5183 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
5184    /**
5185     * The element at position 0
5186     */
5187    struct LDKRawInvoice a;
5188    /**
5189     * The element at position 1
5190     */
5191    struct LDKThirtyTwoBytes b;
5192    /**
5193     * The element at position 2
5194     */
5195    struct LDKInvoiceSignature c;
5196 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
5197
5198
5199
5200 /**
5201  * Payee public key
5202  */
5203 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
5204    /**
5205     * A pointer to the opaque Rust object.
5206     * Nearly everywhere, inner must be non-null, however in places where
5207     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5208     */
5209    LDKnativePayeePubKey *inner;
5210    /**
5211     * Indicates that this is the only struct which contains the same pointer.
5212     * Rust functions which take ownership of an object provided via an argument require
5213     * this to be true and invalidate the object pointed to by inner.
5214     */
5215    bool is_owned;
5216 } LDKPayeePubKey;
5217
5218 /**
5219  * The contents of CResult_PayeePubKeyErrorZ
5220  */
5221 typedef union LDKCResult_PayeePubKeyErrorZPtr {
5222    /**
5223     * A pointer to the contents in the success state.
5224     * Reading from this pointer when `result_ok` is not set is undefined.
5225     */
5226    struct LDKPayeePubKey *result;
5227    /**
5228     * A pointer to the contents in the error state.
5229     * Reading from this pointer when `result_ok` is set is undefined.
5230     */
5231    enum LDKSecp256k1Error *err;
5232 } LDKCResult_PayeePubKeyErrorZPtr;
5233
5234 /**
5235  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5236  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5237  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5238  */
5239 typedef struct LDKCResult_PayeePubKeyErrorZ {
5240    /**
5241     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5242     * `err` or `result` depending on the state of `result_ok`.
5243     */
5244    union LDKCResult_PayeePubKeyErrorZPtr contents;
5245    /**
5246     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
5247     */
5248    bool result_ok;
5249 } LDKCResult_PayeePubKeyErrorZ;
5250
5251
5252
5253 /**
5254  * Private routing information
5255  *
5256  * # Invariants
5257  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
5258  *
5259  */
5260 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
5261    /**
5262     * A pointer to the opaque Rust object.
5263     * Nearly everywhere, inner must be non-null, however in places where
5264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5265     */
5266    LDKnativePrivateRoute *inner;
5267    /**
5268     * Indicates that this is the only struct which contains the same pointer.
5269     * Rust functions which take ownership of an object provided via an argument require
5270     * this to be true and invalidate the object pointed to by inner.
5271     */
5272    bool is_owned;
5273 } LDKPrivateRoute;
5274
5275 /**
5276  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5277  * This corresponds to std::vector in C++
5278  */
5279 typedef struct LDKCVec_PrivateRouteZ {
5280    /**
5281     * The elements in the array.
5282     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5283     */
5284    struct LDKPrivateRoute *data;
5285    /**
5286     * The number of elements pointed to by `data`.
5287     */
5288    uintptr_t datalen;
5289 } LDKCVec_PrivateRouteZ;
5290
5291
5292
5293 /**
5294  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
5295  * timestamp is positive.
5296  *
5297  * # Invariants
5298  * The UNIX timestamp representing the stored time has to be positive and small enough so that
5299  * a `EpiryTime` can be added to it without an overflow.
5300  */
5301 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
5302    /**
5303     * A pointer to the opaque Rust object.
5304     * Nearly everywhere, inner must be non-null, however in places where
5305     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5306     */
5307    LDKnativePositiveTimestamp *inner;
5308    /**
5309     * Indicates that this is the only struct which contains the same pointer.
5310     * Rust functions which take ownership of an object provided via an argument require
5311     * this to be true and invalidate the object pointed to by inner.
5312     */
5313    bool is_owned;
5314 } LDKPositiveTimestamp;
5315
5316 /**
5317  * The contents of CResult_PositiveTimestampCreationErrorZ
5318  */
5319 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
5320    /**
5321     * A pointer to the contents in the success state.
5322     * Reading from this pointer when `result_ok` is not set is undefined.
5323     */
5324    struct LDKPositiveTimestamp *result;
5325    /**
5326     * A pointer to the contents in the error state.
5327     * Reading from this pointer when `result_ok` is set is undefined.
5328     */
5329    enum LDKCreationError *err;
5330 } LDKCResult_PositiveTimestampCreationErrorZPtr;
5331
5332 /**
5333  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5334  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5336  */
5337 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
5338    /**
5339     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5340     * `err` or `result` depending on the state of `result_ok`.
5341     */
5342    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
5343    /**
5344     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5345     */
5346    bool result_ok;
5347 } LDKCResult_PositiveTimestampCreationErrorZ;
5348
5349 /**
5350  * The contents of CResult_NoneSemanticErrorZ
5351  */
5352 typedef union LDKCResult_NoneSemanticErrorZPtr {
5353    /**
5354     * Note that this value is always NULL, as there are no contents in the OK variant
5355     */
5356    void *result;
5357    /**
5358     * A pointer to the contents in the error state.
5359     * Reading from this pointer when `result_ok` is set is undefined.
5360     */
5361    enum LDKSemanticError *err;
5362 } LDKCResult_NoneSemanticErrorZPtr;
5363
5364 /**
5365  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5366  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5368  */
5369 typedef struct LDKCResult_NoneSemanticErrorZ {
5370    /**
5371     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
5372     * `err` or `result` depending on the state of `result_ok`.
5373     */
5374    union LDKCResult_NoneSemanticErrorZPtr contents;
5375    /**
5376     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5377     */
5378    bool result_ok;
5379 } LDKCResult_NoneSemanticErrorZ;
5380
5381 /**
5382  * The contents of CResult_InvoiceSemanticErrorZ
5383  */
5384 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5385    /**
5386     * A pointer to the contents in the success state.
5387     * Reading from this pointer when `result_ok` is not set is undefined.
5388     */
5389    struct LDKInvoice *result;
5390    /**
5391     * A pointer to the contents in the error state.
5392     * Reading from this pointer when `result_ok` is set is undefined.
5393     */
5394    enum LDKSemanticError *err;
5395 } LDKCResult_InvoiceSemanticErrorZPtr;
5396
5397 /**
5398  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5399  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5401  */
5402 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5403    /**
5404     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5405     * `err` or `result` depending on the state of `result_ok`.
5406     */
5407    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5408    /**
5409     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5410     */
5411    bool result_ok;
5412 } LDKCResult_InvoiceSemanticErrorZ;
5413
5414
5415
5416 /**
5417  * Description string
5418  *
5419  * # Invariants
5420  * The description can be at most 639 __bytes__ long
5421  */
5422 typedef struct MUST_USE_STRUCT LDKDescription {
5423    /**
5424     * A pointer to the opaque Rust object.
5425     * Nearly everywhere, inner must be non-null, however in places where
5426     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5427     */
5428    LDKnativeDescription *inner;
5429    /**
5430     * Indicates that this is the only struct which contains the same pointer.
5431     * Rust functions which take ownership of an object provided via an argument require
5432     * this to be true and invalidate the object pointed to by inner.
5433     */
5434    bool is_owned;
5435 } LDKDescription;
5436
5437 /**
5438  * The contents of CResult_DescriptionCreationErrorZ
5439  */
5440 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5441    /**
5442     * A pointer to the contents in the success state.
5443     * Reading from this pointer when `result_ok` is not set is undefined.
5444     */
5445    struct LDKDescription *result;
5446    /**
5447     * A pointer to the contents in the error state.
5448     * Reading from this pointer when `result_ok` is set is undefined.
5449     */
5450    enum LDKCreationError *err;
5451 } LDKCResult_DescriptionCreationErrorZPtr;
5452
5453 /**
5454  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5455  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5457  */
5458 typedef struct LDKCResult_DescriptionCreationErrorZ {
5459    /**
5460     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5461     * `err` or `result` depending on the state of `result_ok`.
5462     */
5463    union LDKCResult_DescriptionCreationErrorZPtr contents;
5464    /**
5465     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5466     */
5467    bool result_ok;
5468 } LDKCResult_DescriptionCreationErrorZ;
5469
5470
5471
5472 /**
5473  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5474  * expires
5475  *
5476  * # Invariants
5477  * The number of seconds this expiry time represents has to be in the range
5478  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5479  * timestamp
5480  */
5481 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5482    /**
5483     * A pointer to the opaque Rust object.
5484     * Nearly everywhere, inner must be non-null, however in places where
5485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5486     */
5487    LDKnativeExpiryTime *inner;
5488    /**
5489     * Indicates that this is the only struct which contains the same pointer.
5490     * Rust functions which take ownership of an object provided via an argument require
5491     * this to be true and invalidate the object pointed to by inner.
5492     */
5493    bool is_owned;
5494 } LDKExpiryTime;
5495
5496 /**
5497  * The contents of CResult_ExpiryTimeCreationErrorZ
5498  */
5499 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5500    /**
5501     * A pointer to the contents in the success state.
5502     * Reading from this pointer when `result_ok` is not set is undefined.
5503     */
5504    struct LDKExpiryTime *result;
5505    /**
5506     * A pointer to the contents in the error state.
5507     * Reading from this pointer when `result_ok` is set is undefined.
5508     */
5509    enum LDKCreationError *err;
5510 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5511
5512 /**
5513  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5514  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5515  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5516  */
5517 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5518    /**
5519     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5520     * `err` or `result` depending on the state of `result_ok`.
5521     */
5522    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5523    /**
5524     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5525     */
5526    bool result_ok;
5527 } LDKCResult_ExpiryTimeCreationErrorZ;
5528
5529 /**
5530  * The contents of CResult_PrivateRouteCreationErrorZ
5531  */
5532 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5533    /**
5534     * A pointer to the contents in the success state.
5535     * Reading from this pointer when `result_ok` is not set is undefined.
5536     */
5537    struct LDKPrivateRoute *result;
5538    /**
5539     * A pointer to the contents in the error state.
5540     * Reading from this pointer when `result_ok` is set is undefined.
5541     */
5542    enum LDKCreationError *err;
5543 } LDKCResult_PrivateRouteCreationErrorZPtr;
5544
5545 /**
5546  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5547  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5549  */
5550 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5551    /**
5552     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5553     * `err` or `result` depending on the state of `result_ok`.
5554     */
5555    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5556    /**
5557     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5558     */
5559    bool result_ok;
5560 } LDKCResult_PrivateRouteCreationErrorZ;
5561
5562 /**
5563  * The contents of CResult_StringErrorZ
5564  */
5565 typedef union LDKCResult_StringErrorZPtr {
5566    /**
5567     * A pointer to the contents in the success state.
5568     * Reading from this pointer when `result_ok` is not set is undefined.
5569     */
5570    struct LDKStr *result;
5571    /**
5572     * A pointer to the contents in the error state.
5573     * Reading from this pointer when `result_ok` is set is undefined.
5574     */
5575    enum LDKSecp256k1Error *err;
5576 } LDKCResult_StringErrorZPtr;
5577
5578 /**
5579  * A CResult_StringErrorZ represents the result of a fallible operation,
5580  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5582  */
5583 typedef struct LDKCResult_StringErrorZ {
5584    /**
5585     * The contents of this CResult_StringErrorZ, accessible via either
5586     * `err` or `result` depending on the state of `result_ok`.
5587     */
5588    union LDKCResult_StringErrorZPtr contents;
5589    /**
5590     * Whether this CResult_StringErrorZ represents a success state.
5591     */
5592    bool result_ok;
5593 } LDKCResult_StringErrorZ;
5594
5595 /**
5596  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5597  */
5598 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5599    /**
5600     * A pointer to the contents in the success state.
5601     * Reading from this pointer when `result_ok` is not set is undefined.
5602     */
5603    struct LDKChannelMonitorUpdate *result;
5604    /**
5605     * A pointer to the contents in the error state.
5606     * Reading from this pointer when `result_ok` is set is undefined.
5607     */
5608    struct LDKDecodeError *err;
5609 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5610
5611 /**
5612  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5613  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5615  */
5616 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5617    /**
5618     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5619     * `err` or `result` depending on the state of `result_ok`.
5620     */
5621    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5622    /**
5623     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5624     */
5625    bool result_ok;
5626 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5627
5628 /**
5629  * The contents of CResult_HTLCUpdateDecodeErrorZ
5630  */
5631 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
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 LDKHTLCUpdate *result;
5637    /**
5638     * A pointer to the contents in the error state.
5639     * Reading from this pointer when `result_ok` is set is undefined.
5640     */
5641    struct LDKDecodeError *err;
5642 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5643
5644 /**
5645  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5646  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5647  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5648  */
5649 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5650    /**
5651     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5652     * `err` or `result` depending on the state of `result_ok`.
5653     */
5654    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5655    /**
5656     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5657     */
5658    bool result_ok;
5659 } LDKCResult_HTLCUpdateDecodeErrorZ;
5660
5661
5662
5663 /**
5664  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5665  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5666  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5667  * corrupted.
5668  * Contains a developer-readable error message.
5669  */
5670 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5671    /**
5672     * A pointer to the opaque Rust object.
5673     * Nearly everywhere, inner must be non-null, however in places where
5674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5675     */
5676    LDKnativeMonitorUpdateError *inner;
5677    /**
5678     * Indicates that this is the only struct which contains the same pointer.
5679     * Rust functions which take ownership of an object provided via an argument require
5680     * this to be true and invalidate the object pointed to by inner.
5681     */
5682    bool is_owned;
5683 } LDKMonitorUpdateError;
5684
5685 /**
5686  * The contents of CResult_NoneMonitorUpdateErrorZ
5687  */
5688 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5689    /**
5690     * Note that this value is always NULL, as there are no contents in the OK variant
5691     */
5692    void *result;
5693    /**
5694     * A pointer to the contents in the error state.
5695     * Reading from this pointer when `result_ok` is set is undefined.
5696     */
5697    struct LDKMonitorUpdateError *err;
5698 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5699
5700 /**
5701  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5702  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5704  */
5705 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5706    /**
5707     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5708     * `err` or `result` depending on the state of `result_ok`.
5709     */
5710    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5711    /**
5712     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5713     */
5714    bool result_ok;
5715 } LDKCResult_NoneMonitorUpdateErrorZ;
5716
5717 /**
5718  * A tuple of 2 elements. See the individual fields for the types contained.
5719  */
5720 typedef struct LDKC2Tuple_OutPointScriptZ {
5721    /**
5722     * The element at position 0
5723     */
5724    struct LDKOutPoint a;
5725    /**
5726     * The element at position 1
5727     */
5728    struct LDKCVec_u8Z b;
5729 } LDKC2Tuple_OutPointScriptZ;
5730
5731 /**
5732  * A tuple of 2 elements. See the individual fields for the types contained.
5733  */
5734 typedef struct LDKC2Tuple_u32ScriptZ {
5735    /**
5736     * The element at position 0
5737     */
5738    uint32_t a;
5739    /**
5740     * The element at position 1
5741     */
5742    struct LDKCVec_u8Z b;
5743 } LDKC2Tuple_u32ScriptZ;
5744
5745 /**
5746  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5747  * This corresponds to std::vector in C++
5748  */
5749 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5750    /**
5751     * The elements in the array.
5752     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5753     */
5754    struct LDKC2Tuple_u32ScriptZ *data;
5755    /**
5756     * The number of elements pointed to by `data`.
5757     */
5758    uintptr_t datalen;
5759 } LDKCVec_C2Tuple_u32ScriptZZ;
5760
5761 /**
5762  * A tuple of 2 elements. See the individual fields for the types contained.
5763  */
5764 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5765    /**
5766     * The element at position 0
5767     */
5768    struct LDKThirtyTwoBytes a;
5769    /**
5770     * The element at position 1
5771     */
5772    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5773 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5774
5775 /**
5776  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5777  * This corresponds to std::vector in C++
5778  */
5779 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5780    /**
5781     * The elements in the array.
5782     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5783     */
5784    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5785    /**
5786     * The number of elements pointed to by `data`.
5787     */
5788    uintptr_t datalen;
5789 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5790
5791 /**
5792  * Some information provided on receipt of payment depends on whether the payment received is a
5793  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
5794  */
5795 typedef enum LDKPaymentPurpose_Tag {
5796    /**
5797     * Information for receiving a payment that we generated an invoice for.
5798     */
5799    LDKPaymentPurpose_InvoicePayment,
5800    /**
5801     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
5802     * (the payee) providing a preimage.
5803     */
5804    LDKPaymentPurpose_SpontaneousPayment,
5805    /**
5806     * Must be last for serialization purposes
5807     */
5808    LDKPaymentPurpose_Sentinel,
5809 } LDKPaymentPurpose_Tag;
5810
5811 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
5812    /**
5813     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5814     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5815     * [`ChannelManager::claim_funds`].
5816     *
5817     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5818     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5819     *
5820     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5821     */
5822    struct LDKThirtyTwoBytes payment_preimage;
5823    /**
5824     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5825     * number of deanonymization attacks during the routing process.
5826     * It is provided here for your reference, however its accuracy is enforced directly by
5827     * [`ChannelManager`] using the values you previously provided to
5828     * [`ChannelManager::create_inbound_payment`] or
5829     * [`ChannelManager::create_inbound_payment_for_hash`].
5830     *
5831     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5832     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5833     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5834     */
5835    struct LDKThirtyTwoBytes payment_secret;
5836    /**
5837     * This is the `user_payment_id` which was provided to
5838     * [`ChannelManager::create_inbound_payment_for_hash`] or
5839     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5840     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5841     * metadata stored elsewhere.
5842     *
5843     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5844     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5845     */
5846    uint64_t user_payment_id;
5847 } LDKPaymentPurpose_LDKInvoicePayment_Body;
5848
5849 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
5850    LDKPaymentPurpose_Tag tag;
5851    union {
5852       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
5853       struct {
5854          struct LDKThirtyTwoBytes spontaneous_payment;
5855       };
5856    };
5857 } LDKPaymentPurpose;
5858
5859 /**
5860  * The reason the channel was closed. See individual variants more details.
5861  */
5862 typedef enum LDKClosureReason_Tag {
5863    /**
5864     * Closure generated from receiving a peer error message.
5865     *
5866     * Our counterparty may have broadcasted their latest commitment state, and we have
5867     * as well.
5868     */
5869    LDKClosureReason_CounterpartyForceClosed,
5870    /**
5871     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
5872     *
5873     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
5874     */
5875    LDKClosureReason_HolderForceClosed,
5876    /**
5877     * The channel was closed after negotiating a cooperative close and we've now broadcasted
5878     * the cooperative close transaction. Note the shutdown may have been initiated by us.
5879     */
5880    LDKClosureReason_CooperativeClosure,
5881    /**
5882     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
5883     * commitment transaction came from our counterparty, but it may also have come from
5884     * a copy of our own `ChannelMonitor`.
5885     */
5886    LDKClosureReason_CommitmentTxConfirmed,
5887    /**
5888     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
5889     */
5890    LDKClosureReason_ProcessingError,
5891    /**
5892     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
5893     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
5894     * peer again in the future or if the peer disconnected before we finished negotiating
5895     * the channel open. The first case may be caused by incompatible features which our
5896     * counterparty, or we, require.
5897     */
5898    LDKClosureReason_DisconnectedPeer,
5899    /**
5900     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
5901     * the ChannelManager deserialized.
5902     */
5903    LDKClosureReason_OutdatedChannelManager,
5904    /**
5905     * Must be last for serialization purposes
5906     */
5907    LDKClosureReason_Sentinel,
5908 } LDKClosureReason_Tag;
5909
5910 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
5911    /**
5912     * The error which the peer sent us.
5913     *
5914     * The string should be sanitized before it is used (e.g emitted to logs
5915     * or printed to stdout). Otherwise, a well crafted error message may exploit
5916     * a security vulnerability in the terminal emulator or the logging subsystem.
5917     */
5918    struct LDKStr peer_msg;
5919 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
5920
5921 typedef struct LDKClosureReason_LDKProcessingError_Body {
5922    /**
5923     * A developer-readable error message which we generated.
5924     */
5925    struct LDKStr err;
5926 } LDKClosureReason_LDKProcessingError_Body;
5927
5928 typedef struct MUST_USE_STRUCT LDKClosureReason {
5929    LDKClosureReason_Tag tag;
5930    union {
5931       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
5932       LDKClosureReason_LDKProcessingError_Body processing_error;
5933    };
5934 } LDKClosureReason;
5935
5936 /**
5937  * An Event which you should probably take some action in response to.
5938  *
5939  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
5940  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
5941  * written as it makes no sense to respond to it after reconnecting to peers).
5942  */
5943 typedef enum LDKEvent_Tag {
5944    /**
5945     * Used to indicate that the client should generate a funding transaction with the given
5946     * parameters and then call ChannelManager::funding_transaction_generated.
5947     * Generated in ChannelManager message handling.
5948     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
5949     * counterparty can steal your funds!
5950     */
5951    LDKEvent_FundingGenerationReady,
5952    /**
5953     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
5954     * ChannelManager::claim_funds to get it....
5955     * Note that if the preimage is not known or the amount paid is incorrect, you should call
5956     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
5957     * network congestion.
5958     * The amount paid should be considered 'incorrect' when it is less than or more than twice
5959     * the amount expected.
5960     * If you fail to call either ChannelManager::claim_funds or
5961     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
5962     * automatically failed.
5963     */
5964    LDKEvent_PaymentReceived,
5965    /**
5966     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
5967     * and we got back the payment preimage for it).
5968     *
5969     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
5970     * event. In this situation, you SHOULD treat this payment as having succeeded.
5971     */
5972    LDKEvent_PaymentSent,
5973    /**
5974     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
5975     * something. You may wish to retry with a different route.
5976     */
5977    LDKEvent_PaymentPathFailed,
5978    /**
5979     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
5980     * time in the future.
5981     */
5982    LDKEvent_PendingHTLCsForwardable,
5983    /**
5984     * Used to indicate that an output which you should know how to spend was confirmed on chain
5985     * and is now spendable.
5986     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
5987     * counterparty spending them due to some kind of timeout. Thus, you need to store them
5988     * somewhere and spend them when you create on-chain transactions.
5989     */
5990    LDKEvent_SpendableOutputs,
5991    /**
5992     * This event is generated when a payment has been successfully forwarded through us and a
5993     * forwarding fee earned.
5994     */
5995    LDKEvent_PaymentForwarded,
5996    /**
5997     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
5998     */
5999    LDKEvent_ChannelClosed,
6000    /**
6001     * Must be last for serialization purposes
6002     */
6003    LDKEvent_Sentinel,
6004 } LDKEvent_Tag;
6005
6006 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
6007    /**
6008     * The random channel_id we picked which you'll need to pass into
6009     * ChannelManager::funding_transaction_generated.
6010     */
6011    struct LDKThirtyTwoBytes temporary_channel_id;
6012    /**
6013     * The value, in satoshis, that the output should have.
6014     */
6015    uint64_t channel_value_satoshis;
6016    /**
6017     * The script which should be used in the transaction output.
6018     */
6019    struct LDKCVec_u8Z output_script;
6020    /**
6021     * The value passed in to ChannelManager::create_channel
6022     */
6023    uint64_t user_channel_id;
6024 } LDKEvent_LDKFundingGenerationReady_Body;
6025
6026 typedef struct LDKEvent_LDKPaymentReceived_Body {
6027    /**
6028     * The hash for which the preimage should be handed to the ChannelManager.
6029     */
6030    struct LDKThirtyTwoBytes payment_hash;
6031    /**
6032     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
6033     * compare this to the expected value before accepting the payment (as otherwise you are
6034     * providing proof-of-payment for less than the value you expected!).
6035     */
6036    uint64_t amt;
6037    /**
6038     * Information for claiming this received payment, based on whether the purpose of the
6039     * payment is to pay an invoice or to send a spontaneous payment.
6040     */
6041    struct LDKPaymentPurpose purpose;
6042 } LDKEvent_LDKPaymentReceived_Body;
6043
6044 typedef struct LDKEvent_LDKPaymentSent_Body {
6045    /**
6046     * The preimage to the hash given to ChannelManager::send_payment.
6047     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
6048     * store it somehow!
6049     */
6050    struct LDKThirtyTwoBytes payment_preimage;
6051 } LDKEvent_LDKPaymentSent_Body;
6052
6053 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
6054    /**
6055     * The hash which was given to ChannelManager::send_payment.
6056     */
6057    struct LDKThirtyTwoBytes payment_hash;
6058    /**
6059     * Indicates the payment was rejected for some reason by the recipient. This implies that
6060     * the payment has failed, not just the route in question. If this is not set, you may
6061     * retry the payment via a different route.
6062     */
6063    bool rejected_by_dest;
6064    /**
6065     * Any failure information conveyed via the Onion return packet by a node along the failed
6066     * payment route.
6067     *
6068     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
6069     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
6070     *
6071     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
6072     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
6073     */
6074    struct LDKCOption_NetworkUpdateZ network_update;
6075    /**
6076     * For both single-path and multi-path payments, this is set if all paths of the payment have
6077     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
6078     * larger MPP payment were still in flight when this event was generated.
6079     */
6080    bool all_paths_failed;
6081    /**
6082     * The payment path that failed.
6083     */
6084    struct LDKCVec_RouteHopZ path;
6085 } LDKEvent_LDKPaymentPathFailed_Body;
6086
6087 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
6088    /**
6089     * The minimum amount of time that should be waited prior to calling
6090     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
6091     * you should wait a random amount of time in roughly the range (now + time_forwardable,
6092     * now + 5*time_forwardable).
6093     */
6094    uint64_t time_forwardable;
6095 } LDKEvent_LDKPendingHTLCsForwardable_Body;
6096
6097 typedef struct LDKEvent_LDKSpendableOutputs_Body {
6098    /**
6099     * The outputs which you should store as spendable by you.
6100     */
6101    struct LDKCVec_SpendableOutputDescriptorZ outputs;
6102 } LDKEvent_LDKSpendableOutputs_Body;
6103
6104 typedef struct LDKEvent_LDKPaymentForwarded_Body {
6105    /**
6106     * The fee, in milli-satoshis, which was earned as a result of the payment.
6107     *
6108     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
6109     * was pending, the amount the next hop claimed will have been rounded down to the nearest
6110     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
6111     * claimed the full value in millisatoshis from the source. In this case,
6112     * `claim_from_onchain_tx` will be set.
6113     *
6114     * If the channel which sent us the payment has been force-closed, we will claim the funds
6115     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
6116     * fees which we will spend and will instead set this to `None`. It is possible duplicate
6117     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
6118     * `None`.
6119     */
6120    struct LDKCOption_u64Z fee_earned_msat;
6121    /**
6122     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
6123     * transaction.
6124     */
6125    bool claim_from_onchain_tx;
6126 } LDKEvent_LDKPaymentForwarded_Body;
6127
6128 typedef struct LDKEvent_LDKChannelClosed_Body {
6129    /**
6130     * The channel_id of the channel which has been closed. Note that on-chain transactions
6131     * resolving the channel are likely still awaiting confirmation.
6132     */
6133    struct LDKThirtyTwoBytes channel_id;
6134    /**
6135     * The reason the channel was closed.
6136     */
6137    struct LDKClosureReason reason;
6138 } LDKEvent_LDKChannelClosed_Body;
6139
6140 typedef struct MUST_USE_STRUCT LDKEvent {
6141    LDKEvent_Tag tag;
6142    union {
6143       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
6144       LDKEvent_LDKPaymentReceived_Body payment_received;
6145       LDKEvent_LDKPaymentSent_Body payment_sent;
6146       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
6147       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
6148       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
6149       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
6150       LDKEvent_LDKChannelClosed_Body channel_closed;
6151    };
6152 } LDKEvent;
6153
6154 /**
6155  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6156  * This corresponds to std::vector in C++
6157  */
6158 typedef struct LDKCVec_EventZ {
6159    /**
6160     * The elements in the array.
6161     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6162     */
6163    struct LDKEvent *data;
6164    /**
6165     * The number of elements pointed to by `data`.
6166     */
6167    uintptr_t datalen;
6168 } LDKCVec_EventZ;
6169
6170 /**
6171  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6172  * This corresponds to std::vector in C++
6173  */
6174 typedef struct LDKCVec_TransactionZ {
6175    /**
6176     * The elements in the array.
6177     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6178     */
6179    struct LDKTransaction *data;
6180    /**
6181     * The number of elements pointed to by `data`.
6182     */
6183    uintptr_t datalen;
6184 } LDKCVec_TransactionZ;
6185
6186 /**
6187  * A tuple of 2 elements. See the individual fields for the types contained.
6188  */
6189 typedef struct LDKC2Tuple_u32TxOutZ {
6190    /**
6191     * The element at position 0
6192     */
6193    uint32_t a;
6194    /**
6195     * The element at position 1
6196     */
6197    struct LDKTxOut b;
6198 } LDKC2Tuple_u32TxOutZ;
6199
6200 /**
6201  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6202  * This corresponds to std::vector in C++
6203  */
6204 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
6205    /**
6206     * The elements in the array.
6207     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6208     */
6209    struct LDKC2Tuple_u32TxOutZ *data;
6210    /**
6211     * The number of elements pointed to by `data`.
6212     */
6213    uintptr_t datalen;
6214 } LDKCVec_C2Tuple_u32TxOutZZ;
6215
6216 /**
6217  * A tuple of 2 elements. See the individual fields for the types contained.
6218  */
6219 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6220    /**
6221     * The element at position 0
6222     */
6223    struct LDKThirtyTwoBytes a;
6224    /**
6225     * The element at position 1
6226     */
6227    struct LDKCVec_C2Tuple_u32TxOutZZ b;
6228 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
6229
6230 /**
6231  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6232  * This corresponds to std::vector in C++
6233  */
6234 typedef struct LDKCVec_TransactionOutputsZ {
6235    /**
6236     * The elements in the array.
6237     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6238     */
6239    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
6240    /**
6241     * The number of elements pointed to by `data`.
6242     */
6243    uintptr_t datalen;
6244 } LDKCVec_TransactionOutputsZ;
6245
6246 /**
6247  * Details about the balance(s) available for spending once the channel appears on chain.
6248  *
6249  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
6250  * be provided.
6251  */
6252 typedef enum LDKBalance_Tag {
6253    /**
6254     * The channel is not yet closed (or the commitment or closing transaction has not yet
6255     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
6256     * force-closed now.
6257     */
6258    LDKBalance_ClaimableOnChannelClose,
6259    /**
6260     * The channel has been closed, and the given balance is ours but awaiting confirmations until
6261     * we consider it spendable.
6262     */
6263    LDKBalance_ClaimableAwaitingConfirmations,
6264    /**
6265     * The channel has been closed, and the given balance should be ours but awaiting spending
6266     * transaction confirmation. If the spending transaction does not confirm in time, it is
6267     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
6268     *
6269     * Once the spending transaction confirms, before it has reached enough confirmations to be
6270     * considered safe from chain reorganizations, the balance will instead be provided via
6271     * [`Balance::ClaimableAwaitingConfirmations`].
6272     */
6273    LDKBalance_ContentiousClaimable,
6274    /**
6275     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
6276     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
6277     * likely to be claimed by our counterparty before we do.
6278     */
6279    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
6280    /**
6281     * Must be last for serialization purposes
6282     */
6283    LDKBalance_Sentinel,
6284 } LDKBalance_Tag;
6285
6286 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
6287    /**
6288     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6289     * required to do so.
6290     */
6291    uint64_t claimable_amount_satoshis;
6292 } LDKBalance_LDKClaimableOnChannelClose_Body;
6293
6294 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
6295    /**
6296     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
6297     * were spent in broadcasting the transaction.
6298     */
6299    uint64_t claimable_amount_satoshis;
6300    /**
6301     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
6302     * amount.
6303     */
6304    uint32_t confirmation_height;
6305 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
6306
6307 typedef struct LDKBalance_LDKContentiousClaimable_Body {
6308    /**
6309     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6310     * required to do so.
6311     */
6312    uint64_t claimable_amount_satoshis;
6313    /**
6314     * The height at which the counterparty may be able to claim the balance if we have not
6315     * done so.
6316     */
6317    uint32_t timeout_height;
6318 } LDKBalance_LDKContentiousClaimable_Body;
6319
6320 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
6321    /**
6322     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6323     * required to do so.
6324     */
6325    uint64_t claimable_amount_satoshis;
6326    /**
6327     * The height at which we will be able to claim the balance if our counterparty has not
6328     * done so.
6329     */
6330    uint32_t claimable_height;
6331 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
6332
6333 typedef struct MUST_USE_STRUCT LDKBalance {
6334    LDKBalance_Tag tag;
6335    union {
6336       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
6337       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
6338       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
6339       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
6340    };
6341 } LDKBalance;
6342
6343 /**
6344  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6345  * This corresponds to std::vector in C++
6346  */
6347 typedef struct LDKCVec_BalanceZ {
6348    /**
6349     * The elements in the array.
6350     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6351     */
6352    struct LDKBalance *data;
6353    /**
6354     * The number of elements pointed to by `data`.
6355     */
6356    uintptr_t datalen;
6357 } LDKCVec_BalanceZ;
6358
6359 /**
6360  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6361  */
6362 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6363    /**
6364     * A pointer to the contents in the success state.
6365     * Reading from this pointer when `result_ok` is not set is undefined.
6366     */
6367    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
6368    /**
6369     * A pointer to the contents in the error state.
6370     * Reading from this pointer when `result_ok` is set is undefined.
6371     */
6372    struct LDKDecodeError *err;
6373 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
6374
6375 /**
6376  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6377  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6379  */
6380 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6381    /**
6382     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6383     * `err` or `result` depending on the state of `result_ok`.
6384     */
6385    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
6386    /**
6387     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6388     */
6389    bool result_ok;
6390 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
6391
6392 /**
6393  * The contents of CResult_NoneLightningErrorZ
6394  */
6395 typedef union LDKCResult_NoneLightningErrorZPtr {
6396    /**
6397     * Note that this value is always NULL, as there are no contents in the OK variant
6398     */
6399    void *result;
6400    /**
6401     * A pointer to the contents in the error state.
6402     * Reading from this pointer when `result_ok` is set is undefined.
6403     */
6404    struct LDKLightningError *err;
6405 } LDKCResult_NoneLightningErrorZPtr;
6406
6407 /**
6408  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6409  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6410  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6411  */
6412 typedef struct LDKCResult_NoneLightningErrorZ {
6413    /**
6414     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6415     * `err` or `result` depending on the state of `result_ok`.
6416     */
6417    union LDKCResult_NoneLightningErrorZPtr contents;
6418    /**
6419     * Whether this CResult_NoneLightningErrorZ represents a success state.
6420     */
6421    bool result_ok;
6422 } LDKCResult_NoneLightningErrorZ;
6423
6424 /**
6425  * A tuple of 2 elements. See the individual fields for the types contained.
6426  */
6427 typedef struct LDKC2Tuple_PublicKeyTypeZ {
6428    /**
6429     * The element at position 0
6430     */
6431    struct LDKPublicKey a;
6432    /**
6433     * The element at position 1
6434     */
6435    struct LDKType b;
6436 } LDKC2Tuple_PublicKeyTypeZ;
6437
6438 /**
6439  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
6440  * This corresponds to std::vector in C++
6441  */
6442 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
6443    /**
6444     * The elements in the array.
6445     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6446     */
6447    struct LDKC2Tuple_PublicKeyTypeZ *data;
6448    /**
6449     * The number of elements pointed to by `data`.
6450     */
6451    uintptr_t datalen;
6452 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
6453
6454 /**
6455  * The contents of CResult_boolLightningErrorZ
6456  */
6457 typedef union LDKCResult_boolLightningErrorZPtr {
6458    /**
6459     * A pointer to the contents in the success state.
6460     * Reading from this pointer when `result_ok` is not set is undefined.
6461     */
6462    bool *result;
6463    /**
6464     * A pointer to the contents in the error state.
6465     * Reading from this pointer when `result_ok` is set is undefined.
6466     */
6467    struct LDKLightningError *err;
6468 } LDKCResult_boolLightningErrorZPtr;
6469
6470 /**
6471  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
6472  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6473  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474  */
6475 typedef struct LDKCResult_boolLightningErrorZ {
6476    /**
6477     * The contents of this CResult_boolLightningErrorZ, accessible via either
6478     * `err` or `result` depending on the state of `result_ok`.
6479     */
6480    union LDKCResult_boolLightningErrorZPtr contents;
6481    /**
6482     * Whether this CResult_boolLightningErrorZ represents a success state.
6483     */
6484    bool result_ok;
6485 } LDKCResult_boolLightningErrorZ;
6486
6487 /**
6488  * A tuple of 3 elements. See the individual fields for the types contained.
6489  */
6490 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6491    /**
6492     * The element at position 0
6493     */
6494    struct LDKChannelAnnouncement a;
6495    /**
6496     * The element at position 1
6497     */
6498    struct LDKChannelUpdate b;
6499    /**
6500     * The element at position 2
6501     */
6502    struct LDKChannelUpdate c;
6503 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
6504
6505 /**
6506  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6507  * This corresponds to std::vector in C++
6508  */
6509 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6510    /**
6511     * The elements in the array.
6512     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6513     */
6514    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
6515    /**
6516     * The number of elements pointed to by `data`.
6517     */
6518    uintptr_t datalen;
6519 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
6520
6521 /**
6522  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6523  * This corresponds to std::vector in C++
6524  */
6525 typedef struct LDKCVec_NodeAnnouncementZ {
6526    /**
6527     * The elements in the array.
6528     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6529     */
6530    struct LDKNodeAnnouncement *data;
6531    /**
6532     * The number of elements pointed to by `data`.
6533     */
6534    uintptr_t datalen;
6535 } LDKCVec_NodeAnnouncementZ;
6536
6537 /**
6538  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6539  * This corresponds to std::vector in C++
6540  */
6541 typedef struct LDKCVec_PublicKeyZ {
6542    /**
6543     * The elements in the array.
6544     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6545     */
6546    struct LDKPublicKey *data;
6547    /**
6548     * The number of elements pointed to by `data`.
6549     */
6550    uintptr_t datalen;
6551 } LDKCVec_PublicKeyZ;
6552
6553
6554
6555 /**
6556  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
6557  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
6558  * descriptor.
6559  */
6560 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
6561    /**
6562     * A pointer to the opaque Rust object.
6563     * Nearly everywhere, inner must be non-null, however in places where
6564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6565     */
6566    LDKnativePeerHandleError *inner;
6567    /**
6568     * Indicates that this is the only struct which contains the same pointer.
6569     * Rust functions which take ownership of an object provided via an argument require
6570     * this to be true and invalidate the object pointed to by inner.
6571     */
6572    bool is_owned;
6573 } LDKPeerHandleError;
6574
6575 /**
6576  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
6577  */
6578 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
6579    /**
6580     * A pointer to the contents in the success state.
6581     * Reading from this pointer when `result_ok` is not set is undefined.
6582     */
6583    struct LDKCVec_u8Z *result;
6584    /**
6585     * A pointer to the contents in the error state.
6586     * Reading from this pointer when `result_ok` is set is undefined.
6587     */
6588    struct LDKPeerHandleError *err;
6589 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
6590
6591 /**
6592  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6593  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6594  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6595  */
6596 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
6597    /**
6598     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6599     * `err` or `result` depending on the state of `result_ok`.
6600     */
6601    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
6602    /**
6603     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6604     */
6605    bool result_ok;
6606 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
6607
6608 /**
6609  * The contents of CResult_NonePeerHandleErrorZ
6610  */
6611 typedef union LDKCResult_NonePeerHandleErrorZPtr {
6612    /**
6613     * Note that this value is always NULL, as there are no contents in the OK variant
6614     */
6615    void *result;
6616    /**
6617     * A pointer to the contents in the error state.
6618     * Reading from this pointer when `result_ok` is set is undefined.
6619     */
6620    struct LDKPeerHandleError *err;
6621 } LDKCResult_NonePeerHandleErrorZPtr;
6622
6623 /**
6624  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6625  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6626  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6627  */
6628 typedef struct LDKCResult_NonePeerHandleErrorZ {
6629    /**
6630     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6631     * `err` or `result` depending on the state of `result_ok`.
6632     */
6633    union LDKCResult_NonePeerHandleErrorZPtr contents;
6634    /**
6635     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
6636     */
6637    bool result_ok;
6638 } LDKCResult_NonePeerHandleErrorZ;
6639
6640 /**
6641  * The contents of CResult_boolPeerHandleErrorZ
6642  */
6643 typedef union LDKCResult_boolPeerHandleErrorZPtr {
6644    /**
6645     * A pointer to the contents in the success state.
6646     * Reading from this pointer when `result_ok` is not set is undefined.
6647     */
6648    bool *result;
6649    /**
6650     * A pointer to the contents in the error state.
6651     * Reading from this pointer when `result_ok` is set is undefined.
6652     */
6653    struct LDKPeerHandleError *err;
6654 } LDKCResult_boolPeerHandleErrorZPtr;
6655
6656 /**
6657  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
6658  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6660  */
6661 typedef struct LDKCResult_boolPeerHandleErrorZ {
6662    /**
6663     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
6664     * `err` or `result` depending on the state of `result_ok`.
6665     */
6666    union LDKCResult_boolPeerHandleErrorZPtr contents;
6667    /**
6668     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
6669     */
6670    bool result_ok;
6671 } LDKCResult_boolPeerHandleErrorZ;
6672
6673 /**
6674  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6675  * UTXOs.
6676  */
6677 typedef struct LDKAccess {
6678    /**
6679     * An opaque pointer which is passed to your function implementations as an argument.
6680     * This has no meaning in the LDK, and can be NULL or any other value.
6681     */
6682    void *this_arg;
6683    /**
6684     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6685     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6686     * is unknown.
6687     *
6688     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6689     */
6690    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6691    /**
6692     * Frees any resources associated with this object given its this_arg pointer.
6693     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6694     */
6695    void (*free)(void *this_arg);
6696 } LDKAccess;
6697
6698 /**
6699  * An enum which can either contain a crate::lightning::chain::Access or not
6700  */
6701 typedef enum LDKCOption_AccessZ_Tag {
6702    /**
6703     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
6704     */
6705    LDKCOption_AccessZ_Some,
6706    /**
6707     * When we're in this state, this COption_AccessZ contains nothing
6708     */
6709    LDKCOption_AccessZ_None,
6710    /**
6711     * Must be last for serialization purposes
6712     */
6713    LDKCOption_AccessZ_Sentinel,
6714 } LDKCOption_AccessZ_Tag;
6715
6716 typedef struct LDKCOption_AccessZ {
6717    LDKCOption_AccessZ_Tag tag;
6718    union {
6719       struct {
6720          struct LDKAccess some;
6721       };
6722    };
6723 } LDKCOption_AccessZ;
6724
6725
6726
6727 /**
6728  * Details about one direction of a channel. Received
6729  * within a channel update.
6730  */
6731 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
6732    /**
6733     * A pointer to the opaque Rust object.
6734     * Nearly everywhere, inner must be non-null, however in places where
6735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6736     */
6737    LDKnativeDirectionalChannelInfo *inner;
6738    /**
6739     * Indicates that this is the only struct which contains the same pointer.
6740     * Rust functions which take ownership of an object provided via an argument require
6741     * this to be true and invalidate the object pointed to by inner.
6742     */
6743    bool is_owned;
6744 } LDKDirectionalChannelInfo;
6745
6746 /**
6747  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
6748  */
6749 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
6750    /**
6751     * A pointer to the contents in the success state.
6752     * Reading from this pointer when `result_ok` is not set is undefined.
6753     */
6754    struct LDKDirectionalChannelInfo *result;
6755    /**
6756     * A pointer to the contents in the error state.
6757     * Reading from this pointer when `result_ok` is set is undefined.
6758     */
6759    struct LDKDecodeError *err;
6760 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
6761
6762 /**
6763  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
6764  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6765  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6766  */
6767 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
6768    /**
6769     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
6770     * `err` or `result` depending on the state of `result_ok`.
6771     */
6772    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
6773    /**
6774     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
6775     */
6776    bool result_ok;
6777 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
6778
6779
6780
6781 /**
6782  * Details about a channel (both directions).
6783  * Received within a channel announcement.
6784  */
6785 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6786    /**
6787     * A pointer to the opaque Rust object.
6788     * Nearly everywhere, inner must be non-null, however in places where
6789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6790     */
6791    LDKnativeChannelInfo *inner;
6792    /**
6793     * Indicates that this is the only struct which contains the same pointer.
6794     * Rust functions which take ownership of an object provided via an argument require
6795     * this to be true and invalidate the object pointed to by inner.
6796     */
6797    bool is_owned;
6798 } LDKChannelInfo;
6799
6800 /**
6801  * The contents of CResult_ChannelInfoDecodeErrorZ
6802  */
6803 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6804    /**
6805     * A pointer to the contents in the success state.
6806     * Reading from this pointer when `result_ok` is not set is undefined.
6807     */
6808    struct LDKChannelInfo *result;
6809    /**
6810     * A pointer to the contents in the error state.
6811     * Reading from this pointer when `result_ok` is set is undefined.
6812     */
6813    struct LDKDecodeError *err;
6814 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6815
6816 /**
6817  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6818  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6819  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6820  */
6821 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6822    /**
6823     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6824     * `err` or `result` depending on the state of `result_ok`.
6825     */
6826    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6827    /**
6828     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6829     */
6830    bool result_ok;
6831 } LDKCResult_ChannelInfoDecodeErrorZ;
6832
6833
6834
6835 /**
6836  * Fees for routing via a given channel or a node
6837  */
6838 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6839    /**
6840     * A pointer to the opaque Rust object.
6841     * Nearly everywhere, inner must be non-null, however in places where
6842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6843     */
6844    LDKnativeRoutingFees *inner;
6845    /**
6846     * Indicates that this is the only struct which contains the same pointer.
6847     * Rust functions which take ownership of an object provided via an argument require
6848     * this to be true and invalidate the object pointed to by inner.
6849     */
6850    bool is_owned;
6851 } LDKRoutingFees;
6852
6853 /**
6854  * The contents of CResult_RoutingFeesDecodeErrorZ
6855  */
6856 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6857    /**
6858     * A pointer to the contents in the success state.
6859     * Reading from this pointer when `result_ok` is not set is undefined.
6860     */
6861    struct LDKRoutingFees *result;
6862    /**
6863     * A pointer to the contents in the error state.
6864     * Reading from this pointer when `result_ok` is set is undefined.
6865     */
6866    struct LDKDecodeError *err;
6867 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6868
6869 /**
6870  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6871  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6873  */
6874 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6875    /**
6876     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6877     * `err` or `result` depending on the state of `result_ok`.
6878     */
6879    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6880    /**
6881     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6882     */
6883    bool result_ok;
6884 } LDKCResult_RoutingFeesDecodeErrorZ;
6885
6886
6887
6888 /**
6889  * Information received in the latest node_announcement from this node.
6890  */
6891 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6892    /**
6893     * A pointer to the opaque Rust object.
6894     * Nearly everywhere, inner must be non-null, however in places where
6895     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6896     */
6897    LDKnativeNodeAnnouncementInfo *inner;
6898    /**
6899     * Indicates that this is the only struct which contains the same pointer.
6900     * Rust functions which take ownership of an object provided via an argument require
6901     * this to be true and invalidate the object pointed to by inner.
6902     */
6903    bool is_owned;
6904 } LDKNodeAnnouncementInfo;
6905
6906 /**
6907  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6908  */
6909 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6910    /**
6911     * A pointer to the contents in the success state.
6912     * Reading from this pointer when `result_ok` is not set is undefined.
6913     */
6914    struct LDKNodeAnnouncementInfo *result;
6915    /**
6916     * A pointer to the contents in the error state.
6917     * Reading from this pointer when `result_ok` is set is undefined.
6918     */
6919    struct LDKDecodeError *err;
6920 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6921
6922 /**
6923  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6924  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6925  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6926  */
6927 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6928    /**
6929     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6930     * `err` or `result` depending on the state of `result_ok`.
6931     */
6932    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6933    /**
6934     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6935     */
6936    bool result_ok;
6937 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6938
6939 /**
6940  * A dynamically-allocated array of u64s of arbitrary size.
6941  * This corresponds to std::vector in C++
6942  */
6943 typedef struct LDKCVec_u64Z {
6944    /**
6945     * The elements in the array.
6946     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6947     */
6948    uint64_t *data;
6949    /**
6950     * The number of elements pointed to by `data`.
6951     */
6952    uintptr_t datalen;
6953 } LDKCVec_u64Z;
6954
6955
6956
6957 /**
6958  * Details about a node in the network, known from the network announcement.
6959  */
6960 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6961    /**
6962     * A pointer to the opaque Rust object.
6963     * Nearly everywhere, inner must be non-null, however in places where
6964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6965     */
6966    LDKnativeNodeInfo *inner;
6967    /**
6968     * Indicates that this is the only struct which contains the same pointer.
6969     * Rust functions which take ownership of an object provided via an argument require
6970     * this to be true and invalidate the object pointed to by inner.
6971     */
6972    bool is_owned;
6973 } LDKNodeInfo;
6974
6975 /**
6976  * The contents of CResult_NodeInfoDecodeErrorZ
6977  */
6978 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6979    /**
6980     * A pointer to the contents in the success state.
6981     * Reading from this pointer when `result_ok` is not set is undefined.
6982     */
6983    struct LDKNodeInfo *result;
6984    /**
6985     * A pointer to the contents in the error state.
6986     * Reading from this pointer when `result_ok` is set is undefined.
6987     */
6988    struct LDKDecodeError *err;
6989 } LDKCResult_NodeInfoDecodeErrorZPtr;
6990
6991 /**
6992  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6993  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6994  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6995  */
6996 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6997    /**
6998     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6999     * `err` or `result` depending on the state of `result_ok`.
7000     */
7001    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7002    /**
7003     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7004     */
7005    bool result_ok;
7006 } LDKCResult_NodeInfoDecodeErrorZ;
7007
7008
7009
7010 /**
7011  * Represents the network as nodes and channels between them
7012  */
7013 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
7014    /**
7015     * A pointer to the opaque Rust object.
7016     * Nearly everywhere, inner must be non-null, however in places where
7017     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7018     */
7019    LDKnativeNetworkGraph *inner;
7020    /**
7021     * Indicates that this is the only struct which contains the same pointer.
7022     * Rust functions which take ownership of an object provided via an argument require
7023     * this to be true and invalidate the object pointed to by inner.
7024     */
7025    bool is_owned;
7026 } LDKNetworkGraph;
7027
7028 /**
7029  * The contents of CResult_NetworkGraphDecodeErrorZ
7030  */
7031 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7032    /**
7033     * A pointer to the contents in the success state.
7034     * Reading from this pointer when `result_ok` is not set is undefined.
7035     */
7036    struct LDKNetworkGraph *result;
7037    /**
7038     * A pointer to the contents in the error state.
7039     * Reading from this pointer when `result_ok` is set is undefined.
7040     */
7041    struct LDKDecodeError *err;
7042 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7043
7044 /**
7045  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7046  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7047  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7048  */
7049 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7050    /**
7051     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7052     * `err` or `result` depending on the state of `result_ok`.
7053     */
7054    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7055    /**
7056     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7057     */
7058    bool result_ok;
7059 } LDKCResult_NetworkGraphDecodeErrorZ;
7060
7061 /**
7062  * The contents of CResult_NetAddressu8Z
7063  */
7064 typedef union LDKCResult_NetAddressu8ZPtr {
7065    /**
7066     * A pointer to the contents in the success state.
7067     * Reading from this pointer when `result_ok` is not set is undefined.
7068     */
7069    struct LDKNetAddress *result;
7070    /**
7071     * A pointer to the contents in the error state.
7072     * Reading from this pointer when `result_ok` is set is undefined.
7073     */
7074    uint8_t *err;
7075 } LDKCResult_NetAddressu8ZPtr;
7076
7077 /**
7078  * A CResult_NetAddressu8Z represents the result of a fallible operation,
7079  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7080  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7081  */
7082 typedef struct LDKCResult_NetAddressu8Z {
7083    /**
7084     * The contents of this CResult_NetAddressu8Z, accessible via either
7085     * `err` or `result` depending on the state of `result_ok`.
7086     */
7087    union LDKCResult_NetAddressu8ZPtr contents;
7088    /**
7089     * Whether this CResult_NetAddressu8Z represents a success state.
7090     */
7091    bool result_ok;
7092 } LDKCResult_NetAddressu8Z;
7093
7094 /**
7095  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7096  */
7097 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7098    /**
7099     * A pointer to the contents in the success state.
7100     * Reading from this pointer when `result_ok` is not set is undefined.
7101     */
7102    struct LDKCResult_NetAddressu8Z *result;
7103    /**
7104     * A pointer to the contents in the error state.
7105     * Reading from this pointer when `result_ok` is set is undefined.
7106     */
7107    struct LDKDecodeError *err;
7108 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
7109
7110 /**
7111  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7112  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7113  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7114  */
7115 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
7116    /**
7117     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7118     * `err` or `result` depending on the state of `result_ok`.
7119     */
7120    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
7121    /**
7122     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7123     */
7124    bool result_ok;
7125 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
7126
7127 /**
7128  * The contents of CResult_NetAddressDecodeErrorZ
7129  */
7130 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
7131    /**
7132     * A pointer to the contents in the success state.
7133     * Reading from this pointer when `result_ok` is not set is undefined.
7134     */
7135    struct LDKNetAddress *result;
7136    /**
7137     * A pointer to the contents in the error state.
7138     * Reading from this pointer when `result_ok` is set is undefined.
7139     */
7140    struct LDKDecodeError *err;
7141 } LDKCResult_NetAddressDecodeErrorZPtr;
7142
7143 /**
7144  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7145  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7146  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7147  */
7148 typedef struct LDKCResult_NetAddressDecodeErrorZ {
7149    /**
7150     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7151     * `err` or `result` depending on the state of `result_ok`.
7152     */
7153    union LDKCResult_NetAddressDecodeErrorZPtr contents;
7154    /**
7155     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7156     */
7157    bool result_ok;
7158 } LDKCResult_NetAddressDecodeErrorZ;
7159
7160
7161
7162 /**
7163  * An update_add_htlc message to be sent or received from a peer
7164  */
7165 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
7166    /**
7167     * A pointer to the opaque Rust object.
7168     * Nearly everywhere, inner must be non-null, however in places where
7169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7170     */
7171    LDKnativeUpdateAddHTLC *inner;
7172    /**
7173     * Indicates that this is the only struct which contains the same pointer.
7174     * Rust functions which take ownership of an object provided via an argument require
7175     * this to be true and invalidate the object pointed to by inner.
7176     */
7177    bool is_owned;
7178 } LDKUpdateAddHTLC;
7179
7180 /**
7181  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7182  * This corresponds to std::vector in C++
7183  */
7184 typedef struct LDKCVec_UpdateAddHTLCZ {
7185    /**
7186     * The elements in the array.
7187     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7188     */
7189    struct LDKUpdateAddHTLC *data;
7190    /**
7191     * The number of elements pointed to by `data`.
7192     */
7193    uintptr_t datalen;
7194 } LDKCVec_UpdateAddHTLCZ;
7195
7196
7197
7198 /**
7199  * An update_fulfill_htlc message to be sent or received from a peer
7200  */
7201 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
7202    /**
7203     * A pointer to the opaque Rust object.
7204     * Nearly everywhere, inner must be non-null, however in places where
7205     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7206     */
7207    LDKnativeUpdateFulfillHTLC *inner;
7208    /**
7209     * Indicates that this is the only struct which contains the same pointer.
7210     * Rust functions which take ownership of an object provided via an argument require
7211     * this to be true and invalidate the object pointed to by inner.
7212     */
7213    bool is_owned;
7214 } LDKUpdateFulfillHTLC;
7215
7216 /**
7217  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7218  * This corresponds to std::vector in C++
7219  */
7220 typedef struct LDKCVec_UpdateFulfillHTLCZ {
7221    /**
7222     * The elements in the array.
7223     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7224     */
7225    struct LDKUpdateFulfillHTLC *data;
7226    /**
7227     * The number of elements pointed to by `data`.
7228     */
7229    uintptr_t datalen;
7230 } LDKCVec_UpdateFulfillHTLCZ;
7231
7232
7233
7234 /**
7235  * An update_fail_htlc message to be sent or received from a peer
7236  */
7237 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
7238    /**
7239     * A pointer to the opaque Rust object.
7240     * Nearly everywhere, inner must be non-null, however in places where
7241     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7242     */
7243    LDKnativeUpdateFailHTLC *inner;
7244    /**
7245     * Indicates that this is the only struct which contains the same pointer.
7246     * Rust functions which take ownership of an object provided via an argument require
7247     * this to be true and invalidate the object pointed to by inner.
7248     */
7249    bool is_owned;
7250 } LDKUpdateFailHTLC;
7251
7252 /**
7253  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
7254  * This corresponds to std::vector in C++
7255  */
7256 typedef struct LDKCVec_UpdateFailHTLCZ {
7257    /**
7258     * The elements in the array.
7259     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7260     */
7261    struct LDKUpdateFailHTLC *data;
7262    /**
7263     * The number of elements pointed to by `data`.
7264     */
7265    uintptr_t datalen;
7266 } LDKCVec_UpdateFailHTLCZ;
7267
7268
7269
7270 /**
7271  * An update_fail_malformed_htlc message to be sent or received from a peer
7272  */
7273 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
7274    /**
7275     * A pointer to the opaque Rust object.
7276     * Nearly everywhere, inner must be non-null, however in places where
7277     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7278     */
7279    LDKnativeUpdateFailMalformedHTLC *inner;
7280    /**
7281     * Indicates that this is the only struct which contains the same pointer.
7282     * Rust functions which take ownership of an object provided via an argument require
7283     * this to be true and invalidate the object pointed to by inner.
7284     */
7285    bool is_owned;
7286 } LDKUpdateFailMalformedHTLC;
7287
7288 /**
7289  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
7290  * This corresponds to std::vector in C++
7291  */
7292 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
7293    /**
7294     * The elements in the array.
7295     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7296     */
7297    struct LDKUpdateFailMalformedHTLC *data;
7298    /**
7299     * The number of elements pointed to by `data`.
7300     */
7301    uintptr_t datalen;
7302 } LDKCVec_UpdateFailMalformedHTLCZ;
7303
7304 /**
7305  * The contents of CResult_AcceptChannelDecodeErrorZ
7306  */
7307 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
7308    /**
7309     * A pointer to the contents in the success state.
7310     * Reading from this pointer when `result_ok` is not set is undefined.
7311     */
7312    struct LDKAcceptChannel *result;
7313    /**
7314     * A pointer to the contents in the error state.
7315     * Reading from this pointer when `result_ok` is set is undefined.
7316     */
7317    struct LDKDecodeError *err;
7318 } LDKCResult_AcceptChannelDecodeErrorZPtr;
7319
7320 /**
7321  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
7322  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7323  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7324  */
7325 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
7326    /**
7327     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
7328     * `err` or `result` depending on the state of `result_ok`.
7329     */
7330    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
7331    /**
7332     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
7333     */
7334    bool result_ok;
7335 } LDKCResult_AcceptChannelDecodeErrorZ;
7336
7337 /**
7338  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
7339  */
7340 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
7341    /**
7342     * A pointer to the contents in the success state.
7343     * Reading from this pointer when `result_ok` is not set is undefined.
7344     */
7345    struct LDKAnnouncementSignatures *result;
7346    /**
7347     * A pointer to the contents in the error state.
7348     * Reading from this pointer when `result_ok` is set is undefined.
7349     */
7350    struct LDKDecodeError *err;
7351 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
7352
7353 /**
7354  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
7355  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
7356  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7357  */
7358 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
7359    /**
7360     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
7361     * `err` or `result` depending on the state of `result_ok`.
7362     */
7363    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
7364    /**
7365     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
7366     */
7367    bool result_ok;
7368 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
7369
7370 /**
7371  * The contents of CResult_ChannelReestablishDecodeErrorZ
7372  */
7373 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
7374    /**
7375     * A pointer to the contents in the success state.
7376     * Reading from this pointer when `result_ok` is not set is undefined.
7377     */
7378    struct LDKChannelReestablish *result;
7379    /**
7380     * A pointer to the contents in the error state.
7381     * Reading from this pointer when `result_ok` is set is undefined.
7382     */
7383    struct LDKDecodeError *err;
7384 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
7385
7386 /**
7387  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
7388  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
7389  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7390  */
7391 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
7392    /**
7393     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
7394     * `err` or `result` depending on the state of `result_ok`.
7395     */
7396    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
7397    /**
7398     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
7399     */
7400    bool result_ok;
7401 } LDKCResult_ChannelReestablishDecodeErrorZ;
7402
7403 /**
7404  * The contents of CResult_ClosingSignedDecodeErrorZ
7405  */
7406 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
7407    /**
7408     * A pointer to the contents in the success state.
7409     * Reading from this pointer when `result_ok` is not set is undefined.
7410     */
7411    struct LDKClosingSigned *result;
7412    /**
7413     * A pointer to the contents in the error state.
7414     * Reading from this pointer when `result_ok` is set is undefined.
7415     */
7416    struct LDKDecodeError *err;
7417 } LDKCResult_ClosingSignedDecodeErrorZPtr;
7418
7419 /**
7420  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
7421  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7422  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7423  */
7424 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
7425    /**
7426     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
7427     * `err` or `result` depending on the state of `result_ok`.
7428     */
7429    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
7430    /**
7431     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
7432     */
7433    bool result_ok;
7434 } LDKCResult_ClosingSignedDecodeErrorZ;
7435
7436
7437
7438 /**
7439  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
7440  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
7441  * to use.
7442  */
7443 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
7444    /**
7445     * A pointer to the opaque Rust object.
7446     * Nearly everywhere, inner must be non-null, however in places where
7447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7448     */
7449    LDKnativeClosingSignedFeeRange *inner;
7450    /**
7451     * Indicates that this is the only struct which contains the same pointer.
7452     * Rust functions which take ownership of an object provided via an argument require
7453     * this to be true and invalidate the object pointed to by inner.
7454     */
7455    bool is_owned;
7456 } LDKClosingSignedFeeRange;
7457
7458 /**
7459  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
7460  */
7461 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
7462    /**
7463     * A pointer to the contents in the success state.
7464     * Reading from this pointer when `result_ok` is not set is undefined.
7465     */
7466    struct LDKClosingSignedFeeRange *result;
7467    /**
7468     * A pointer to the contents in the error state.
7469     * Reading from this pointer when `result_ok` is set is undefined.
7470     */
7471    struct LDKDecodeError *err;
7472 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
7473
7474 /**
7475  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
7476  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7477  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7478  */
7479 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
7480    /**
7481     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
7482     * `err` or `result` depending on the state of `result_ok`.
7483     */
7484    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
7485    /**
7486     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
7487     */
7488    bool result_ok;
7489 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
7490
7491
7492
7493 /**
7494  * A commitment_signed message to be sent or received from a peer
7495  */
7496 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
7497    /**
7498     * A pointer to the opaque Rust object.
7499     * Nearly everywhere, inner must be non-null, however in places where
7500     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7501     */
7502    LDKnativeCommitmentSigned *inner;
7503    /**
7504     * Indicates that this is the only struct which contains the same pointer.
7505     * Rust functions which take ownership of an object provided via an argument require
7506     * this to be true and invalidate the object pointed to by inner.
7507     */
7508    bool is_owned;
7509 } LDKCommitmentSigned;
7510
7511 /**
7512  * The contents of CResult_CommitmentSignedDecodeErrorZ
7513  */
7514 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
7515    /**
7516     * A pointer to the contents in the success state.
7517     * Reading from this pointer when `result_ok` is not set is undefined.
7518     */
7519    struct LDKCommitmentSigned *result;
7520    /**
7521     * A pointer to the contents in the error state.
7522     * Reading from this pointer when `result_ok` is set is undefined.
7523     */
7524    struct LDKDecodeError *err;
7525 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
7526
7527 /**
7528  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
7529  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7530  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7531  */
7532 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
7533    /**
7534     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
7535     * `err` or `result` depending on the state of `result_ok`.
7536     */
7537    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
7538    /**
7539     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
7540     */
7541    bool result_ok;
7542 } LDKCResult_CommitmentSignedDecodeErrorZ;
7543
7544 /**
7545  * The contents of CResult_FundingCreatedDecodeErrorZ
7546  */
7547 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
7548    /**
7549     * A pointer to the contents in the success state.
7550     * Reading from this pointer when `result_ok` is not set is undefined.
7551     */
7552    struct LDKFundingCreated *result;
7553    /**
7554     * A pointer to the contents in the error state.
7555     * Reading from this pointer when `result_ok` is set is undefined.
7556     */
7557    struct LDKDecodeError *err;
7558 } LDKCResult_FundingCreatedDecodeErrorZPtr;
7559
7560 /**
7561  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
7562  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
7563  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7564  */
7565 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
7566    /**
7567     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
7568     * `err` or `result` depending on the state of `result_ok`.
7569     */
7570    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
7571    /**
7572     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
7573     */
7574    bool result_ok;
7575 } LDKCResult_FundingCreatedDecodeErrorZ;
7576
7577 /**
7578  * The contents of CResult_FundingSignedDecodeErrorZ
7579  */
7580 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
7581    /**
7582     * A pointer to the contents in the success state.
7583     * Reading from this pointer when `result_ok` is not set is undefined.
7584     */
7585    struct LDKFundingSigned *result;
7586    /**
7587     * A pointer to the contents in the error state.
7588     * Reading from this pointer when `result_ok` is set is undefined.
7589     */
7590    struct LDKDecodeError *err;
7591 } LDKCResult_FundingSignedDecodeErrorZPtr;
7592
7593 /**
7594  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
7595  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7596  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7597  */
7598 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
7599    /**
7600     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
7601     * `err` or `result` depending on the state of `result_ok`.
7602     */
7603    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
7604    /**
7605     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
7606     */
7607    bool result_ok;
7608 } LDKCResult_FundingSignedDecodeErrorZ;
7609
7610 /**
7611  * The contents of CResult_FundingLockedDecodeErrorZ
7612  */
7613 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
7614    /**
7615     * A pointer to the contents in the success state.
7616     * Reading from this pointer when `result_ok` is not set is undefined.
7617     */
7618    struct LDKFundingLocked *result;
7619    /**
7620     * A pointer to the contents in the error state.
7621     * Reading from this pointer when `result_ok` is set is undefined.
7622     */
7623    struct LDKDecodeError *err;
7624 } LDKCResult_FundingLockedDecodeErrorZPtr;
7625
7626 /**
7627  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
7628  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
7629  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7630  */
7631 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
7632    /**
7633     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
7634     * `err` or `result` depending on the state of `result_ok`.
7635     */
7636    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
7637    /**
7638     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
7639     */
7640    bool result_ok;
7641 } LDKCResult_FundingLockedDecodeErrorZ;
7642
7643
7644
7645 /**
7646  * An init message to be sent or received from a peer
7647  */
7648 typedef struct MUST_USE_STRUCT LDKInit {
7649    /**
7650     * A pointer to the opaque Rust object.
7651     * Nearly everywhere, inner must be non-null, however in places where
7652     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7653     */
7654    LDKnativeInit *inner;
7655    /**
7656     * Indicates that this is the only struct which contains the same pointer.
7657     * Rust functions which take ownership of an object provided via an argument require
7658     * this to be true and invalidate the object pointed to by inner.
7659     */
7660    bool is_owned;
7661 } LDKInit;
7662
7663 /**
7664  * The contents of CResult_InitDecodeErrorZ
7665  */
7666 typedef union LDKCResult_InitDecodeErrorZPtr {
7667    /**
7668     * A pointer to the contents in the success state.
7669     * Reading from this pointer when `result_ok` is not set is undefined.
7670     */
7671    struct LDKInit *result;
7672    /**
7673     * A pointer to the contents in the error state.
7674     * Reading from this pointer when `result_ok` is set is undefined.
7675     */
7676    struct LDKDecodeError *err;
7677 } LDKCResult_InitDecodeErrorZPtr;
7678
7679 /**
7680  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
7681  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
7682  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7683  */
7684 typedef struct LDKCResult_InitDecodeErrorZ {
7685    /**
7686     * The contents of this CResult_InitDecodeErrorZ, accessible via either
7687     * `err` or `result` depending on the state of `result_ok`.
7688     */
7689    union LDKCResult_InitDecodeErrorZPtr contents;
7690    /**
7691     * Whether this CResult_InitDecodeErrorZ represents a success state.
7692     */
7693    bool result_ok;
7694 } LDKCResult_InitDecodeErrorZ;
7695
7696 /**
7697  * The contents of CResult_OpenChannelDecodeErrorZ
7698  */
7699 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
7700    /**
7701     * A pointer to the contents in the success state.
7702     * Reading from this pointer when `result_ok` is not set is undefined.
7703     */
7704    struct LDKOpenChannel *result;
7705    /**
7706     * A pointer to the contents in the error state.
7707     * Reading from this pointer when `result_ok` is set is undefined.
7708     */
7709    struct LDKDecodeError *err;
7710 } LDKCResult_OpenChannelDecodeErrorZPtr;
7711
7712 /**
7713  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
7714  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7715  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7716  */
7717 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
7718    /**
7719     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
7720     * `err` or `result` depending on the state of `result_ok`.
7721     */
7722    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
7723    /**
7724     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
7725     */
7726    bool result_ok;
7727 } LDKCResult_OpenChannelDecodeErrorZ;
7728
7729 /**
7730  * The contents of CResult_RevokeAndACKDecodeErrorZ
7731  */
7732 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
7733    /**
7734     * A pointer to the contents in the success state.
7735     * Reading from this pointer when `result_ok` is not set is undefined.
7736     */
7737    struct LDKRevokeAndACK *result;
7738    /**
7739     * A pointer to the contents in the error state.
7740     * Reading from this pointer when `result_ok` is set is undefined.
7741     */
7742    struct LDKDecodeError *err;
7743 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
7744
7745 /**
7746  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7747  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
7748  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749  */
7750 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
7751    /**
7752     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7753     * `err` or `result` depending on the state of `result_ok`.
7754     */
7755    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
7756    /**
7757     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7758     */
7759    bool result_ok;
7760 } LDKCResult_RevokeAndACKDecodeErrorZ;
7761
7762 /**
7763  * The contents of CResult_ShutdownDecodeErrorZ
7764  */
7765 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
7766    /**
7767     * A pointer to the contents in the success state.
7768     * Reading from this pointer when `result_ok` is not set is undefined.
7769     */
7770    struct LDKShutdown *result;
7771    /**
7772     * A pointer to the contents in the error state.
7773     * Reading from this pointer when `result_ok` is set is undefined.
7774     */
7775    struct LDKDecodeError *err;
7776 } LDKCResult_ShutdownDecodeErrorZPtr;
7777
7778 /**
7779  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7780  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
7781  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7782  */
7783 typedef struct LDKCResult_ShutdownDecodeErrorZ {
7784    /**
7785     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7786     * `err` or `result` depending on the state of `result_ok`.
7787     */
7788    union LDKCResult_ShutdownDecodeErrorZPtr contents;
7789    /**
7790     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7791     */
7792    bool result_ok;
7793 } LDKCResult_ShutdownDecodeErrorZ;
7794
7795 /**
7796  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
7797  */
7798 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
7799    /**
7800     * A pointer to the contents in the success state.
7801     * Reading from this pointer when `result_ok` is not set is undefined.
7802     */
7803    struct LDKUpdateFailHTLC *result;
7804    /**
7805     * A pointer to the contents in the error state.
7806     * Reading from this pointer when `result_ok` is set is undefined.
7807     */
7808    struct LDKDecodeError *err;
7809 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
7810
7811 /**
7812  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7813  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7814  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7815  */
7816 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
7817    /**
7818     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7819     * `err` or `result` depending on the state of `result_ok`.
7820     */
7821    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
7822    /**
7823     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7824     */
7825    bool result_ok;
7826 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
7827
7828 /**
7829  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7830  */
7831 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7832    /**
7833     * A pointer to the contents in the success state.
7834     * Reading from this pointer when `result_ok` is not set is undefined.
7835     */
7836    struct LDKUpdateFailMalformedHTLC *result;
7837    /**
7838     * A pointer to the contents in the error state.
7839     * Reading from this pointer when `result_ok` is set is undefined.
7840     */
7841    struct LDKDecodeError *err;
7842 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
7843
7844 /**
7845  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7846  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7847  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7848  */
7849 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
7850    /**
7851     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7852     * `err` or `result` depending on the state of `result_ok`.
7853     */
7854    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
7855    /**
7856     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7857     */
7858    bool result_ok;
7859 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
7860
7861
7862
7863 /**
7864  * An update_fee message to be sent or received from a peer
7865  */
7866 typedef struct MUST_USE_STRUCT LDKUpdateFee {
7867    /**
7868     * A pointer to the opaque Rust object.
7869     * Nearly everywhere, inner must be non-null, however in places where
7870     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7871     */
7872    LDKnativeUpdateFee *inner;
7873    /**
7874     * Indicates that this is the only struct which contains the same pointer.
7875     * Rust functions which take ownership of an object provided via an argument require
7876     * this to be true and invalidate the object pointed to by inner.
7877     */
7878    bool is_owned;
7879 } LDKUpdateFee;
7880
7881 /**
7882  * The contents of CResult_UpdateFeeDecodeErrorZ
7883  */
7884 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
7885    /**
7886     * A pointer to the contents in the success state.
7887     * Reading from this pointer when `result_ok` is not set is undefined.
7888     */
7889    struct LDKUpdateFee *result;
7890    /**
7891     * A pointer to the contents in the error state.
7892     * Reading from this pointer when `result_ok` is set is undefined.
7893     */
7894    struct LDKDecodeError *err;
7895 } LDKCResult_UpdateFeeDecodeErrorZPtr;
7896
7897 /**
7898  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7899  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7900  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7901  */
7902 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
7903    /**
7904     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7905     * `err` or `result` depending on the state of `result_ok`.
7906     */
7907    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
7908    /**
7909     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7910     */
7911    bool result_ok;
7912 } LDKCResult_UpdateFeeDecodeErrorZ;
7913
7914 /**
7915  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7916  */
7917 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
7918    /**
7919     * A pointer to the contents in the success state.
7920     * Reading from this pointer when `result_ok` is not set is undefined.
7921     */
7922    struct LDKUpdateFulfillHTLC *result;
7923    /**
7924     * A pointer to the contents in the error state.
7925     * Reading from this pointer when `result_ok` is set is undefined.
7926     */
7927    struct LDKDecodeError *err;
7928 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
7929
7930 /**
7931  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7932  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7933  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7934  */
7935 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
7936    /**
7937     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7938     * `err` or `result` depending on the state of `result_ok`.
7939     */
7940    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
7941    /**
7942     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7943     */
7944    bool result_ok;
7945 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
7946
7947 /**
7948  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
7949  */
7950 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
7951    /**
7952     * A pointer to the contents in the success state.
7953     * Reading from this pointer when `result_ok` is not set is undefined.
7954     */
7955    struct LDKUpdateAddHTLC *result;
7956    /**
7957     * A pointer to the contents in the error state.
7958     * Reading from this pointer when `result_ok` is set is undefined.
7959     */
7960    struct LDKDecodeError *err;
7961 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
7962
7963 /**
7964  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7965  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7966  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7967  */
7968 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
7969    /**
7970     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7971     * `err` or `result` depending on the state of `result_ok`.
7972     */
7973    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
7974    /**
7975     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7976     */
7977    bool result_ok;
7978 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
7979
7980
7981
7982 /**
7983  * A ping message to be sent or received from a peer
7984  */
7985 typedef struct MUST_USE_STRUCT LDKPing {
7986    /**
7987     * A pointer to the opaque Rust object.
7988     * Nearly everywhere, inner must be non-null, however in places where
7989     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7990     */
7991    LDKnativePing *inner;
7992    /**
7993     * Indicates that this is the only struct which contains the same pointer.
7994     * Rust functions which take ownership of an object provided via an argument require
7995     * this to be true and invalidate the object pointed to by inner.
7996     */
7997    bool is_owned;
7998 } LDKPing;
7999
8000 /**
8001  * The contents of CResult_PingDecodeErrorZ
8002  */
8003 typedef union LDKCResult_PingDecodeErrorZPtr {
8004    /**
8005     * A pointer to the contents in the success state.
8006     * Reading from this pointer when `result_ok` is not set is undefined.
8007     */
8008    struct LDKPing *result;
8009    /**
8010     * A pointer to the contents in the error state.
8011     * Reading from this pointer when `result_ok` is set is undefined.
8012     */
8013    struct LDKDecodeError *err;
8014 } LDKCResult_PingDecodeErrorZPtr;
8015
8016 /**
8017  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
8018  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
8019  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8020  */
8021 typedef struct LDKCResult_PingDecodeErrorZ {
8022    /**
8023     * The contents of this CResult_PingDecodeErrorZ, accessible via either
8024     * `err` or `result` depending on the state of `result_ok`.
8025     */
8026    union LDKCResult_PingDecodeErrorZPtr contents;
8027    /**
8028     * Whether this CResult_PingDecodeErrorZ represents a success state.
8029     */
8030    bool result_ok;
8031 } LDKCResult_PingDecodeErrorZ;
8032
8033
8034
8035 /**
8036  * A pong message to be sent or received from a peer
8037  */
8038 typedef struct MUST_USE_STRUCT LDKPong {
8039    /**
8040     * A pointer to the opaque Rust object.
8041     * Nearly everywhere, inner must be non-null, however in places where
8042     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8043     */
8044    LDKnativePong *inner;
8045    /**
8046     * Indicates that this is the only struct which contains the same pointer.
8047     * Rust functions which take ownership of an object provided via an argument require
8048     * this to be true and invalidate the object pointed to by inner.
8049     */
8050    bool is_owned;
8051 } LDKPong;
8052
8053 /**
8054  * The contents of CResult_PongDecodeErrorZ
8055  */
8056 typedef union LDKCResult_PongDecodeErrorZPtr {
8057    /**
8058     * A pointer to the contents in the success state.
8059     * Reading from this pointer when `result_ok` is not set is undefined.
8060     */
8061    struct LDKPong *result;
8062    /**
8063     * A pointer to the contents in the error state.
8064     * Reading from this pointer when `result_ok` is set is undefined.
8065     */
8066    struct LDKDecodeError *err;
8067 } LDKCResult_PongDecodeErrorZPtr;
8068
8069 /**
8070  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
8071  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
8072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8073  */
8074 typedef struct LDKCResult_PongDecodeErrorZ {
8075    /**
8076     * The contents of this CResult_PongDecodeErrorZ, accessible via either
8077     * `err` or `result` depending on the state of `result_ok`.
8078     */
8079    union LDKCResult_PongDecodeErrorZPtr contents;
8080    /**
8081     * Whether this CResult_PongDecodeErrorZ represents a success state.
8082     */
8083    bool result_ok;
8084 } LDKCResult_PongDecodeErrorZ;
8085
8086 /**
8087  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
8088  */
8089 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8090    /**
8091     * A pointer to the contents in the success state.
8092     * Reading from this pointer when `result_ok` is not set is undefined.
8093     */
8094    struct LDKUnsignedChannelAnnouncement *result;
8095    /**
8096     * A pointer to the contents in the error state.
8097     * Reading from this pointer when `result_ok` is set is undefined.
8098     */
8099    struct LDKDecodeError *err;
8100 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
8101
8102 /**
8103  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8104  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8106  */
8107 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
8108    /**
8109     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
8110     * `err` or `result` depending on the state of `result_ok`.
8111     */
8112    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
8113    /**
8114     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
8115     */
8116    bool result_ok;
8117 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
8118
8119 /**
8120  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
8121  */
8122 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
8123    /**
8124     * A pointer to the contents in the success state.
8125     * Reading from this pointer when `result_ok` is not set is undefined.
8126     */
8127    struct LDKChannelAnnouncement *result;
8128    /**
8129     * A pointer to the contents in the error state.
8130     * Reading from this pointer when `result_ok` is set is undefined.
8131     */
8132    struct LDKDecodeError *err;
8133 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
8134
8135 /**
8136  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8137  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8138  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8139  */
8140 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
8141    /**
8142     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8143     * `err` or `result` depending on the state of `result_ok`.
8144     */
8145    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
8146    /**
8147     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8148     */
8149    bool result_ok;
8150 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
8151
8152
8153
8154 /**
8155  * The unsigned part of a channel_update
8156  */
8157 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8158    /**
8159     * A pointer to the opaque Rust object.
8160     * Nearly everywhere, inner must be non-null, however in places where
8161     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8162     */
8163    LDKnativeUnsignedChannelUpdate *inner;
8164    /**
8165     * Indicates that this is the only struct which contains the same pointer.
8166     * Rust functions which take ownership of an object provided via an argument require
8167     * this to be true and invalidate the object pointed to by inner.
8168     */
8169    bool is_owned;
8170 } LDKUnsignedChannelUpdate;
8171
8172 /**
8173  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8174  */
8175 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
8176    /**
8177     * A pointer to the contents in the success state.
8178     * Reading from this pointer when `result_ok` is not set is undefined.
8179     */
8180    struct LDKUnsignedChannelUpdate *result;
8181    /**
8182     * A pointer to the contents in the error state.
8183     * Reading from this pointer when `result_ok` is set is undefined.
8184     */
8185    struct LDKDecodeError *err;
8186 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
8187
8188 /**
8189  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8190  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8191  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8192  */
8193 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
8194    /**
8195     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8196     * `err` or `result` depending on the state of `result_ok`.
8197     */
8198    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
8199    /**
8200     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8201     */
8202    bool result_ok;
8203 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
8204
8205 /**
8206  * The contents of CResult_ChannelUpdateDecodeErrorZ
8207  */
8208 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
8209    /**
8210     * A pointer to the contents in the success state.
8211     * Reading from this pointer when `result_ok` is not set is undefined.
8212     */
8213    struct LDKChannelUpdate *result;
8214    /**
8215     * A pointer to the contents in the error state.
8216     * Reading from this pointer when `result_ok` is set is undefined.
8217     */
8218    struct LDKDecodeError *err;
8219 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
8220
8221 /**
8222  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8223  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8224  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8225  */
8226 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
8227    /**
8228     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8229     * `err` or `result` depending on the state of `result_ok`.
8230     */
8231    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
8232    /**
8233     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8234     */
8235    bool result_ok;
8236 } LDKCResult_ChannelUpdateDecodeErrorZ;
8237
8238 /**
8239  * The contents of CResult_ErrorMessageDecodeErrorZ
8240  */
8241 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
8242    /**
8243     * A pointer to the contents in the success state.
8244     * Reading from this pointer when `result_ok` is not set is undefined.
8245     */
8246    struct LDKErrorMessage *result;
8247    /**
8248     * A pointer to the contents in the error state.
8249     * Reading from this pointer when `result_ok` is set is undefined.
8250     */
8251    struct LDKDecodeError *err;
8252 } LDKCResult_ErrorMessageDecodeErrorZPtr;
8253
8254 /**
8255  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8256  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8257  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8258  */
8259 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
8260    /**
8261     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8262     * `err` or `result` depending on the state of `result_ok`.
8263     */
8264    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
8265    /**
8266     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8267     */
8268    bool result_ok;
8269 } LDKCResult_ErrorMessageDecodeErrorZ;
8270
8271
8272
8273 /**
8274  * The unsigned part of a node_announcement
8275  */
8276 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8277    /**
8278     * A pointer to the opaque Rust object.
8279     * Nearly everywhere, inner must be non-null, however in places where
8280     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8281     */
8282    LDKnativeUnsignedNodeAnnouncement *inner;
8283    /**
8284     * Indicates that this is the only struct which contains the same pointer.
8285     * Rust functions which take ownership of an object provided via an argument require
8286     * this to be true and invalidate the object pointed to by inner.
8287     */
8288    bool is_owned;
8289 } LDKUnsignedNodeAnnouncement;
8290
8291 /**
8292  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8293  */
8294 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8295    /**
8296     * A pointer to the contents in the success state.
8297     * Reading from this pointer when `result_ok` is not set is undefined.
8298     */
8299    struct LDKUnsignedNodeAnnouncement *result;
8300    /**
8301     * A pointer to the contents in the error state.
8302     * Reading from this pointer when `result_ok` is set is undefined.
8303     */
8304    struct LDKDecodeError *err;
8305 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
8306
8307 /**
8308  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8309  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8310  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8311  */
8312 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
8313    /**
8314     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8315     * `err` or `result` depending on the state of `result_ok`.
8316     */
8317    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
8318    /**
8319     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8320     */
8321    bool result_ok;
8322 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
8323
8324 /**
8325  * The contents of CResult_NodeAnnouncementDecodeErrorZ
8326  */
8327 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
8328    /**
8329     * A pointer to the contents in the success state.
8330     * Reading from this pointer when `result_ok` is not set is undefined.
8331     */
8332    struct LDKNodeAnnouncement *result;
8333    /**
8334     * A pointer to the contents in the error state.
8335     * Reading from this pointer when `result_ok` is set is undefined.
8336     */
8337    struct LDKDecodeError *err;
8338 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
8339
8340 /**
8341  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8342  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8344  */
8345 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
8346    /**
8347     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8348     * `err` or `result` depending on the state of `result_ok`.
8349     */
8350    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
8351    /**
8352     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8353     */
8354    bool result_ok;
8355 } LDKCResult_NodeAnnouncementDecodeErrorZ;
8356
8357 /**
8358  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8359  */
8360 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
8361    /**
8362     * A pointer to the contents in the success state.
8363     * Reading from this pointer when `result_ok` is not set is undefined.
8364     */
8365    struct LDKQueryShortChannelIds *result;
8366    /**
8367     * A pointer to the contents in the error state.
8368     * Reading from this pointer when `result_ok` is set is undefined.
8369     */
8370    struct LDKDecodeError *err;
8371 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
8372
8373 /**
8374  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8375  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8376  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8377  */
8378 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
8379    /**
8380     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8381     * `err` or `result` depending on the state of `result_ok`.
8382     */
8383    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
8384    /**
8385     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8386     */
8387    bool result_ok;
8388 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
8389
8390
8391
8392 /**
8393  * A reply_short_channel_ids_end message is sent as a reply to a
8394  * query_short_channel_ids message. The query recipient makes a best
8395  * effort to respond based on their local network view which may not be
8396  * a perfect view of the network.
8397  */
8398 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
8399    /**
8400     * A pointer to the opaque Rust object.
8401     * Nearly everywhere, inner must be non-null, however in places where
8402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8403     */
8404    LDKnativeReplyShortChannelIdsEnd *inner;
8405    /**
8406     * Indicates that this is the only struct which contains the same pointer.
8407     * Rust functions which take ownership of an object provided via an argument require
8408     * this to be true and invalidate the object pointed to by inner.
8409     */
8410    bool is_owned;
8411 } LDKReplyShortChannelIdsEnd;
8412
8413 /**
8414  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8415  */
8416 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8417    /**
8418     * A pointer to the contents in the success state.
8419     * Reading from this pointer when `result_ok` is not set is undefined.
8420     */
8421    struct LDKReplyShortChannelIdsEnd *result;
8422    /**
8423     * A pointer to the contents in the error state.
8424     * Reading from this pointer when `result_ok` is set is undefined.
8425     */
8426    struct LDKDecodeError *err;
8427 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
8428
8429 /**
8430  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8431  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8432  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8433  */
8434 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
8435    /**
8436     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8437     * `err` or `result` depending on the state of `result_ok`.
8438     */
8439    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
8440    /**
8441     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8442     */
8443    bool result_ok;
8444 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
8445
8446 /**
8447  * The contents of CResult_QueryChannelRangeDecodeErrorZ
8448  */
8449 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
8450    /**
8451     * A pointer to the contents in the success state.
8452     * Reading from this pointer when `result_ok` is not set is undefined.
8453     */
8454    struct LDKQueryChannelRange *result;
8455    /**
8456     * A pointer to the contents in the error state.
8457     * Reading from this pointer when `result_ok` is set is undefined.
8458     */
8459    struct LDKDecodeError *err;
8460 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
8461
8462 /**
8463  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8464  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8465  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8466  */
8467 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
8468    /**
8469     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8470     * `err` or `result` depending on the state of `result_ok`.
8471     */
8472    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
8473    /**
8474     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8475     */
8476    bool result_ok;
8477 } LDKCResult_QueryChannelRangeDecodeErrorZ;
8478
8479 /**
8480  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
8481  */
8482 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
8483    /**
8484     * A pointer to the contents in the success state.
8485     * Reading from this pointer when `result_ok` is not set is undefined.
8486     */
8487    struct LDKReplyChannelRange *result;
8488    /**
8489     * A pointer to the contents in the error state.
8490     * Reading from this pointer when `result_ok` is set is undefined.
8491     */
8492    struct LDKDecodeError *err;
8493 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
8494
8495 /**
8496  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8497  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8498  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8499  */
8500 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
8501    /**
8502     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8503     * `err` or `result` depending on the state of `result_ok`.
8504     */
8505    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
8506    /**
8507     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8508     */
8509    bool result_ok;
8510 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
8511
8512
8513
8514 /**
8515  * A gossip_timestamp_filter message is used by a node to request
8516  * gossip relay for messages in the requested time range when the
8517  * gossip_queries feature has been negotiated.
8518  */
8519 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
8520    /**
8521     * A pointer to the opaque Rust object.
8522     * Nearly everywhere, inner must be non-null, however in places where
8523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8524     */
8525    LDKnativeGossipTimestampFilter *inner;
8526    /**
8527     * Indicates that this is the only struct which contains the same pointer.
8528     * Rust functions which take ownership of an object provided via an argument require
8529     * this to be true and invalidate the object pointed to by inner.
8530     */
8531    bool is_owned;
8532 } LDKGossipTimestampFilter;
8533
8534 /**
8535  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
8536  */
8537 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
8538    /**
8539     * A pointer to the contents in the success state.
8540     * Reading from this pointer when `result_ok` is not set is undefined.
8541     */
8542    struct LDKGossipTimestampFilter *result;
8543    /**
8544     * A pointer to the contents in the error state.
8545     * Reading from this pointer when `result_ok` is set is undefined.
8546     */
8547    struct LDKDecodeError *err;
8548 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
8549
8550 /**
8551  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8552  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8554  */
8555 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
8556    /**
8557     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8558     * `err` or `result` depending on the state of `result_ok`.
8559     */
8560    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
8561    /**
8562     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8563     */
8564    bool result_ok;
8565 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
8566
8567 /**
8568  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
8569  * may occur.
8570  */
8571 typedef enum LDKSignOrCreationError_Tag {
8572    /**
8573     * An error occurred during signing
8574     */
8575    LDKSignOrCreationError_SignError,
8576    /**
8577     * An error occurred while building the transaction
8578     */
8579    LDKSignOrCreationError_CreationError,
8580    /**
8581     * Must be last for serialization purposes
8582     */
8583    LDKSignOrCreationError_Sentinel,
8584 } LDKSignOrCreationError_Tag;
8585
8586 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
8587    LDKSignOrCreationError_Tag tag;
8588    union {
8589       struct {
8590          enum LDKCreationError creation_error;
8591       };
8592    };
8593 } LDKSignOrCreationError;
8594
8595 /**
8596  * The contents of CResult_InvoiceSignOrCreationErrorZ
8597  */
8598 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
8599    /**
8600     * A pointer to the contents in the success state.
8601     * Reading from this pointer when `result_ok` is not set is undefined.
8602     */
8603    struct LDKInvoice *result;
8604    /**
8605     * A pointer to the contents in the error state.
8606     * Reading from this pointer when `result_ok` is set is undefined.
8607     */
8608    struct LDKSignOrCreationError *err;
8609 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
8610
8611 /**
8612  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
8613  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
8614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8615  */
8616 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
8617    /**
8618     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
8619     * `err` or `result` depending on the state of `result_ok`.
8620     */
8621    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
8622    /**
8623     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
8624     */
8625    bool result_ok;
8626 } LDKCResult_InvoiceSignOrCreationErrorZ;
8627
8628
8629
8630 /**
8631  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8632  *
8633  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8634  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8635  * the return value of [`Filter::register_output`].
8636  *
8637  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8638  * may have been spent there. See [`Filter::register_output`] for details.
8639  *
8640  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8641  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8642  */
8643 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8644    /**
8645     * A pointer to the opaque Rust object.
8646     * Nearly everywhere, inner must be non-null, however in places where
8647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8648     */
8649    LDKnativeWatchedOutput *inner;
8650    /**
8651     * Indicates that this is the only struct which contains the same pointer.
8652     * Rust functions which take ownership of an object provided via an argument require
8653     * this to be true and invalidate the object pointed to by inner.
8654     */
8655    bool is_owned;
8656 } LDKWatchedOutput;
8657
8658 /**
8659  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8660  * channels.
8661  *
8662  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8663  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8664  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8665  * receiving full blocks from a chain source, any further filtering is unnecessary.
8666  *
8667  * After an output has been registered, subsequent block retrievals from the chain source must not
8668  * exclude any transactions matching the new criteria nor any in-block descendants of such
8669  * transactions.
8670  *
8671  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8672  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8673  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8674  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8675  *
8676  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8677  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8678  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8679  */
8680 typedef struct LDKFilter {
8681    /**
8682     * An opaque pointer which is passed to your function implementations as an argument.
8683     * This has no meaning in the LDK, and can be NULL or any other value.
8684     */
8685    void *this_arg;
8686    /**
8687     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8688     * a spending condition.
8689     */
8690    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8691    /**
8692     * Registers interest in spends of a transaction output.
8693     *
8694     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8695     * output that is found in the corresponding block along with its index.
8696     *
8697     * This return value is useful for Electrum clients in order to supply in-block descendant
8698     * transactions which otherwise were not included. This is not necessary for other clients if
8699     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8700     * full block).
8701     */
8702    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8703    /**
8704     * Frees any resources associated with this object given its this_arg pointer.
8705     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8706     */
8707    void (*free)(void *this_arg);
8708 } LDKFilter;
8709
8710 /**
8711  * An enum which can either contain a crate::lightning::chain::Filter or not
8712  */
8713 typedef enum LDKCOption_FilterZ_Tag {
8714    /**
8715     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
8716     */
8717    LDKCOption_FilterZ_Some,
8718    /**
8719     * When we're in this state, this COption_FilterZ contains nothing
8720     */
8721    LDKCOption_FilterZ_None,
8722    /**
8723     * Must be last for serialization purposes
8724     */
8725    LDKCOption_FilterZ_Sentinel,
8726 } LDKCOption_FilterZ_Tag;
8727
8728 typedef struct LDKCOption_FilterZ {
8729    LDKCOption_FilterZ_Tag tag;
8730    union {
8731       struct {
8732          struct LDKFilter some;
8733       };
8734    };
8735 } LDKCOption_FilterZ;
8736
8737 /**
8738  * A trait indicating an object may generate message send events
8739  */
8740 typedef struct LDKMessageSendEventsProvider {
8741    /**
8742     * An opaque pointer which is passed to your function implementations as an argument.
8743     * This has no meaning in the LDK, and can be NULL or any other value.
8744     */
8745    void *this_arg;
8746    /**
8747     * Gets the list of pending events which were generated by previous actions, clearing the list
8748     * in the process.
8749     */
8750    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
8751    /**
8752     * Frees any resources associated with this object given its this_arg pointer.
8753     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8754     */
8755    void (*free)(void *this_arg);
8756 } LDKMessageSendEventsProvider;
8757
8758 /**
8759  * A trait implemented for objects handling events from [`EventsProvider`].
8760  */
8761 typedef struct LDKEventHandler {
8762    /**
8763     * An opaque pointer which is passed to your function implementations as an argument.
8764     * This has no meaning in the LDK, and can be NULL or any other value.
8765     */
8766    void *this_arg;
8767    /**
8768     * Handles the given [`Event`].
8769     *
8770     * See [`EventsProvider`] for details that must be considered when implementing this method.
8771     */
8772    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
8773    /**
8774     * Frees any resources associated with this object given its this_arg pointer.
8775     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8776     */
8777    void (*free)(void *this_arg);
8778 } LDKEventHandler;
8779
8780 /**
8781  * A trait indicating an object may generate events.
8782  *
8783  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
8784  *
8785  * # Requirements
8786  *
8787  * See [`process_pending_events`] for requirements around event processing.
8788  *
8789  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
8790  * event since the last invocation. The handler must either act upon the event immediately
8791  * or preserve it for later handling.
8792  *
8793  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
8794  * consult the provider's documentation on the implication of processing events and how a handler
8795  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
8796  * [`ChainMonitor::process_pending_events`]).
8797  *
8798  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
8799  * own type(s).
8800  *
8801  * [`process_pending_events`]: Self::process_pending_events
8802  * [`handle_event`]: EventHandler::handle_event
8803  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
8804  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
8805  */
8806 typedef struct LDKEventsProvider {
8807    /**
8808     * An opaque pointer which is passed to your function implementations as an argument.
8809     * This has no meaning in the LDK, and can be NULL or any other value.
8810     */
8811    void *this_arg;
8812    /**
8813     * Processes any events generated since the last call using the given event handler.
8814     *
8815     * Subsequent calls must only process new events. However, handlers must be capable of handling
8816     * duplicate events across process restarts. This may occur if the provider was recovered from
8817     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
8818     */
8819    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
8820    /**
8821     * Frees any resources associated with this object given its this_arg pointer.
8822     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8823     */
8824    void (*free)(void *this_arg);
8825 } LDKEventsProvider;
8826
8827
8828
8829 /**
8830  * Configuration we set when applicable.
8831  *
8832  * Default::default() provides sane defaults.
8833  */
8834 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
8835    /**
8836     * A pointer to the opaque Rust object.
8837     * Nearly everywhere, inner must be non-null, however in places where
8838     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8839     */
8840    LDKnativeChannelHandshakeConfig *inner;
8841    /**
8842     * Indicates that this is the only struct which contains the same pointer.
8843     * Rust functions which take ownership of an object provided via an argument require
8844     * this to be true and invalidate the object pointed to by inner.
8845     */
8846    bool is_owned;
8847 } LDKChannelHandshakeConfig;
8848
8849
8850
8851 /**
8852  * Optional channel limits which are applied during channel creation.
8853  *
8854  * These limits are only applied to our counterparty's limits, not our own.
8855  *
8856  * Use 0/<type>::max_value() as appropriate to skip checking.
8857  *
8858  * Provides sane defaults for most configurations.
8859  *
8860  * Most additional limits are disabled except those with which specify a default in individual
8861  * field documentation. Note that this may result in barely-usable channels, but since they
8862  * are applied mostly only to incoming channels that's not much of a problem.
8863  */
8864 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
8865    /**
8866     * A pointer to the opaque Rust object.
8867     * Nearly everywhere, inner must be non-null, however in places where
8868     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8869     */
8870    LDKnativeChannelHandshakeLimits *inner;
8871    /**
8872     * Indicates that this is the only struct which contains the same pointer.
8873     * Rust functions which take ownership of an object provided via an argument require
8874     * this to be true and invalidate the object pointed to by inner.
8875     */
8876    bool is_owned;
8877 } LDKChannelHandshakeLimits;
8878
8879
8880
8881 /**
8882  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
8883  *
8884  * Default::default() provides sane defaults for most configurations
8885  * (but currently with 0 relay fees!)
8886  */
8887 typedef struct MUST_USE_STRUCT LDKUserConfig {
8888    /**
8889     * A pointer to the opaque Rust object.
8890     * Nearly everywhere, inner must be non-null, however in places where
8891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8892     */
8893    LDKnativeUserConfig *inner;
8894    /**
8895     * Indicates that this is the only struct which contains the same pointer.
8896     * Rust functions which take ownership of an object provided via an argument require
8897     * this to be true and invalidate the object pointed to by inner.
8898     */
8899    bool is_owned;
8900 } LDKUserConfig;
8901
8902
8903
8904 /**
8905  * The best known block as identified by its hash and height.
8906  */
8907 typedef struct MUST_USE_STRUCT LDKBestBlock {
8908    /**
8909     * A pointer to the opaque Rust object.
8910     * Nearly everywhere, inner must be non-null, however in places where
8911     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8912     */
8913    LDKnativeBestBlock *inner;
8914    /**
8915     * Indicates that this is the only struct which contains the same pointer.
8916     * Rust functions which take ownership of an object provided via an argument require
8917     * this to be true and invalidate the object pointed to by inner.
8918     */
8919    bool is_owned;
8920 } LDKBestBlock;
8921
8922 /**
8923  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
8924  * chain.
8925  *
8926  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
8927  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
8928  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
8929  * when needed.
8930  */
8931 typedef struct LDKListen {
8932    /**
8933     * An opaque pointer which is passed to your function implementations as an argument.
8934     * This has no meaning in the LDK, and can be NULL or any other value.
8935     */
8936    void *this_arg;
8937    /**
8938     * Notifies the listener that a block was added at the given height.
8939     */
8940    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
8941    /**
8942     * Notifies the listener that a block was removed at the given height.
8943     */
8944    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8945    /**
8946     * Frees any resources associated with this object given its this_arg pointer.
8947     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8948     */
8949    void (*free)(void *this_arg);
8950 } LDKListen;
8951
8952 /**
8953  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
8954  * unconfirmed during a chain reorganization.
8955  *
8956  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
8957  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
8958  * related to registered transactions and outputs. Upon notification, it would pass along the
8959  * matching transactions using this interface.
8960  *
8961  * # Use
8962  *
8963  * The intended use is as follows:
8964  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
8965  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
8966  *   that has been reorganized out of the chain.
8967  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
8968  *
8969  * # Order
8970  *
8971  * Clients must call these methods in chain order. Specifically:
8972  * - Transactions confirmed in a block must be given before transactions confirmed in a later
8973  *   block.
8974  * - Dependent transactions within the same block must be given in topological order, possibly in
8975  *   separate calls.
8976  * - Unconfirmed transactions must be given after the original confirmations and before any
8977  *   reconfirmation.
8978  *
8979  * See individual method documentation for further details.
8980  *
8981  * [`transactions_confirmed`]: Self::transactions_confirmed
8982  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8983  * [`best_block_updated`]: Self::best_block_updated
8984  * [`get_relevant_txids`]: Self::get_relevant_txids
8985  */
8986 typedef struct LDKConfirm {
8987    /**
8988     * An opaque pointer which is passed to your function implementations as an argument.
8989     * This has no meaning in the LDK, and can be NULL or any other value.
8990     */
8991    void *this_arg;
8992    /**
8993     * Processes transactions confirmed in a block with a given header and height.
8994     *
8995     * Should be called for any transactions registered by [`Filter::register_tx`] or any
8996     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
8997     * appearing in the same block do not need to be included in the same call; instead, multiple
8998     * calls with additional transactions may be made so long as they are made in [chain order].
8999     *
9000     * May be called before or after [`best_block_updated`] for the corresponding block. However,
9001     * in the event of a chain reorganization, it must not be called with a `header` that is no
9002     * longer in the chain as of the last call to [`best_block_updated`].
9003     *
9004     * [chain order]: Confirm#Order
9005     * [`best_block_updated`]: Self::best_block_updated
9006     */
9007    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
9008    /**
9009     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
9010     *
9011     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
9012     * reorganized out of the best chain. Once called, the given transaction should not be returned
9013     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
9014     *
9015     * [`get_relevant_txids`]: Self::get_relevant_txids
9016     * [`transactions_confirmed`]: Self::transactions_confirmed
9017     */
9018    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
9019    /**
9020     * Processes an update to the best header connected at the given height.
9021     *
9022     * Should be called when a new header is available but may be skipped for intermediary blocks
9023     * if they become available at the same time.
9024     */
9025    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9026    /**
9027     * Returns transactions that should be monitored for reorganization out of the chain.
9028     *
9029     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
9030     * confirmations to be safe from a chain reorganization. Should not include any transactions
9031     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
9032     *
9033     * May be called to determine the subset of transactions that must still be monitored for
9034     * reorganization. Will be idempotent between calls but may change as a result of calls to the
9035     * other interface methods. Thus, this is useful to determine which transactions may need to be
9036     * given to [`transaction_unconfirmed`].
9037     *
9038     * [`transactions_confirmed`]: Self::transactions_confirmed
9039     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9040     */
9041    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
9042    /**
9043     * Frees any resources associated with this object given its this_arg pointer.
9044     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9045     */
9046    void (*free)(void *this_arg);
9047 } LDKConfirm;
9048
9049 /**
9050  * `Persist` defines behavior for persisting channel monitors: this could mean
9051  * writing once to disk, and/or uploading to one or more backup services.
9052  *
9053  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
9054  * to disk/backups. And, on every update, you **must** persist either the
9055  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
9056  * of situations such as revoking a transaction, then crashing before this
9057  * revocation can be persisted, then unintentionally broadcasting a revoked
9058  * transaction and losing money. This is a risk because previous channel states
9059  * are toxic, so it's important that whatever channel state is persisted is
9060  * kept up-to-date.
9061  */
9062 typedef struct LDKPersist {
9063    /**
9064     * An opaque pointer which is passed to your function implementations as an argument.
9065     * This has no meaning in the LDK, and can be NULL or any other value.
9066     */
9067    void *this_arg;
9068    /**
9069     * Persist a new channel's data. The data can be stored any way you want, but
9070     * the identifier provided by Rust-Lightning is the channel's outpoint (and
9071     * it is up to you to maintain a correct mapping between the outpoint and the
9072     * stored channel data). Note that you **must** persist every new monitor to
9073     * disk. See the `Persist` trait documentation for more details.
9074     *
9075     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
9076     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9077     */
9078    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
9079    /**
9080     * Update one channel's data. The provided `ChannelMonitor` has already
9081     * applied the given update.
9082     *
9083     * Note that on every update, you **must** persist either the
9084     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
9085     * the `Persist` trait documentation for more details.
9086     *
9087     * If an implementer chooses to persist the updates only, they need to make
9088     * sure that all the updates are applied to the `ChannelMonitors` *before*
9089     * the set of channel monitors is given to the `ChannelManager`
9090     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
9091     * applying a monitor update to a monitor. If full `ChannelMonitors` are
9092     * persisted, then there is no need to persist individual updates.
9093     *
9094     * Note that there could be a performance tradeoff between persisting complete
9095     * channel monitors on every update vs. persisting only updates and applying
9096     * them in batches. The size of each monitor grows `O(number of state updates)`
9097     * whereas updates are small and `O(1)`.
9098     *
9099     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
9100     * [`ChannelMonitorUpdate::write`] for writing out an update, and
9101     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9102     */
9103    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
9104    /**
9105     * Frees any resources associated with this object given its this_arg pointer.
9106     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9107     */
9108    void (*free)(void *this_arg);
9109 } LDKPersist;
9110
9111
9112
9113 /**
9114  * An implementation of [`chain::Watch`] for monitoring channels.
9115  *
9116  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
9117  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
9118  * or used independently to monitor channels remotely. See the [module-level documentation] for
9119  * details.
9120  *
9121  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9122  * [module-level documentation]: crate::chain::chainmonitor
9123  */
9124 typedef struct MUST_USE_STRUCT LDKChainMonitor {
9125    /**
9126     * A pointer to the opaque Rust object.
9127     * Nearly everywhere, inner must be non-null, however in places where
9128     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9129     */
9130    LDKnativeChainMonitor *inner;
9131    /**
9132     * Indicates that this is the only struct which contains the same pointer.
9133     * Rust functions which take ownership of an object provided via an argument require
9134     * this to be true and invalidate the object pointed to by inner.
9135     */
9136    bool is_owned;
9137 } LDKChainMonitor;
9138
9139
9140
9141 /**
9142  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
9143  * and derives keys from that.
9144  *
9145  * Your node_id is seed/0'
9146  * ChannelMonitor closes may use seed/1'
9147  * Cooperative closes may use seed/2'
9148  * The two close keys may be needed to claim on-chain funds!
9149  */
9150 typedef struct MUST_USE_STRUCT LDKKeysManager {
9151    /**
9152     * A pointer to the opaque Rust object.
9153     * Nearly everywhere, inner must be non-null, however in places where
9154     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9155     */
9156    LDKnativeKeysManager *inner;
9157    /**
9158     * Indicates that this is the only struct which contains the same pointer.
9159     * Rust functions which take ownership of an object provided via an argument require
9160     * this to be true and invalidate the object pointed to by inner.
9161     */
9162    bool is_owned;
9163 } LDKKeysManager;
9164
9165
9166
9167 /**
9168  * Chain-related parameters used to construct a new `ChannelManager`.
9169  *
9170  * Typically, the block-specific parameters are derived from the best block hash for the network,
9171  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
9172  * are not needed when deserializing a previously constructed `ChannelManager`.
9173  */
9174 typedef struct MUST_USE_STRUCT LDKChainParameters {
9175    /**
9176     * A pointer to the opaque Rust object.
9177     * Nearly everywhere, inner must be non-null, however in places where
9178     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9179     */
9180    LDKnativeChainParameters *inner;
9181    /**
9182     * Indicates that this is the only struct which contains the same pointer.
9183     * Rust functions which take ownership of an object provided via an argument require
9184     * this to be true and invalidate the object pointed to by inner.
9185     */
9186    bool is_owned;
9187 } LDKChainParameters;
9188
9189
9190
9191 /**
9192  * Information needed for constructing an invoice route hint for this channel.
9193  */
9194 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
9195    /**
9196     * A pointer to the opaque Rust object.
9197     * Nearly everywhere, inner must be non-null, however in places where
9198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9199     */
9200    LDKnativeCounterpartyForwardingInfo *inner;
9201    /**
9202     * Indicates that this is the only struct which contains the same pointer.
9203     * Rust functions which take ownership of an object provided via an argument require
9204     * this to be true and invalidate the object pointed to by inner.
9205     */
9206    bool is_owned;
9207 } LDKCounterpartyForwardingInfo;
9208
9209
9210
9211 /**
9212  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
9213  * to better separate parameters.
9214  */
9215 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
9216    /**
9217     * A pointer to the opaque Rust object.
9218     * Nearly everywhere, inner must be non-null, however in places where
9219     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9220     */
9221    LDKnativeChannelCounterparty *inner;
9222    /**
9223     * Indicates that this is the only struct which contains the same pointer.
9224     * Rust functions which take ownership of an object provided via an argument require
9225     * this to be true and invalidate the object pointed to by inner.
9226     */
9227    bool is_owned;
9228 } LDKChannelCounterparty;
9229
9230 /**
9231  * A 3-byte byte array.
9232  */
9233 typedef struct LDKThreeBytes {
9234    /**
9235     * The three bytes
9236     */
9237    uint8_t data[3];
9238 } LDKThreeBytes;
9239
9240 /**
9241  * A trait to describe an object which can receive channel messages.
9242  *
9243  * Messages MAY be called in parallel when they originate from different their_node_ids, however
9244  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
9245  */
9246 typedef struct LDKChannelMessageHandler {
9247    /**
9248     * An opaque pointer which is passed to your function implementations as an argument.
9249     * This has no meaning in the LDK, and can be NULL or any other value.
9250     */
9251    void *this_arg;
9252    /**
9253     * Handle an incoming open_channel message from the given peer.
9254     */
9255    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
9256    /**
9257     * Handle an incoming accept_channel message from the given peer.
9258     */
9259    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
9260    /**
9261     * Handle an incoming funding_created message from the given peer.
9262     */
9263    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
9264    /**
9265     * Handle an incoming funding_signed message from the given peer.
9266     */
9267    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
9268    /**
9269     * Handle an incoming funding_locked message from the given peer.
9270     */
9271    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
9272    /**
9273     * Handle an incoming shutdown message from the given peer.
9274     */
9275    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);
9276    /**
9277     * Handle an incoming closing_signed message from the given peer.
9278     */
9279    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
9280    /**
9281     * Handle an incoming update_add_htlc message from the given peer.
9282     */
9283    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
9284    /**
9285     * Handle an incoming update_fulfill_htlc message from the given peer.
9286     */
9287    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
9288    /**
9289     * Handle an incoming update_fail_htlc message from the given peer.
9290     */
9291    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
9292    /**
9293     * Handle an incoming update_fail_malformed_htlc message from the given peer.
9294     */
9295    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
9296    /**
9297     * Handle an incoming commitment_signed message from the given peer.
9298     */
9299    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
9300    /**
9301     * Handle an incoming revoke_and_ack message from the given peer.
9302     */
9303    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
9304    /**
9305     * Handle an incoming update_fee message from the given peer.
9306     */
9307    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
9308    /**
9309     * Handle an incoming announcement_signatures message from the given peer.
9310     */
9311    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
9312    /**
9313     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
9314     * is believed to be possible in the future (eg they're sending us messages we don't
9315     * understand or indicate they require unknown feature bits), no_connection_possible is set
9316     * and any outstanding channels should be failed.
9317     */
9318    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
9319    /**
9320     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
9321     */
9322    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
9323    /**
9324     * Handle an incoming channel_reestablish message from the given peer.
9325     */
9326    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
9327    /**
9328     * Handle an incoming channel update from the given peer.
9329     */
9330    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
9331    /**
9332     * Handle an incoming error message from the given peer.
9333     */
9334    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
9335    /**
9336     * Implementation of MessageSendEventsProvider for this object.
9337     */
9338    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
9339    /**
9340     * Frees any resources associated with this object given its this_arg pointer.
9341     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9342     */
9343    void (*free)(void *this_arg);
9344 } LDKChannelMessageHandler;
9345
9346
9347
9348 /**
9349  * Arguments for the creation of a ChannelManager that are not deserialized.
9350  *
9351  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
9352  * is:
9353  * 1) Deserialize all stored ChannelMonitors.
9354  * 2) Deserialize the ChannelManager by filling in this struct and calling:
9355  *    <(BlockHash, ChannelManager)>::read(reader, args)
9356  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
9357  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
9358  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
9359  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
9360  *    ChannelMonitor::get_funding_txo().
9361  * 4) Reconnect blocks on your ChannelMonitors.
9362  * 5) Disconnect/connect blocks on the ChannelManager.
9363  * 6) Move the ChannelMonitors into your local chain::Watch.
9364  *
9365  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
9366  * call any other methods on the newly-deserialized ChannelManager.
9367  *
9368  * Note that because some channels may be closed during deserialization, it is critical that you
9369  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
9370  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
9371  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
9372  * not force-close the same channels but consider them live), you may end up revoking a state for
9373  * which you've already broadcasted the transaction.
9374  */
9375 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
9376    /**
9377     * A pointer to the opaque Rust object.
9378     * Nearly everywhere, inner must be non-null, however in places where
9379     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9380     */
9381    LDKnativeChannelManagerReadArgs *inner;
9382    /**
9383     * Indicates that this is the only struct which contains the same pointer.
9384     * Rust functions which take ownership of an object provided via an argument require
9385     * this to be true and invalidate the object pointed to by inner.
9386     */
9387    bool is_owned;
9388 } LDKChannelManagerReadArgs;
9389
9390
9391
9392 /**
9393  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
9394  * This is used to convince the recipient that the channel is at a certain commitment
9395  * number even if they lost that data due to a local failure.  Of course, the peer may lie
9396  * and even later commitments may have been revoked.
9397  */
9398 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
9399    /**
9400     * A pointer to the opaque Rust object.
9401     * Nearly everywhere, inner must be non-null, however in places where
9402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9403     */
9404    LDKnativeDataLossProtect *inner;
9405    /**
9406     * Indicates that this is the only struct which contains the same pointer.
9407     * Rust functions which take ownership of an object provided via an argument require
9408     * this to be true and invalidate the object pointed to by inner.
9409     */
9410    bool is_owned;
9411 } LDKDataLossProtect;
9412
9413 /**
9414  * A trait to describe an object which can receive routing messages.
9415  *
9416  * # Implementor DoS Warnings
9417  *
9418  * For `gossip_queries` messages there are potential DoS vectors when handling
9419  * inbound queries. Implementors using an on-disk network graph should be aware of
9420  * repeated disk I/O for queries accessing different parts of the network graph.
9421  */
9422 typedef struct LDKRoutingMessageHandler {
9423    /**
9424     * An opaque pointer which is passed to your function implementations as an argument.
9425     * This has no meaning in the LDK, and can be NULL or any other value.
9426     */
9427    void *this_arg;
9428    /**
9429     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
9430     * false or returning an Err otherwise.
9431     */
9432    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
9433    /**
9434     * Handle a channel_announcement message, returning true if it should be forwarded on, false
9435     * or returning an Err otherwise.
9436     */
9437    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
9438    /**
9439     * Handle an incoming channel_update message, returning true if it should be forwarded on,
9440     * false or returning an Err otherwise.
9441     */
9442    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
9443    /**
9444     * Gets a subset of the channel announcements and updates required to dump our routing table
9445     * to a remote node, starting at the short_channel_id indicated by starting_point and
9446     * including the batch_amount entries immediately higher in numerical value than starting_point.
9447     */
9448    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
9449    /**
9450     * Gets a subset of the node announcements required to dump our routing table to a remote node,
9451     * starting at the node *after* the provided publickey and including batch_amount entries
9452     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
9453     * If None is provided for starting_point, we start at the first node.
9454     *
9455     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
9456     */
9457    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
9458    /**
9459     * Called when a connection is established with a peer. This can be used to
9460     * perform routing table synchronization using a strategy defined by the
9461     * implementor.
9462     */
9463    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
9464    /**
9465     * Handles the reply of a query we initiated to learn about channels
9466     * for a given range of blocks. We can expect to receive one or more
9467     * replies to a single query.
9468     */
9469    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
9470    /**
9471     * Handles the reply of a query we initiated asking for routing gossip
9472     * messages for a list of channels. We should receive this message when
9473     * a node has completed its best effort to send us the pertaining routing
9474     * gossip messages.
9475     */
9476    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
9477    /**
9478     * Handles when a peer asks us to send a list of short_channel_ids
9479     * for the requested range of blocks.
9480     */
9481    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
9482    /**
9483     * Handles when a peer asks us to send routing gossip messages for a
9484     * list of short_channel_ids.
9485     */
9486    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
9487    /**
9488     * Implementation of MessageSendEventsProvider for this object.
9489     */
9490    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
9491    /**
9492     * Frees any resources associated with this object given its this_arg pointer.
9493     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9494     */
9495    void (*free)(void *this_arg);
9496 } LDKRoutingMessageHandler;
9497
9498 /**
9499  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
9500  * decoders.
9501  */
9502 typedef struct LDKCustomMessageReader {
9503    /**
9504     * An opaque pointer which is passed to your function implementations as an argument.
9505     * This has no meaning in the LDK, and can be NULL or any other value.
9506     */
9507    void *this_arg;
9508    /**
9509     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
9510     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
9511     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
9512     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
9513     */
9514    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
9515    /**
9516     * Frees any resources associated with this object given its this_arg pointer.
9517     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9518     */
9519    void (*free)(void *this_arg);
9520 } LDKCustomMessageReader;
9521
9522 /**
9523  * Handler for BOLT1-compliant messages.
9524  */
9525 typedef struct LDKCustomMessageHandler {
9526    /**
9527     * An opaque pointer which is passed to your function implementations as an argument.
9528     * This has no meaning in the LDK, and can be NULL or any other value.
9529     */
9530    void *this_arg;
9531    /**
9532     * Called with the message type that was received and the buffer to be read.
9533     * Can return a `MessageHandlingError` if the message could not be handled.
9534     */
9535    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
9536    /**
9537     * Gets the list of pending messages which were generated by the custom message
9538     * handler, clearing the list in the process. The first tuple element must
9539     * correspond to the intended recipients node ids. If no connection to one of the
9540     * specified node does not exist, the message is simply not sent to it.
9541     */
9542    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
9543    /**
9544     * Implementation of CustomMessageReader for this object.
9545     */
9546    struct LDKCustomMessageReader CustomMessageReader;
9547    /**
9548     * Frees any resources associated with this object given its this_arg pointer.
9549     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9550     */
9551    void (*free)(void *this_arg);
9552 } LDKCustomMessageHandler;
9553
9554
9555
9556 /**
9557  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
9558  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
9559  */
9560 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
9561    /**
9562     * A pointer to the opaque Rust object.
9563     * Nearly everywhere, inner must be non-null, however in places where
9564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9565     */
9566    LDKnativeIgnoringMessageHandler *inner;
9567    /**
9568     * Indicates that this is the only struct which contains the same pointer.
9569     * Rust functions which take ownership of an object provided via an argument require
9570     * this to be true and invalidate the object pointed to by inner.
9571     */
9572    bool is_owned;
9573 } LDKIgnoringMessageHandler;
9574
9575
9576
9577 /**
9578  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
9579  * You can provide one of these as the route_handler in a MessageHandler.
9580  */
9581 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
9582    /**
9583     * A pointer to the opaque Rust object.
9584     * Nearly everywhere, inner must be non-null, however in places where
9585     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9586     */
9587    LDKnativeErroringMessageHandler *inner;
9588    /**
9589     * Indicates that this is the only struct which contains the same pointer.
9590     * Rust functions which take ownership of an object provided via an argument require
9591     * this to be true and invalidate the object pointed to by inner.
9592     */
9593    bool is_owned;
9594 } LDKErroringMessageHandler;
9595
9596
9597
9598 /**
9599  * Provides references to trait impls which handle different types of messages.
9600  */
9601 typedef struct MUST_USE_STRUCT LDKMessageHandler {
9602    /**
9603     * A pointer to the opaque Rust object.
9604     * Nearly everywhere, inner must be non-null, however in places where
9605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9606     */
9607    LDKnativeMessageHandler *inner;
9608    /**
9609     * Indicates that this is the only struct which contains the same pointer.
9610     * Rust functions which take ownership of an object provided via an argument require
9611     * this to be true and invalidate the object pointed to by inner.
9612     */
9613    bool is_owned;
9614 } LDKMessageHandler;
9615
9616 /**
9617  * Provides an object which can be used to send data to and which uniquely identifies a connection
9618  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
9619  * implement Hash to meet the PeerManager API.
9620  *
9621  * For efficiency, Clone should be relatively cheap for this type.
9622  *
9623  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
9624  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
9625  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
9626  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
9627  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
9628  * to simply use another value which is guaranteed to be globally unique instead.
9629  */
9630 typedef struct LDKSocketDescriptor {
9631    /**
9632     * An opaque pointer which is passed to your function implementations as an argument.
9633     * This has no meaning in the LDK, and can be NULL or any other value.
9634     */
9635    void *this_arg;
9636    /**
9637     * Attempts to send some data from the given slice to the peer.
9638     *
9639     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
9640     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
9641     * called and further write attempts may occur until that time.
9642     *
9643     * If the returned size is smaller than `data.len()`, a
9644     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
9645     * written. Additionally, until a `send_data` event completes fully, no further
9646     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
9647     * prevent denial-of-service issues, you should not read or buffer any data from the socket
9648     * until then.
9649     *
9650     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
9651     * (indicating that read events should be paused to prevent DoS in the send buffer),
9652     * `resume_read` may be set indicating that read events on this descriptor should resume. A
9653     * `resume_read` of false carries no meaning, and should not cause any action.
9654     */
9655    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
9656    /**
9657     * Disconnect the socket pointed to by this SocketDescriptor.
9658     *
9659     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
9660     * call (doing so is a noop).
9661     */
9662    void (*disconnect_socket)(void *this_arg);
9663    /**
9664     * Checks if two objects are equal given this object's this_arg pointer and another object.
9665     */
9666    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
9667    /**
9668     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
9669     * This is used, for example, for inclusion of this object in a hash map.
9670     */
9671    uint64_t (*hash)(const void *this_arg);
9672    /**
9673     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
9674     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
9675     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
9676     */
9677    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
9678    /**
9679     * Frees any resources associated with this object given its this_arg pointer.
9680     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9681     */
9682    void (*free)(void *this_arg);
9683 } LDKSocketDescriptor;
9684
9685
9686
9687 /**
9688  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
9689  * socket events into messages which it passes on to its [`MessageHandler`].
9690  *
9691  * Locks are taken internally, so you must never assume that reentrancy from a
9692  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
9693  *
9694  * Calls to [`read_event`] will decode relevant messages and pass them to the
9695  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
9696  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
9697  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
9698  * calls only after previous ones have returned.
9699  *
9700  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
9701  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
9702  * essentially you should default to using a SimpleRefPeerManager, and use a
9703  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
9704  * you're using lightning-net-tokio.
9705  *
9706  * [`read_event`]: PeerManager::read_event
9707  */
9708 typedef struct MUST_USE_STRUCT LDKPeerManager {
9709    /**
9710     * A pointer to the opaque Rust object.
9711     * Nearly everywhere, inner must be non-null, however in places where
9712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9713     */
9714    LDKnativePeerManager *inner;
9715    /**
9716     * Indicates that this is the only struct which contains the same pointer.
9717     * Rust functions which take ownership of an object provided via an argument require
9718     * this to be true and invalidate the object pointed to by inner.
9719     */
9720    bool is_owned;
9721 } LDKPeerManager;
9722
9723
9724
9725 /**
9726  * Static channel fields used to build transactions given per-commitment fields, organized by
9727  * broadcaster/countersignatory.
9728  *
9729  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
9730  * as_holder_broadcastable and as_counterparty_broadcastable functions.
9731  */
9732 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
9733    /**
9734     * A pointer to the opaque Rust object.
9735     * Nearly everywhere, inner must be non-null, however in places where
9736     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9737     */
9738    LDKnativeDirectedChannelTransactionParameters *inner;
9739    /**
9740     * Indicates that this is the only struct which contains the same pointer.
9741     * Rust functions which take ownership of an object provided via an argument require
9742     * this to be true and invalidate the object pointed to by inner.
9743     */
9744    bool is_owned;
9745 } LDKDirectedChannelTransactionParameters;
9746
9747
9748
9749 /**
9750  * A channel descriptor for a hop along a payment path.
9751  */
9752 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
9753    /**
9754     * A pointer to the opaque Rust object.
9755     * Nearly everywhere, inner must be non-null, however in places where
9756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9757     */
9758    LDKnativeRouteHintHop *inner;
9759    /**
9760     * Indicates that this is the only struct which contains the same pointer.
9761     * Rust functions which take ownership of an object provided via an argument require
9762     * this to be true and invalidate the object pointed to by inner.
9763     */
9764    bool is_owned;
9765 } LDKRouteHintHop;
9766
9767
9768
9769 /**
9770  * A read-only view of [`NetworkGraph`].
9771  */
9772 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
9773    /**
9774     * A pointer to the opaque Rust object.
9775     * Nearly everywhere, inner must be non-null, however in places where
9776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9777     */
9778    LDKnativeReadOnlyNetworkGraph *inner;
9779    /**
9780     * Indicates that this is the only struct which contains the same pointer.
9781     * Rust functions which take ownership of an object provided via an argument require
9782     * this to be true and invalidate the object pointed to by inner.
9783     */
9784    bool is_owned;
9785 } LDKReadOnlyNetworkGraph;
9786
9787
9788
9789 /**
9790  * Receives and validates network updates from peers,
9791  * stores authentic and relevant data as a network graph.
9792  * This network graph is then used for routing payments.
9793  * Provides interface to help with initial routing sync by
9794  * serving historical announcements.
9795  *
9796  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
9797  * [`NetworkGraph`].
9798  */
9799 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
9800    /**
9801     * A pointer to the opaque Rust object.
9802     * Nearly everywhere, inner must be non-null, however in places where
9803     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9804     */
9805    LDKnativeNetGraphMsgHandler *inner;
9806    /**
9807     * Indicates that this is the only struct which contains the same pointer.
9808     * Rust functions which take ownership of an object provided via an argument require
9809     * this to be true and invalidate the object pointed to by inner.
9810     */
9811    bool is_owned;
9812 } LDKNetGraphMsgHandler;
9813
9814
9815
9816 /**
9817  * FilesystemPersister persists channel data on disk, where each channel's
9818  * data is stored in a file named after its funding outpoint.
9819  *
9820  * Warning: this module does the best it can with calls to persist data, but it
9821  * can only guarantee that the data is passed to the drive. It is up to the
9822  * drive manufacturers to do the actual persistence properly, which they often
9823  * don't (especially on consumer-grade hardware). Therefore, it is up to the
9824  * user to validate their entire storage stack, to ensure the writes are
9825  * persistent.
9826  * Corollary: especially when dealing with larger amounts of money, it is best
9827  * practice to have multiple channel data backups and not rely only on one
9828  * FilesystemPersister.
9829  */
9830 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
9831    /**
9832     * A pointer to the opaque Rust object.
9833     * Nearly everywhere, inner must be non-null, however in places where
9834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9835     */
9836    LDKnativeFilesystemPersister *inner;
9837    /**
9838     * Indicates that this is the only struct which contains the same pointer.
9839     * Rust functions which take ownership of an object provided via an argument require
9840     * this to be true and invalidate the object pointed to by inner.
9841     */
9842    bool is_owned;
9843 } LDKFilesystemPersister;
9844
9845
9846
9847 /**
9848  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
9849  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
9850  * responsibilities are:
9851  * * Processing [`Event`]s with a user-provided [`EventHandler`].
9852  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
9853  *   writing it to disk/backups by invoking the callback given to it at startup.
9854  *   [`ChannelManager`] persistence should be done in the background.
9855  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
9856  *   at the appropriate intervals.
9857  *
9858  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
9859  * upon as doing so may result in high latency.
9860  *
9861  * # Note
9862  *
9863  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
9864  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
9865  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
9866  * unilateral chain closure fees are at risk.
9867  *
9868  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
9869  * [`Event`]: lightning::util::events::Event
9870  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
9871  */
9872 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
9873    /**
9874     * A pointer to the opaque Rust object.
9875     * Nearly everywhere, inner must be non-null, however in places where
9876     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9877     */
9878    LDKnativeBackgroundProcessor *inner;
9879    /**
9880     * Indicates that this is the only struct which contains the same pointer.
9881     * Rust functions which take ownership of an object provided via an argument require
9882     * this to be true and invalidate the object pointed to by inner.
9883     */
9884    bool is_owned;
9885 } LDKBackgroundProcessor;
9886
9887 /**
9888  * Trait which handles persisting a [`ChannelManager`] to disk.
9889  *
9890  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9891  */
9892 typedef struct LDKChannelManagerPersister {
9893    /**
9894     * An opaque pointer which is passed to your function implementations as an argument.
9895     * This has no meaning in the LDK, and can be NULL or any other value.
9896     */
9897    void *this_arg;
9898    /**
9899     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
9900     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
9901     *
9902     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9903     */
9904    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
9905    /**
9906     * Frees any resources associated with this object given its this_arg pointer.
9907     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9908     */
9909    void (*free)(void *this_arg);
9910 } LDKChannelManagerPersister;
9911
9912
9913
9914 /**
9915  * Data of the `RawInvoice` that is encoded in the data part
9916  */
9917 typedef struct MUST_USE_STRUCT LDKRawDataPart {
9918    /**
9919     * A pointer to the opaque Rust object.
9920     * Nearly everywhere, inner must be non-null, however in places where
9921     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9922     */
9923    LDKnativeRawDataPart *inner;
9924    /**
9925     * Indicates that this is the only struct which contains the same pointer.
9926     * Rust functions which take ownership of an object provided via an argument require
9927     * this to be true and invalidate the object pointed to by inner.
9928     */
9929    bool is_owned;
9930 } LDKRawDataPart;
9931
9932
9933
9934 /**
9935  * SHA-256 hash
9936  */
9937 typedef struct MUST_USE_STRUCT LDKSha256 {
9938    /**
9939     * A pointer to the opaque Rust object.
9940     * Nearly everywhere, inner must be non-null, however in places where
9941     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9942     */
9943    LDKnativeSha256 *inner;
9944    /**
9945     * Indicates that this is the only struct which contains the same pointer.
9946     * Rust functions which take ownership of an object provided via an argument require
9947     * this to be true and invalidate the object pointed to by inner.
9948     */
9949    bool is_owned;
9950 } LDKSha256;
9951
9952
9953
9954 /**
9955  * `min_final_cltv_expiry` to use for the last HTLC in the route
9956  */
9957 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
9958    /**
9959     * A pointer to the opaque Rust object.
9960     * Nearly everywhere, inner must be non-null, however in places where
9961     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9962     */
9963    LDKnativeMinFinalCltvExpiry *inner;
9964    /**
9965     * Indicates that this is the only struct which contains the same pointer.
9966     * Rust functions which take ownership of an object provided via an argument require
9967     * this to be true and invalidate the object pointed to by inner.
9968     */
9969    bool is_owned;
9970 } LDKMinFinalCltvExpiry;
9971
9972 /**
9973  * Integer in the range `0..32`
9974  */
9975 typedef struct LDKu5 {
9976    uint8_t _0;
9977 } LDKu5;
9978
9979 /**
9980  * A 20-byte byte array.
9981  */
9982 typedef struct LDKTwentyBytes {
9983    /**
9984     * The twenty bytes
9985     */
9986    uint8_t data[20];
9987 } LDKTwentyBytes;
9988
9989 /**
9990  * Fallback address in case no LN payment is possible
9991  */
9992 typedef enum LDKFallback_Tag {
9993    LDKFallback_SegWitProgram,
9994    LDKFallback_PubKeyHash,
9995    LDKFallback_ScriptHash,
9996    /**
9997     * Must be last for serialization purposes
9998     */
9999    LDKFallback_Sentinel,
10000 } LDKFallback_Tag;
10001
10002 typedef struct LDKFallback_LDKSegWitProgram_Body {
10003    struct LDKu5 version;
10004    struct LDKCVec_u8Z program;
10005 } LDKFallback_LDKSegWitProgram_Body;
10006
10007 typedef struct MUST_USE_STRUCT LDKFallback {
10008    LDKFallback_Tag tag;
10009    union {
10010       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
10011       struct {
10012          struct LDKTwentyBytes pub_key_hash;
10013       };
10014       struct {
10015          struct LDKTwentyBytes script_hash;
10016       };
10017    };
10018 } LDKFallback;
10019
10020 extern const uintptr_t MAX_BUF_SIZE;
10021
10022 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
10023
10024 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
10025
10026 extern const uint32_t ANTI_REORG_DELAY;
10027
10028 extern const uint16_t BREAKDOWN_TIMEOUT;
10029
10030 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
10031
10032 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
10033
10034 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
10035
10036 extern const uint64_t DEFAULT_EXPIRY_TIME;
10037
10038 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
10039
10040 extern const uint8_t TAG_PAYMENT_HASH;
10041
10042 extern const uint8_t TAG_DESCRIPTION;
10043
10044 extern const uint8_t TAG_PAYEE_PUB_KEY;
10045
10046 extern const uint8_t TAG_DESCRIPTION_HASH;
10047
10048 extern const uint8_t TAG_EXPIRY_TIME;
10049
10050 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
10051
10052 extern const uint8_t TAG_FALLBACK;
10053
10054 extern const uint8_t TAG_PRIVATE_ROUTE;
10055
10056 extern const uint8_t TAG_PAYMENT_SECRET;
10057
10058 extern const uint8_t TAG_FEATURES;
10059
10060 struct LDKStr _ldk_get_compiled_version(void);
10061
10062 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
10063
10064 /**
10065  * Frees the data buffer, if data_is_owned is set and datalen > 0.
10066  */
10067 void Transaction_free(struct LDKTransaction _res);
10068
10069 /**
10070  * Convenience function for constructing a new TxOut
10071  */
10072 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
10073
10074 /**
10075  * Frees the data pointed to by script_pubkey.
10076  */
10077 void TxOut_free(struct LDKTxOut _res);
10078
10079 /**
10080  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
10081  */
10082 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
10083
10084 /**
10085  * Frees the data buffer, if chars_is_owned is set and len > 0.
10086  */
10087 void Str_free(struct LDKStr _res);
10088
10089 /**
10090  * Creates a new CResult_SecretKeyErrorZ in the success state.
10091  */
10092 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
10093
10094 /**
10095  * Creates a new CResult_SecretKeyErrorZ in the error state.
10096  */
10097 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
10098
10099 /**
10100  * Frees any resources used by the CResult_SecretKeyErrorZ.
10101  */
10102 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
10103
10104 /**
10105  * Creates a new CResult_PublicKeyErrorZ in the success state.
10106  */
10107 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
10108
10109 /**
10110  * Creates a new CResult_PublicKeyErrorZ in the error state.
10111  */
10112 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
10113
10114 /**
10115  * Frees any resources used by the CResult_PublicKeyErrorZ.
10116  */
10117 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
10118
10119 /**
10120  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10121  * but with all dynamically-allocated buffers duplicated in new buffers.
10122  */
10123 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
10124
10125 /**
10126  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
10127  */
10128 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
10129
10130 /**
10131  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
10132  */
10133 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
10134
10135 /**
10136  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
10137  */
10138 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
10139
10140 /**
10141  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
10142  * but with all dynamically-allocated buffers duplicated in new buffers.
10143  */
10144 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
10145
10146 /**
10147  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
10148  */
10149 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
10150
10151 /**
10152  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
10153  */
10154 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
10155
10156 /**
10157  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
10158  */
10159 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
10160
10161 /**
10162  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
10163  * but with all dynamically-allocated buffers duplicated in new buffers.
10164  */
10165 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
10166
10167 /**
10168  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
10169  */
10170 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
10171
10172 /**
10173  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
10174  */
10175 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
10176
10177 /**
10178  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
10179  */
10180 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
10181
10182 /**
10183  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
10184  * but with all dynamically-allocated buffers duplicated in new buffers.
10185  */
10186 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
10187
10188 /**
10189  * Constructs a new COption_u32Z containing a u32
10190  */
10191 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
10192
10193 /**
10194  * Constructs a new COption_u32Z containing nothing
10195  */
10196 struct LDKCOption_u32Z COption_u32Z_none(void);
10197
10198 /**
10199  * Frees any resources associated with the u32, if we are in the Some state
10200  */
10201 void COption_u32Z_free(struct LDKCOption_u32Z _res);
10202
10203 /**
10204  * Creates a new COption_u32Z which has the same data as `orig`
10205  * but with all dynamically-allocated buffers duplicated in new buffers.
10206  */
10207 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
10208
10209 /**
10210  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
10211  */
10212 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
10213
10214 /**
10215  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
10216  */
10217 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
10218
10219 /**
10220  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
10221  */
10222 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
10223
10224 /**
10225  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
10226  * but with all dynamically-allocated buffers duplicated in new buffers.
10227  */
10228 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
10229
10230 /**
10231  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
10232  */
10233 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
10234
10235 /**
10236  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
10237  */
10238 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
10239
10240 /**
10241  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
10242  */
10243 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
10244
10245 /**
10246  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
10247  * but with all dynamically-allocated buffers duplicated in new buffers.
10248  */
10249 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
10250
10251 /**
10252  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
10253  */
10254 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
10255
10256 /**
10257  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
10258  */
10259 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
10260
10261 /**
10262  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
10263  */
10264 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
10265
10266 /**
10267  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
10268  * but with all dynamically-allocated buffers duplicated in new buffers.
10269  */
10270 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
10271
10272 /**
10273  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10274  */
10275 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
10276
10277 /**
10278  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
10279  */
10280 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
10281
10282 /**
10283  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
10284  */
10285 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10286
10287 /**
10288  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
10289  */
10290 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
10291
10292 /**
10293  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
10294  * but with all dynamically-allocated buffers duplicated in new buffers.
10295  */
10296 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10297
10298 /**
10299  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
10300  */
10301 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
10302
10303 /**
10304  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
10305  */
10306 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10307
10308 /**
10309  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
10310  */
10311 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
10312
10313 /**
10314  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
10315  * but with all dynamically-allocated buffers duplicated in new buffers.
10316  */
10317 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10318
10319 /**
10320  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
10321  */
10322 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
10323
10324 /**
10325  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
10326  */
10327 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
10328
10329 /**
10330  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
10331  */
10332 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
10333
10334 /**
10335  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
10336  */
10337 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
10338
10339 /**
10340  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
10341  */
10342 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10343
10344 /**
10345  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
10346  */
10347 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
10348
10349 /**
10350  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
10351  * but with all dynamically-allocated buffers duplicated in new buffers.
10352  */
10353 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10354
10355 /**
10356  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
10357  */
10358 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
10359
10360 /**
10361  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
10362  */
10363 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
10364
10365 /**
10366  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
10367  */
10368 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
10369
10370 /**
10371  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
10372  */
10373 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
10374
10375 /**
10376  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
10377  */
10378 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
10379
10380 /**
10381  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
10382  */
10383 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
10384
10385 /**
10386  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
10387  * but with all dynamically-allocated buffers duplicated in new buffers.
10388  */
10389 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
10390
10391 /**
10392  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
10393  */
10394 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
10395
10396 /**
10397  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
10398  */
10399 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
10400
10401 /**
10402  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
10403  */
10404 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
10405
10406 /**
10407  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
10408  * but with all dynamically-allocated buffers duplicated in new buffers.
10409  */
10410 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
10411
10412 /**
10413  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
10414  */
10415 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
10416
10417 /**
10418  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
10419  */
10420 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
10421
10422 /**
10423  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
10424  */
10425 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
10426
10427 /**
10428  * Creates a new CResult_NoneErrorZ in the success state.
10429  */
10430 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
10431
10432 /**
10433  * Creates a new CResult_NoneErrorZ in the error state.
10434  */
10435 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
10436
10437 /**
10438  * Frees any resources used by the CResult_NoneErrorZ.
10439  */
10440 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
10441
10442 /**
10443  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
10444  * but with all dynamically-allocated buffers duplicated in new buffers.
10445  */
10446 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
10447
10448 /**
10449  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
10450  */
10451 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
10452
10453 /**
10454  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
10455  */
10456 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
10457
10458 /**
10459  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
10460  */
10461 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
10462
10463 /**
10464  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
10465  * but with all dynamically-allocated buffers duplicated in new buffers.
10466  */
10467 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
10468
10469 /**
10470  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10471  */
10472 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
10473
10474 /**
10475  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10476  */
10477 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
10478
10479 /**
10480  * Creates a new CResult_RouteDecodeErrorZ in the success state.
10481  */
10482 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
10483
10484 /**
10485  * Creates a new CResult_RouteDecodeErrorZ in the error state.
10486  */
10487 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
10488
10489 /**
10490  * Frees any resources used by the CResult_RouteDecodeErrorZ.
10491  */
10492 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
10493
10494 /**
10495  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
10496  * but with all dynamically-allocated buffers duplicated in new buffers.
10497  */
10498 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
10499
10500 /**
10501  * Constructs a new COption_u64Z containing a u64
10502  */
10503 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
10504
10505 /**
10506  * Constructs a new COption_u64Z containing nothing
10507  */
10508 struct LDKCOption_u64Z COption_u64Z_none(void);
10509
10510 /**
10511  * Frees any resources associated with the u64, if we are in the Some state
10512  */
10513 void COption_u64Z_free(struct LDKCOption_u64Z _res);
10514
10515 /**
10516  * Creates a new COption_u64Z which has the same data as `orig`
10517  * but with all dynamically-allocated buffers duplicated in new buffers.
10518  */
10519 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
10520
10521 /**
10522  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10523  */
10524 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
10525
10526 /**
10527  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10528  */
10529 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
10530
10531 /**
10532  * Creates a new CResult_RouteLightningErrorZ in the success state.
10533  */
10534 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
10535
10536 /**
10537  * Creates a new CResult_RouteLightningErrorZ in the error state.
10538  */
10539 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
10540
10541 /**
10542  * Frees any resources used by the CResult_RouteLightningErrorZ.
10543  */
10544 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
10545
10546 /**
10547  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
10548  * but with all dynamically-allocated buffers duplicated in new buffers.
10549  */
10550 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
10551
10552 /**
10553  * Creates a new CResult_TxOutAccessErrorZ in the success state.
10554  */
10555 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
10556
10557 /**
10558  * Creates a new CResult_TxOutAccessErrorZ in the error state.
10559  */
10560 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
10561
10562 /**
10563  * Frees any resources used by the CResult_TxOutAccessErrorZ.
10564  */
10565 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
10566
10567 /**
10568  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
10569  * but with all dynamically-allocated buffers duplicated in new buffers.
10570  */
10571 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
10572
10573 /**
10574  * Creates a new tuple which has the same data as `orig`
10575  * but with all dynamically-allocated buffers duplicated in new buffers.
10576  */
10577 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
10578
10579 /**
10580  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
10581  */
10582 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
10583
10584 /**
10585  * Frees any resources used by the C2Tuple_usizeTransactionZ.
10586  */
10587 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
10588
10589 /**
10590  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10591  */
10592 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
10593
10594 /**
10595  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10596  */
10597 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
10598
10599 /**
10600  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
10601  */
10602 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
10603
10604 /**
10605  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
10606  */
10607 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
10608
10609 /**
10610  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
10611  */
10612 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
10613
10614 /**
10615  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
10616  * but with all dynamically-allocated buffers duplicated in new buffers.
10617  */
10618 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
10619
10620 /**
10621  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10622  */
10623 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
10624
10625 /**
10626  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
10627  */
10628 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
10629
10630 /**
10631  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
10632  */
10633 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
10634
10635 /**
10636  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
10637  */
10638 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
10639
10640 /**
10641  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
10642  * but with all dynamically-allocated buffers duplicated in new buffers.
10643  */
10644 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
10645
10646 /**
10647  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
10648  */
10649 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
10650
10651 /**
10652  * Constructs a new COption_NetworkUpdateZ containing nothing
10653  */
10654 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
10655
10656 /**
10657  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
10658  */
10659 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
10660
10661 /**
10662  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
10663  * but with all dynamically-allocated buffers duplicated in new buffers.
10664  */
10665 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
10666
10667 /**
10668  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10669  */
10670 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
10671
10672 /**
10673  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10674  */
10675 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
10676
10677 /**
10678  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
10679  */
10680 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
10681
10682 /**
10683  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
10684  */
10685 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10686
10687 /**
10688  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
10689  */
10690 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
10691
10692 /**
10693  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
10694  */
10695 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
10696
10697 /**
10698  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
10699  */
10700 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10701
10702 /**
10703  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
10704  */
10705 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
10706
10707 /**
10708  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10709  */
10710 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10711
10712 /**
10713  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10714  */
10715 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10716
10717 /**
10718  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10719  */
10720 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10721
10722 /**
10723  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10724  */
10725 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10726
10727 /**
10728  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10729  */
10730 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10731
10732 /**
10733  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10734  */
10735 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10736
10737 /**
10738  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
10739  */
10740 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
10741
10742 /**
10743  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
10744  */
10745 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10746
10747 /**
10748  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
10749  */
10750 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
10751
10752 /**
10753  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
10754  * but with all dynamically-allocated buffers duplicated in new buffers.
10755  */
10756 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10757
10758 /**
10759  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
10760  */
10761 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
10762
10763 /**
10764  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
10765  */
10766 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10767
10768 /**
10769  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
10770  */
10771 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
10772
10773 /**
10774  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
10775  * but with all dynamically-allocated buffers duplicated in new buffers.
10776  */
10777 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10778
10779 /**
10780  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10781  */
10782 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10783
10784 /**
10785  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10786  */
10787 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10788
10789 /**
10790  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10791  */
10792 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10793
10794 /**
10795  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10796  * but with all dynamically-allocated buffers duplicated in new buffers.
10797  */
10798 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10799
10800 /**
10801  * Creates a new CResult_NoneNoneZ in the success state.
10802  */
10803 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
10804
10805 /**
10806  * Creates a new CResult_NoneNoneZ in the error state.
10807  */
10808 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
10809
10810 /**
10811  * Frees any resources used by the CResult_NoneNoneZ.
10812  */
10813 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
10814
10815 /**
10816  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
10817  * but with all dynamically-allocated buffers duplicated in new buffers.
10818  */
10819 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
10820
10821 /**
10822  * Creates a new tuple which has the same data as `orig`
10823  * but with all dynamically-allocated buffers duplicated in new buffers.
10824  */
10825 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10826
10827 /**
10828  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10829  */
10830 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10831
10832 /**
10833  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10834  */
10835 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10836
10837 /**
10838  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10839  */
10840 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10841
10842 /**
10843  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10844  */
10845 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10846
10847 /**
10848  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10849  */
10850 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10851
10852 /**
10853  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10854  * but with all dynamically-allocated buffers duplicated in new buffers.
10855  */
10856 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10857
10858 /**
10859  * Creates a new CResult_SignatureNoneZ in the success state.
10860  */
10861 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10862
10863 /**
10864  * Creates a new CResult_SignatureNoneZ in the error state.
10865  */
10866 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10867
10868 /**
10869  * Frees any resources used by the CResult_SignatureNoneZ.
10870  */
10871 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10872
10873 /**
10874  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10875  * but with all dynamically-allocated buffers duplicated in new buffers.
10876  */
10877 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10878
10879 /**
10880  * Creates a new CResult_SignDecodeErrorZ in the success state.
10881  */
10882 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10883
10884 /**
10885  * Creates a new CResult_SignDecodeErrorZ in the error state.
10886  */
10887 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10888
10889 /**
10890  * Frees any resources used by the CResult_SignDecodeErrorZ.
10891  */
10892 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10893
10894 /**
10895  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10896  * but with all dynamically-allocated buffers duplicated in new buffers.
10897  */
10898 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10899
10900 /**
10901  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10902  */
10903 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
10904
10905 /**
10906  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
10907  */
10908 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
10909
10910 /**
10911  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
10912  */
10913 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
10914
10915 /**
10916  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
10917  */
10918 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
10919
10920 /**
10921  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
10922  * but with all dynamically-allocated buffers duplicated in new buffers.
10923  */
10924 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
10925
10926 /**
10927  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10928  */
10929 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
10930
10931 /**
10932  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
10933  */
10934 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
10935
10936 /**
10937  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
10938  */
10939 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
10940
10941 /**
10942  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
10943  */
10944 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
10945
10946 /**
10947  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
10948  * but with all dynamically-allocated buffers duplicated in new buffers.
10949  */
10950 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
10951
10952 /**
10953  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
10954  */
10955 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
10956
10957 /**
10958  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10959  */
10960 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10961
10962 /**
10963  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10964  */
10965 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10966
10967 /**
10968  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10969  * but with all dynamically-allocated buffers duplicated in new buffers.
10970  */
10971 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10972
10973 /**
10974  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10975  */
10976 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10977
10978 /**
10979  * Creates a new CResult_TransactionNoneZ in the success state.
10980  */
10981 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10982
10983 /**
10984  * Creates a new CResult_TransactionNoneZ in the error state.
10985  */
10986 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10987
10988 /**
10989  * Frees any resources used by the CResult_TransactionNoneZ.
10990  */
10991 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10992
10993 /**
10994  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
10995  * but with all dynamically-allocated buffers duplicated in new buffers.
10996  */
10997 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
10998
10999 /**
11000  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
11001  */
11002 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
11003
11004 /**
11005  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
11006  */
11007 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
11008
11009 /**
11010  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11011  */
11012 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
11013
11014 /**
11015  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
11016  */
11017 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
11018
11019 /**
11020  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
11021  */
11022 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
11023
11024 /**
11025  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
11026  */
11027 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
11028
11029 /**
11030  * Constructs a new COption_u16Z containing a u16
11031  */
11032 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
11033
11034 /**
11035  * Constructs a new COption_u16Z containing nothing
11036  */
11037 struct LDKCOption_u16Z COption_u16Z_none(void);
11038
11039 /**
11040  * Frees any resources associated with the u16, if we are in the Some state
11041  */
11042 void COption_u16Z_free(struct LDKCOption_u16Z _res);
11043
11044 /**
11045  * Creates a new COption_u16Z which has the same data as `orig`
11046  * but with all dynamically-allocated buffers duplicated in new buffers.
11047  */
11048 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
11049
11050 /**
11051  * Creates a new CResult_NoneAPIErrorZ in the success state.
11052  */
11053 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
11054
11055 /**
11056  * Creates a new CResult_NoneAPIErrorZ in the error state.
11057  */
11058 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
11059
11060 /**
11061  * Frees any resources used by the CResult_NoneAPIErrorZ.
11062  */
11063 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11064
11065 /**
11066  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11067  * but with all dynamically-allocated buffers duplicated in new buffers.
11068  */
11069 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11070
11071 /**
11072  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11073  */
11074 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11075
11076 /**
11077  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11078  */
11079 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11080
11081 /**
11082  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11083  */
11084 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11085
11086 /**
11087  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11088  */
11089 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11090
11091 /**
11092  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11093  */
11094 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11095
11096 /**
11097  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11098  * but with all dynamically-allocated buffers duplicated in new buffers.
11099  */
11100 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11101
11102 /**
11103  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
11104  */
11105 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
11106
11107 /**
11108  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
11109  */
11110 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11111
11112 /**
11113  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
11114  */
11115 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
11116
11117 /**
11118  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
11119  * but with all dynamically-allocated buffers duplicated in new buffers.
11120  */
11121 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
11122
11123 /**
11124  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11125  */
11126 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
11127
11128 /**
11129  * Creates a new tuple which has the same data as `orig`
11130  * but with all dynamically-allocated buffers duplicated in new buffers.
11131  */
11132 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
11133
11134 /**
11135  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11136  */
11137 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11138
11139 /**
11140  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11141  */
11142 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11143
11144 /**
11145  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11146  */
11147 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11148
11149 /**
11150  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11151  */
11152 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11153
11154 /**
11155  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11156  */
11157 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11158
11159 /**
11160  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
11161  * but with all dynamically-allocated buffers duplicated in new buffers.
11162  */
11163 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
11164
11165 /**
11166  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11167  */
11168 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11169
11170 /**
11171  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11172  */
11173 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11174
11175 /**
11176  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11177  */
11178 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11179
11180 /**
11181  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11182  */
11183 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11184
11185 /**
11186  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11187  */
11188 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11189
11190 /**
11191  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11192  */
11193 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11194
11195 /**
11196  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11197  */
11198 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
11199
11200 /**
11201  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11202  */
11203 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
11204
11205 /**
11206  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11207  */
11208 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
11209
11210 /**
11211  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11212  * but with all dynamically-allocated buffers duplicated in new buffers.
11213  */
11214 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
11215
11216 /**
11217  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
11218  */
11219 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
11220
11221 /**
11222  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
11223  */
11224 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
11225
11226 /**
11227  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
11228  */
11229 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
11230
11231 /**
11232  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
11233  * but with all dynamically-allocated buffers duplicated in new buffers.
11234  */
11235 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
11236
11237 /**
11238  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11239  */
11240 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
11241
11242 /**
11243  * Constructs a new COption_TypeZ containing nothing
11244  */
11245 struct LDKCOption_TypeZ COption_TypeZ_none(void);
11246
11247 /**
11248  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11249  */
11250 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
11251
11252 /**
11253  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11254  */
11255 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
11256
11257 /**
11258  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11259  */
11260 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
11261
11262 /**
11263  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11264  */
11265 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
11266
11267 /**
11268  * Creates a new CResult_SiPrefixNoneZ in the success state.
11269  */
11270 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
11271
11272 /**
11273  * Creates a new CResult_SiPrefixNoneZ in the error state.
11274  */
11275 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
11276
11277 /**
11278  * Frees any resources used by the CResult_SiPrefixNoneZ.
11279  */
11280 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
11281
11282 /**
11283  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
11284  * but with all dynamically-allocated buffers duplicated in new buffers.
11285  */
11286 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
11287
11288 /**
11289  * Creates a new CResult_InvoiceNoneZ in the success state.
11290  */
11291 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
11292
11293 /**
11294  * Creates a new CResult_InvoiceNoneZ in the error state.
11295  */
11296 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
11297
11298 /**
11299  * Frees any resources used by the CResult_InvoiceNoneZ.
11300  */
11301 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
11302
11303 /**
11304  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
11305  * but with all dynamically-allocated buffers duplicated in new buffers.
11306  */
11307 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
11308
11309 /**
11310  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
11311  */
11312 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
11313
11314 /**
11315  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
11316  */
11317 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
11318
11319 /**
11320  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
11321  */
11322 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
11323
11324 /**
11325  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
11326  * but with all dynamically-allocated buffers duplicated in new buffers.
11327  */
11328 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
11329
11330 /**
11331  * Creates a new tuple which has the same data as `orig`
11332  * but with all dynamically-allocated buffers duplicated in new buffers.
11333  */
11334 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
11335
11336 /**
11337  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
11338  */
11339 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
11340
11341 /**
11342  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
11343  */
11344 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
11345
11346 /**
11347  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
11348  */
11349 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
11350
11351 /**
11352  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
11353  */
11354 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
11355
11356 /**
11357  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
11358  */
11359 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
11360
11361 /**
11362  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
11363  * but with all dynamically-allocated buffers duplicated in new buffers.
11364  */
11365 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
11366
11367 /**
11368  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11369  */
11370 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
11371
11372 /**
11373  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
11374  */
11375 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
11376
11377 /**
11378  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
11379  */
11380 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
11381
11382 /**
11383  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
11384  */
11385 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
11386
11387 /**
11388  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
11389  * but with all dynamically-allocated buffers duplicated in new buffers.
11390  */
11391 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
11392
11393 /**
11394  * Creates a new CResult_NoneSemanticErrorZ in the success state.
11395  */
11396 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
11397
11398 /**
11399  * Creates a new CResult_NoneSemanticErrorZ in the error state.
11400  */
11401 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
11402
11403 /**
11404  * Frees any resources used by the CResult_NoneSemanticErrorZ.
11405  */
11406 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
11407
11408 /**
11409  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
11410  * but with all dynamically-allocated buffers duplicated in new buffers.
11411  */
11412 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
11413
11414 /**
11415  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
11416  */
11417 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
11418
11419 /**
11420  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
11421  */
11422 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
11423
11424 /**
11425  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
11426  */
11427 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
11428
11429 /**
11430  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
11431  * but with all dynamically-allocated buffers duplicated in new buffers.
11432  */
11433 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
11434
11435 /**
11436  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
11437  */
11438 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
11439
11440 /**
11441  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
11442  */
11443 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
11444
11445 /**
11446  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
11447  */
11448 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
11449
11450 /**
11451  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
11452  * but with all dynamically-allocated buffers duplicated in new buffers.
11453  */
11454 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
11455
11456 /**
11457  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
11458  */
11459 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
11460
11461 /**
11462  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
11463  */
11464 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
11465
11466 /**
11467  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
11468  */
11469 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
11470
11471 /**
11472  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
11473  * but with all dynamically-allocated buffers duplicated in new buffers.
11474  */
11475 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
11476
11477 /**
11478  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
11479  */
11480 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
11481
11482 /**
11483  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
11484  */
11485 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
11486
11487 /**
11488  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
11489  */
11490 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
11491
11492 /**
11493  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
11494  * but with all dynamically-allocated buffers duplicated in new buffers.
11495  */
11496 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
11497
11498 /**
11499  * Creates a new CResult_StringErrorZ in the success state.
11500  */
11501 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
11502
11503 /**
11504  * Creates a new CResult_StringErrorZ in the error state.
11505  */
11506 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
11507
11508 /**
11509  * Frees any resources used by the CResult_StringErrorZ.
11510  */
11511 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
11512
11513 /**
11514  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11515  */
11516 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
11517
11518 /**
11519  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11520  */
11521 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11522
11523 /**
11524  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11525  */
11526 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
11527
11528 /**
11529  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11530  * but with all dynamically-allocated buffers duplicated in new buffers.
11531  */
11532 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
11533
11534 /**
11535  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11536  */
11537 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
11538
11539 /**
11540  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11541  */
11542 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11543
11544 /**
11545  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11546  */
11547 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
11548
11549 /**
11550  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11551  * but with all dynamically-allocated buffers duplicated in new buffers.
11552  */
11553 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
11554
11555 /**
11556  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
11557  */
11558 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
11559
11560 /**
11561  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
11562  */
11563 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
11564
11565 /**
11566  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
11567  */
11568 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
11569
11570 /**
11571  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
11572  * but with all dynamically-allocated buffers duplicated in new buffers.
11573  */
11574 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
11575
11576 /**
11577  * Creates a new tuple which has the same data as `orig`
11578  * but with all dynamically-allocated buffers duplicated in new buffers.
11579  */
11580 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
11581
11582 /**
11583  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11584  */
11585 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
11586
11587 /**
11588  * Frees any resources used by the C2Tuple_OutPointScriptZ.
11589  */
11590 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
11591
11592 /**
11593  * Creates a new tuple which has the same data as `orig`
11594  * but with all dynamically-allocated buffers duplicated in new buffers.
11595  */
11596 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
11597
11598 /**
11599  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
11600  */
11601 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
11602
11603 /**
11604  * Frees any resources used by the C2Tuple_u32ScriptZ.
11605  */
11606 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
11607
11608 /**
11609  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11610  */
11611 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
11612
11613 /**
11614  * Creates a new tuple which has the same data as `orig`
11615  * but with all dynamically-allocated buffers duplicated in new buffers.
11616  */
11617 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
11618
11619 /**
11620  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11621  */
11622 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
11623
11624 /**
11625  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11626  */
11627 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
11628
11629 /**
11630  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11631  */
11632 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
11633
11634 /**
11635  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11636  */
11637 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
11638
11639 /**
11640  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11641  */
11642 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
11643
11644 /**
11645  * Creates a new tuple which has the same data as `orig`
11646  * but with all dynamically-allocated buffers duplicated in new buffers.
11647  */
11648 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
11649
11650 /**
11651  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
11652  */
11653 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
11654
11655 /**
11656  * Frees any resources used by the C2Tuple_u32TxOutZ.
11657  */
11658 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
11659
11660 /**
11661  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11662  */
11663 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
11664
11665 /**
11666  * Creates a new tuple which has the same data as `orig`
11667  * but with all dynamically-allocated buffers duplicated in new buffers.
11668  */
11669 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
11670
11671 /**
11672  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11673  */
11674 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
11675
11676 /**
11677  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11678  */
11679 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
11680
11681 /**
11682  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11683  */
11684 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
11685
11686 /**
11687  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11688  */
11689 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
11690
11691 /**
11692  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11693  */
11694 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
11695
11696 /**
11697  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11698  */
11699 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
11700
11701 /**
11702  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11703  */
11704 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
11705
11706 /**
11707  * Creates a new CResult_NoneLightningErrorZ in the success state.
11708  */
11709 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
11710
11711 /**
11712  * Creates a new CResult_NoneLightningErrorZ in the error state.
11713  */
11714 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
11715
11716 /**
11717  * Frees any resources used by the CResult_NoneLightningErrorZ.
11718  */
11719 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
11720
11721 /**
11722  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
11723  * but with all dynamically-allocated buffers duplicated in new buffers.
11724  */
11725 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
11726
11727 /**
11728  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11729  */
11730 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
11731
11732 /**
11733  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11734  */
11735 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
11736
11737 /**
11738  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11739  */
11740 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
11741
11742 /**
11743  * Creates a new CResult_boolLightningErrorZ in the success state.
11744  */
11745 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
11746
11747 /**
11748  * Creates a new CResult_boolLightningErrorZ in the error state.
11749  */
11750 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
11751
11752 /**
11753  * Frees any resources used by the CResult_boolLightningErrorZ.
11754  */
11755 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
11756
11757 /**
11758  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
11759  * but with all dynamically-allocated buffers duplicated in new buffers.
11760  */
11761 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
11762
11763 /**
11764  * Creates a new tuple which has the same data as `orig`
11765  * but with all dynamically-allocated buffers duplicated in new buffers.
11766  */
11767 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
11768
11769 /**
11770  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
11771  */
11772 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
11773
11774 /**
11775  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
11776  */
11777 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
11778
11779 /**
11780  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11781  */
11782 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
11783
11784 /**
11785  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11786  */
11787 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
11788
11789 /**
11790  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11791  */
11792 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
11793
11794 /**
11795  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11796  */
11797 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
11798
11799 /**
11800  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11801  */
11802 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
11803
11804 /**
11805  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11806  */
11807 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
11808
11809 /**
11810  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11811  * but with all dynamically-allocated buffers duplicated in new buffers.
11812  */
11813 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
11814
11815 /**
11816  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
11817  */
11818 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
11819
11820 /**
11821  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
11822  */
11823 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
11824
11825 /**
11826  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
11827  */
11828 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
11829
11830 /**
11831  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11832  * but with all dynamically-allocated buffers duplicated in new buffers.
11833  */
11834 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
11835
11836 /**
11837  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
11838  */
11839 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
11840
11841 /**
11842  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
11843  */
11844 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
11845
11846 /**
11847  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
11848  */
11849 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
11850
11851 /**
11852  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11853  * but with all dynamically-allocated buffers duplicated in new buffers.
11854  */
11855 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
11856
11857 /**
11858  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11859  */
11860 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
11861
11862 /**
11863  * Constructs a new COption_AccessZ containing nothing
11864  */
11865 struct LDKCOption_AccessZ COption_AccessZ_none(void);
11866
11867 /**
11868  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11869  */
11870 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
11871
11872 /**
11873  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
11874  */
11875 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
11876
11877 /**
11878  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
11879  */
11880 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
11881
11882 /**
11883  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
11884  */
11885 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
11886
11887 /**
11888  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
11889  * but with all dynamically-allocated buffers duplicated in new buffers.
11890  */
11891 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
11892
11893 /**
11894  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11895  */
11896 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
11897
11898 /**
11899  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11900  */
11901 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
11902
11903 /**
11904  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11905  */
11906 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
11907
11908 /**
11909  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11910  * but with all dynamically-allocated buffers duplicated in new buffers.
11911  */
11912 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
11913
11914 /**
11915  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11916  */
11917 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
11918
11919 /**
11920  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11921  */
11922 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
11923
11924 /**
11925  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11926  */
11927 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
11928
11929 /**
11930  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11931  * but with all dynamically-allocated buffers duplicated in new buffers.
11932  */
11933 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
11934
11935 /**
11936  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11937  */
11938 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
11939
11940 /**
11941  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11942  */
11943 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
11944
11945 /**
11946  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11947  */
11948 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
11949
11950 /**
11951  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11952  * but with all dynamically-allocated buffers duplicated in new buffers.
11953  */
11954 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
11955
11956 /**
11957  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11958  */
11959 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
11960
11961 /**
11962  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11963  */
11964 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
11965
11966 /**
11967  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11968  */
11969 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
11970
11971 /**
11972  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11973  */
11974 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
11975
11976 /**
11977  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11978  * but with all dynamically-allocated buffers duplicated in new buffers.
11979  */
11980 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
11981
11982 /**
11983  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11984  */
11985 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
11986
11987 /**
11988  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11989  */
11990 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
11991
11992 /**
11993  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11994  */
11995 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
11996
11997 /**
11998  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11999  * but with all dynamically-allocated buffers duplicated in new buffers.
12000  */
12001 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
12002
12003 /**
12004  * Creates a new CResult_NetAddressu8Z in the success state.
12005  */
12006 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
12007
12008 /**
12009  * Creates a new CResult_NetAddressu8Z in the error state.
12010  */
12011 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
12012
12013 /**
12014  * Frees any resources used by the CResult_NetAddressu8Z.
12015  */
12016 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
12017
12018 /**
12019  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
12020  * but with all dynamically-allocated buffers duplicated in new buffers.
12021  */
12022 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
12023
12024 /**
12025  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
12026  */
12027 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
12028
12029 /**
12030  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
12031  */
12032 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
12033
12034 /**
12035  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
12036  */
12037 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
12038
12039 /**
12040  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
12041  * but with all dynamically-allocated buffers duplicated in new buffers.
12042  */
12043 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
12044
12045 /**
12046  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12047  */
12048 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
12049
12050 /**
12051  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12052  */
12053 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
12054
12055 /**
12056  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12057  */
12058 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
12059
12060 /**
12061  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12062  * but with all dynamically-allocated buffers duplicated in new buffers.
12063  */
12064 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
12065
12066 /**
12067  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12068  */
12069 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
12070
12071 /**
12072  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12073  */
12074 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
12075
12076 /**
12077  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12078  */
12079 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
12080
12081 /**
12082  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12083  */
12084 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
12085
12086 /**
12087  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12088  */
12089 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
12090
12091 /**
12092  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12093  */
12094 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
12095
12096 /**
12097  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12098  */
12099 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
12100
12101 /**
12102  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12103  * but with all dynamically-allocated buffers duplicated in new buffers.
12104  */
12105 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
12106
12107 /**
12108  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12109  */
12110 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
12111
12112 /**
12113  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12114  */
12115 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
12116
12117 /**
12118  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12119  */
12120 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
12121
12122 /**
12123  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12124  * but with all dynamically-allocated buffers duplicated in new buffers.
12125  */
12126 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
12127
12128 /**
12129  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12130  */
12131 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
12132
12133 /**
12134  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12135  */
12136 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
12137
12138 /**
12139  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12140  */
12141 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
12142
12143 /**
12144  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12145  * but with all dynamically-allocated buffers duplicated in new buffers.
12146  */
12147 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
12148
12149 /**
12150  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12151  */
12152 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
12153
12154 /**
12155  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12156  */
12157 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
12158
12159 /**
12160  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12161  */
12162 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
12163
12164 /**
12165  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12166  * but with all dynamically-allocated buffers duplicated in new buffers.
12167  */
12168 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
12169
12170 /**
12171  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12172  */
12173 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
12174
12175 /**
12176  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12177  */
12178 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
12179
12180 /**
12181  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12182  */
12183 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
12184
12185 /**
12186  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12187  * but with all dynamically-allocated buffers duplicated in new buffers.
12188  */
12189 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
12190
12191 /**
12192  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12193  */
12194 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
12195
12196 /**
12197  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12198  */
12199 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
12200
12201 /**
12202  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12203  */
12204 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
12205
12206 /**
12207  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12208  * but with all dynamically-allocated buffers duplicated in new buffers.
12209  */
12210 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
12211
12212 /**
12213  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12214  */
12215 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
12216
12217 /**
12218  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12219  */
12220 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
12221
12222 /**
12223  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12224  */
12225 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
12226
12227 /**
12228  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12229  * but with all dynamically-allocated buffers duplicated in new buffers.
12230  */
12231 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
12232
12233 /**
12234  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12235  */
12236 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
12237
12238 /**
12239  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12240  */
12241 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
12242
12243 /**
12244  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12245  */
12246 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
12247
12248 /**
12249  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12250  * but with all dynamically-allocated buffers duplicated in new buffers.
12251  */
12252 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
12253
12254 /**
12255  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12256  */
12257 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
12258
12259 /**
12260  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12261  */
12262 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
12263
12264 /**
12265  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12266  */
12267 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
12268
12269 /**
12270  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12271  * but with all dynamically-allocated buffers duplicated in new buffers.
12272  */
12273 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
12274
12275 /**
12276  * Creates a new CResult_InitDecodeErrorZ in the success state.
12277  */
12278 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
12279
12280 /**
12281  * Creates a new CResult_InitDecodeErrorZ in the error state.
12282  */
12283 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
12284
12285 /**
12286  * Frees any resources used by the CResult_InitDecodeErrorZ.
12287  */
12288 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
12289
12290 /**
12291  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12292  * but with all dynamically-allocated buffers duplicated in new buffers.
12293  */
12294 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
12295
12296 /**
12297  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12298  */
12299 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
12300
12301 /**
12302  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12303  */
12304 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
12305
12306 /**
12307  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12308  */
12309 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
12310
12311 /**
12312  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12313  * but with all dynamically-allocated buffers duplicated in new buffers.
12314  */
12315 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
12316
12317 /**
12318  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12319  */
12320 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
12321
12322 /**
12323  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12324  */
12325 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
12326
12327 /**
12328  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12329  */
12330 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
12331
12332 /**
12333  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12334  * but with all dynamically-allocated buffers duplicated in new buffers.
12335  */
12336 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
12337
12338 /**
12339  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12340  */
12341 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
12342
12343 /**
12344  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12345  */
12346 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
12347
12348 /**
12349  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12350  */
12351 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
12352
12353 /**
12354  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12355  * but with all dynamically-allocated buffers duplicated in new buffers.
12356  */
12357 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
12358
12359 /**
12360  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12361  */
12362 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
12363
12364 /**
12365  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12366  */
12367 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12368
12369 /**
12370  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12371  */
12372 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
12373
12374 /**
12375  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12376  * but with all dynamically-allocated buffers duplicated in new buffers.
12377  */
12378 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
12379
12380 /**
12381  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12382  */
12383 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
12384
12385 /**
12386  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12387  */
12388 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12389
12390 /**
12391  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12392  */
12393 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
12394
12395 /**
12396  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12397  * but with all dynamically-allocated buffers duplicated in new buffers.
12398  */
12399 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
12400
12401 /**
12402  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12403  */
12404 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
12405
12406 /**
12407  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12408  */
12409 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
12410
12411 /**
12412  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12413  */
12414 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
12415
12416 /**
12417  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12418  * but with all dynamically-allocated buffers duplicated in new buffers.
12419  */
12420 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
12421
12422 /**
12423  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12424  */
12425 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
12426
12427 /**
12428  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12429  */
12430 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12431
12432 /**
12433  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12434  */
12435 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
12436
12437 /**
12438  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12439  * but with all dynamically-allocated buffers duplicated in new buffers.
12440  */
12441 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
12442
12443 /**
12444  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12445  */
12446 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
12447
12448 /**
12449  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12450  */
12451 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12452
12453 /**
12454  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12455  */
12456 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
12457
12458 /**
12459  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12460  * but with all dynamically-allocated buffers duplicated in new buffers.
12461  */
12462 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
12463
12464 /**
12465  * Creates a new CResult_PingDecodeErrorZ in the success state.
12466  */
12467 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
12468
12469 /**
12470  * Creates a new CResult_PingDecodeErrorZ in the error state.
12471  */
12472 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
12473
12474 /**
12475  * Frees any resources used by the CResult_PingDecodeErrorZ.
12476  */
12477 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
12478
12479 /**
12480  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12481  * but with all dynamically-allocated buffers duplicated in new buffers.
12482  */
12483 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
12484
12485 /**
12486  * Creates a new CResult_PongDecodeErrorZ in the success state.
12487  */
12488 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
12489
12490 /**
12491  * Creates a new CResult_PongDecodeErrorZ in the error state.
12492  */
12493 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
12494
12495 /**
12496  * Frees any resources used by the CResult_PongDecodeErrorZ.
12497  */
12498 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
12499
12500 /**
12501  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12502  * but with all dynamically-allocated buffers duplicated in new buffers.
12503  */
12504 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
12505
12506 /**
12507  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12508  */
12509 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
12510
12511 /**
12512  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12513  */
12514 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
12515
12516 /**
12517  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12518  */
12519 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
12520
12521 /**
12522  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12523  * but with all dynamically-allocated buffers duplicated in new buffers.
12524  */
12525 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
12526
12527 /**
12528  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
12529  */
12530 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
12531
12532 /**
12533  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
12534  */
12535 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
12536
12537 /**
12538  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
12539  */
12540 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
12541
12542 /**
12543  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12544  * but with all dynamically-allocated buffers duplicated in new buffers.
12545  */
12546 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
12547
12548 /**
12549  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
12550  */
12551 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
12552
12553 /**
12554  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
12555  */
12556 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12557
12558 /**
12559  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
12560  */
12561 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
12562
12563 /**
12564  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
12565  * but with all dynamically-allocated buffers duplicated in new buffers.
12566  */
12567 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
12568
12569 /**
12570  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
12571  */
12572 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
12573
12574 /**
12575  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
12576  */
12577 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12578
12579 /**
12580  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
12581  */
12582 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
12583
12584 /**
12585  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
12586  * but with all dynamically-allocated buffers duplicated in new buffers.
12587  */
12588 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
12589
12590 /**
12591  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
12592  */
12593 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
12594
12595 /**
12596  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
12597  */
12598 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
12599
12600 /**
12601  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
12602  */
12603 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
12604
12605 /**
12606  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
12607  * but with all dynamically-allocated buffers duplicated in new buffers.
12608  */
12609 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
12610
12611 /**
12612  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
12613  */
12614 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
12615
12616 /**
12617  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
12618  */
12619 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
12620
12621 /**
12622  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
12623  */
12624 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
12625
12626 /**
12627  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
12628  * but with all dynamically-allocated buffers duplicated in new buffers.
12629  */
12630 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
12631
12632 /**
12633  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
12634  */
12635 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
12636
12637 /**
12638  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
12639  */
12640 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
12641
12642 /**
12643  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
12644  */
12645 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
12646
12647 /**
12648  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
12649  * but with all dynamically-allocated buffers duplicated in new buffers.
12650  */
12651 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
12652
12653 /**
12654  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
12655  */
12656 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
12657
12658 /**
12659  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
12660  */
12661 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
12662
12663 /**
12664  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
12665  */
12666 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
12667
12668 /**
12669  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
12670  * but with all dynamically-allocated buffers duplicated in new buffers.
12671  */
12672 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
12673
12674 /**
12675  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
12676  */
12677 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
12678
12679 /**
12680  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
12681  */
12682 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
12683
12684 /**
12685  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
12686  */
12687 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
12688
12689 /**
12690  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
12691  * but with all dynamically-allocated buffers duplicated in new buffers.
12692  */
12693 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
12694
12695 /**
12696  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
12697  */
12698 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
12699
12700 /**
12701  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
12702  */
12703 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
12704
12705 /**
12706  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
12707  */
12708 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
12709
12710 /**
12711  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12712  * but with all dynamically-allocated buffers duplicated in new buffers.
12713  */
12714 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
12715
12716 /**
12717  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12718  */
12719 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
12720
12721 /**
12722  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12723  */
12724 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
12725
12726 /**
12727  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12728  */
12729 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
12730
12731 /**
12732  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12733  * but with all dynamically-allocated buffers duplicated in new buffers.
12734  */
12735 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
12736
12737 /**
12738  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12739  */
12740 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
12741
12742 /**
12743  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12744  */
12745 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
12746
12747 /**
12748  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12749  */
12750 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
12751
12752 /**
12753  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12754  * but with all dynamically-allocated buffers duplicated in new buffers.
12755  */
12756 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
12757
12758 /**
12759  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12760  */
12761 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
12762
12763 /**
12764  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12765  */
12766 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
12767
12768 /**
12769  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12770  */
12771 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
12772
12773 /**
12774  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12775  * but with all dynamically-allocated buffers duplicated in new buffers.
12776  */
12777 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
12778
12779 /**
12780  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12781  */
12782 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
12783
12784 /**
12785  * Constructs a new COption_FilterZ containing nothing
12786  */
12787 struct LDKCOption_FilterZ COption_FilterZ_none(void);
12788
12789 /**
12790  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12791  */
12792 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
12793
12794 /**
12795  * Frees any resources used by the PaymentPurpose
12796  */
12797 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
12798
12799 /**
12800  * Creates a copy of the PaymentPurpose
12801  */
12802 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
12803
12804 /**
12805  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
12806  */
12807 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
12808
12809 /**
12810  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
12811  */
12812 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
12813
12814 /**
12815  * Frees any resources used by the ClosureReason
12816  */
12817 void ClosureReason_free(struct LDKClosureReason this_ptr);
12818
12819 /**
12820  * Creates a copy of the ClosureReason
12821  */
12822 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
12823
12824 /**
12825  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
12826  */
12827 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
12828
12829 /**
12830  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
12831  */
12832 struct LDKClosureReason ClosureReason_holder_force_closed(void);
12833
12834 /**
12835  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
12836  */
12837 struct LDKClosureReason ClosureReason_cooperative_closure(void);
12838
12839 /**
12840  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
12841  */
12842 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
12843
12844 /**
12845  * Utility method to constructs a new ProcessingError-variant ClosureReason
12846  */
12847 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
12848
12849 /**
12850  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
12851  */
12852 struct LDKClosureReason ClosureReason_disconnected_peer(void);
12853
12854 /**
12855  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
12856  */
12857 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
12858
12859 /**
12860  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
12861  */
12862 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
12863
12864 /**
12865  * Frees any resources used by the Event
12866  */
12867 void Event_free(struct LDKEvent this_ptr);
12868
12869 /**
12870  * Creates a copy of the Event
12871  */
12872 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
12873
12874 /**
12875  * Utility method to constructs a new FundingGenerationReady-variant Event
12876  */
12877 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);
12878
12879 /**
12880  * Utility method to constructs a new PaymentReceived-variant Event
12881  */
12882 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
12883
12884 /**
12885  * Utility method to constructs a new PaymentSent-variant Event
12886  */
12887 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage);
12888
12889 /**
12890  * Utility method to constructs a new PaymentPathFailed-variant Event
12891  */
12892 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path);
12893
12894 /**
12895  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
12896  */
12897 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
12898
12899 /**
12900  * Utility method to constructs a new SpendableOutputs-variant Event
12901  */
12902 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
12903
12904 /**
12905  * Utility method to constructs a new PaymentForwarded-variant Event
12906  */
12907 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
12908
12909 /**
12910  * Utility method to constructs a new ChannelClosed-variant Event
12911  */
12912 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKClosureReason reason);
12913
12914 /**
12915  * Serialize the Event object into a byte array which can be read by Event_read
12916  */
12917 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
12918
12919 /**
12920  * Frees any resources used by the MessageSendEvent
12921  */
12922 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
12923
12924 /**
12925  * Creates a copy of the MessageSendEvent
12926  */
12927 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
12928
12929 /**
12930  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
12931  */
12932 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
12933
12934 /**
12935  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
12936  */
12937 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
12938
12939 /**
12940  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
12941  */
12942 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
12943
12944 /**
12945  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
12946  */
12947 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
12948
12949 /**
12950  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
12951  */
12952 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
12953
12954 /**
12955  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
12956  */
12957 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
12958
12959 /**
12960  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
12961  */
12962 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
12963
12964 /**
12965  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
12966  */
12967 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
12968
12969 /**
12970  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
12971  */
12972 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
12973
12974 /**
12975  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
12976  */
12977 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
12978
12979 /**
12980  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
12981  */
12982 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
12983
12984 /**
12985  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
12986  */
12987 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
12988
12989 /**
12990  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
12991  */
12992 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
12993
12994 /**
12995  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
12996  */
12997 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
12998
12999 /**
13000  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
13001  */
13002 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
13003
13004 /**
13005  * Utility method to constructs a new HandleError-variant MessageSendEvent
13006  */
13007 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
13008
13009 /**
13010  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
13011  */
13012 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
13013
13014 /**
13015  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
13016  */
13017 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
13018
13019 /**
13020  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
13021  */
13022 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
13023
13024 /**
13025  * Calls the free function if one is set
13026  */
13027 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
13028
13029 /**
13030  * Calls the free function if one is set
13031  */
13032 void EventsProvider_free(struct LDKEventsProvider this_ptr);
13033
13034 /**
13035  * Calls the free function if one is set
13036  */
13037 void EventHandler_free(struct LDKEventHandler this_ptr);
13038
13039 /**
13040  * Frees any resources used by the APIError
13041  */
13042 void APIError_free(struct LDKAPIError this_ptr);
13043
13044 /**
13045  * Creates a copy of the APIError
13046  */
13047 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
13048
13049 /**
13050  * Utility method to constructs a new APIMisuseError-variant APIError
13051  */
13052 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
13053
13054 /**
13055  * Utility method to constructs a new FeeRateTooHigh-variant APIError
13056  */
13057 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
13058
13059 /**
13060  * Utility method to constructs a new RouteError-variant APIError
13061  */
13062 struct LDKAPIError APIError_route_error(struct LDKStr err);
13063
13064 /**
13065  * Utility method to constructs a new ChannelUnavailable-variant APIError
13066  */
13067 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
13068
13069 /**
13070  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
13071  */
13072 struct LDKAPIError APIError_monitor_update_failed(void);
13073
13074 /**
13075  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
13076  */
13077 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
13078
13079 /**
13080  * Creates a digital signature of a message given a SecretKey, like the node's secret.
13081  * 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.
13082  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
13083  */
13084 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
13085
13086 /**
13087  * Recovers the PublicKey of the signer of the message given the message and the signature.
13088  */
13089 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
13090
13091 /**
13092  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
13093  * and the PublicKey.
13094  */
13095 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
13096
13097 /**
13098  * Creates a copy of the Level
13099  */
13100 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
13101
13102 /**
13103  * Utility method to constructs a new Trace-variant Level
13104  */
13105 enum LDKLevel Level_trace(void);
13106
13107 /**
13108  * Utility method to constructs a new Debug-variant Level
13109  */
13110 enum LDKLevel Level_debug(void);
13111
13112 /**
13113  * Utility method to constructs a new Info-variant Level
13114  */
13115 enum LDKLevel Level_info(void);
13116
13117 /**
13118  * Utility method to constructs a new Warn-variant Level
13119  */
13120 enum LDKLevel Level_warn(void);
13121
13122 /**
13123  * Utility method to constructs a new Error-variant Level
13124  */
13125 enum LDKLevel Level_error(void);
13126
13127 /**
13128  * Checks if two Levels contain equal inner contents.
13129  * This ignores pointers and is_owned flags and looks at the values in fields.
13130  */
13131 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
13132
13133 /**
13134  * Checks if two Levels contain equal inner contents.
13135  */
13136 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
13137
13138 /**
13139  * Returns the most verbose logging level.
13140  */
13141 MUST_USE_RES enum LDKLevel Level_max(void);
13142
13143 /**
13144  * Calls the free function if one is set
13145  */
13146 void Logger_free(struct LDKLogger this_ptr);
13147
13148 /**
13149  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
13150  */
13151 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
13152
13153 /**
13154  * Confirmations we will wait for before considering the channel locked in.
13155  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
13156  * equivalent limit applied to outbound channels).
13157  *
13158  * Default value: 6.
13159  */
13160 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13161
13162 /**
13163  * Confirmations we will wait for before considering the channel locked in.
13164  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
13165  * equivalent limit applied to outbound channels).
13166  *
13167  * Default value: 6.
13168  */
13169 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
13170
13171 /**
13172  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
13173  * the number of blocks we have to punish our counterparty if they broadcast a revoked
13174  * transaction).
13175  *
13176  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
13177  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
13178  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
13179  * possibly with time in between to RBF the spending transaction).
13180  *
13181  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
13182  * case of an honest unilateral channel close, which implicitly decrease the economic value of
13183  * our channel.
13184  *
13185  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
13186  * can tweak config to ask for more security, not less.
13187  */
13188 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13189
13190 /**
13191  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
13192  * the number of blocks we have to punish our counterparty if they broadcast a revoked
13193  * transaction).
13194  *
13195  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
13196  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
13197  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
13198  * possibly with time in between to RBF the spending transaction).
13199  *
13200  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
13201  * case of an honest unilateral channel close, which implicitly decrease the economic value of
13202  * our channel.
13203  *
13204  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
13205  * can tweak config to ask for more security, not less.
13206  */
13207 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
13208
13209 /**
13210  * Set to the smallest value HTLC we will accept to process.
13211  *
13212  * This value is sent to our counterparty on channel-open and we close the channel any time
13213  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
13214  *
13215  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
13216  * by the protocol.
13217  */
13218 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13219
13220 /**
13221  * Set to the smallest value HTLC we will accept to process.
13222  *
13223  * This value is sent to our counterparty on channel-open and we close the channel any time
13224  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
13225  *
13226  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
13227  * by the protocol.
13228  */
13229 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
13230
13231 /**
13232  * Constructs a new ChannelHandshakeConfig given each field
13233  */
13234 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);
13235
13236 /**
13237  * Creates a copy of the ChannelHandshakeConfig
13238  */
13239 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
13240
13241 /**
13242  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
13243  */
13244 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
13245
13246 /**
13247  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
13248  */
13249 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
13250
13251 /**
13252  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
13253  * only applies to inbound channels.
13254  *
13255  * Default value: 0.
13256  */
13257 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13258
13259 /**
13260  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
13261  * only applies to inbound channels.
13262  *
13263  * Default value: 0.
13264  */
13265 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13266
13267 /**
13268  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
13269  * you to limit the maximum minimum-size they can require.
13270  *
13271  * Default value: u64::max_value.
13272  */
13273 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13274
13275 /**
13276  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
13277  * you to limit the maximum minimum-size they can require.
13278  *
13279  * Default value: u64::max_value.
13280  */
13281 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13282
13283 /**
13284  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
13285  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
13286  *
13287  * Default value: 0.
13288  */
13289 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13290
13291 /**
13292  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
13293  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
13294  *
13295  * Default value: 0.
13296  */
13297 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13298
13299 /**
13300  * The remote node will require we keep a certain amount in direct payment to ourselves at all
13301  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
13302  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
13303  *
13304  * Default value: u64::max_value.
13305  */
13306 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13307
13308 /**
13309  * The remote node will require we keep a certain amount in direct payment to ourselves at all
13310  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
13311  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
13312  *
13313  * Default value: u64::max_value.
13314  */
13315 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13316
13317 /**
13318  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
13319  * time. This allows you to set a minimum such value.
13320  *
13321  * Default value: 0.
13322  */
13323 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13324
13325 /**
13326  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
13327  * time. This allows you to set a minimum such value.
13328  *
13329  * Default value: 0.
13330  */
13331 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
13332
13333 /**
13334  * Before a channel is usable the funding transaction will need to be confirmed by at least a
13335  * certain number of blocks, specified by the node which is not the funder (as the funder can
13336  * assume they aren't going to double-spend themselves).
13337  * This config allows you to set a limit on the maximum amount of time to wait.
13338  *
13339  * Default value: 144, or roughly one day and only applies to outbound channels.
13340  */
13341 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13342
13343 /**
13344  * Before a channel is usable the funding transaction will need to be confirmed by at least a
13345  * certain number of blocks, specified by the node which is not the funder (as the funder can
13346  * assume they aren't going to double-spend themselves).
13347  * This config allows you to set a limit on the maximum amount of time to wait.
13348  *
13349  * Default value: 144, or roughly one day and only applies to outbound channels.
13350  */
13351 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
13352
13353 /**
13354  * Set to force an incoming channel to match our announced channel preference in
13355  * [`ChannelConfig::announced_channel`].
13356  *
13357  * For a node which is not online reliably, this should be set to true and
13358  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
13359  * channels will ever be opened.
13360  *
13361  * Default value: true.
13362  */
13363 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13364
13365 /**
13366  * Set to force an incoming channel to match our announced channel preference in
13367  * [`ChannelConfig::announced_channel`].
13368  *
13369  * For a node which is not online reliably, this should be set to true and
13370  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
13371  * channels will ever be opened.
13372  *
13373  * Default value: true.
13374  */
13375 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
13376
13377 /**
13378  * Set to the amount of time we're willing to wait to claim money back to us.
13379  *
13380  * Not checking this value would be a security issue, as our peer would be able to set it to
13381  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
13382  *
13383  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
13384  * reduce the loss of having useless locked funds (if your peer accepts)
13385  */
13386 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13387
13388 /**
13389  * Set to the amount of time we're willing to wait to claim money back to us.
13390  *
13391  * Not checking this value would be a security issue, as our peer would be able to set it to
13392  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
13393  *
13394  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
13395  * reduce the loss of having useless locked funds (if your peer accepts)
13396  */
13397 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
13398
13399 /**
13400  * Constructs a new ChannelHandshakeLimits given each field
13401  */
13402 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);
13403
13404 /**
13405  * Creates a copy of the ChannelHandshakeLimits
13406  */
13407 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
13408
13409 /**
13410  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
13411  */
13412 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
13413
13414 /**
13415  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
13416  */
13417 void ChannelConfig_free(struct LDKChannelConfig this_obj);
13418
13419 /**
13420  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
13421  * over the channel.
13422  * This may be allowed to change at runtime in a later update, however doing so must result in
13423  * update messages sent to notify all nodes of our updated relay fee.
13424  *
13425  * Default value: 0.
13426  */
13427 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13428
13429 /**
13430  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
13431  * over the channel.
13432  * This may be allowed to change at runtime in a later update, however doing so must result in
13433  * update messages sent to notify all nodes of our updated relay fee.
13434  *
13435  * Default value: 0.
13436  */
13437 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
13438
13439 /**
13440  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
13441  * excess of [`forwarding_fee_proportional_millionths`].
13442  * This may be allowed to change at runtime in a later update, however doing so must result in
13443  * update messages sent to notify all nodes of our updated relay fee.
13444  *
13445  * The default value of a single satoshi roughly matches the market rate on many routing nodes
13446  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
13447  * this node.
13448  *
13449  * Default value: 1000.
13450  *
13451  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
13452  */
13453 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13454
13455 /**
13456  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
13457  * excess of [`forwarding_fee_proportional_millionths`].
13458  * This may be allowed to change at runtime in a later update, however doing so must result in
13459  * update messages sent to notify all nodes of our updated relay fee.
13460  *
13461  * The default value of a single satoshi roughly matches the market rate on many routing nodes
13462  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
13463  * this node.
13464  *
13465  * Default value: 1000.
13466  *
13467  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
13468  */
13469 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
13470
13471 /**
13472  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
13473  * the channel this config applies to.
13474  *
13475  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
13476  * HTLC balance when a channel appears on-chain whereas
13477  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
13478  * (non-HTLC-encumbered) balance.
13479  *
13480  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
13481  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
13482  * commitment transaction at least once per this many blocks (minus some margin to allow us
13483  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
13484  * the spending transaction).
13485  *
13486  * Default value: 72 (12 hours at an average of 6 blocks/hour).
13487  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
13488  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
13489  *
13490  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
13491  */
13492 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13493
13494 /**
13495  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
13496  * the channel this config applies to.
13497  *
13498  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
13499  * HTLC balance when a channel appears on-chain whereas
13500  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
13501  * (non-HTLC-encumbered) balance.
13502  *
13503  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
13504  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
13505  * commitment transaction at least once per this many blocks (minus some margin to allow us
13506  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
13507  * the spending transaction).
13508  *
13509  * Default value: 72 (12 hours at an average of 6 blocks/hour).
13510  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
13511  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
13512  *
13513  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
13514  */
13515 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
13516
13517 /**
13518  * Set to announce the channel publicly and notify all nodes that they can route via this
13519  * channel.
13520  *
13521  * This should only be set to true for nodes which expect to be online reliably.
13522  *
13523  * As the node which funds a channel picks this value this will only apply for new outbound
13524  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
13525  *
13526  * This cannot be changed after the initial channel handshake.
13527  *
13528  * Default value: false.
13529  */
13530 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13531
13532 /**
13533  * Set to announce the channel publicly and notify all nodes that they can route via this
13534  * channel.
13535  *
13536  * This should only be set to true for nodes which expect to be online reliably.
13537  *
13538  * As the node which funds a channel picks this value this will only apply for new outbound
13539  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
13540  *
13541  * This cannot be changed after the initial channel handshake.
13542  *
13543  * Default value: false.
13544  */
13545 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
13546
13547 /**
13548  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
13549  * supports it, they will then enforce the mutual-close output to us matches what we provided
13550  * at intialization, preventing us from closing to an alternate pubkey.
13551  *
13552  * This is set to true by default to provide a slight increase in security, though ultimately
13553  * any attacker who is able to take control of a channel can just as easily send the funds via
13554  * lightning payments, so we never require that our counterparties support this option.
13555  *
13556  * This cannot be changed after a channel has been initialized.
13557  *
13558  * Default value: true.
13559  */
13560 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13561
13562 /**
13563  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
13564  * supports it, they will then enforce the mutual-close output to us matches what we provided
13565  * at intialization, preventing us from closing to an alternate pubkey.
13566  *
13567  * This is set to true by default to provide a slight increase in security, though ultimately
13568  * any attacker who is able to take control of a channel can just as easily send the funds via
13569  * lightning payments, so we never require that our counterparties support this option.
13570  *
13571  * This cannot be changed after a channel has been initialized.
13572  *
13573  * Default value: true.
13574  */
13575 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
13576
13577 /**
13578  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
13579  * small to claim on-chain.
13580  *
13581  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
13582  * not be claimable on-chain, instead being turned into additional miner fees if either
13583  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
13584  * to such payments may be sustantial if there are many dust HTLCs present when the
13585  * channel is force-closed.
13586  *
13587  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
13588  * exposure across all three types per-channel. Setting this too low may prevent the
13589  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
13590  * important to prevent stealing of dust HTLCs by miners.
13591  *
13592  * Default value: 5_000_000 msat.
13593  */
13594 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13595
13596 /**
13597  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
13598  * small to claim on-chain.
13599  *
13600  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
13601  * not be claimable on-chain, instead being turned into additional miner fees if either
13602  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
13603  * to such payments may be sustantial if there are many dust HTLCs present when the
13604  * channel is force-closed.
13605  *
13606  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
13607  * exposure across all three types per-channel. Setting this too low may prevent the
13608  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
13609  * important to prevent stealing of dust HTLCs by miners.
13610  *
13611  * Default value: 5_000_000 msat.
13612  */
13613 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
13614
13615 /**
13616  * The additional fee we're willing to pay to avoid waiting for the counterparty's
13617  * `to_self_delay` to reclaim funds.
13618  *
13619  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
13620  * closing transaction which both sides find acceptable, ultimately paid by the channel
13621  * funder/initiator.
13622  *
13623  * When we are the funder, because we have to pay the channel closing fee, we bound the
13624  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
13625  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
13626  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
13627  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
13628  * funds.
13629  *
13630  * When we are not the funder, we require the closing transaction fee pay at least our
13631  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
13632  * Thus, this value is ignored when we are not the funder.
13633  *
13634  * Default value: 1000 satoshis.
13635  *
13636  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
13637  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
13638  */
13639 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13640
13641 /**
13642  * The additional fee we're willing to pay to avoid waiting for the counterparty's
13643  * `to_self_delay` to reclaim funds.
13644  *
13645  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
13646  * closing transaction which both sides find acceptable, ultimately paid by the channel
13647  * funder/initiator.
13648  *
13649  * When we are the funder, because we have to pay the channel closing fee, we bound the
13650  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
13651  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
13652  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
13653  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
13654  * funds.
13655  *
13656  * When we are not the funder, we require the closing transaction fee pay at least our
13657  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
13658  * Thus, this value is ignored when we are not the funder.
13659  *
13660  * Default value: 1000 satoshis.
13661  *
13662  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
13663  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
13664  */
13665 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
13666
13667 /**
13668  * Constructs a new ChannelConfig given each field
13669  */
13670 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);
13671
13672 /**
13673  * Creates a copy of the ChannelConfig
13674  */
13675 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
13676
13677 /**
13678  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
13679  */
13680 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
13681
13682 /**
13683  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
13684  */
13685 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
13686
13687 /**
13688  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
13689  */
13690 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
13691
13692 /**
13693  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
13694  */
13695 void UserConfig_free(struct LDKUserConfig this_obj);
13696
13697 /**
13698  * Channel config that we propose to our counterparty.
13699  */
13700 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
13701
13702 /**
13703  * Channel config that we propose to our counterparty.
13704  */
13705 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
13706
13707 /**
13708  * Limits applied to our counterparty's proposed channel config settings.
13709  */
13710 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
13711
13712 /**
13713  * Limits applied to our counterparty's proposed channel config settings.
13714  */
13715 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
13716
13717 /**
13718  * Channel config which affects behavior during channel lifetime.
13719  */
13720 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
13721
13722 /**
13723  * Channel config which affects behavior during channel lifetime.
13724  */
13725 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
13726
13727 /**
13728  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
13729  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
13730  * node which is not online reliably.
13731  *
13732  * For nodes which are not online reliably, you should set all channels to *not* be announced
13733  * (using [`ChannelConfig::announced_channel`] and
13734  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
13735  * ensure you are not exposed to any forwarding risk.
13736  *
13737  * Note that because you cannot change a channel's announced state after creation, there is no
13738  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
13739  * from a publicly-announced forwarding node to a private non-forwarding node you must close
13740  * all your channels and open new ones. For privacy, you should also change your node_id
13741  * (swapping all private and public key material for new ones) at that time.
13742  *
13743  * Default value: false.
13744  */
13745 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
13746
13747 /**
13748  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
13749  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
13750  * node which is not online reliably.
13751  *
13752  * For nodes which are not online reliably, you should set all channels to *not* be announced
13753  * (using [`ChannelConfig::announced_channel`] and
13754  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
13755  * ensure you are not exposed to any forwarding risk.
13756  *
13757  * Note that because you cannot change a channel's announced state after creation, there is no
13758  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
13759  * from a publicly-announced forwarding node to a private non-forwarding node you must close
13760  * all your channels and open new ones. For privacy, you should also change your node_id
13761  * (swapping all private and public key material for new ones) at that time.
13762  *
13763  * Default value: false.
13764  */
13765 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
13766
13767 /**
13768  * Constructs a new UserConfig given each field
13769  */
13770 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);
13771
13772 /**
13773  * Creates a copy of the UserConfig
13774  */
13775 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
13776
13777 /**
13778  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
13779  */
13780 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
13781
13782 /**
13783  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
13784  */
13785 void BestBlock_free(struct LDKBestBlock this_obj);
13786
13787 /**
13788  * Creates a copy of the BestBlock
13789  */
13790 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
13791
13792 /**
13793  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
13794  * network.
13795  */
13796 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
13797
13798 /**
13799  * Returns a `BestBlock` as identified by the given block hash and height.
13800  */
13801 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
13802
13803 /**
13804  * Returns the best block hash.
13805  */
13806 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
13807
13808 /**
13809  * Returns the best block height.
13810  */
13811 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
13812
13813 /**
13814  * Creates a copy of the AccessError
13815  */
13816 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
13817
13818 /**
13819  * Utility method to constructs a new UnknownChain-variant AccessError
13820  */
13821 enum LDKAccessError AccessError_unknown_chain(void);
13822
13823 /**
13824  * Utility method to constructs a new UnknownTx-variant AccessError
13825  */
13826 enum LDKAccessError AccessError_unknown_tx(void);
13827
13828 /**
13829  * Calls the free function if one is set
13830  */
13831 void Access_free(struct LDKAccess this_ptr);
13832
13833 /**
13834  * Calls the free function if one is set
13835  */
13836 void Listen_free(struct LDKListen this_ptr);
13837
13838 /**
13839  * Calls the free function if one is set
13840  */
13841 void Confirm_free(struct LDKConfirm this_ptr);
13842
13843 /**
13844  * Calls the free function if one is set
13845  */
13846 void Watch_free(struct LDKWatch this_ptr);
13847
13848 /**
13849  * Calls the free function if one is set
13850  */
13851 void Filter_free(struct LDKFilter this_ptr);
13852
13853 /**
13854  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
13855  */
13856 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
13857
13858 /**
13859  * First block where the transaction output may have been spent.
13860  *
13861  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
13862  */
13863 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13864
13865 /**
13866  * First block where the transaction output may have been spent.
13867  *
13868  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
13869  */
13870 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13871
13872 /**
13873  * Outpoint identifying the transaction output.
13874  */
13875 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13876
13877 /**
13878  * Outpoint identifying the transaction output.
13879  */
13880 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13881
13882 /**
13883  * Spending condition of the transaction output.
13884  */
13885 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13886
13887 /**
13888  * Spending condition of the transaction output.
13889  */
13890 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13891
13892 /**
13893  * Constructs a new WatchedOutput given each field
13894  */
13895 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
13896
13897 /**
13898  * Creates a copy of the WatchedOutput
13899  */
13900 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
13901
13902 /**
13903  * Checks if two WatchedOutputs contain equal inner contents.
13904  */
13905 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
13906
13907 /**
13908  * Calls the free function if one is set
13909  */
13910 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
13911
13912 /**
13913  * Creates a copy of the ConfirmationTarget
13914  */
13915 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
13916
13917 /**
13918  * Utility method to constructs a new Background-variant ConfirmationTarget
13919  */
13920 enum LDKConfirmationTarget ConfirmationTarget_background(void);
13921
13922 /**
13923  * Utility method to constructs a new Normal-variant ConfirmationTarget
13924  */
13925 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
13926
13927 /**
13928  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
13929  */
13930 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
13931
13932 /**
13933  * Checks if two ConfirmationTargets contain equal inner contents.
13934  * This ignores pointers and is_owned flags and looks at the values in fields.
13935  */
13936 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
13937
13938 /**
13939  * Calls the free function if one is set
13940  */
13941 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
13942
13943 /**
13944  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
13945  */
13946 void ChainMonitor_free(struct LDKChainMonitor this_obj);
13947
13948 /**
13949  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
13950  *
13951  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
13952  * will call back to it indicating transactions and outputs of interest. This allows clients to
13953  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
13954  * always need to fetch full blocks absent another means for determining which blocks contain
13955  * transactions relevant to the watched channels.
13956  */
13957 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
13958
13959 /**
13960  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
13961  * claims which are awaiting confirmation.
13962  *
13963  * Includes the balances from each [`ChannelMonitor`] *except* those included in
13964  * `ignored_channels`, allowing you to filter out balances from channels which are still open
13965  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
13966  *
13967  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
13968  * inclusion in the return value.
13969  */
13970 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
13971
13972 /**
13973  * Constructs a new Listen which calls the relevant methods on this_arg.
13974  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13975  */
13976 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13977
13978 /**
13979  * Constructs a new Confirm which calls the relevant methods on this_arg.
13980  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13981  */
13982 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13983
13984 /**
13985  * Constructs a new Watch which calls the relevant methods on this_arg.
13986  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
13987  */
13988 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13989
13990 /**
13991  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13992  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13993  */
13994 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13995
13996 /**
13997  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
13998  */
13999 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
14000
14001 /**
14002  * The sequence number of this update. Updates *must* be replayed in-order according to this
14003  * sequence number (and updates may panic if they are not). The update_id values are strictly
14004  * increasing and increase by one for each new update, with one exception specified below.
14005  *
14006  * This sequence number is also used to track up to which points updates which returned
14007  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
14008  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
14009  *
14010  * The only instance where update_id values are not strictly increasing is the case where we
14011  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
14012  * its docs for more details.
14013  */
14014 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
14015
14016 /**
14017  * The sequence number of this update. Updates *must* be replayed in-order according to this
14018  * sequence number (and updates may panic if they are not). The update_id values are strictly
14019  * increasing and increase by one for each new update, with one exception specified below.
14020  *
14021  * This sequence number is also used to track up to which points updates which returned
14022  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
14023  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
14024  *
14025  * The only instance where update_id values are not strictly increasing is the case where we
14026  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
14027  * its docs for more details.
14028  */
14029 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
14030
14031 /**
14032  * Creates a copy of the ChannelMonitorUpdate
14033  */
14034 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
14035
14036 /**
14037  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
14038  */
14039 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
14040
14041 /**
14042  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
14043  */
14044 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
14045
14046 /**
14047  * Creates a copy of the ChannelMonitorUpdateErr
14048  */
14049 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
14050
14051 /**
14052  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
14053  */
14054 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
14055
14056 /**
14057  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
14058  */
14059 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
14060
14061 /**
14062  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
14063  */
14064 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
14065
14066 /**
14067  * Creates a copy of the MonitorUpdateError
14068  */
14069 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
14070
14071 /**
14072  * Frees any resources used by the MonitorEvent
14073  */
14074 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
14075
14076 /**
14077  * Creates a copy of the MonitorEvent
14078  */
14079 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
14080
14081 /**
14082  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
14083  */
14084 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
14085
14086 /**
14087  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
14088  */
14089 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
14090
14091 /**
14092  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
14093  */
14094 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
14095
14096 /**
14097  * Creates a copy of the HTLCUpdate
14098  */
14099 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
14100
14101 /**
14102  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
14103  */
14104 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
14105
14106 /**
14107  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
14108  */
14109 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
14110
14111 /**
14112  * Frees any resources used by the Balance
14113  */
14114 void Balance_free(struct LDKBalance this_ptr);
14115
14116 /**
14117  * Creates a copy of the Balance
14118  */
14119 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
14120
14121 /**
14122  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
14123  */
14124 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
14125
14126 /**
14127  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
14128  */
14129 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
14130
14131 /**
14132  * Utility method to constructs a new ContentiousClaimable-variant Balance
14133  */
14134 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
14135
14136 /**
14137  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
14138  */
14139 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
14140
14141 /**
14142  * Checks if two Balances contain equal inner contents.
14143  * This ignores pointers and is_owned flags and looks at the values in fields.
14144  */
14145 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
14146
14147 /**
14148  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
14149  */
14150 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
14151
14152 /**
14153  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
14154  */
14155 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
14156
14157 /**
14158  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
14159  * itself.
14160  *
14161  * panics if the given update is not the next update by update_id.
14162  */
14163 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
14164
14165 /**
14166  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
14167  * ChannelMonitor.
14168  */
14169 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14170
14171 /**
14172  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
14173  */
14174 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14175
14176 /**
14177  * Gets a list of txids, with their output scripts (in the order they appear in the
14178  * transaction), which we must learn about spends of via block_connected().
14179  */
14180 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14181
14182 /**
14183  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
14184  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
14185  * have been registered.
14186  */
14187 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
14188
14189 /**
14190  * Get the list of HTLCs who's status has been updated on chain. This should be called by
14191  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
14192  */
14193 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14194
14195 /**
14196  * Gets the list of pending events which were generated by previous actions, clearing the list
14197  * in the process.
14198  *
14199  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
14200  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
14201  * no internal locking in ChannelMonitors.
14202  */
14203 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14204
14205 /**
14206  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
14207  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
14208  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
14209  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
14210  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
14211  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
14212  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
14213  * out-of-band the other node operator to coordinate with him if option is available to you.
14214  * In any-case, choice is up to the user.
14215  */
14216 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);
14217
14218 /**
14219  * Processes transactions in a newly connected block, which may result in any of the following:
14220  * - update the monitor's state against resolved HTLCs
14221  * - punish the counterparty in the case of seeing a revoked commitment transaction
14222  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
14223  * - detect settled outputs for later spending
14224  * - schedule and bump any in-flight claims
14225  *
14226  * Returns any new outputs to watch from `txdata`; after called, these are also included in
14227  * [`get_outputs_to_watch`].
14228  *
14229  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
14230  */
14231 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);
14232
14233 /**
14234  * Determines if the disconnected block contained any transactions of interest and updates
14235  * appropriately.
14236  */
14237 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);
14238
14239 /**
14240  * Processes transactions confirmed in a block with the given header and height, returning new
14241  * outputs to watch. See [`block_connected`] for details.
14242  *
14243  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
14244  * blocks. See [`chain::Confirm`] for calling expectations.
14245  *
14246  * [`block_connected`]: Self::block_connected
14247  */
14248 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);
14249
14250 /**
14251  * Processes a transaction that was reorganized out of the chain.
14252  *
14253  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
14254  * than blocks. See [`chain::Confirm`] for calling expectations.
14255  *
14256  * [`block_disconnected`]: Self::block_disconnected
14257  */
14258 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);
14259
14260 /**
14261  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
14262  * [`block_connected`] for details.
14263  *
14264  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
14265  * blocks. See [`chain::Confirm`] for calling expectations.
14266  *
14267  * [`block_connected`]: Self::block_connected
14268  */
14269 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);
14270
14271 /**
14272  * Returns the set of txids that should be monitored for re-organization out of the chain.
14273  */
14274 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14275
14276 /**
14277  * Gets the latest best block which was connected either via the [`chain::Listen`] or
14278  * [`chain::Confirm`] interfaces.
14279  */
14280 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14281
14282 /**
14283  * Gets the balances in this channel which are either claimable by us if we were to
14284  * force-close the channel now or which are claimable on-chain (possibly awaiting
14285  * confirmation).
14286  *
14287  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
14288  * included here until an [`Event::SpendableOutputs`] event has been generated for the
14289  * balance, or until our counterparty has claimed the balance and accrued several
14290  * confirmations on the claim transaction.
14291  *
14292  * Note that the balances available when you or your counterparty have broadcasted revoked
14293  * state(s) may not be fully captured here.
14294  *
14295  * See [`Balance`] for additional details on the types of claimable balances which
14296  * may be returned here and their meanings.
14297  */
14298 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14299
14300 /**
14301  * Calls the free function if one is set
14302  */
14303 void Persist_free(struct LDKPersist this_ptr);
14304
14305 /**
14306  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
14307  */
14308 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
14309
14310 /**
14311  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
14312  */
14313 void OutPoint_free(struct LDKOutPoint this_obj);
14314
14315 /**
14316  * The referenced transaction's txid.
14317  */
14318 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
14319
14320 /**
14321  * The referenced transaction's txid.
14322  */
14323 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14324
14325 /**
14326  * The index of the referenced output in its transaction's vout.
14327  */
14328 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
14329
14330 /**
14331  * The index of the referenced output in its transaction's vout.
14332  */
14333 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
14334
14335 /**
14336  * Constructs a new OutPoint given each field
14337  */
14338 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
14339
14340 /**
14341  * Creates a copy of the OutPoint
14342  */
14343 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
14344
14345 /**
14346  * Checks if two OutPoints contain equal inner contents.
14347  * This ignores pointers and is_owned flags and looks at the values in fields.
14348  * Two objects with NULL inner values will be considered "equal" here.
14349  */
14350 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
14351
14352 /**
14353  * Checks if two OutPoints contain equal inner contents.
14354  */
14355 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
14356
14357 /**
14358  * Convert an `OutPoint` to a lightning channel id.
14359  */
14360 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
14361
14362 /**
14363  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
14364  */
14365 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
14366
14367 /**
14368  * Read a OutPoint from a byte array, created by OutPoint_write
14369  */
14370 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
14371
14372 /**
14373  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
14374  */
14375 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
14376
14377 /**
14378  * The outpoint which is spendable
14379  */
14380 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14381
14382 /**
14383  * The outpoint which is spendable
14384  */
14385 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14386
14387 /**
14388  * Per commitment point to derive delayed_payment_key by key holder
14389  */
14390 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14391
14392 /**
14393  * Per commitment point to derive delayed_payment_key by key holder
14394  */
14395 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14396
14397 /**
14398  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
14399  * the witness_script.
14400  */
14401 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14402
14403 /**
14404  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
14405  * the witness_script.
14406  */
14407 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
14408
14409 /**
14410  * The output which is referenced by the given outpoint
14411  */
14412 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
14413
14414 /**
14415  * The revocation point specific to the commitment transaction which was broadcast. Used to
14416  * derive the witnessScript for this output.
14417  */
14418 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14419
14420 /**
14421  * The revocation point specific to the commitment transaction which was broadcast. Used to
14422  * derive the witnessScript for this output.
14423  */
14424 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14425
14426 /**
14427  * Arbitrary identification information returned by a call to
14428  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14429  * the channel to spend the output.
14430  */
14431 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
14432
14433 /**
14434  * Arbitrary identification information returned by a call to
14435  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14436  * the channel to spend the output.
14437  */
14438 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14439
14440 /**
14441  * The value of the channel which this output originated from, possibly indirectly.
14442  */
14443 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14444
14445 /**
14446  * The value of the channel which this output originated from, possibly indirectly.
14447  */
14448 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
14449
14450 /**
14451  * Constructs a new DelayedPaymentOutputDescriptor given each field
14452  */
14453 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);
14454
14455 /**
14456  * Creates a copy of the DelayedPaymentOutputDescriptor
14457  */
14458 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
14459
14460 /**
14461  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
14462  */
14463 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
14464
14465 /**
14466  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
14467  */
14468 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
14469
14470 /**
14471  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
14472  */
14473 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
14474
14475 /**
14476  * The outpoint which is spendable
14477  */
14478 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14479
14480 /**
14481  * The outpoint which is spendable
14482  */
14483 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14484
14485 /**
14486  * The output which is referenced by the given outpoint
14487  */
14488 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
14489
14490 /**
14491  * Arbitrary identification information returned by a call to
14492  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14493  * the channel to spend the output.
14494  */
14495 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
14496
14497 /**
14498  * Arbitrary identification information returned by a call to
14499  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14500  * the channel to spend the output.
14501  */
14502 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14503
14504 /**
14505  * The value of the channel which this transactions spends.
14506  */
14507 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14508
14509 /**
14510  * The value of the channel which this transactions spends.
14511  */
14512 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
14513
14514 /**
14515  * Constructs a new StaticPaymentOutputDescriptor given each field
14516  */
14517 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);
14518
14519 /**
14520  * Creates a copy of the StaticPaymentOutputDescriptor
14521  */
14522 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
14523
14524 /**
14525  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
14526  */
14527 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
14528
14529 /**
14530  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
14531  */
14532 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
14533
14534 /**
14535  * Frees any resources used by the SpendableOutputDescriptor
14536  */
14537 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
14538
14539 /**
14540  * Creates a copy of the SpendableOutputDescriptor
14541  */
14542 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
14543
14544 /**
14545  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
14546  */
14547 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
14548
14549 /**
14550  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
14551  */
14552 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
14553
14554 /**
14555  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
14556  */
14557 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
14558
14559 /**
14560  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
14561  */
14562 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
14563
14564 /**
14565  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
14566  */
14567 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
14568
14569 /**
14570  * Calls the free function if one is set
14571  */
14572 void BaseSign_free(struct LDKBaseSign this_ptr);
14573
14574 /**
14575  * Creates a copy of a Sign
14576  */
14577 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
14578
14579 /**
14580  * Calls the free function if one is set
14581  */
14582 void Sign_free(struct LDKSign this_ptr);
14583
14584 /**
14585  * Calls the free function if one is set
14586  */
14587 void KeysInterface_free(struct LDKKeysInterface this_ptr);
14588
14589 /**
14590  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
14591  */
14592 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
14593
14594 /**
14595  * Private key of anchor tx
14596  */
14597 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14598
14599 /**
14600  * Private key of anchor tx
14601  */
14602 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
14603
14604 /**
14605  * Holder secret key for blinded revocation pubkey
14606  */
14607 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14608
14609 /**
14610  * Holder secret key for blinded revocation pubkey
14611  */
14612 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
14613
14614 /**
14615  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
14616  */
14617 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14618
14619 /**
14620  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
14621  */
14622 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
14623
14624 /**
14625  * Holder secret key used in HTLC tx
14626  */
14627 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14628
14629 /**
14630  * Holder secret key used in HTLC tx
14631  */
14632 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
14633
14634 /**
14635  * Holder htlc secret key used in commitment tx htlc outputs
14636  */
14637 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14638
14639 /**
14640  * Holder htlc secret key used in commitment tx htlc outputs
14641  */
14642 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
14643
14644 /**
14645  * Commitment seed
14646  */
14647 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
14648
14649 /**
14650  * Commitment seed
14651  */
14652 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14653
14654 /**
14655  * Creates a copy of the InMemorySigner
14656  */
14657 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
14658
14659 /**
14660  * Create a new InMemorySigner
14661  */
14662 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);
14663
14664 /**
14665  * Counterparty pubkeys.
14666  * Will panic if ready_channel wasn't called.
14667  */
14668 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14669
14670 /**
14671  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
14672  * transactions, ie the amount of time that we have to wait to recover our funds if we
14673  * broadcast a transaction.
14674  * Will panic if ready_channel wasn't called.
14675  */
14676 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14677
14678 /**
14679  * The contest_delay value specified by us and applied on transactions broadcastable
14680  * by our counterparty, ie the amount of time that they have to wait to recover their funds
14681  * if they broadcast a transaction.
14682  * Will panic if ready_channel wasn't called.
14683  */
14684 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14685
14686 /**
14687  * Whether the holder is the initiator
14688  * Will panic if ready_channel wasn't called.
14689  */
14690 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14691
14692 /**
14693  * Funding outpoint
14694  * Will panic if ready_channel wasn't called.
14695  */
14696 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14697
14698 /**
14699  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
14700  * building transactions.
14701  *
14702  * Will panic if ready_channel wasn't called.
14703  */
14704 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14705
14706 /**
14707  * Sign the single input of spend_tx at index `input_idx` which spends the output
14708  * described by descriptor, returning the witness stack for the input.
14709  *
14710  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
14711  * or is not spending the outpoint described by `descriptor.outpoint`.
14712  */
14713 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);
14714
14715 /**
14716  * Sign the single input of spend_tx at index `input_idx` which spends the output
14717  * described by descriptor, returning the witness stack for the input.
14718  *
14719  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
14720  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
14721  * sequence set to `descriptor.to_self_delay`.
14722  */
14723 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);
14724
14725 /**
14726  * Constructs a new BaseSign which calls the relevant methods on this_arg.
14727  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
14728  */
14729 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14730
14731 /**
14732  * Constructs a new Sign which calls the relevant methods on this_arg.
14733  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
14734  */
14735 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
14736
14737 /**
14738  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
14739  */
14740 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
14741
14742 /**
14743  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
14744  */
14745 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
14746
14747 /**
14748  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
14749  */
14750 void KeysManager_free(struct LDKKeysManager this_obj);
14751
14752 /**
14753  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
14754  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
14755  * starting_time isn't strictly required to actually be a time, but it must absolutely,
14756  * without a doubt, be unique to this instance. ie if you start multiple times with the same
14757  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
14758  * simply use the current time (with very high precision).
14759  *
14760  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
14761  * obviously, starting_time should be unique every time you reload the library - it is only
14762  * used to generate new ephemeral key data (which will be stored by the individual channel if
14763  * necessary).
14764  *
14765  * Note that the seed is required to recover certain on-chain funds independent of
14766  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
14767  * channel, and some on-chain during-closing funds.
14768  *
14769  * Note that until the 0.1 release there is no guarantee of backward compatibility between
14770  * versions. Once the library is more fully supported, the docs will be updated to include a
14771  * detailed description of the guarantee.
14772  */
14773 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
14774
14775 /**
14776  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
14777  *
14778  * Key derivation parameters are accessible through a per-channel secrets
14779  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
14780  * onchain output detection for which a corresponding delayed_payment_key must be derived.
14781  */
14782 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]);
14783
14784 /**
14785  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
14786  * output to the given change destination (if sufficient change value remains). The
14787  * transaction will have a feerate, at least, of the given value.
14788  *
14789  * Returns `Err(())` if the output value is greater than the input value minus required fee or
14790  * if a descriptor was duplicated.
14791  *
14792  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
14793  *
14794  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
14795  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
14796  */
14797 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);
14798
14799 /**
14800  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
14801  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
14802  */
14803 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
14804
14805 /**
14806  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
14807  */
14808 void ChannelManager_free(struct LDKChannelManager this_obj);
14809
14810 /**
14811  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
14812  */
14813 void ChainParameters_free(struct LDKChainParameters this_obj);
14814
14815 /**
14816  * The network for determining the `chain_hash` in Lightning messages.
14817  */
14818 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
14819
14820 /**
14821  * The network for determining the `chain_hash` in Lightning messages.
14822  */
14823 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
14824
14825 /**
14826  * The hash and height of the latest block successfully connected.
14827  *
14828  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
14829  */
14830 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
14831
14832 /**
14833  * The hash and height of the latest block successfully connected.
14834  *
14835  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
14836  */
14837 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
14838
14839 /**
14840  * Constructs a new ChainParameters given each field
14841  */
14842 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
14843
14844 /**
14845  * Creates a copy of the ChainParameters
14846  */
14847 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
14848
14849 /**
14850  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
14851  */
14852 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
14853
14854 /**
14855  * Base routing fee in millisatoshis.
14856  */
14857 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
14858
14859 /**
14860  * Base routing fee in millisatoshis.
14861  */
14862 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
14863
14864 /**
14865  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
14866  */
14867 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
14868
14869 /**
14870  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
14871  */
14872 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
14873
14874 /**
14875  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
14876  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
14877  * `cltv_expiry_delta` for more details.
14878  */
14879 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
14880
14881 /**
14882  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
14883  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
14884  * `cltv_expiry_delta` for more details.
14885  */
14886 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
14887
14888 /**
14889  * Constructs a new CounterpartyForwardingInfo given each field
14890  */
14891 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);
14892
14893 /**
14894  * Creates a copy of the CounterpartyForwardingInfo
14895  */
14896 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
14897
14898 /**
14899  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
14900  */
14901 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
14902
14903 /**
14904  * The node_id of our counterparty
14905  */
14906 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
14907
14908 /**
14909  * The node_id of our counterparty
14910  */
14911 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14912
14913 /**
14914  * The Features the channel counterparty provided upon last connection.
14915  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
14916  * many routing-relevant features are present in the init context.
14917  */
14918 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
14919
14920 /**
14921  * The Features the channel counterparty provided upon last connection.
14922  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
14923  * many routing-relevant features are present in the init context.
14924  */
14925 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
14926
14927 /**
14928  * The value, in satoshis, that must always be held in the channel for our counterparty. This
14929  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
14930  * claiming at least this value on chain.
14931  *
14932  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
14933  *
14934  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
14935  */
14936 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
14937
14938 /**
14939  * The value, in satoshis, that must always be held in the channel for our counterparty. This
14940  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
14941  * claiming at least this value on chain.
14942  *
14943  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
14944  *
14945  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
14946  */
14947 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
14948
14949 /**
14950  * Information on the fees and requirements that the counterparty requires when forwarding
14951  * payments to us through this channel.
14952  *
14953  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14954  */
14955 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
14956
14957 /**
14958  * Information on the fees and requirements that the counterparty requires when forwarding
14959  * payments to us through this channel.
14960  *
14961  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
14962  */
14963 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
14964
14965 /**
14966  * Constructs a new ChannelCounterparty given each field
14967  */
14968 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);
14969
14970 /**
14971  * Creates a copy of the ChannelCounterparty
14972  */
14973 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
14974
14975 /**
14976  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
14977  */
14978 void ChannelDetails_free(struct LDKChannelDetails this_obj);
14979
14980 /**
14981  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
14982  * thereafter this is the txid of the funding transaction xor the funding transaction output).
14983  * Note that this means this value is *not* persistent - it can change once during the
14984  * lifetime of the channel.
14985  */
14986 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
14987
14988 /**
14989  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
14990  * thereafter this is the txid of the funding transaction xor the funding transaction output).
14991  * Note that this means this value is *not* persistent - it can change once during the
14992  * lifetime of the channel.
14993  */
14994 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14995
14996 /**
14997  * Parameters which apply to our counterparty. See individual fields for more information.
14998  */
14999 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15000
15001 /**
15002  * Parameters which apply to our counterparty. See individual fields for more information.
15003  */
15004 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
15005
15006 /**
15007  * The Channel's funding transaction output, if we've negotiated the funding transaction with
15008  * our counterparty already.
15009  *
15010  * Note that, if this has been set, `channel_id` will be equivalent to
15011  * `funding_txo.unwrap().to_channel_id()`.
15012  *
15013  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
15014  */
15015 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15016
15017 /**
15018  * The Channel's funding transaction output, if we've negotiated the funding transaction with
15019  * our counterparty already.
15020  *
15021  * Note that, if this has been set, `channel_id` will be equivalent to
15022  * `funding_txo.unwrap().to_channel_id()`.
15023  *
15024  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
15025  */
15026 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15027
15028 /**
15029  * The position of the funding transaction in the chain. None if the funding transaction has
15030  * not yet been confirmed and the channel fully opened.
15031  */
15032 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15033
15034 /**
15035  * The position of the funding transaction in the chain. None if the funding transaction has
15036  * not yet been confirmed and the channel fully opened.
15037  */
15038 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15039
15040 /**
15041  * The value, in satoshis, of this channel as appears in the funding output
15042  */
15043 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15044
15045 /**
15046  * The value, in satoshis, of this channel as appears in the funding output
15047  */
15048 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15049
15050 /**
15051  * The value, in satoshis, that must always be held in the channel for us. This value ensures
15052  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
15053  * this value on chain.
15054  *
15055  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
15056  *
15057  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15058  *
15059  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
15060  */
15061 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15062
15063 /**
15064  * The value, in satoshis, that must always be held in the channel for us. This value ensures
15065  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
15066  * this value on chain.
15067  *
15068  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
15069  *
15070  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15071  *
15072  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
15073  */
15074 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15075
15076 /**
15077  * The user_id passed in to create_channel, or 0 if the channel was inbound.
15078  */
15079 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15080
15081 /**
15082  * The user_id passed in to create_channel, or 0 if the channel was inbound.
15083  */
15084 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15085
15086 /**
15087  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
15088  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15089  * available for inclusion in new outbound HTLCs). This further does not include any pending
15090  * outgoing HTLCs which are awaiting some other resolution to be sent.
15091  *
15092  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15093  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
15094  * should be able to spend nearly this amount.
15095  */
15096 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15097
15098 /**
15099  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
15100  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15101  * available for inclusion in new outbound HTLCs). This further does not include any pending
15102  * outgoing HTLCs which are awaiting some other resolution to be sent.
15103  *
15104  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15105  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
15106  * should be able to spend nearly this amount.
15107  */
15108 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15109
15110 /**
15111  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
15112  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15113  * available for inclusion in new inbound HTLCs).
15114  * Note that there are some corner cases not fully handled here, so the actual available
15115  * inbound capacity may be slightly higher than this.
15116  *
15117  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15118  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
15119  * However, our counterparty should be able to spend nearly this amount.
15120  */
15121 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15122
15123 /**
15124  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
15125  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15126  * available for inclusion in new inbound HTLCs).
15127  * Note that there are some corner cases not fully handled here, so the actual available
15128  * inbound capacity may be slightly higher than this.
15129  *
15130  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15131  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
15132  * However, our counterparty should be able to spend nearly this amount.
15133  */
15134 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15135
15136 /**
15137  * The number of required confirmations on the funding transaction before the funding will be
15138  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
15139  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
15140  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
15141  * [`ChannelHandshakeLimits::max_minimum_depth`].
15142  *
15143  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15144  *
15145  * [`is_outbound`]: ChannelDetails::is_outbound
15146  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
15147  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
15148  */
15149 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15150
15151 /**
15152  * The number of required confirmations on the funding transaction before the funding will be
15153  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
15154  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
15155  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
15156  * [`ChannelHandshakeLimits::max_minimum_depth`].
15157  *
15158  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15159  *
15160  * [`is_outbound`]: ChannelDetails::is_outbound
15161  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
15162  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
15163  */
15164 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
15165
15166 /**
15167  * The number of blocks (after our commitment transaction confirms) that we will need to wait
15168  * until we can claim our funds after we force-close the channel. During this time our
15169  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
15170  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
15171  * time to claim our non-HTLC-encumbered funds.
15172  *
15173  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15174  */
15175 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15176
15177 /**
15178  * The number of blocks (after our commitment transaction confirms) that we will need to wait
15179  * until we can claim our funds after we force-close the channel. During this time our
15180  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
15181  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
15182  * time to claim our non-HTLC-encumbered funds.
15183  *
15184  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15185  */
15186 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
15187
15188 /**
15189  * True if the channel was initiated (and thus funded) by us.
15190  */
15191 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15192
15193 /**
15194  * True if the channel was initiated (and thus funded) by us.
15195  */
15196 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15197
15198 /**
15199  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
15200  * channel is not currently being shut down. `funding_locked` message exchange implies the
15201  * required confirmation count has been reached (and we were connected to the peer at some
15202  * point after the funding transaction received enough confirmations). The required
15203  * confirmation count is provided in [`confirmations_required`].
15204  *
15205  * [`confirmations_required`]: ChannelDetails::confirmations_required
15206  */
15207 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15208
15209 /**
15210  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
15211  * channel is not currently being shut down. `funding_locked` message exchange implies the
15212  * required confirmation count has been reached (and we were connected to the peer at some
15213  * point after the funding transaction received enough confirmations). The required
15214  * confirmation count is provided in [`confirmations_required`].
15215  *
15216  * [`confirmations_required`]: ChannelDetails::confirmations_required
15217  */
15218 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15219
15220 /**
15221  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
15222  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
15223  *
15224  * This is a strict superset of `is_funding_locked`.
15225  */
15226 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15227
15228 /**
15229  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
15230  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
15231  *
15232  * This is a strict superset of `is_funding_locked`.
15233  */
15234 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15235
15236 /**
15237  * True if this channel is (or will be) publicly-announced.
15238  */
15239 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15240
15241 /**
15242  * True if this channel is (or will be) publicly-announced.
15243  */
15244 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15245
15246 /**
15247  * Constructs a new ChannelDetails given each field
15248  */
15249 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
15250
15251 /**
15252  * Creates a copy of the ChannelDetails
15253  */
15254 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
15255
15256 /**
15257  * Frees any resources used by the PaymentSendFailure
15258  */
15259 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
15260
15261 /**
15262  * Creates a copy of the PaymentSendFailure
15263  */
15264 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
15265
15266 /**
15267  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
15268  */
15269 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
15270
15271 /**
15272  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
15273  */
15274 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
15275
15276 /**
15277  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
15278  */
15279 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
15280
15281 /**
15282  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
15283  */
15284 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a);
15285
15286 /**
15287  * Constructs a new ChannelManager to hold several channels and route between them.
15288  *
15289  * This is the main \"logic hub\" for all channel-related actions, and implements
15290  * ChannelMessageHandler.
15291  *
15292  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
15293  *
15294  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
15295  *
15296  * Users need to notify the new ChannelManager when a new block is connected or
15297  * disconnected using its `block_connected` and `block_disconnected` methods, starting
15298  * from after `params.latest_hash`.
15299  */
15300 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);
15301
15302 /**
15303  * Gets the current configuration applied to all new channels,  as
15304  */
15305 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
15306
15307 /**
15308  * Creates a new outbound channel to the given remote node and with the given value.
15309  *
15310  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
15311  * tracking of which events correspond with which create_channel call. Note that the
15312  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
15313  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
15314  * otherwise ignored.
15315  *
15316  * If successful, will generate a SendOpenChannel message event, so you should probably poll
15317  * PeerManager::process_events afterwards.
15318  *
15319  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
15320  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
15321  *
15322  * Note that we do not check if you are currently connected to the given peer. If no
15323  * connection is available, the outbound `open_channel` message may fail to send, resulting in
15324  * the channel eventually being silently forgotten.
15325  *
15326  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
15327  */
15328 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
15329
15330 /**
15331  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
15332  * more information.
15333  */
15334 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15335
15336 /**
15337  * Gets the list of usable channels, in random order. Useful as an argument to
15338  * get_route to ensure non-announced channels are used.
15339  *
15340  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
15341  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
15342  * are.
15343  */
15344 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15345
15346 /**
15347  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
15348  * will be accepted on the given channel, and after additional timeout/the closing of all
15349  * pending HTLCs, the channel will be closed on chain.
15350  *
15351  *  * If we are the channel initiator, we will pay between our [`Background`] and
15352  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
15353  *    estimate.
15354  *  * If our counterparty is the channel initiator, we will require a channel closing
15355  *    transaction feerate of at least our [`Background`] feerate or the feerate which
15356  *    would appear on a force-closure transaction, whichever is lower. We will allow our
15357  *    counterparty to pay as much fee as they'd like, however.
15358  *
15359  * May generate a SendShutdown message event on success, which should be relayed.
15360  *
15361  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
15362  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15363  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15364  */
15365 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
15366
15367 /**
15368  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
15369  * will be accepted on the given channel, and after additional timeout/the closing of all
15370  * pending HTLCs, the channel will be closed on chain.
15371  *
15372  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
15373  * the channel being closed or not:
15374  *  * If we are the channel initiator, we will pay at least this feerate on the closing
15375  *    transaction. The upper-bound is set by
15376  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
15377  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
15378  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
15379  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
15380  *    will appear on a force-closure transaction, whichever is lower).
15381  *
15382  * May generate a SendShutdown message event on success, which should be relayed.
15383  *
15384  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
15385  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15386  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15387  */
15388 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);
15389
15390 /**
15391  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
15392  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
15393  */
15394 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
15395
15396 /**
15397  * Force close all channels, immediately broadcasting the latest local commitment transaction
15398  * for each to the chain and rejecting new HTLCs on each.
15399  */
15400 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15401
15402 /**
15403  * Sends a payment along a given route.
15404  *
15405  * Value parameters are provided via the last hop in route, see documentation for RouteHop
15406  * fields for more info.
15407  *
15408  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
15409  * payment), we don't do anything to stop you! We always try to ensure that if the provided
15410  * next hop knows the preimage to payment_hash they can claim an additional amount as
15411  * specified in the last hop in the route! Thus, you should probably do your own
15412  * payment_preimage tracking (which you should already be doing as they represent \"proof of
15413  * payment\") and prevent double-sends yourself.
15414  *
15415  * May generate SendHTLCs message(s) event on success, which should be relayed.
15416  *
15417  * Each path may have a different return value, and PaymentSendValue may return a Vec with
15418  * each entry matching the corresponding-index entry in the route paths, see
15419  * PaymentSendFailure for more info.
15420  *
15421  * In general, a path may raise:
15422  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
15423  *    node public key) is specified.
15424  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
15425  *    (including due to previous monitor update failure or new permanent monitor update
15426  *    failure).
15427  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
15428  *    relevant updates.
15429  *
15430  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
15431  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
15432  * different route unless you intend to pay twice!
15433  *
15434  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
15435  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
15436  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
15437  * must not contain multiple paths as multi-path payments require a recipient-provided
15438  * payment_secret.
15439  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
15440  * bit set (either as required or as available). If multiple paths are present in the Route,
15441  * we assume the invoice had the basic_mpp feature set.
15442  *
15443  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
15444  */
15445 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
15446
15447 /**
15448  * Send a spontaneous payment, which is a payment that does not require the recipient to have
15449  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
15450  * the preimage, it must be a cryptographically secure random value that no intermediate node
15451  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
15452  * never reach the recipient.
15453  *
15454  * See [`send_payment`] documentation for more details on the return value of this function.
15455  *
15456  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
15457  * [`send_payment`] for more information about the risks of duplicate preimage usage.
15458  *
15459  * Note that `route` must have exactly one path.
15460  *
15461  * [`send_payment`]: Self::send_payment
15462  *
15463  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
15464  */
15465 MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
15466
15467 /**
15468  * Call this upon creation of a funding transaction for the given channel.
15469  *
15470  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
15471  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
15472  *
15473  * Panics if a funding transaction has already been provided for this channel.
15474  *
15475  * May panic if the output found in the funding transaction is duplicative with some other
15476  * channel (note that this should be trivially prevented by using unique funding transaction
15477  * keys per-channel).
15478  *
15479  * Do NOT broadcast the funding transaction yourself. When we have safely received our
15480  * counterparty's signature the funding transaction will automatically be broadcast via the
15481  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
15482  *
15483  * Note that this includes RBF or similar transaction replacement strategies - lightning does
15484  * not currently support replacing a funding transaction on an existing channel. Instead,
15485  * create a new channel with a conflicting funding transaction.
15486  *
15487  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
15488  */
15489 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);
15490
15491 /**
15492  * Regenerates channel_announcements and generates a signed node_announcement from the given
15493  * arguments, providing them in corresponding events via
15494  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
15495  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
15496  * announcement to ensure that the lightning P2P network is aware of the channels we have and
15497  * our network addresses.
15498  *
15499  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
15500  * node to humans. They carry no in-protocol meaning.
15501  *
15502  * `addresses` represent the set (possibly empty) of socket addresses on which this node
15503  * accepts incoming connections. These will be included in the node_announcement, publicly
15504  * tying these addresses together and to this node. If you wish to preserve user privacy,
15505  * addresses should likely contain only Tor Onion addresses.
15506  *
15507  * Panics if `addresses` is absurdly large (more than 500).
15508  *
15509  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
15510  */
15511 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
15512
15513 /**
15514  * Processes HTLCs which are pending waiting on random forward delay.
15515  *
15516  * Should only really ever be called in response to a PendingHTLCsForwardable event.
15517  * Will likely generate further events.
15518  */
15519 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
15520
15521 /**
15522  * Performs actions which should happen on startup and roughly once per minute thereafter.
15523  *
15524  * This currently includes:
15525  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
15526  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
15527  *    than a minute, informing the network that they should no longer attempt to route over
15528  *    the channel.
15529  *
15530  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
15531  * estimate fetches.
15532  */
15533 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
15534
15535 /**
15536  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
15537  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
15538  * along the path (including in our own channel on which we received it).
15539  * Returns false if no payment was found to fail backwards, true if the process of failing the
15540  * HTLC backwards has been started.
15541  */
15542 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
15543
15544 /**
15545  * Provides a payment preimage in response to a PaymentReceived event, returning true and
15546  * generating message events for the net layer to claim the payment, if possible. Thus, you
15547  * should probably kick the net layer to go send messages if this returns true!
15548  *
15549  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
15550  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
15551  * event matches your expectation. If you fail to do so and call this method, you may provide
15552  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
15553  *
15554  * May panic if called except in response to a PaymentReceived event.
15555  *
15556  * [`create_inbound_payment`]: Self::create_inbound_payment
15557  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
15558  */
15559 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
15560
15561 /**
15562  * Gets the node_id held by this ChannelManager
15563  */
15564 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
15565
15566 /**
15567  * Restores a single, given channel to normal operation after a
15568  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
15569  * operation.
15570  *
15571  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
15572  * fully committed in every copy of the given channels' ChannelMonitors.
15573  *
15574  * Note that there is no effect to calling with a highest_applied_update_id other than the
15575  * current latest ChannelMonitorUpdate and one call to this function after multiple
15576  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
15577  * exists largely only to prevent races between this and concurrent update_monitor calls.
15578  *
15579  * Thus, the anticipated use is, at a high level:
15580  *  1) You register a chain::Watch with this ChannelManager,
15581  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
15582  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
15583  *     any time it cannot do so instantly,
15584  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
15585  *  4) once all remote copies are updated, you call this function with the update_id that
15586  *     completed, and once it is the latest the Channel will be re-enabled.
15587  */
15588 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
15589
15590 /**
15591  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
15592  * to pay us.
15593  *
15594  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
15595  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
15596  *
15597  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
15598  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
15599  * passed directly to [`claim_funds`].
15600  *
15601  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
15602  *
15603  * [`claim_funds`]: Self::claim_funds
15604  * [`PaymentReceived`]: events::Event::PaymentReceived
15605  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
15606  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
15607  */
15608 MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
15609
15610 /**
15611  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
15612  * stored external to LDK.
15613  *
15614  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
15615  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
15616  * the `min_value_msat` provided here, if one is provided.
15617  *
15618  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
15619  * method may return an Err if another payment with the same payment_hash is still pending.
15620  *
15621  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
15622  * allow tracking of which events correspond with which calls to this and
15623  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
15624  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
15625  * with invoice metadata stored elsewhere.
15626  *
15627  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
15628  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
15629  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
15630  * sender \"proof-of-payment\" unless they have paid the required amount.
15631  *
15632  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
15633  * in excess of the current time. This should roughly match the expiry time set in the invoice.
15634  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
15635  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
15636  * invoices when no timeout is set.
15637  *
15638  * Note that we use block header time to time-out pending inbound payments (with some margin
15639  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
15640  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
15641  * If you need exact expiry semantics, you should enforce them upon receipt of
15642  * [`PaymentReceived`].
15643  *
15644  * Pending inbound payments are stored in memory and in serialized versions of this
15645  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
15646  * space is limited, you may wish to rate-limit inbound payment creation.
15647  *
15648  * May panic if `invoice_expiry_delta_secs` is greater than one year.
15649  *
15650  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
15651  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
15652  *
15653  * [`create_inbound_payment`]: Self::create_inbound_payment
15654  * [`PaymentReceived`]: events::Event::PaymentReceived
15655  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
15656  */
15657 MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
15658
15659 /**
15660  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15661  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15662  */
15663 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
15664
15665 /**
15666  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
15667  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
15668  */
15669 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
15670
15671 /**
15672  * Constructs a new Listen which calls the relevant methods on this_arg.
15673  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
15674  */
15675 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
15676
15677 /**
15678  * Constructs a new Confirm which calls the relevant methods on this_arg.
15679  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
15680  */
15681 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
15682
15683 /**
15684  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
15685  * indicating whether persistence is necessary. Only one listener on
15686  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
15687  * up.
15688  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
15689  */
15690 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
15691
15692 /**
15693  * Blocks until ChannelManager needs to be persisted. Only one listener on
15694  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
15695  * up.
15696  */
15697 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
15698
15699 /**
15700  * Gets the latest best block which was connected either via the [`chain::Listen`] or
15701  * [`chain::Confirm`] interfaces.
15702  */
15703 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
15704
15705 /**
15706  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15707  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15708  */
15709 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
15710
15711 /**
15712  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
15713  */
15714 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
15715
15716 /**
15717  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
15718  */
15719 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
15720
15721 /**
15722  * The keys provider which will give us relevant keys. Some keys will be loaded during
15723  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
15724  * signing data.
15725  */
15726 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15727
15728 /**
15729  * The keys provider which will give us relevant keys. Some keys will be loaded during
15730  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
15731  * signing data.
15732  */
15733 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
15734
15735 /**
15736  * The fee_estimator for use in the ChannelManager in the future.
15737  *
15738  * No calls to the FeeEstimator will be made during deserialization.
15739  */
15740 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15741
15742 /**
15743  * The fee_estimator for use in the ChannelManager in the future.
15744  *
15745  * No calls to the FeeEstimator will be made during deserialization.
15746  */
15747 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
15748
15749 /**
15750  * The chain::Watch for use in the ChannelManager in the future.
15751  *
15752  * No calls to the chain::Watch will be made during deserialization. It is assumed that
15753  * you have deserialized ChannelMonitors separately and will add them to your
15754  * chain::Watch after deserializing this ChannelManager.
15755  */
15756 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15757
15758 /**
15759  * The chain::Watch for use in the ChannelManager in the future.
15760  *
15761  * No calls to the chain::Watch will be made during deserialization. It is assumed that
15762  * you have deserialized ChannelMonitors separately and will add them to your
15763  * chain::Watch after deserializing this ChannelManager.
15764  */
15765 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
15766
15767 /**
15768  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
15769  * used to broadcast the latest local commitment transactions of channels which must be
15770  * force-closed during deserialization.
15771  */
15772 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15773
15774 /**
15775  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
15776  * used to broadcast the latest local commitment transactions of channels which must be
15777  * force-closed during deserialization.
15778  */
15779 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
15780
15781 /**
15782  * The Logger for use in the ChannelManager and which may be used to log information during
15783  * deserialization.
15784  */
15785 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15786
15787 /**
15788  * The Logger for use in the ChannelManager and which may be used to log information during
15789  * deserialization.
15790  */
15791 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
15792
15793 /**
15794  * Default settings used for new channels. Any existing channels will continue to use the
15795  * runtime settings which were stored when the ChannelManager was serialized.
15796  */
15797 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
15798
15799 /**
15800  * Default settings used for new channels. Any existing channels will continue to use the
15801  * runtime settings which were stored when the ChannelManager was serialized.
15802  */
15803 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
15804
15805 /**
15806  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
15807  * HashMap for you. This is primarily useful for C bindings where it is not practical to
15808  * populate a HashMap directly from C.
15809  */
15810 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);
15811
15812 /**
15813  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
15814  */
15815 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
15816
15817 /**
15818  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
15819  */
15820 void DecodeError_free(struct LDKDecodeError this_obj);
15821
15822 /**
15823  * Creates a copy of the DecodeError
15824  */
15825 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
15826
15827 /**
15828  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
15829  */
15830 void Init_free(struct LDKInit this_obj);
15831
15832 /**
15833  * The relevant features which the sender supports
15834  */
15835 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
15836
15837 /**
15838  * The relevant features which the sender supports
15839  */
15840 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
15841
15842 /**
15843  * Constructs a new Init given each field
15844  */
15845 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
15846
15847 /**
15848  * Creates a copy of the Init
15849  */
15850 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
15851
15852 /**
15853  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
15854  */
15855 void ErrorMessage_free(struct LDKErrorMessage this_obj);
15856
15857 /**
15858  * The channel ID involved in the error
15859  */
15860 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
15861
15862 /**
15863  * The channel ID involved in the error
15864  */
15865 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15866
15867 /**
15868  * A possibly human-readable error description.
15869  * The string should be sanitized before it is used (e.g. emitted to logs
15870  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
15871  * vulnerability in the terminal emulator or the logging subsystem.
15872  */
15873 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
15874
15875 /**
15876  * A possibly human-readable error description.
15877  * The string should be sanitized before it is used (e.g. emitted to logs
15878  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
15879  * vulnerability in the terminal emulator or the logging subsystem.
15880  */
15881 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
15882
15883 /**
15884  * Constructs a new ErrorMessage given each field
15885  */
15886 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
15887
15888 /**
15889  * Creates a copy of the ErrorMessage
15890  */
15891 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
15892
15893 /**
15894  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
15895  */
15896 void Ping_free(struct LDKPing this_obj);
15897
15898 /**
15899  * The desired response length
15900  */
15901 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
15902
15903 /**
15904  * The desired response length
15905  */
15906 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
15907
15908 /**
15909  * The ping packet size.
15910  * This field is not sent on the wire. byteslen zeros are sent.
15911  */
15912 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
15913
15914 /**
15915  * The ping packet size.
15916  * This field is not sent on the wire. byteslen zeros are sent.
15917  */
15918 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
15919
15920 /**
15921  * Constructs a new Ping given each field
15922  */
15923 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
15924
15925 /**
15926  * Creates a copy of the Ping
15927  */
15928 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
15929
15930 /**
15931  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
15932  */
15933 void Pong_free(struct LDKPong this_obj);
15934
15935 /**
15936  * The pong packet size.
15937  * This field is not sent on the wire. byteslen zeros are sent.
15938  */
15939 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
15940
15941 /**
15942  * The pong packet size.
15943  * This field is not sent on the wire. byteslen zeros are sent.
15944  */
15945 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
15946
15947 /**
15948  * Constructs a new Pong given each field
15949  */
15950 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
15951
15952 /**
15953  * Creates a copy of the Pong
15954  */
15955 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
15956
15957 /**
15958  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
15959  */
15960 void OpenChannel_free(struct LDKOpenChannel this_obj);
15961
15962 /**
15963  * The genesis hash of the blockchain where the channel is to be opened
15964  */
15965 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
15966
15967 /**
15968  * The genesis hash of the blockchain where the channel is to be opened
15969  */
15970 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15971
15972 /**
15973  * A temporary channel ID, until the funding outpoint is announced
15974  */
15975 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
15976
15977 /**
15978  * A temporary channel ID, until the funding outpoint is announced
15979  */
15980 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15981
15982 /**
15983  * The channel value
15984  */
15985 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15986
15987 /**
15988  * The channel value
15989  */
15990 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15991
15992 /**
15993  * The amount to push to the counterparty as part of the open, in milli-satoshi
15994  */
15995 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15996
15997 /**
15998  * The amount to push to the counterparty as part of the open, in milli-satoshi
15999  */
16000 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16001
16002 /**
16003  * The threshold below which outputs on transactions broadcast by sender will be omitted
16004  */
16005 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16006
16007 /**
16008  * The threshold below which outputs on transactions broadcast by sender will be omitted
16009  */
16010 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16011
16012 /**
16013  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16014  */
16015 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16016
16017 /**
16018  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16019  */
16020 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16021
16022 /**
16023  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16024  */
16025 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16026
16027 /**
16028  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16029  */
16030 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16031
16032 /**
16033  * The minimum HTLC size incoming to sender, in milli-satoshi
16034  */
16035 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16036
16037 /**
16038  * The minimum HTLC size incoming to sender, in milli-satoshi
16039  */
16040 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16041
16042 /**
16043  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
16044  */
16045 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16046
16047 /**
16048  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
16049  */
16050 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
16051
16052 /**
16053  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16054  */
16055 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16056
16057 /**
16058  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16059  */
16060 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
16061
16062 /**
16063  * The maximum number of inbound HTLCs towards sender
16064  */
16065 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16066
16067 /**
16068  * The maximum number of inbound HTLCs towards sender
16069  */
16070 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
16071
16072 /**
16073  * The sender's key controlling the funding transaction
16074  */
16075 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16076
16077 /**
16078  * The sender's key controlling the funding transaction
16079  */
16080 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16081
16082 /**
16083  * Used to derive a revocation key for transactions broadcast by counterparty
16084  */
16085 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16086
16087 /**
16088  * Used to derive a revocation key for transactions broadcast by counterparty
16089  */
16090 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16091
16092 /**
16093  * A payment key to sender for transactions broadcast by counterparty
16094  */
16095 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16096
16097 /**
16098  * A payment key to sender for transactions broadcast by counterparty
16099  */
16100 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16101
16102 /**
16103  * Used to derive a payment key to sender for transactions broadcast by sender
16104  */
16105 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16106
16107 /**
16108  * Used to derive a payment key to sender for transactions broadcast by sender
16109  */
16110 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16111
16112 /**
16113  * Used to derive an HTLC payment key to sender
16114  */
16115 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16116
16117 /**
16118  * Used to derive an HTLC payment key to sender
16119  */
16120 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16121
16122 /**
16123  * The first to-be-broadcast-by-sender transaction's per commitment point
16124  */
16125 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16126
16127 /**
16128  * The first to-be-broadcast-by-sender transaction's per commitment point
16129  */
16130 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16131
16132 /**
16133  * Channel flags
16134  */
16135 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16136
16137 /**
16138  * Channel flags
16139  */
16140 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
16141
16142 /**
16143  * Creates a copy of the OpenChannel
16144  */
16145 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
16146
16147 /**
16148  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
16149  */
16150 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
16151
16152 /**
16153  * A temporary channel ID, until the funding outpoint is announced
16154  */
16155 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
16156
16157 /**
16158  * A temporary channel ID, until the funding outpoint is announced
16159  */
16160 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16161
16162 /**
16163  * The threshold below which outputs on transactions broadcast by sender will be omitted
16164  */
16165 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16166
16167 /**
16168  * The threshold below which outputs on transactions broadcast by sender will be omitted
16169  */
16170 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16171
16172 /**
16173  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16174  */
16175 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16176
16177 /**
16178  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16179  */
16180 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16181
16182 /**
16183  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16184  */
16185 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16186
16187 /**
16188  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16189  */
16190 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16191
16192 /**
16193  * The minimum HTLC size incoming to sender, in milli-satoshi
16194  */
16195 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16196
16197 /**
16198  * The minimum HTLC size incoming to sender, in milli-satoshi
16199  */
16200 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16201
16202 /**
16203  * Minimum depth of the funding transaction before the channel is considered open
16204  */
16205 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16206
16207 /**
16208  * Minimum depth of the funding transaction before the channel is considered open
16209  */
16210 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
16211
16212 /**
16213  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16214  */
16215 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16216
16217 /**
16218  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16219  */
16220 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
16221
16222 /**
16223  * The maximum number of inbound HTLCs towards sender
16224  */
16225 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16226
16227 /**
16228  * The maximum number of inbound HTLCs towards sender
16229  */
16230 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
16231
16232 /**
16233  * The sender's key controlling the funding transaction
16234  */
16235 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16236
16237 /**
16238  * The sender's key controlling the funding transaction
16239  */
16240 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16241
16242 /**
16243  * Used to derive a revocation key for transactions broadcast by counterparty
16244  */
16245 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16246
16247 /**
16248  * Used to derive a revocation key for transactions broadcast by counterparty
16249  */
16250 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16251
16252 /**
16253  * A payment key to sender for transactions broadcast by counterparty
16254  */
16255 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16256
16257 /**
16258  * A payment key to sender for transactions broadcast by counterparty
16259  */
16260 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16261
16262 /**
16263  * Used to derive a payment key to sender for transactions broadcast by sender
16264  */
16265 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16266
16267 /**
16268  * Used to derive a payment key to sender for transactions broadcast by sender
16269  */
16270 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16271
16272 /**
16273  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
16274  */
16275 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16276
16277 /**
16278  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
16279  */
16280 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16281
16282 /**
16283  * The first to-be-broadcast-by-sender transaction's per commitment point
16284  */
16285 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16286
16287 /**
16288  * The first to-be-broadcast-by-sender transaction's per commitment point
16289  */
16290 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16291
16292 /**
16293  * Creates a copy of the AcceptChannel
16294  */
16295 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
16296
16297 /**
16298  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
16299  */
16300 void FundingCreated_free(struct LDKFundingCreated this_obj);
16301
16302 /**
16303  * A temporary channel ID, until the funding is established
16304  */
16305 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
16306
16307 /**
16308  * A temporary channel ID, until the funding is established
16309  */
16310 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16311
16312 /**
16313  * The funding transaction ID
16314  */
16315 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
16316
16317 /**
16318  * The funding transaction ID
16319  */
16320 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16321
16322 /**
16323  * The specific output index funding this channel
16324  */
16325 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
16326
16327 /**
16328  * The specific output index funding this channel
16329  */
16330 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
16331
16332 /**
16333  * The signature of the channel initiator (funder) on the initial commitment transaction
16334  */
16335 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
16336
16337 /**
16338  * The signature of the channel initiator (funder) on the initial commitment transaction
16339  */
16340 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
16341
16342 /**
16343  * Constructs a new FundingCreated given each field
16344  */
16345 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);
16346
16347 /**
16348  * Creates a copy of the FundingCreated
16349  */
16350 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
16351
16352 /**
16353  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
16354  */
16355 void FundingSigned_free(struct LDKFundingSigned this_obj);
16356
16357 /**
16358  * The channel ID
16359  */
16360 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
16361
16362 /**
16363  * The channel ID
16364  */
16365 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16366
16367 /**
16368  * The signature of the channel acceptor (fundee) on the initial commitment transaction
16369  */
16370 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
16371
16372 /**
16373  * The signature of the channel acceptor (fundee) on the initial commitment transaction
16374  */
16375 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
16376
16377 /**
16378  * Constructs a new FundingSigned given each field
16379  */
16380 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
16381
16382 /**
16383  * Creates a copy of the FundingSigned
16384  */
16385 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
16386
16387 /**
16388  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
16389  */
16390 void FundingLocked_free(struct LDKFundingLocked this_obj);
16391
16392 /**
16393  * The channel ID
16394  */
16395 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
16396
16397 /**
16398  * The channel ID
16399  */
16400 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16401
16402 /**
16403  * The per-commitment point of the second commitment transaction
16404  */
16405 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
16406
16407 /**
16408  * The per-commitment point of the second commitment transaction
16409  */
16410 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16411
16412 /**
16413  * Constructs a new FundingLocked given each field
16414  */
16415 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
16416
16417 /**
16418  * Creates a copy of the FundingLocked
16419  */
16420 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
16421
16422 /**
16423  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
16424  */
16425 void Shutdown_free(struct LDKShutdown this_obj);
16426
16427 /**
16428  * The channel ID
16429  */
16430 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
16431
16432 /**
16433  * The channel ID
16434  */
16435 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16436
16437 /**
16438  * The destination of this peer's funds on closing.
16439  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
16440  */
16441 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
16442
16443 /**
16444  * The destination of this peer's funds on closing.
16445  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
16446  */
16447 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
16448
16449 /**
16450  * Constructs a new Shutdown given each field
16451  */
16452 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
16453
16454 /**
16455  * Creates a copy of the Shutdown
16456  */
16457 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
16458
16459 /**
16460  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
16461  */
16462 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
16463
16464 /**
16465  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
16466  * transaction.
16467  */
16468 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
16469
16470 /**
16471  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
16472  * transaction.
16473  */
16474 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
16475
16476 /**
16477  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
16478  * transaction.
16479  */
16480 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
16481
16482 /**
16483  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
16484  * transaction.
16485  */
16486 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
16487
16488 /**
16489  * Constructs a new ClosingSignedFeeRange given each field
16490  */
16491 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
16492
16493 /**
16494  * Creates a copy of the ClosingSignedFeeRange
16495  */
16496 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
16497
16498 /**
16499  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
16500  */
16501 void ClosingSigned_free(struct LDKClosingSigned this_obj);
16502
16503 /**
16504  * The channel ID
16505  */
16506 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
16507
16508 /**
16509  * The channel ID
16510  */
16511 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16512
16513 /**
16514  * The proposed total fee for the closing transaction
16515  */
16516 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
16517
16518 /**
16519  * The proposed total fee for the closing transaction
16520  */
16521 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
16522
16523 /**
16524  * A signature on the closing transaction
16525  */
16526 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
16527
16528 /**
16529  * A signature on the closing transaction
16530  */
16531 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
16532
16533 /**
16534  * The minimum and maximum fees which the sender is willing to accept, provided only by new
16535  * nodes.
16536  *
16537  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16538  */
16539 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
16540
16541 /**
16542  * The minimum and maximum fees which the sender is willing to accept, provided only by new
16543  * nodes.
16544  *
16545  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16546  */
16547 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
16548
16549 /**
16550  * Constructs a new ClosingSigned given each field
16551  */
16552 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);
16553
16554 /**
16555  * Creates a copy of the ClosingSigned
16556  */
16557 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
16558
16559 /**
16560  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
16561  */
16562 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
16563
16564 /**
16565  * The channel ID
16566  */
16567 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
16568
16569 /**
16570  * The channel ID
16571  */
16572 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16573
16574 /**
16575  * The HTLC ID
16576  */
16577 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
16578
16579 /**
16580  * The HTLC ID
16581  */
16582 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
16583
16584 /**
16585  * The HTLC value in milli-satoshi
16586  */
16587 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
16588
16589 /**
16590  * The HTLC value in milli-satoshi
16591  */
16592 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
16593
16594 /**
16595  * The payment hash, the pre-image of which controls HTLC redemption
16596  */
16597 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
16598
16599 /**
16600  * The payment hash, the pre-image of which controls HTLC redemption
16601  */
16602 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16603
16604 /**
16605  * The expiry height of the HTLC
16606  */
16607 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
16608
16609 /**
16610  * The expiry height of the HTLC
16611  */
16612 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
16613
16614 /**
16615  * Creates a copy of the UpdateAddHTLC
16616  */
16617 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
16618
16619 /**
16620  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
16621  */
16622 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
16623
16624 /**
16625  * The channel ID
16626  */
16627 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
16628
16629 /**
16630  * The channel ID
16631  */
16632 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16633
16634 /**
16635  * The HTLC ID
16636  */
16637 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
16638
16639 /**
16640  * The HTLC ID
16641  */
16642 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
16643
16644 /**
16645  * The pre-image of the payment hash, allowing HTLC redemption
16646  */
16647 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
16648
16649 /**
16650  * The pre-image of the payment hash, allowing HTLC redemption
16651  */
16652 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16653
16654 /**
16655  * Constructs a new UpdateFulfillHTLC given each field
16656  */
16657 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
16658
16659 /**
16660  * Creates a copy of the UpdateFulfillHTLC
16661  */
16662 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
16663
16664 /**
16665  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
16666  */
16667 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
16668
16669 /**
16670  * The channel ID
16671  */
16672 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
16673
16674 /**
16675  * The channel ID
16676  */
16677 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16678
16679 /**
16680  * The HTLC ID
16681  */
16682 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
16683
16684 /**
16685  * The HTLC ID
16686  */
16687 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
16688
16689 /**
16690  * Creates a copy of the UpdateFailHTLC
16691  */
16692 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
16693
16694 /**
16695  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
16696  */
16697 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
16698
16699 /**
16700  * The channel ID
16701  */
16702 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
16703
16704 /**
16705  * The channel ID
16706  */
16707 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16708
16709 /**
16710  * The HTLC ID
16711  */
16712 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
16713
16714 /**
16715  * The HTLC ID
16716  */
16717 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
16718
16719 /**
16720  * The failure code
16721  */
16722 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
16723
16724 /**
16725  * The failure code
16726  */
16727 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
16728
16729 /**
16730  * Creates a copy of the UpdateFailMalformedHTLC
16731  */
16732 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
16733
16734 /**
16735  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
16736  */
16737 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
16738
16739 /**
16740  * The channel ID
16741  */
16742 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
16743
16744 /**
16745  * The channel ID
16746  */
16747 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16748
16749 /**
16750  * A signature on the commitment transaction
16751  */
16752 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
16753
16754 /**
16755  * A signature on the commitment transaction
16756  */
16757 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
16758
16759 /**
16760  * Signatures on the HTLC transactions
16761  */
16762 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16763
16764 /**
16765  * Constructs a new CommitmentSigned given each field
16766  */
16767 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
16768
16769 /**
16770  * Creates a copy of the CommitmentSigned
16771  */
16772 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
16773
16774 /**
16775  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
16776  */
16777 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
16778
16779 /**
16780  * The channel ID
16781  */
16782 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
16783
16784 /**
16785  * The channel ID
16786  */
16787 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16788
16789 /**
16790  * The secret corresponding to the per-commitment point
16791  */
16792 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
16793
16794 /**
16795  * The secret corresponding to the per-commitment point
16796  */
16797 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16798
16799 /**
16800  * The next sender-broadcast commitment transaction's per-commitment point
16801  */
16802 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
16803
16804 /**
16805  * The next sender-broadcast commitment transaction's per-commitment point
16806  */
16807 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16808
16809 /**
16810  * Constructs a new RevokeAndACK given each field
16811  */
16812 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);
16813
16814 /**
16815  * Creates a copy of the RevokeAndACK
16816  */
16817 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
16818
16819 /**
16820  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
16821  */
16822 void UpdateFee_free(struct LDKUpdateFee this_obj);
16823
16824 /**
16825  * The channel ID
16826  */
16827 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
16828
16829 /**
16830  * The channel ID
16831  */
16832 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16833
16834 /**
16835  * Fee rate per 1000-weight of the transaction
16836  */
16837 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
16838
16839 /**
16840  * Fee rate per 1000-weight of the transaction
16841  */
16842 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
16843
16844 /**
16845  * Constructs a new UpdateFee given each field
16846  */
16847 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
16848
16849 /**
16850  * Creates a copy of the UpdateFee
16851  */
16852 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
16853
16854 /**
16855  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
16856  */
16857 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
16858
16859 /**
16860  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
16861  * belonging to the recipient
16862  */
16863 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
16864
16865 /**
16866  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
16867  * belonging to the recipient
16868  */
16869 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16870
16871 /**
16872  * The sender's per-commitment point for their current commitment transaction
16873  */
16874 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
16875
16876 /**
16877  * The sender's per-commitment point for their current commitment transaction
16878  */
16879 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16880
16881 /**
16882  * Constructs a new DataLossProtect given each field
16883  */
16884 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
16885
16886 /**
16887  * Creates a copy of the DataLossProtect
16888  */
16889 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
16890
16891 /**
16892  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
16893  */
16894 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
16895
16896 /**
16897  * The channel ID
16898  */
16899 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
16900
16901 /**
16902  * The channel ID
16903  */
16904 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16905
16906 /**
16907  * The next commitment number for the sender
16908  */
16909 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
16910
16911 /**
16912  * The next commitment number for the sender
16913  */
16914 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
16915
16916 /**
16917  * The next commitment number for the recipient
16918  */
16919 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
16920
16921 /**
16922  * The next commitment number for the recipient
16923  */
16924 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
16925
16926 /**
16927  * Creates a copy of the ChannelReestablish
16928  */
16929 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
16930
16931 /**
16932  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
16933  */
16934 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
16935
16936 /**
16937  * The channel ID
16938  */
16939 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
16940
16941 /**
16942  * The channel ID
16943  */
16944 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16945
16946 /**
16947  * The short channel ID
16948  */
16949 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
16950
16951 /**
16952  * The short channel ID
16953  */
16954 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
16955
16956 /**
16957  * A signature by the node key
16958  */
16959 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
16960
16961 /**
16962  * A signature by the node key
16963  */
16964 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
16965
16966 /**
16967  * A signature by the funding key
16968  */
16969 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
16970
16971 /**
16972  * A signature by the funding key
16973  */
16974 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
16975
16976 /**
16977  * Constructs a new AnnouncementSignatures given each field
16978  */
16979 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);
16980
16981 /**
16982  * Creates a copy of the AnnouncementSignatures
16983  */
16984 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
16985
16986 /**
16987  * Frees any resources used by the NetAddress
16988  */
16989 void NetAddress_free(struct LDKNetAddress this_ptr);
16990
16991 /**
16992  * Creates a copy of the NetAddress
16993  */
16994 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
16995
16996 /**
16997  * Utility method to constructs a new IPv4-variant NetAddress
16998  */
16999 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
17000
17001 /**
17002  * Utility method to constructs a new IPv6-variant NetAddress
17003  */
17004 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
17005
17006 /**
17007  * Utility method to constructs a new OnionV2-variant NetAddress
17008  */
17009 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
17010
17011 /**
17012  * Utility method to constructs a new OnionV3-variant NetAddress
17013  */
17014 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
17015
17016 /**
17017  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
17018  */
17019 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
17020
17021 /**
17022  * Read a Result from a byte array, created by Result_write
17023  */
17024 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
17025
17026 /**
17027  * Read a NetAddress from a byte array, created by NetAddress_write
17028  */
17029 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
17030
17031 /**
17032  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
17033  */
17034 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
17035
17036 /**
17037  * The advertised features
17038  */
17039 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17040
17041 /**
17042  * The advertised features
17043  */
17044 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17045
17046 /**
17047  * A strictly monotonic announcement counter, with gaps allowed
17048  */
17049 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17050
17051 /**
17052  * A strictly monotonic announcement counter, with gaps allowed
17053  */
17054 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
17055
17056 /**
17057  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
17058  * to this node).
17059  */
17060 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17061
17062 /**
17063  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
17064  * to this node).
17065  */
17066 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17067
17068 /**
17069  * An RGB color for UI purposes
17070  */
17071 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
17072
17073 /**
17074  * An RGB color for UI purposes
17075  */
17076 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17077
17078 /**
17079  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
17080  * of uniqueness.
17081  */
17082 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
17083
17084 /**
17085  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
17086  * of uniqueness.
17087  */
17088 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17089
17090 /**
17091  * List of addresses on which this node is reachable
17092  */
17093 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17094
17095 /**
17096  * Creates a copy of the UnsignedNodeAnnouncement
17097  */
17098 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
17099
17100 /**
17101  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
17102  */
17103 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
17104
17105 /**
17106  * The signature by the node key
17107  */
17108 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
17109
17110 /**
17111  * The signature by the node key
17112  */
17113 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17114
17115 /**
17116  * The actual content of the announcement
17117  */
17118 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
17119
17120 /**
17121  * The actual content of the announcement
17122  */
17123 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
17124
17125 /**
17126  * Constructs a new NodeAnnouncement given each field
17127  */
17128 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
17129
17130 /**
17131  * Creates a copy of the NodeAnnouncement
17132  */
17133 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
17134
17135 /**
17136  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
17137  */
17138 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
17139
17140 /**
17141  * The advertised channel features
17142  */
17143 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17144
17145 /**
17146  * The advertised channel features
17147  */
17148 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17149
17150 /**
17151  * The genesis hash of the blockchain where the channel is to be opened
17152  */
17153 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
17154
17155 /**
17156  * The genesis hash of the blockchain where the channel is to be opened
17157  */
17158 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17159
17160 /**
17161  * The short channel ID
17162  */
17163 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17164
17165 /**
17166  * The short channel ID
17167  */
17168 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
17169
17170 /**
17171  * One of the two node_ids which are endpoints of this channel
17172  */
17173 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17174
17175 /**
17176  * One of the two node_ids which are endpoints of this channel
17177  */
17178 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17179
17180 /**
17181  * The other of the two node_ids which are endpoints of this channel
17182  */
17183 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17184
17185 /**
17186  * The other of the two node_ids which are endpoints of this channel
17187  */
17188 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17189
17190 /**
17191  * The funding key for the first node
17192  */
17193 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17194
17195 /**
17196  * The funding key for the first node
17197  */
17198 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17199
17200 /**
17201  * The funding key for the second node
17202  */
17203 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17204
17205 /**
17206  * The funding key for the second node
17207  */
17208 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17209
17210 /**
17211  * Creates a copy of the UnsignedChannelAnnouncement
17212  */
17213 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
17214
17215 /**
17216  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
17217  */
17218 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
17219
17220 /**
17221  * Authentication of the announcement by the first public node
17222  */
17223 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17224
17225 /**
17226  * Authentication of the announcement by the first public node
17227  */
17228 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17229
17230 /**
17231  * Authentication of the announcement by the second public node
17232  */
17233 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17234
17235 /**
17236  * Authentication of the announcement by the second public node
17237  */
17238 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17239
17240 /**
17241  * Proof of funding UTXO ownership by the first public node
17242  */
17243 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17244
17245 /**
17246  * Proof of funding UTXO ownership by the first public node
17247  */
17248 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17249
17250 /**
17251  * Proof of funding UTXO ownership by the second public node
17252  */
17253 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17254
17255 /**
17256  * Proof of funding UTXO ownership by the second public node
17257  */
17258 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17259
17260 /**
17261  * The actual announcement
17262  */
17263 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17264
17265 /**
17266  * The actual announcement
17267  */
17268 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
17269
17270 /**
17271  * Constructs a new ChannelAnnouncement given each field
17272  */
17273 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);
17274
17275 /**
17276  * Creates a copy of the ChannelAnnouncement
17277  */
17278 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
17279
17280 /**
17281  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
17282  */
17283 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
17284
17285 /**
17286  * The genesis hash of the blockchain where the channel is to be opened
17287  */
17288 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
17289
17290 /**
17291  * The genesis hash of the blockchain where the channel is to be opened
17292  */
17293 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17294
17295 /**
17296  * The short channel ID
17297  */
17298 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17299
17300 /**
17301  * The short channel ID
17302  */
17303 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
17304
17305 /**
17306  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
17307  */
17308 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17309
17310 /**
17311  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
17312  */
17313 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17314
17315 /**
17316  * Channel flags
17317  */
17318 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17319
17320 /**
17321  * Channel flags
17322  */
17323 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
17324
17325 /**
17326  * The number of blocks such that if:
17327  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
17328  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
17329  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
17330  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
17331  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
17332  * forwarding. Note that the HTLC sender is the one who originally sets this value when
17333  * constructing the route.
17334  */
17335 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17336
17337 /**
17338  * The number of blocks such that if:
17339  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
17340  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
17341  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
17342  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
17343  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
17344  * forwarding. Note that the HTLC sender is the one who originally sets this value when
17345  * constructing the route.
17346  */
17347 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
17348
17349 /**
17350  * The minimum HTLC size incoming to sender, in milli-satoshi
17351  */
17352 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17353
17354 /**
17355  * The minimum HTLC size incoming to sender, in milli-satoshi
17356  */
17357 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
17358
17359 /**
17360  * The base HTLC fee charged by sender, in milli-satoshi
17361  */
17362 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17363
17364 /**
17365  * The base HTLC fee charged by sender, in milli-satoshi
17366  */
17367 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17368
17369 /**
17370  * The amount to fee multiplier, in micro-satoshi
17371  */
17372 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17373
17374 /**
17375  * The amount to fee multiplier, in micro-satoshi
17376  */
17377 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17378
17379 /**
17380  * Creates a copy of the UnsignedChannelUpdate
17381  */
17382 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
17383
17384 /**
17385  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
17386  */
17387 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
17388
17389 /**
17390  * A signature of the channel update
17391  */
17392 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
17393
17394 /**
17395  * A signature of the channel update
17396  */
17397 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
17398
17399 /**
17400  * The actual channel update
17401  */
17402 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
17403
17404 /**
17405  * The actual channel update
17406  */
17407 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
17408
17409 /**
17410  * Constructs a new ChannelUpdate given each field
17411  */
17412 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
17413
17414 /**
17415  * Creates a copy of the ChannelUpdate
17416  */
17417 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
17418
17419 /**
17420  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
17421  */
17422 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
17423
17424 /**
17425  * The genesis hash of the blockchain being queried
17426  */
17427 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
17428
17429 /**
17430  * The genesis hash of the blockchain being queried
17431  */
17432 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17433
17434 /**
17435  * The height of the first block for the channel UTXOs being queried
17436  */
17437 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
17438
17439 /**
17440  * The height of the first block for the channel UTXOs being queried
17441  */
17442 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
17443
17444 /**
17445  * The number of blocks to include in the query results
17446  */
17447 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
17448
17449 /**
17450  * The number of blocks to include in the query results
17451  */
17452 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
17453
17454 /**
17455  * Constructs a new QueryChannelRange given each field
17456  */
17457 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
17458
17459 /**
17460  * Creates a copy of the QueryChannelRange
17461  */
17462 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
17463
17464 /**
17465  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
17466  */
17467 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
17468
17469 /**
17470  * The genesis hash of the blockchain being queried
17471  */
17472 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
17473
17474 /**
17475  * The genesis hash of the blockchain being queried
17476  */
17477 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17478
17479 /**
17480  * The height of the first block in the range of the reply
17481  */
17482 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
17483
17484 /**
17485  * The height of the first block in the range of the reply
17486  */
17487 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
17488
17489 /**
17490  * The number of blocks included in the range of the reply
17491  */
17492 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
17493
17494 /**
17495  * The number of blocks included in the range of the reply
17496  */
17497 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
17498
17499 /**
17500  * True when this is the final reply for a query
17501  */
17502 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
17503
17504 /**
17505  * True when this is the final reply for a query
17506  */
17507 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
17508
17509 /**
17510  * The short_channel_ids in the channel range
17511  */
17512 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17513
17514 /**
17515  * Constructs a new ReplyChannelRange given each field
17516  */
17517 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);
17518
17519 /**
17520  * Creates a copy of the ReplyChannelRange
17521  */
17522 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
17523
17524 /**
17525  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
17526  */
17527 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
17528
17529 /**
17530  * The genesis hash of the blockchain being queried
17531  */
17532 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
17533
17534 /**
17535  * The genesis hash of the blockchain being queried
17536  */
17537 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17538
17539 /**
17540  * The short_channel_ids that are being queried
17541  */
17542 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17543
17544 /**
17545  * Constructs a new QueryShortChannelIds given each field
17546  */
17547 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
17548
17549 /**
17550  * Creates a copy of the QueryShortChannelIds
17551  */
17552 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
17553
17554 /**
17555  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
17556  */
17557 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
17558
17559 /**
17560  * The genesis hash of the blockchain that was queried
17561  */
17562 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
17563
17564 /**
17565  * The genesis hash of the blockchain that was queried
17566  */
17567 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17568
17569 /**
17570  * Indicates if the query recipient maintains up-to-date channel
17571  * information for the chain_hash
17572  */
17573 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
17574
17575 /**
17576  * Indicates if the query recipient maintains up-to-date channel
17577  * information for the chain_hash
17578  */
17579 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
17580
17581 /**
17582  * Constructs a new ReplyShortChannelIdsEnd given each field
17583  */
17584 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
17585
17586 /**
17587  * Creates a copy of the ReplyShortChannelIdsEnd
17588  */
17589 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
17590
17591 /**
17592  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
17593  */
17594 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
17595
17596 /**
17597  * The genesis hash of the blockchain for channel and node information
17598  */
17599 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
17600
17601 /**
17602  * The genesis hash of the blockchain for channel and node information
17603  */
17604 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17605
17606 /**
17607  * The starting unix timestamp
17608  */
17609 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
17610
17611 /**
17612  * The starting unix timestamp
17613  */
17614 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
17615
17616 /**
17617  * The range of information in seconds
17618  */
17619 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
17620
17621 /**
17622  * The range of information in seconds
17623  */
17624 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
17625
17626 /**
17627  * Constructs a new GossipTimestampFilter given each field
17628  */
17629 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
17630
17631 /**
17632  * Creates a copy of the GossipTimestampFilter
17633  */
17634 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
17635
17636 /**
17637  * Frees any resources used by the ErrorAction
17638  */
17639 void ErrorAction_free(struct LDKErrorAction this_ptr);
17640
17641 /**
17642  * Creates a copy of the ErrorAction
17643  */
17644 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
17645
17646 /**
17647  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
17648  */
17649 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
17650
17651 /**
17652  * Utility method to constructs a new IgnoreError-variant ErrorAction
17653  */
17654 struct LDKErrorAction ErrorAction_ignore_error(void);
17655
17656 /**
17657  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
17658  */
17659 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
17660
17661 /**
17662  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
17663  */
17664 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
17665
17666 /**
17667  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
17668  */
17669 void LightningError_free(struct LDKLightningError this_obj);
17670
17671 /**
17672  * A human-readable message describing the error
17673  */
17674 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
17675
17676 /**
17677  * A human-readable message describing the error
17678  */
17679 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
17680
17681 /**
17682  * The action which should be taken against the offending peer.
17683  */
17684 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
17685
17686 /**
17687  * The action which should be taken against the offending peer.
17688  */
17689 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
17690
17691 /**
17692  * Constructs a new LightningError given each field
17693  */
17694 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
17695
17696 /**
17697  * Creates a copy of the LightningError
17698  */
17699 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
17700
17701 /**
17702  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
17703  */
17704 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
17705
17706 /**
17707  * update_add_htlc messages which should be sent
17708  */
17709 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17710
17711 /**
17712  * update_add_htlc messages which should be sent
17713  */
17714 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
17715
17716 /**
17717  * update_fulfill_htlc messages which should be sent
17718  */
17719 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17720
17721 /**
17722  * update_fulfill_htlc messages which should be sent
17723  */
17724 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
17725
17726 /**
17727  * update_fail_htlc messages which should be sent
17728  */
17729 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17730
17731 /**
17732  * update_fail_htlc messages which should be sent
17733  */
17734 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
17735
17736 /**
17737  * update_fail_malformed_htlc messages which should be sent
17738  */
17739 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17740
17741 /**
17742  * update_fail_malformed_htlc messages which should be sent
17743  */
17744 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
17745
17746 /**
17747  * An update_fee message which should be sent
17748  *
17749  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17750  */
17751 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17752
17753 /**
17754  * An update_fee message which should be sent
17755  *
17756  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17757  */
17758 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
17759
17760 /**
17761  * Finally, the commitment_signed message which should be sent
17762  */
17763 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
17764
17765 /**
17766  * Finally, the commitment_signed message which should be sent
17767  */
17768 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
17769
17770 /**
17771  * Constructs a new CommitmentUpdate given each field
17772  */
17773 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);
17774
17775 /**
17776  * Creates a copy of the CommitmentUpdate
17777  */
17778 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
17779
17780 /**
17781  * Calls the free function if one is set
17782  */
17783 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
17784
17785 /**
17786  * Calls the free function if one is set
17787  */
17788 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
17789
17790 /**
17791  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
17792  */
17793 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
17794
17795 /**
17796  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
17797  */
17798 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
17799
17800 /**
17801  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
17802  */
17803 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
17804
17805 /**
17806  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
17807  */
17808 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
17809
17810 /**
17811  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
17812  */
17813 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
17814
17815 /**
17816  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
17817  */
17818 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
17819
17820 /**
17821  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
17822  */
17823 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
17824
17825 /**
17826  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
17827  */
17828 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
17829
17830 /**
17831  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
17832  */
17833 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
17834
17835 /**
17836  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
17837  */
17838 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
17839
17840 /**
17841  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
17842  */
17843 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
17844
17845 /**
17846  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
17847  */
17848 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
17849
17850 /**
17851  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
17852  */
17853 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
17854
17855 /**
17856  * Read a FundingCreated from a byte array, created by FundingCreated_write
17857  */
17858 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
17859
17860 /**
17861  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
17862  */
17863 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
17864
17865 /**
17866  * Read a FundingSigned from a byte array, created by FundingSigned_write
17867  */
17868 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
17869
17870 /**
17871  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
17872  */
17873 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
17874
17875 /**
17876  * Read a FundingLocked from a byte array, created by FundingLocked_write
17877  */
17878 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
17879
17880 /**
17881  * Serialize the Init object into a byte array which can be read by Init_read
17882  */
17883 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
17884
17885 /**
17886  * Read a Init from a byte array, created by Init_write
17887  */
17888 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
17889
17890 /**
17891  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
17892  */
17893 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
17894
17895 /**
17896  * Read a OpenChannel from a byte array, created by OpenChannel_write
17897  */
17898 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
17899
17900 /**
17901  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
17902  */
17903 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
17904
17905 /**
17906  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
17907  */
17908 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
17909
17910 /**
17911  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
17912  */
17913 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
17914
17915 /**
17916  * Read a Shutdown from a byte array, created by Shutdown_write
17917  */
17918 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
17919
17920 /**
17921  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
17922  */
17923 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
17924
17925 /**
17926  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
17927  */
17928 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
17929
17930 /**
17931  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
17932  */
17933 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
17934
17935 /**
17936  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
17937  */
17938 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
17939
17940 /**
17941  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
17942  */
17943 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
17944
17945 /**
17946  * Read a UpdateFee from a byte array, created by UpdateFee_write
17947  */
17948 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
17949
17950 /**
17951  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
17952  */
17953 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
17954
17955 /**
17956  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
17957  */
17958 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
17959
17960 /**
17961  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
17962  */
17963 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
17964
17965 /**
17966  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
17967  */
17968 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
17969
17970 /**
17971  * Serialize the Ping object into a byte array which can be read by Ping_read
17972  */
17973 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
17974
17975 /**
17976  * Read a Ping from a byte array, created by Ping_write
17977  */
17978 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
17979
17980 /**
17981  * Serialize the Pong object into a byte array which can be read by Pong_read
17982  */
17983 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
17984
17985 /**
17986  * Read a Pong from a byte array, created by Pong_write
17987  */
17988 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
17989
17990 /**
17991  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
17992  */
17993 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
17994
17995 /**
17996  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
17997  */
17998 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
17999
18000 /**
18001  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
18002  */
18003 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
18004
18005 /**
18006  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
18007  */
18008 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
18009
18010 /**
18011  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
18012  */
18013 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
18014
18015 /**
18016  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
18017  */
18018 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
18019
18020 /**
18021  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
18022  */
18023 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
18024
18025 /**
18026  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
18027  */
18028 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
18029
18030 /**
18031  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
18032  */
18033 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
18034
18035 /**
18036  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
18037  */
18038 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
18039
18040 /**
18041  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
18042  */
18043 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
18044
18045 /**
18046  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
18047  */
18048 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
18049
18050 /**
18051  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
18052  */
18053 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
18054
18055 /**
18056  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
18057  */
18058 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
18059
18060 /**
18061  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
18062  */
18063 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
18064
18065 /**
18066  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
18067  */
18068 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
18069
18070 /**
18071  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
18072  */
18073 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
18074
18075 /**
18076  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
18077  */
18078 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
18079
18080 /**
18081  *\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
18082  */
18083 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
18084
18085 /**
18086  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
18087  */
18088 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
18089
18090 /**
18091  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
18092  */
18093 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
18094
18095 /**
18096  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
18097  */
18098 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
18099
18100 /**
18101  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
18102  */
18103 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
18104
18105 /**
18106  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
18107  */
18108 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
18109
18110 /**
18111  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
18112  */
18113 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
18114
18115 /**
18116  * Calls the free function if one is set
18117  */
18118 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
18119
18120 /**
18121  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
18122  */
18123 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
18124
18125 /**
18126  * Constructs a new IgnoringMessageHandler given each field
18127  */
18128 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
18129
18130 /**
18131  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18132  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18133  */
18134 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18135
18136 /**
18137  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
18138  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
18139  */
18140 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18141
18142 /**
18143  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
18144  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
18145  */
18146 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18147
18148 /**
18149  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
18150  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
18151  */
18152 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18153
18154 /**
18155  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
18156  */
18157 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
18158
18159 /**
18160  * Constructs a new ErroringMessageHandler
18161  */
18162 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
18163
18164 /**
18165  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18166  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18167  */
18168 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
18169
18170 /**
18171  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
18172  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
18173  */
18174 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
18175
18176 /**
18177  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
18178  */
18179 void MessageHandler_free(struct LDKMessageHandler this_obj);
18180
18181 /**
18182  * A message handler which handles messages specific to channels. Usually this is just a
18183  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
18184  *
18185  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18186  */
18187 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
18188
18189 /**
18190  * A message handler which handles messages specific to channels. Usually this is just a
18191  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
18192  *
18193  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18194  */
18195 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
18196
18197 /**
18198  * A message handler which handles messages updating our knowledge of the network channel
18199  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
18200  * [`IgnoringMessageHandler`].
18201  *
18202  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
18203  */
18204 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
18205
18206 /**
18207  * A message handler which handles messages updating our knowledge of the network channel
18208  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
18209  * [`IgnoringMessageHandler`].
18210  *
18211  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
18212  */
18213 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
18214
18215 /**
18216  * Constructs a new MessageHandler given each field
18217  */
18218 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
18219
18220 /**
18221  * Creates a copy of a SocketDescriptor
18222  */
18223 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
18224
18225 /**
18226  * Calls the free function if one is set
18227  */
18228 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
18229
18230 /**
18231  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
18232  */
18233 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
18234
18235 /**
18236  * Used to indicate that we probably can't make any future connections to this peer, implying
18237  * we should go ahead and force-close any channels we have with it.
18238  */
18239 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
18240
18241 /**
18242  * Used to indicate that we probably can't make any future connections to this peer, implying
18243  * we should go ahead and force-close any channels we have with it.
18244  */
18245 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
18246
18247 /**
18248  * Constructs a new PeerHandleError given each field
18249  */
18250 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
18251
18252 /**
18253  * Creates a copy of the PeerHandleError
18254  */
18255 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
18256
18257 /**
18258  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
18259  */
18260 void PeerManager_free(struct LDKPeerManager this_obj);
18261
18262 /**
18263  * Constructs a new PeerManager with the given message handlers and node_id secret key
18264  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
18265  * cryptographically secure random bytes.
18266  */
18267 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);
18268
18269 /**
18270  * Get the list of node ids for peers which have completed the initial handshake.
18271  *
18272  * For outbound connections, this will be the same as the their_node_id parameter passed in to
18273  * new_outbound_connection, however entries will only appear once the initial handshake has
18274  * completed and we are sure the remote peer has the private key for the given node_id.
18275  */
18276 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
18277
18278 /**
18279  * Indicates a new outbound connection has been established to a node with the given node_id.
18280  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
18281  * descriptor but must disconnect the connection immediately.
18282  *
18283  * Returns a small number of bytes to send to the remote node (currently always 50).
18284  *
18285  * Panics if descriptor is duplicative with some other descriptor which has not yet been
18286  * [`socket_disconnected()`].
18287  *
18288  * [`socket_disconnected()`]: PeerManager::socket_disconnected
18289  */
18290 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);
18291
18292 /**
18293  * Indicates a new inbound connection has been established.
18294  *
18295  * May refuse the connection by returning an Err, but will never write bytes to the remote end
18296  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
18297  * call socket_disconnected for the new descriptor but must disconnect the connection
18298  * immediately.
18299  *
18300  * Panics if descriptor is duplicative with some other descriptor which has not yet been
18301  * [`socket_disconnected()`].
18302  *
18303  * [`socket_disconnected()`]: PeerManager::socket_disconnected
18304  */
18305 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
18306
18307 /**
18308  * Indicates that there is room to write data to the given socket descriptor.
18309  *
18310  * May return an Err to indicate that the connection should be closed.
18311  *
18312  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
18313  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
18314  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
18315  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
18316  * sufficient!
18317  *
18318  * [`send_data`]: SocketDescriptor::send_data
18319  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
18320  */
18321 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
18322
18323 /**
18324  * Indicates that data was read from the given socket descriptor.
18325  *
18326  * May return an Err to indicate that the connection should be closed.
18327  *
18328  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
18329  * Thus, however, you should call [`process_events`] after any `read_event` to generate
18330  * [`send_data`] calls to handle responses.
18331  *
18332  * If `Ok(true)` is returned, further read_events should not be triggered until a
18333  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
18334  * send buffer).
18335  *
18336  * [`send_data`]: SocketDescriptor::send_data
18337  * [`process_events`]: PeerManager::process_events
18338  */
18339 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);
18340
18341 /**
18342  * Checks for any events generated by our handlers and processes them. Includes sending most
18343  * response messages as well as messages generated by calls to handler functions directly (eg
18344  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
18345  *
18346  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
18347  * issues!
18348  *
18349  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
18350  * or one of the other clients provided in our language bindings.
18351  *
18352  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18353  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
18354  * [`send_data`]: SocketDescriptor::send_data
18355  */
18356 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
18357
18358 /**
18359  * Indicates that the given socket descriptor's connection is now closed.
18360  */
18361 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
18362
18363 /**
18364  * Disconnect a peer given its node id.
18365  *
18366  * Set `no_connection_possible` to true to prevent any further connection with this peer,
18367  * force-closing any channels we have with it.
18368  *
18369  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
18370  * peer. Thus, be very careful about reentrancy issues.
18371  *
18372  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
18373  */
18374 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
18375
18376 /**
18377  * Send pings to each peer and disconnect those which did not respond to the last round of
18378  * pings.
18379  *
18380  * This may be called on any timescale you want, however, roughly once every five to ten
18381  * seconds is preferred. The call rate determines both how often we send a ping to our peers
18382  * and how much time they have to respond before we disconnect them.
18383  *
18384  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
18385  * issues!
18386  *
18387  * [`send_data`]: SocketDescriptor::send_data
18388  */
18389 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
18390
18391 /**
18392  * Build the commitment secret from the seed and the commitment number
18393  */
18394 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
18395
18396 /**
18397  * Build a closing transaction
18398  */
18399 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);
18400
18401 /**
18402  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
18403  * from the base secret and the per_commitment_point.
18404  *
18405  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
18406  * generated (ie our own).
18407  */
18408 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
18409
18410 /**
18411  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
18412  * from the base point and the per_commitment_key. This is the public equivalent of
18413  * derive_private_key - using only public keys to derive a public key instead of private keys.
18414  *
18415  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
18416  * generated (ie our own).
18417  */
18418 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
18419
18420 /**
18421  * Derives a per-commitment-transaction revocation key from its constituent parts.
18422  *
18423  * Only the cheating participant owns a valid witness to propagate a revoked
18424  * commitment transaction, thus per_commitment_secret always come from cheater
18425  * and revocation_base_secret always come from punisher, which is the broadcaster
18426  * of the transaction spending with this key knowledge.
18427  *
18428  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
18429  * generated (ie our own).
18430  */
18431 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
18432
18433 /**
18434  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
18435  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
18436  * public key instead of private keys.
18437  *
18438  * Only the cheating participant owns a valid witness to propagate a revoked
18439  * commitment transaction, thus per_commitment_point always come from cheater
18440  * and revocation_base_point always come from punisher, which is the broadcaster
18441  * of the transaction spending with this key knowledge.
18442  *
18443  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
18444  * generated (ie our own).
18445  */
18446 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
18447
18448 /**
18449  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
18450  */
18451 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
18452
18453 /**
18454  * The broadcaster's per-commitment public key which was used to derive the other keys.
18455  */
18456 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
18457
18458 /**
18459  * The broadcaster's per-commitment public key which was used to derive the other keys.
18460  */
18461 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18462
18463 /**
18464  * The revocation key which is used to allow the broadcaster of the commitment
18465  * transaction to provide their counterparty the ability to punish them if they broadcast
18466  * an old state.
18467  */
18468 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
18469
18470 /**
18471  * The revocation key which is used to allow the broadcaster of the commitment
18472  * transaction to provide their counterparty the ability to punish them if they broadcast
18473  * an old state.
18474  */
18475 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18476
18477 /**
18478  * Broadcaster's HTLC Key
18479  */
18480 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
18481
18482 /**
18483  * Broadcaster's HTLC Key
18484  */
18485 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18486
18487 /**
18488  * Countersignatory's HTLC Key
18489  */
18490 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
18491
18492 /**
18493  * Countersignatory's HTLC Key
18494  */
18495 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18496
18497 /**
18498  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
18499  */
18500 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
18501
18502 /**
18503  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
18504  */
18505 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18506
18507 /**
18508  * Constructs a new TxCreationKeys given each field
18509  */
18510 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);
18511
18512 /**
18513  * Creates a copy of the TxCreationKeys
18514  */
18515 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
18516
18517 /**
18518  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
18519  */
18520 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
18521
18522 /**
18523  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
18524  */
18525 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
18526
18527 /**
18528  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
18529  */
18530 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
18531
18532 /**
18533  * The public key which is used to sign all commitment transactions, as it appears in the
18534  * on-chain channel lock-in 2-of-2 multisig output.
18535  */
18536 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
18537
18538 /**
18539  * The public key which is used to sign all commitment transactions, as it appears in the
18540  * on-chain channel lock-in 2-of-2 multisig output.
18541  */
18542 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18543
18544 /**
18545  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
18546  * revocation keys. This is combined with the per-commitment-secret generated by the
18547  * counterparty to create a secret which the counterparty can reveal to revoke previous
18548  * states.
18549  */
18550 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
18551
18552 /**
18553  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
18554  * revocation keys. This is combined with the per-commitment-secret generated by the
18555  * counterparty to create a secret which the counterparty can reveal to revoke previous
18556  * states.
18557  */
18558 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18559
18560 /**
18561  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
18562  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
18563  * static across every commitment transaction.
18564  */
18565 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
18566
18567 /**
18568  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
18569  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
18570  * static across every commitment transaction.
18571  */
18572 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18573
18574 /**
18575  * The base point which is used (with derive_public_key) to derive a per-commitment payment
18576  * public key which receives non-HTLC-encumbered funds which are only available for spending
18577  * after some delay (or can be claimed via the revocation path).
18578  */
18579 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
18580
18581 /**
18582  * The base point which is used (with derive_public_key) to derive a per-commitment payment
18583  * public key which receives non-HTLC-encumbered funds which are only available for spending
18584  * after some delay (or can be claimed via the revocation path).
18585  */
18586 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18587
18588 /**
18589  * The base point which is used (with derive_public_key) to derive a per-commitment public key
18590  * which is used to encumber HTLC-in-flight outputs.
18591  */
18592 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
18593
18594 /**
18595  * The base point which is used (with derive_public_key) to derive a per-commitment public key
18596  * which is used to encumber HTLC-in-flight outputs.
18597  */
18598 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18599
18600 /**
18601  * Constructs a new ChannelPublicKeys given each field
18602  */
18603 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);
18604
18605 /**
18606  * Creates a copy of the ChannelPublicKeys
18607  */
18608 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
18609
18610 /**
18611  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
18612  */
18613 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
18614
18615 /**
18616  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
18617  */
18618 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
18619
18620 /**
18621  * Create per-state keys from channel base points and the per-commitment point.
18622  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
18623  */
18624 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);
18625
18626 /**
18627  * Generate per-state keys from channel static keys.
18628  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
18629  */
18630 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);
18631
18632 /**
18633  * A script either spendable by the revocation
18634  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
18635  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
18636  */
18637 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
18638
18639 /**
18640  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
18641  */
18642 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
18643
18644 /**
18645  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
18646  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
18647  * need to compare this value to whether the commitment transaction in question is that of
18648  * the counterparty or our own.
18649  */
18650 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
18651
18652 /**
18653  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
18654  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
18655  * need to compare this value to whether the commitment transaction in question is that of
18656  * the counterparty or our own.
18657  */
18658 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
18659
18660 /**
18661  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
18662  * this divided by 1000.
18663  */
18664 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
18665
18666 /**
18667  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
18668  * this divided by 1000.
18669  */
18670 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
18671
18672 /**
18673  * The CLTV lock-time at which this HTLC expires.
18674  */
18675 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
18676
18677 /**
18678  * The CLTV lock-time at which this HTLC expires.
18679  */
18680 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
18681
18682 /**
18683  * The hash of the preimage which unlocks this HTLC.
18684  */
18685 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
18686
18687 /**
18688  * The hash of the preimage which unlocks this HTLC.
18689  */
18690 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18691
18692 /**
18693  * The position within the commitment transactions' outputs. This may be None if the value is
18694  * below the dust limit (in which case no output appears in the commitment transaction and the
18695  * value is spent to additional transaction fees).
18696  */
18697 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
18698
18699 /**
18700  * The position within the commitment transactions' outputs. This may be None if the value is
18701  * below the dust limit (in which case no output appears in the commitment transaction and the
18702  * value is spent to additional transaction fees).
18703  */
18704 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
18705
18706 /**
18707  * Constructs a new HTLCOutputInCommitment given each field
18708  */
18709 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);
18710
18711 /**
18712  * Creates a copy of the HTLCOutputInCommitment
18713  */
18714 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
18715
18716 /**
18717  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
18718  */
18719 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
18720
18721 /**
18722  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
18723  */
18724 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
18725
18726 /**
18727  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
18728  * does not need to have its previous_output_index filled.
18729  */
18730 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
18731
18732 /**
18733  * Gets the redeemscript for a funding output from the two funding public keys.
18734  * Note that the order of funding public keys does not matter.
18735  */
18736 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
18737
18738 /**
18739  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
18740  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
18741  * transaction which needs signing, and can be used to construct an HTLC transaction which is
18742  * broadcastable given a counterparty HTLC signature.
18743  *
18744  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
18745  * commitment transaction).
18746  */
18747 struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
18748
18749 /**
18750  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
18751  */
18752 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
18753
18754 /**
18755  * Holder public keys
18756  */
18757 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
18758
18759 /**
18760  * Holder public keys
18761  */
18762 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
18763
18764 /**
18765  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
18766  */
18767 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
18768
18769 /**
18770  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
18771  */
18772 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
18773
18774 /**
18775  * Whether the holder is the initiator of this channel.
18776  * This is an input to the commitment number obscure factor computation.
18777  */
18778 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
18779
18780 /**
18781  * Whether the holder is the initiator of this channel.
18782  * This is an input to the commitment number obscure factor computation.
18783  */
18784 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
18785
18786 /**
18787  * The late-bound counterparty channel transaction parameters.
18788  * These parameters are populated at the point in the protocol where the counterparty provides them.
18789  *
18790  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18791  */
18792 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
18793
18794 /**
18795  * The late-bound counterparty channel transaction parameters.
18796  * These parameters are populated at the point in the protocol where the counterparty provides them.
18797  *
18798  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18799  */
18800 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
18801
18802 /**
18803  * The late-bound funding outpoint
18804  *
18805  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18806  */
18807 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
18808
18809 /**
18810  * The late-bound funding outpoint
18811  *
18812  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18813  */
18814 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18815
18816 /**
18817  * Constructs a new ChannelTransactionParameters given each field
18818  */
18819 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);
18820
18821 /**
18822  * Creates a copy of the ChannelTransactionParameters
18823  */
18824 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
18825
18826 /**
18827  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
18828  */
18829 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
18830
18831 /**
18832  * Counter-party public keys
18833  */
18834 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
18835
18836 /**
18837  * Counter-party public keys
18838  */
18839 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
18840
18841 /**
18842  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
18843  */
18844 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
18845
18846 /**
18847  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
18848  */
18849 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
18850
18851 /**
18852  * Constructs a new CounterpartyChannelTransactionParameters given each field
18853  */
18854 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
18855
18856 /**
18857  * Creates a copy of the CounterpartyChannelTransactionParameters
18858  */
18859 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
18860
18861 /**
18862  * Whether the late bound parameters are populated.
18863  */
18864 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
18865
18866 /**
18867  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
18868  * given that the holder is the broadcaster.
18869  *
18870  * self.is_populated() must be true before calling this function.
18871  */
18872 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
18873
18874 /**
18875  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
18876  * given that the counterparty is the broadcaster.
18877  *
18878  * self.is_populated() must be true before calling this function.
18879  */
18880 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
18881
18882 /**
18883  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
18884  */
18885 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
18886
18887 /**
18888  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
18889  */
18890 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
18891
18892 /**
18893  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
18894  */
18895 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
18896
18897 /**
18898  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
18899  */
18900 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
18901
18902 /**
18903  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
18904  */
18905 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
18906
18907 /**
18908  * Get the channel pubkeys for the broadcaster
18909  */
18910 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
18911
18912 /**
18913  * Get the channel pubkeys for the countersignatory
18914  */
18915 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
18916
18917 /**
18918  * Get the contest delay applicable to the transactions.
18919  * Note that the contest delay was selected by the countersignatory.
18920  */
18921 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
18922
18923 /**
18924  * Whether the channel is outbound from the broadcaster.
18925  *
18926  * The boolean representing the side that initiated the channel is
18927  * an input to the commitment number obscure factor computation.
18928  */
18929 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
18930
18931 /**
18932  * The funding outpoint
18933  */
18934 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
18935
18936 /**
18937  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
18938  */
18939 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
18940
18941 /**
18942  * Our counterparty's signature for the transaction
18943  */
18944 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
18945
18946 /**
18947  * Our counterparty's signature for the transaction
18948  */
18949 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
18950
18951 /**
18952  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
18953  */
18954 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
18955
18956 /**
18957  * Creates a copy of the HolderCommitmentTransaction
18958  */
18959 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
18960
18961 /**
18962  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
18963  */
18964 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
18965
18966 /**
18967  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
18968  */
18969 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
18970
18971 /**
18972  * Create a new holder transaction with the given counterparty signatures.
18973  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
18974  */
18975 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);
18976
18977 /**
18978  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
18979  */
18980 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
18981
18982 /**
18983  * The commitment transaction
18984  */
18985 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
18986
18987 /**
18988  * The commitment transaction
18989  */
18990 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
18991
18992 /**
18993  * The txid for the commitment transaction.
18994  *
18995  * This is provided as a performance optimization, instead of calling transaction.txid()
18996  * multiple times.
18997  */
18998 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
18999
19000 /**
19001  * The txid for the commitment transaction.
19002  *
19003  * This is provided as a performance optimization, instead of calling transaction.txid()
19004  * multiple times.
19005  */
19006 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19007
19008 /**
19009  * Constructs a new BuiltCommitmentTransaction given each field
19010  */
19011 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
19012
19013 /**
19014  * Creates a copy of the BuiltCommitmentTransaction
19015  */
19016 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
19017
19018 /**
19019  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
19020  */
19021 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
19022
19023 /**
19024  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
19025  */
19026 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
19027
19028 /**
19029  * Get the SIGHASH_ALL sighash value of the transaction.
19030  *
19031  * This can be used to verify a signature.
19032  */
19033 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);
19034
19035 /**
19036  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
19037  * because we are about to broadcast a holder transaction.
19038  */
19039 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);
19040
19041 /**
19042  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
19043  */
19044 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
19045
19046 /**
19047  * Construct an object of the class
19048  */
19049 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);
19050
19051 /**
19052  * Trust our pre-built transaction.
19053  *
19054  * Applies a wrapper which allows access to the transaction.
19055  *
19056  * This should only be used if you fully trust the builder of this object. It should not
19057  * be used by an external signer - instead use the verify function.
19058  */
19059 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19060
19061 /**
19062  * Verify our pre-built transaction.
19063  *
19064  * Applies a wrapper which allows access to the transaction.
19065  *
19066  * An external validating signer must call this method before signing
19067  * or using the built transaction.
19068  */
19069 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
19070
19071 /**
19072  * The value to be sent to the holder, or zero if the output will be omitted
19073  */
19074 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19075
19076 /**
19077  * The value to be sent to the counterparty, or zero if the output will be omitted
19078  */
19079 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19080
19081 /**
19082  * The destination of the holder's output
19083  */
19084 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19085
19086 /**
19087  * The destination of the counterparty's output
19088  */
19089 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19090
19091 /**
19092  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
19093  */
19094 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
19095
19096 /**
19097  * The pre-built Bitcoin commitment transaction
19098  */
19099 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
19100
19101 /**
19102  * Get the SIGHASH_ALL sighash value of the transaction.
19103  *
19104  * This can be used to verify a signature.
19105  */
19106 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);
19107
19108 /**
19109  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
19110  * because we are about to broadcast a holder transaction.
19111  */
19112 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);
19113
19114 /**
19115  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
19116  */
19117 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
19118
19119 /**
19120  * Creates a copy of the CommitmentTransaction
19121  */
19122 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
19123
19124 /**
19125  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
19126  */
19127 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
19128
19129 /**
19130  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
19131  */
19132 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
19133
19134 /**
19135  * The backwards-counting commitment number
19136  */
19137 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19138
19139 /**
19140  * The value to be sent to the broadcaster
19141  */
19142 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19143
19144 /**
19145  * The value to be sent to the counterparty
19146  */
19147 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19148
19149 /**
19150  * The feerate paid per 1000-weight-unit in this commitment transaction.
19151  */
19152 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19153
19154 /**
19155  * Trust our pre-built transaction and derived transaction creation public keys.
19156  *
19157  * Applies a wrapper which allows access to these fields.
19158  *
19159  * This should only be used if you fully trust the builder of this object.  It should not
19160  * be used by an external signer - instead use the verify function.
19161  */
19162 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19163
19164 /**
19165  * Verify our pre-built transaction and derived transaction creation public keys.
19166  *
19167  * Applies a wrapper which allows access to these fields.
19168  *
19169  * An external validating signer must call this method before signing
19170  * or using the built transaction.
19171  */
19172 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);
19173
19174 /**
19175  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
19176  */
19177 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
19178
19179 /**
19180  * The transaction ID of the built Bitcoin transaction
19181  */
19182 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19183
19184 /**
19185  * The pre-built Bitcoin commitment transaction
19186  */
19187 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19188
19189 /**
19190  * The pre-calculated transaction creation public keys.
19191  */
19192 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19193
19194 /**
19195  * Get a signature for each HTLC which was included in the commitment transaction (ie for
19196  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
19197  *
19198  * The returned Vec has one entry for each HTLC, and in the same order.
19199  */
19200 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);
19201
19202 /**
19203  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
19204  * shared secret first. This prevents on-chain observers from discovering how many commitment
19205  * transactions occurred in a channel before it was closed.
19206  *
19207  * This function gets the shared secret from relevant channel public keys and can be used to
19208  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
19209  */
19210 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
19211
19212 /**
19213  * Checks if two InitFeaturess contain equal inner contents.
19214  * This ignores pointers and is_owned flags and looks at the values in fields.
19215  * Two objects with NULL inner values will be considered "equal" here.
19216  */
19217 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
19218
19219 /**
19220  * Checks if two NodeFeaturess contain equal inner contents.
19221  * This ignores pointers and is_owned flags and looks at the values in fields.
19222  * Two objects with NULL inner values will be considered "equal" here.
19223  */
19224 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
19225
19226 /**
19227  * Checks if two ChannelFeaturess contain equal inner contents.
19228  * This ignores pointers and is_owned flags and looks at the values in fields.
19229  * Two objects with NULL inner values will be considered "equal" here.
19230  */
19231 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
19232
19233 /**
19234  * Checks if two InvoiceFeaturess contain equal inner contents.
19235  * This ignores pointers and is_owned flags and looks at the values in fields.
19236  * Two objects with NULL inner values will be considered "equal" here.
19237  */
19238 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
19239
19240 /**
19241  * Creates a copy of the InitFeatures
19242  */
19243 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
19244
19245 /**
19246  * Creates a copy of the NodeFeatures
19247  */
19248 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
19249
19250 /**
19251  * Creates a copy of the ChannelFeatures
19252  */
19253 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
19254
19255 /**
19256  * Creates a copy of the InvoiceFeatures
19257  */
19258 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
19259
19260 /**
19261  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
19262  */
19263 void InitFeatures_free(struct LDKInitFeatures this_obj);
19264
19265 /**
19266  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
19267  */
19268 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
19269
19270 /**
19271  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
19272  */
19273 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
19274
19275 /**
19276  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
19277  */
19278 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
19279
19280 /**
19281  * Create a blank Features with no features set
19282  */
19283 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
19284
19285 /**
19286  * Creates a Features with the bits set which are known by the implementation
19287  */
19288 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
19289
19290 /**
19291  * Returns true if this `Features` object contains unknown feature flags which are set as
19292  * \"required\".
19293  */
19294 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
19295
19296 /**
19297  * Create a blank Features with no features set
19298  */
19299 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
19300
19301 /**
19302  * Creates a Features with the bits set which are known by the implementation
19303  */
19304 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
19305
19306 /**
19307  * Returns true if this `Features` object contains unknown feature flags which are set as
19308  * \"required\".
19309  */
19310 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
19311
19312 /**
19313  * Create a blank Features with no features set
19314  */
19315 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
19316
19317 /**
19318  * Creates a Features with the bits set which are known by the implementation
19319  */
19320 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
19321
19322 /**
19323  * Returns true if this `Features` object contains unknown feature flags which are set as
19324  * \"required\".
19325  */
19326 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
19327
19328 /**
19329  * Create a blank Features with no features set
19330  */
19331 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
19332
19333 /**
19334  * Creates a Features with the bits set which are known by the implementation
19335  */
19336 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
19337
19338 /**
19339  * Returns true if this `Features` object contains unknown feature flags which are set as
19340  * \"required\".
19341  */
19342 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
19343
19344 /**
19345  * Returns whether the `payment_secret` feature is supported.
19346  */
19347 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
19348
19349 /**
19350  * Returns whether the `payment_secret` feature is supported.
19351  */
19352 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
19353
19354 /**
19355  * Returns whether the `payment_secret` feature is supported.
19356  */
19357 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
19358
19359 /**
19360  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
19361  */
19362 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
19363
19364 /**
19365  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
19366  */
19367 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
19368
19369 /**
19370  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
19371  */
19372 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
19373
19374 /**
19375  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
19376  */
19377 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
19378
19379 /**
19380  * Read a InitFeatures from a byte array, created by InitFeatures_write
19381  */
19382 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
19383
19384 /**
19385  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
19386  */
19387 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
19388
19389 /**
19390  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
19391  */
19392 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
19393
19394 /**
19395  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
19396  */
19397 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
19398
19399 /**
19400  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
19401  */
19402 void ShutdownScript_free(struct LDKShutdownScript this_obj);
19403
19404 /**
19405  * Creates a copy of the ShutdownScript
19406  */
19407 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
19408
19409 /**
19410  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
19411  */
19412 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
19413
19414 /**
19415  * The script that did not meet the requirements from [BOLT #2].
19416  *
19417  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
19418  */
19419 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
19420
19421 /**
19422  * The script that did not meet the requirements from [BOLT #2].
19423  *
19424  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
19425  */
19426 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
19427
19428 /**
19429  * Constructs a new InvalidShutdownScript given each field
19430  */
19431 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
19432
19433 /**
19434  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
19435  */
19436 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
19437
19438 /**
19439  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
19440  */
19441 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
19442
19443 /**
19444  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
19445  */
19446 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
19447
19448 /**
19449  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
19450  */
19451 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
19452
19453 /**
19454  * Generates a witness script pubkey from the given segwit version and program.
19455  *
19456  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
19457  * [`ShutdownScript::new_p2wsh`] instead.
19458  *
19459  * # Errors
19460  *
19461  * This function may return an error if `program` is invalid for the segwit `version`.
19462  */
19463 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
19464
19465 /**
19466  * Converts the shutdown script into the underlying [`Script`].
19467  */
19468 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
19469
19470 /**
19471  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
19472  *
19473  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19474  */
19475 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
19476
19477 /**
19478  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
19479  *
19480  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
19481  */
19482 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
19483
19484 /**
19485  * Calls the free function if one is set
19486  */
19487 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
19488
19489 /**
19490  * Calls the free function if one is set
19491  */
19492 void Type_free(struct LDKType this_ptr);
19493
19494 /**
19495  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
19496  */
19497 void RouteHop_free(struct LDKRouteHop this_obj);
19498
19499 /**
19500  * The node_id of the node at this hop.
19501  */
19502 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19503
19504 /**
19505  * The node_id of the node at this hop.
19506  */
19507 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19508
19509 /**
19510  * The node_announcement features of the node at this hop. For the last hop, these may be
19511  * amended to match the features present in the invoice this node generated.
19512  */
19513 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19514
19515 /**
19516  * The node_announcement features of the node at this hop. For the last hop, these may be
19517  * amended to match the features present in the invoice this node generated.
19518  */
19519 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
19520
19521 /**
19522  * The channel that should be used from the previous hop to reach this node.
19523  */
19524 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19525
19526 /**
19527  * The channel that should be used from the previous hop to reach this node.
19528  */
19529 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
19530
19531 /**
19532  * The channel_announcement features of the channel that should be used from the previous hop
19533  * to reach this node.
19534  */
19535 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19536
19537 /**
19538  * The channel_announcement features of the channel that should be used from the previous hop
19539  * to reach this node.
19540  */
19541 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
19542
19543 /**
19544  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
19545  * For the last hop, this should be the full value of the payment (might be more than
19546  * requested if we had to match htlc_minimum_msat).
19547  */
19548 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19549
19550 /**
19551  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
19552  * For the last hop, this should be the full value of the payment (might be more than
19553  * requested if we had to match htlc_minimum_msat).
19554  */
19555 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
19556
19557 /**
19558  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
19559  * expected at the destination, in excess of the current block height.
19560  */
19561 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
19562
19563 /**
19564  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
19565  * expected at the destination, in excess of the current block height.
19566  */
19567 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
19568
19569 /**
19570  * Constructs a new RouteHop given each field
19571  */
19572 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);
19573
19574 /**
19575  * Creates a copy of the RouteHop
19576  */
19577 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
19578
19579 /**
19580  * Checks if two RouteHops contain equal inner contents.
19581  */
19582 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
19583
19584 /**
19585  * Checks if two RouteHops contain equal inner contents.
19586  * This ignores pointers and is_owned flags and looks at the values in fields.
19587  * Two objects with NULL inner values will be considered "equal" here.
19588  */
19589 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
19590
19591 /**
19592  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
19593  */
19594 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
19595
19596 /**
19597  * Read a RouteHop from a byte array, created by RouteHop_write
19598  */
19599 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
19600
19601 /**
19602  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
19603  */
19604 void Route_free(struct LDKRoute this_obj);
19605
19606 /**
19607  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
19608  * last RouteHop in each path must be the same.
19609  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
19610  * destination. Thus, this must always be at least length one. While the maximum length of any
19611  * given path is variable, keeping the length of any path to less than 20 should currently
19612  * ensure it is viable.
19613  */
19614 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
19615
19616 /**
19617  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
19618  * last RouteHop in each path must be the same.
19619  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
19620  * destination. Thus, this must always be at least length one. While the maximum length of any
19621  * given path is variable, keeping the length of any path to less than 20 should currently
19622  * ensure it is viable.
19623  */
19624 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
19625
19626 /**
19627  * Constructs a new Route given each field
19628  */
19629 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
19630
19631 /**
19632  * Creates a copy of the Route
19633  */
19634 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
19635
19636 /**
19637  * Checks if two Routes contain equal inner contents.
19638  */
19639 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
19640
19641 /**
19642  * Checks if two Routes contain equal inner contents.
19643  * This ignores pointers and is_owned flags and looks at the values in fields.
19644  * Two objects with NULL inner values will be considered "equal" here.
19645  */
19646 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
19647
19648 /**
19649  * Returns the total amount of fees paid on this [`Route`].
19650  *
19651  * This doesn't include any extra payment made to the recipient, which can happen in excess of
19652  * the amount passed to [`get_route`]'s `final_value_msat`.
19653  */
19654 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
19655
19656 /**
19657  * Returns the total amount paid on this [`Route`], excluding the fees.
19658  */
19659 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
19660
19661 /**
19662  * Serialize the Route object into a byte array which can be read by Route_read
19663  */
19664 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
19665
19666 /**
19667  * Read a Route from a byte array, created by Route_write
19668  */
19669 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
19670
19671 /**
19672  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
19673  */
19674 void RouteHint_free(struct LDKRouteHint this_obj);
19675
19676 /**
19677  * Creates a copy of the RouteHint
19678  */
19679 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
19680
19681 /**
19682  * Checks if two RouteHints contain equal inner contents.
19683  */
19684 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
19685
19686 /**
19687  * Checks if two RouteHints contain equal inner contents.
19688  * This ignores pointers and is_owned flags and looks at the values in fields.
19689  * Two objects with NULL inner values will be considered "equal" here.
19690  */
19691 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
19692
19693 /**
19694  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
19695  */
19696 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
19697
19698 /**
19699  * The node_id of the non-target end of the route
19700  */
19701 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19702
19703 /**
19704  * The node_id of the non-target end of the route
19705  */
19706 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19707
19708 /**
19709  * The short_channel_id of this channel
19710  */
19711 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19712
19713 /**
19714  * The short_channel_id of this channel
19715  */
19716 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
19717
19718 /**
19719  * The fees which must be paid to use this channel
19720  */
19721 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19722
19723 /**
19724  * The fees which must be paid to use this channel
19725  */
19726 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
19727
19728 /**
19729  * The difference in CLTV values between this node and the next node.
19730  */
19731 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19732
19733 /**
19734  * The difference in CLTV values between this node and the next node.
19735  */
19736 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
19737
19738 /**
19739  * The minimum value, in msat, which must be relayed to the next hop.
19740  */
19741 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19742
19743 /**
19744  * The minimum value, in msat, which must be relayed to the next hop.
19745  */
19746 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19747
19748 /**
19749  * The maximum value in msat available for routing with a single HTLC.
19750  */
19751 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
19752
19753 /**
19754  * The maximum value in msat available for routing with a single HTLC.
19755  */
19756 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19757
19758 /**
19759  * Constructs a new RouteHintHop given each field
19760  */
19761 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);
19762
19763 /**
19764  * Creates a copy of the RouteHintHop
19765  */
19766 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
19767
19768 /**
19769  * Checks if two RouteHintHops contain equal inner contents.
19770  */
19771 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
19772
19773 /**
19774  * Checks if two RouteHintHops contain equal inner contents.
19775  * This ignores pointers and is_owned flags and looks at the values in fields.
19776  * Two objects with NULL inner values will be considered "equal" here.
19777  */
19778 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
19779
19780 /**
19781  * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
19782  * keysend payments do not have an invoice from which to pull the payee's supported features, which
19783  * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
19784  *
19785  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
19786  */
19787 struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
19788
19789 /**
19790  * Gets a route from us (payer) to the given target node (payee).
19791  *
19792  * If the payee provided features in their invoice, they should be provided via payee_features.
19793  * Without this, MPP will only be used if the payee's features are available in the network graph.
19794  *
19795  * Private routing paths between a public node and the target may be included in `last_hops`.
19796  * Currently, only the last hop in each path is considered.
19797  *
19798  * If some channels aren't announced, it may be useful to fill in a first_hops with the
19799  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
19800  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
19801  * in first_hops will be used.
19802  *
19803  * Panics if first_hops contains channels without short_channel_ids
19804  * (ChannelManager::list_usable_channels will never include such channels).
19805  *
19806  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
19807  * equal), however the enabled/disabled bit on such channels as well as the
19808  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
19809  *
19810  * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
19811  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
19812  */
19813 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
19814
19815 /**
19816  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
19817  */
19818 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
19819
19820 /**
19821  * Creates a copy of the NetworkGraph
19822  */
19823 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
19824
19825 /**
19826  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
19827  */
19828 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
19829
19830 /**
19831  * Frees any resources used by the NetworkUpdate
19832  */
19833 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
19834
19835 /**
19836  * Creates a copy of the NetworkUpdate
19837  */
19838 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
19839
19840 /**
19841  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
19842  */
19843 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
19844
19845 /**
19846  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
19847  */
19848 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
19849
19850 /**
19851  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
19852  */
19853 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
19854
19855 /**
19856  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
19857  */
19858 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
19859
19860 /**
19861  * Constructs a new EventHandler which calls the relevant methods on this_arg.
19862  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
19863  */
19864 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
19865
19866 /**
19867  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
19868  */
19869 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
19870
19871 /**
19872  * Representation of the payment channel network
19873  */
19874 struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
19875
19876 /**
19877  * Representation of the payment channel network
19878  */
19879 void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
19880
19881 /**
19882  * Creates a new tracker of the actual state of the network of channels and nodes,
19883  * assuming an existing Network Graph.
19884  * Chain monitor is used to make sure announced channels exist on-chain,
19885  * channel data is correct, and that the announcement is signed with
19886  * channel owners' keys.
19887  */
19888 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
19889
19890 /**
19891  * Adds a provider used to check new announcements. Does not affect
19892  * existing announcements unless they are updated.
19893  * Add, update or remove the provider would replace the current one.
19894  */
19895 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
19896
19897 /**
19898  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
19899  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
19900  */
19901 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
19902
19903 /**
19904  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19905  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19906  */
19907 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
19908
19909 /**
19910  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
19911  */
19912 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
19913
19914 /**
19915  * When the last update to the channel direction was issued.
19916  * Value is opaque, as set in the announcement.
19917  */
19918 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19919
19920 /**
19921  * When the last update to the channel direction was issued.
19922  * Value is opaque, as set in the announcement.
19923  */
19924 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
19925
19926 /**
19927  * Whether the channel can be currently used for payments (in this one direction).
19928  */
19929 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19930
19931 /**
19932  * Whether the channel can be currently used for payments (in this one direction).
19933  */
19934 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
19935
19936 /**
19937  * The difference in CLTV values that you must have when routing through this channel.
19938  */
19939 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19940
19941 /**
19942  * The difference in CLTV values that you must have when routing through this channel.
19943  */
19944 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
19945
19946 /**
19947  * The minimum value, which must be relayed to the next hop via the channel
19948  */
19949 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19950
19951 /**
19952  * The minimum value, which must be relayed to the next hop via the channel
19953  */
19954 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
19955
19956 /**
19957  * The maximum value which may be relayed to the next hop via the channel.
19958  */
19959 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19960
19961 /**
19962  * The maximum value which may be relayed to the next hop via the channel.
19963  */
19964 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19965
19966 /**
19967  * Fees charged when the channel is used for routing
19968  */
19969 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19970
19971 /**
19972  * Fees charged when the channel is used for routing
19973  */
19974 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
19975
19976 /**
19977  * Most recent update for the channel received from the network
19978  * Mostly redundant with the data we store in fields explicitly.
19979  * Everything else is useful only for sending out for initial routing sync.
19980  * Not stored if contains excess data to prevent DoS.
19981  *
19982  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19983  */
19984 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
19985
19986 /**
19987  * Most recent update for the channel received from the network
19988  * Mostly redundant with the data we store in fields explicitly.
19989  * Everything else is useful only for sending out for initial routing sync.
19990  * Not stored if contains excess data to prevent DoS.
19991  *
19992  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19993  */
19994 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
19995
19996 /**
19997  * Constructs a new DirectionalChannelInfo given each field
19998  */
19999 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);
20000
20001 /**
20002  * Creates a copy of the DirectionalChannelInfo
20003  */
20004 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
20005
20006 /**
20007  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
20008  */
20009 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
20010
20011 /**
20012  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
20013  */
20014 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
20015
20016 /**
20017  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
20018  */
20019 void ChannelInfo_free(struct LDKChannelInfo this_obj);
20020
20021 /**
20022  * Protocol features of a channel communicated during its announcement
20023  */
20024 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20025
20026 /**
20027  * Protocol features of a channel communicated during its announcement
20028  */
20029 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
20030
20031 /**
20032  * Source node of the first direction of a channel
20033  */
20034 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20035
20036 /**
20037  * Source node of the first direction of a channel
20038  */
20039 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20040
20041 /**
20042  * Details about the first direction of a channel
20043  *
20044  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20045  */
20046 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20047
20048 /**
20049  * Details about the first direction of a channel
20050  *
20051  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20052  */
20053 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20054
20055 /**
20056  * Source node of the second direction of a channel
20057  */
20058 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20059
20060 /**
20061  * Source node of the second direction of a channel
20062  */
20063 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20064
20065 /**
20066  * Details about the second direction of a channel
20067  *
20068  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20069  */
20070 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20071
20072 /**
20073  * Details about the second direction of a channel
20074  *
20075  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20076  */
20077 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20078
20079 /**
20080  * The channel capacity as seen on-chain, if chain lookup is available.
20081  */
20082 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20083
20084 /**
20085  * The channel capacity as seen on-chain, if chain lookup is available.
20086  */
20087 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20088
20089 /**
20090  * An initial announcement of the channel
20091  * Mostly redundant with the data we store in fields explicitly.
20092  * Everything else is useful only for sending out for initial routing sync.
20093  * Not stored if contains excess data to prevent DoS.
20094  *
20095  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20096  */
20097 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20098
20099 /**
20100  * An initial announcement of the channel
20101  * Mostly redundant with the data we store in fields explicitly.
20102  * Everything else is useful only for sending out for initial routing sync.
20103  * Not stored if contains excess data to prevent DoS.
20104  *
20105  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20106  */
20107 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
20108
20109 /**
20110  * Constructs a new ChannelInfo given each field
20111  */
20112 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
20113
20114 /**
20115  * Creates a copy of the ChannelInfo
20116  */
20117 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
20118
20119 /**
20120  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
20121  */
20122 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
20123
20124 /**
20125  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
20126  */
20127 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
20128
20129 /**
20130  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
20131  */
20132 void RoutingFees_free(struct LDKRoutingFees this_obj);
20133
20134 /**
20135  * Flat routing fee in satoshis
20136  */
20137 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20138
20139 /**
20140  * Flat routing fee in satoshis
20141  */
20142 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20143
20144 /**
20145  * Liquidity-based routing fee in millionths of a routed amount.
20146  * In other words, 10000 is 1%.
20147  */
20148 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20149
20150 /**
20151  * Liquidity-based routing fee in millionths of a routed amount.
20152  * In other words, 10000 is 1%.
20153  */
20154 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20155
20156 /**
20157  * Constructs a new RoutingFees given each field
20158  */
20159 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
20160
20161 /**
20162  * Checks if two RoutingFeess contain equal inner contents.
20163  * This ignores pointers and is_owned flags and looks at the values in fields.
20164  * Two objects with NULL inner values will be considered "equal" here.
20165  */
20166 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
20167
20168 /**
20169  * Creates a copy of the RoutingFees
20170  */
20171 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
20172
20173 /**
20174  * Checks if two RoutingFeess contain equal inner contents.
20175  */
20176 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
20177
20178 /**
20179  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
20180  */
20181 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
20182
20183 /**
20184  * Read a RoutingFees from a byte array, created by RoutingFees_write
20185  */
20186 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
20187
20188 /**
20189  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
20190  */
20191 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
20192
20193 /**
20194  * Protocol features the node announced support for
20195  */
20196 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20197
20198 /**
20199  * Protocol features the node announced support for
20200  */
20201 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
20202
20203 /**
20204  * When the last known update to the node state was issued.
20205  * Value is opaque, as set in the announcement.
20206  */
20207 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20208
20209 /**
20210  * When the last known update to the node state was issued.
20211  * Value is opaque, as set in the announcement.
20212  */
20213 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
20214
20215 /**
20216  * Color assigned to the node
20217  */
20218 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
20219
20220 /**
20221  * Color assigned to the node
20222  */
20223 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
20224
20225 /**
20226  * Moniker assigned to the node.
20227  * May be invalid or malicious (eg control chars),
20228  * should not be exposed to the user.
20229  */
20230 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
20231
20232 /**
20233  * Moniker assigned to the node.
20234  * May be invalid or malicious (eg control chars),
20235  * should not be exposed to the user.
20236  */
20237 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20238
20239 /**
20240  * Internet-level addresses via which one can connect to the node
20241  */
20242 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
20243
20244 /**
20245  * An initial announcement of the node
20246  * Mostly redundant with the data we store in fields explicitly.
20247  * Everything else is useful only for sending out for initial routing sync.
20248  * Not stored if contains excess data to prevent DoS.
20249  *
20250  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20251  */
20252 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20253
20254 /**
20255  * An initial announcement of the node
20256  * Mostly redundant with the data we store in fields explicitly.
20257  * Everything else is useful only for sending out for initial routing sync.
20258  * Not stored if contains excess data to prevent DoS.
20259  *
20260  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20261  */
20262 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
20263
20264 /**
20265  * Constructs a new NodeAnnouncementInfo given each field
20266  */
20267 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);
20268
20269 /**
20270  * Creates a copy of the NodeAnnouncementInfo
20271  */
20272 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
20273
20274 /**
20275  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
20276  */
20277 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
20278
20279 /**
20280  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
20281  */
20282 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
20283
20284 /**
20285  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
20286  */
20287 void NodeInfo_free(struct LDKNodeInfo this_obj);
20288
20289 /**
20290  * All valid channels a node has announced
20291  */
20292 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
20293
20294 /**
20295  * Lowest fees enabling routing via any of the enabled, known channels to a node.
20296  * The two fields (flat and proportional fee) are independent,
20297  * meaning they don't have to refer to the same channel.
20298  *
20299  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20300  */
20301 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
20302
20303 /**
20304  * Lowest fees enabling routing via any of the enabled, known channels to a node.
20305  * The two fields (flat and proportional fee) are independent,
20306  * meaning they don't have to refer to the same channel.
20307  *
20308  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20309  */
20310 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20311
20312 /**
20313  * More information about a node from node_announcement.
20314  * Optional because we store a Node entry after learning about it from
20315  * a channel announcement, but before receiving a node announcement.
20316  *
20317  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20318  */
20319 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
20320
20321 /**
20322  * More information about a node from node_announcement.
20323  * Optional because we store a Node entry after learning about it from
20324  * a channel announcement, but before receiving a node announcement.
20325  *
20326  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20327  */
20328 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
20329
20330 /**
20331  * Constructs a new NodeInfo given each field
20332  */
20333 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
20334
20335 /**
20336  * Creates a copy of the NodeInfo
20337  */
20338 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
20339
20340 /**
20341  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
20342  */
20343 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
20344
20345 /**
20346  * Read a NodeInfo from a byte array, created by NodeInfo_write
20347  */
20348 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
20349
20350 /**
20351  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
20352  */
20353 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
20354
20355 /**
20356  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
20357  */
20358 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
20359
20360 /**
20361  * Creates a new, empty, network graph.
20362  */
20363 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
20364
20365 /**
20366  * Returns a read-only view of the network graph.
20367  */
20368 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
20369
20370 /**
20371  * For an already known node (from channel announcements), update its stored properties from a
20372  * given node announcement.
20373  *
20374  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20375  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20376  * routing messages from a source using a protocol other than the lightning P2P protocol.
20377  */
20378 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
20379
20380 /**
20381  * For an already known node (from channel announcements), update its stored properties from a
20382  * given node announcement without verifying the associated signatures. Because we aren't
20383  * given the associated signatures here we cannot relay the node announcement to any of our
20384  * peers.
20385  */
20386 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);
20387
20388 /**
20389  * Store or update channel info from a channel announcement.
20390  *
20391  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20392  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20393  * routing messages from a source using a protocol other than the lightning P2P protocol.
20394  *
20395  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
20396  * the corresponding UTXO exists on chain and is correctly-formatted.
20397  */
20398 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);
20399
20400 /**
20401  * Store or update channel info from a channel announcement without verifying the associated
20402  * signatures. Because we aren't given the associated signatures here we cannot relay the
20403  * channel announcement to any of our peers.
20404  *
20405  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
20406  * the corresponding UTXO exists on chain and is correctly-formatted.
20407  */
20408 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);
20409
20410 /**
20411  * Close a channel if a corresponding HTLC fail was sent.
20412  * If permanent, removes a channel from the local storage.
20413  * May cause the removal of nodes too, if this was their last channel.
20414  * If not permanent, makes channels unavailable for routing.
20415  */
20416 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
20417
20418 /**
20419  * Marks a node in the graph as failed.
20420  */
20421 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
20422
20423 /**
20424  * For an already known (from announcement) channel, update info about one of the directions
20425  * of the channel.
20426  *
20427  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20428  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20429  * routing messages from a source using a protocol other than the lightning P2P protocol.
20430  */
20431 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
20432
20433 /**
20434  * For an already known (from announcement) channel, update info about one of the directions
20435  * of the channel without verifying the associated signatures. Because we aren't given the
20436  * associated signatures here we cannot relay the channel update to any of our peers.
20437  */
20438 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
20439
20440 /**
20441  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
20442  */
20443 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
20444
20445 /**
20446  * Initialize a new FilesystemPersister and set the path to the individual channels'
20447  * files.
20448  */
20449 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
20450
20451 /**
20452  * Get the directory which was provided when this persister was initialized.
20453  */
20454 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
20455
20456 /**
20457  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
20458  * initialization, within a file called \"manager\".
20459  */
20460 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
20461
20462 /**
20463  * Read `ChannelMonitor`s from disk.
20464  */
20465 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
20466
20467 /**
20468  * Constructs a new Persist which calls the relevant methods on this_arg.
20469  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
20470  */
20471 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
20472
20473 /**
20474  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
20475  */
20476 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
20477
20478 /**
20479  * Calls the free function if one is set
20480  */
20481 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
20482
20483 /**
20484  * Start a background thread that takes care of responsibilities enumerated in the [top-level
20485  * documentation].
20486  *
20487  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
20488  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
20489  * either [`join`] or [`stop`].
20490  *
20491  * # Data Persistence
20492  *
20493  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
20494  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
20495  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
20496  * provided implementation.
20497  *
20498  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
20499  * error or call [`join`] and handle any error that may arise. For the latter case,
20500  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
20501  *
20502  * # Event Handling
20503  *
20504  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
20505  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
20506  * functionality implemented by other handlers.
20507  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
20508  *
20509  * [top-level documentation]: Self
20510  * [`join`]: Self::join
20511  * [`stop`]: Self::stop
20512  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
20513  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
20514  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
20515  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
20516  *
20517  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
20518  */
20519 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);
20520
20521 /**
20522  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
20523  * [`ChannelManager`].
20524  *
20525  * # Panics
20526  *
20527  * This function panics if the background thread has panicked such as while persisting or
20528  * handling events.
20529  *
20530  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
20531  */
20532 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
20533
20534 /**
20535  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
20536  * [`ChannelManager`].
20537  *
20538  * # Panics
20539  *
20540  * This function panics if the background thread has panicked such as while persisting or
20541  * handling events.
20542  *
20543  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
20544  */
20545 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
20546
20547 /**
20548  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
20549  *
20550  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
20551  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
20552  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
20553  * since this check is fast we recommend to do it anyway.
20554  *
20555  * If this function fails this is considered a bug. Please open an issue describing your
20556  * platform and stating your current system time.
20557  *
20558  * # Panics
20559  * If the check fails this function panics. By calling this function on startup you ensure that
20560  * this wont happen at an arbitrary later point in time.
20561  */
20562 void check_platform(void);
20563
20564 /**
20565  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
20566  */
20567 void Invoice_free(struct LDKInvoice this_obj);
20568
20569 /**
20570  * Checks if two Invoices contain equal inner contents.
20571  * This ignores pointers and is_owned flags and looks at the values in fields.
20572  * Two objects with NULL inner values will be considered "equal" here.
20573  */
20574 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
20575
20576 /**
20577  * Creates a copy of the Invoice
20578  */
20579 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
20580
20581 /**
20582  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
20583  */
20584 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
20585
20586 /**
20587  * Checks if two SignedRawInvoices contain equal inner contents.
20588  * This ignores pointers and is_owned flags and looks at the values in fields.
20589  * Two objects with NULL inner values will be considered "equal" here.
20590  */
20591 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
20592
20593 /**
20594  * Creates a copy of the SignedRawInvoice
20595  */
20596 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
20597
20598 /**
20599  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
20600  */
20601 void RawInvoice_free(struct LDKRawInvoice this_obj);
20602
20603 /**
20604  * data part
20605  */
20606 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
20607
20608 /**
20609  * data part
20610  */
20611 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
20612
20613 /**
20614  * Checks if two RawInvoices contain equal inner contents.
20615  * This ignores pointers and is_owned flags and looks at the values in fields.
20616  * Two objects with NULL inner values will be considered "equal" here.
20617  */
20618 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
20619
20620 /**
20621  * Creates a copy of the RawInvoice
20622  */
20623 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
20624
20625 /**
20626  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
20627  */
20628 void RawDataPart_free(struct LDKRawDataPart this_obj);
20629
20630 /**
20631  * generation time of the invoice
20632  */
20633 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
20634
20635 /**
20636  * generation time of the invoice
20637  */
20638 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
20639
20640 /**
20641  * Checks if two RawDataParts contain equal inner contents.
20642  * This ignores pointers and is_owned flags and looks at the values in fields.
20643  * Two objects with NULL inner values will be considered "equal" here.
20644  */
20645 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
20646
20647 /**
20648  * Creates a copy of the RawDataPart
20649  */
20650 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
20651
20652 /**
20653  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
20654  */
20655 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
20656
20657 /**
20658  * Checks if two PositiveTimestamps contain equal inner contents.
20659  * This ignores pointers and is_owned flags and looks at the values in fields.
20660  * Two objects with NULL inner values will be considered "equal" here.
20661  */
20662 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
20663
20664 /**
20665  * Creates a copy of the PositiveTimestamp
20666  */
20667 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
20668
20669 /**
20670  * Creates a copy of the SiPrefix
20671  */
20672 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
20673
20674 /**
20675  * Utility method to constructs a new Milli-variant SiPrefix
20676  */
20677 enum LDKSiPrefix SiPrefix_milli(void);
20678
20679 /**
20680  * Utility method to constructs a new Micro-variant SiPrefix
20681  */
20682 enum LDKSiPrefix SiPrefix_micro(void);
20683
20684 /**
20685  * Utility method to constructs a new Nano-variant SiPrefix
20686  */
20687 enum LDKSiPrefix SiPrefix_nano(void);
20688
20689 /**
20690  * Utility method to constructs a new Pico-variant SiPrefix
20691  */
20692 enum LDKSiPrefix SiPrefix_pico(void);
20693
20694 /**
20695  * Checks if two SiPrefixs contain equal inner contents.
20696  * This ignores pointers and is_owned flags and looks at the values in fields.
20697  */
20698 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
20699
20700 /**
20701  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
20702  * This is effectively 10^12 * the prefix multiplier
20703  */
20704 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
20705
20706 /**
20707  * Creates a copy of the Currency
20708  */
20709 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
20710
20711 /**
20712  * Utility method to constructs a new Bitcoin-variant Currency
20713  */
20714 enum LDKCurrency Currency_bitcoin(void);
20715
20716 /**
20717  * Utility method to constructs a new BitcoinTestnet-variant Currency
20718  */
20719 enum LDKCurrency Currency_bitcoin_testnet(void);
20720
20721 /**
20722  * Utility method to constructs a new Regtest-variant Currency
20723  */
20724 enum LDKCurrency Currency_regtest(void);
20725
20726 /**
20727  * Utility method to constructs a new Simnet-variant Currency
20728  */
20729 enum LDKCurrency Currency_simnet(void);
20730
20731 /**
20732  * Utility method to constructs a new Signet-variant Currency
20733  */
20734 enum LDKCurrency Currency_signet(void);
20735
20736 /**
20737  * Checks if two Currencys contain equal inner contents.
20738  */
20739 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
20740
20741 /**
20742  * Checks if two Currencys contain equal inner contents.
20743  * This ignores pointers and is_owned flags and looks at the values in fields.
20744  */
20745 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
20746
20747 /**
20748  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
20749  */
20750 void Sha256_free(struct LDKSha256 this_obj);
20751
20752 /**
20753  * Creates a copy of the Sha256
20754  */
20755 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
20756
20757 /**
20758  * Checks if two Sha256s contain equal inner contents.
20759  */
20760 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
20761
20762 /**
20763  * Checks if two Sha256s contain equal inner contents.
20764  * This ignores pointers and is_owned flags and looks at the values in fields.
20765  * Two objects with NULL inner values will be considered "equal" here.
20766  */
20767 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
20768
20769 /**
20770  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
20771  */
20772 void Description_free(struct LDKDescription this_obj);
20773
20774 /**
20775  * Creates a copy of the Description
20776  */
20777 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
20778
20779 /**
20780  * Checks if two Descriptions contain equal inner contents.
20781  */
20782 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
20783
20784 /**
20785  * Checks if two Descriptions contain equal inner contents.
20786  * This ignores pointers and is_owned flags and looks at the values in fields.
20787  * Two objects with NULL inner values will be considered "equal" here.
20788  */
20789 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
20790
20791 /**
20792  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
20793  */
20794 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
20795
20796 /**
20797  * Creates a copy of the PayeePubKey
20798  */
20799 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
20800
20801 /**
20802  * Checks if two PayeePubKeys contain equal inner contents.
20803  */
20804 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
20805
20806 /**
20807  * Checks if two PayeePubKeys contain equal inner contents.
20808  * This ignores pointers and is_owned flags and looks at the values in fields.
20809  * Two objects with NULL inner values will be considered "equal" here.
20810  */
20811 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
20812
20813 /**
20814  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
20815  */
20816 void ExpiryTime_free(struct LDKExpiryTime this_obj);
20817
20818 /**
20819  * Creates a copy of the ExpiryTime
20820  */
20821 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
20822
20823 /**
20824  * Checks if two ExpiryTimes contain equal inner contents.
20825  */
20826 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
20827
20828 /**
20829  * Checks if two ExpiryTimes contain equal inner contents.
20830  * This ignores pointers and is_owned flags and looks at the values in fields.
20831  * Two objects with NULL inner values will be considered "equal" here.
20832  */
20833 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
20834
20835 /**
20836  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
20837  */
20838 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
20839
20840 /**
20841  * Creates a copy of the MinFinalCltvExpiry
20842  */
20843 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
20844
20845 /**
20846  * Checks if two MinFinalCltvExpirys contain equal inner contents.
20847  */
20848 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
20849
20850 /**
20851  * Checks if two MinFinalCltvExpirys contain equal inner contents.
20852  * This ignores pointers and is_owned flags and looks at the values in fields.
20853  * Two objects with NULL inner values will be considered "equal" here.
20854  */
20855 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
20856
20857 /**
20858  * Frees any resources used by the Fallback
20859  */
20860 void Fallback_free(struct LDKFallback this_ptr);
20861
20862 /**
20863  * Creates a copy of the Fallback
20864  */
20865 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
20866
20867 /**
20868  * Utility method to constructs a new SegWitProgram-variant Fallback
20869  */
20870 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
20871
20872 /**
20873  * Utility method to constructs a new PubKeyHash-variant Fallback
20874  */
20875 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
20876
20877 /**
20878  * Utility method to constructs a new ScriptHash-variant Fallback
20879  */
20880 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
20881
20882 /**
20883  * Checks if two Fallbacks contain equal inner contents.
20884  */
20885 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
20886
20887 /**
20888  * Checks if two Fallbacks contain equal inner contents.
20889  * This ignores pointers and is_owned flags and looks at the values in fields.
20890  */
20891 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
20892
20893 /**
20894  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
20895  */
20896 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
20897
20898 /**
20899  * Creates a copy of the InvoiceSignature
20900  */
20901 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
20902
20903 /**
20904  * Checks if two InvoiceSignatures contain equal inner contents.
20905  * This ignores pointers and is_owned flags and looks at the values in fields.
20906  * Two objects with NULL inner values will be considered "equal" here.
20907  */
20908 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
20909
20910 /**
20911  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
20912  */
20913 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
20914
20915 /**
20916  * Creates a copy of the PrivateRoute
20917  */
20918 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
20919
20920 /**
20921  * Checks if two PrivateRoutes contain equal inner contents.
20922  */
20923 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
20924
20925 /**
20926  * Checks if two PrivateRoutes contain equal inner contents.
20927  * This ignores pointers and is_owned flags and looks at the values in fields.
20928  * Two objects with NULL inner values will be considered "equal" here.
20929  */
20930 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
20931
20932 /**
20933  * Disassembles the `SignedRawInvoice` into its three parts:
20934  *  1. raw invoice
20935  *  2. hash of the raw invoice
20936  *  3. signature
20937  */
20938 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
20939
20940 /**
20941  * The `RawInvoice` which was signed.
20942  */
20943 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
20944
20945 /**
20946  * The hash of the `RawInvoice` that was signed.
20947  */
20948 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
20949
20950 /**
20951  * InvoiceSignature for the invoice.
20952  */
20953 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
20954
20955 /**
20956  * Recovers the public key used for signing the invoice from the recoverable signature.
20957  */
20958 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
20959
20960 /**
20961  * Checks if the signature is valid for the included payee public key or if none exists if it's
20962  * valid for the recovered signature (which should always be true?).
20963  */
20964 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
20965
20966 /**
20967  * Calculate the hash of the encoded `RawInvoice`
20968  */
20969 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
20970
20971 /**
20972  *
20973  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20974  */
20975 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
20976
20977 /**
20978  *
20979  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20980  */
20981 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
20982
20983 /**
20984  *
20985  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20986  */
20987 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
20988
20989 /**
20990  *
20991  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20992  */
20993 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
20994
20995 /**
20996  *
20997  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20998  */
20999 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21000
21001 /**
21002  *
21003  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21004  */
21005 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21006
21007 /**
21008  *
21009  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21010  */
21011 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21012
21013 /**
21014  *
21015  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21016  */
21017 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21018
21019 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21020
21021 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21022
21023 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21024
21025 /**
21026  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
21027  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
21028  * `CreationError::TimestampOutOfBounds`.
21029  */
21030 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
21031
21032 /**
21033  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
21034  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
21035  * `CreationError::TimestampOutOfBounds`.
21036  */
21037 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
21038
21039 /**
21040  * Returns the UNIX timestamp representing the stored time
21041  */
21042 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
21043
21044 /**
21045  * Returns a reference to the internal `SystemTime` time representation
21046  */
21047 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
21048
21049 /**
21050  * Transform the `Invoice` into it's unchecked version
21051  */
21052 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
21053
21054 /**
21055  * Check that the invoice is signed correctly and that key recovery works
21056  */
21057 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
21058
21059 /**
21060  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
21061  * ```
21062  * use lightning_invoice::*;
21063  *
21064  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
21065  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
21066  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
21067  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
21068  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
21069  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
21070  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
21071  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
21072  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
21073  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
21074  * j5r6drg6k6zcqj0fcwg\";
21075  *
21076  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
21077  *
21078  * assert!(Invoice::from_signed(signed).is_ok());
21079  * ```
21080  */
21081 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
21082
21083 /**
21084  * Returns the `Invoice`'s timestamp (should equal it's creation time)
21085  */
21086 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
21087
21088 /**
21089  * Returns the hash to which we will receive the preimage on completion of the payment
21090  */
21091 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
21092
21093 /**
21094  * Get the payee's public key if one was included in the invoice
21095  *
21096  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21097  */
21098 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
21099
21100 /**
21101  * Get the payment secret if one was included in the invoice
21102  */
21103 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
21104
21105 /**
21106  * Get the invoice features if they were included in the invoice
21107  *
21108  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21109  */
21110 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
21111
21112 /**
21113  * Recover the payee's public key (only to be used if none was included in the invoice)
21114  */
21115 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
21116
21117 /**
21118  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
21119  */
21120 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
21121
21122 /**
21123  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
21124  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
21125  */
21126 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
21127
21128 /**
21129  * Returns a list of all routes included in the invoice
21130  */
21131 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
21132
21133 /**
21134  * Returns a list of all routes included in the invoice as the underlying hints
21135  */
21136 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
21137
21138 /**
21139  * Returns the currency for which the invoice was issued
21140  */
21141 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
21142
21143 /**
21144  * Returns the amount if specified in the invoice as pico <currency>.
21145  */
21146 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
21147
21148 /**
21149  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
21150  * returns `CreationError::DescriptionTooLong` otherwise
21151  *
21152  * Please note that single characters may use more than one byte due to UTF8 encoding.
21153  */
21154 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
21155
21156 /**
21157  * Returns the underlying description `String`
21158  */
21159 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
21160
21161 /**
21162  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
21163  * overflow on adding the `EpiryTime` to it then this function will return a
21164  * `CreationError::ExpiryTimeOutOfBounds`.
21165  */
21166 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
21167
21168 /**
21169  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
21170  * would overflow on adding the `EpiryTime` to it then this function will return a
21171  * `CreationError::ExpiryTimeOutOfBounds`.
21172  */
21173 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
21174
21175 /**
21176  * Returns the expiry time in seconds
21177  */
21178 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
21179
21180 /**
21181  * Returns a reference to the underlying `Duration` (=expiry time)
21182  */
21183 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
21184
21185 /**
21186  * Creates a new (partial) route from a list of hops
21187  */
21188 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
21189
21190 /**
21191  * Returns the underlying list of hops
21192  */
21193 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
21194
21195 /**
21196  * Creates a copy of the CreationError
21197  */
21198 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
21199
21200 /**
21201  * Utility method to constructs a new DescriptionTooLong-variant CreationError
21202  */
21203 enum LDKCreationError CreationError_description_too_long(void);
21204
21205 /**
21206  * Utility method to constructs a new RouteTooLong-variant CreationError
21207  */
21208 enum LDKCreationError CreationError_route_too_long(void);
21209
21210 /**
21211  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
21212  */
21213 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
21214
21215 /**
21216  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
21217  */
21218 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
21219
21220 /**
21221  * Checks if two CreationErrors contain equal inner contents.
21222  * This ignores pointers and is_owned flags and looks at the values in fields.
21223  */
21224 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
21225
21226 /**
21227  * Get the string representation of a CreationError object
21228  */
21229 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
21230
21231 /**
21232  * Creates a copy of the SemanticError
21233  */
21234 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
21235
21236 /**
21237  * Utility method to constructs a new NoPaymentHash-variant SemanticError
21238  */
21239 enum LDKSemanticError SemanticError_no_payment_hash(void);
21240
21241 /**
21242  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
21243  */
21244 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
21245
21246 /**
21247  * Utility method to constructs a new NoDescription-variant SemanticError
21248  */
21249 enum LDKSemanticError SemanticError_no_description(void);
21250
21251 /**
21252  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
21253  */
21254 enum LDKSemanticError SemanticError_multiple_descriptions(void);
21255
21256 /**
21257  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
21258  */
21259 enum LDKSemanticError SemanticError_no_payment_secret(void);
21260
21261 /**
21262  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
21263  */
21264 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
21265
21266 /**
21267  * Utility method to constructs a new InvalidFeatures-variant SemanticError
21268  */
21269 enum LDKSemanticError SemanticError_invalid_features(void);
21270
21271 /**
21272  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
21273  */
21274 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
21275
21276 /**
21277  * Utility method to constructs a new InvalidSignature-variant SemanticError
21278  */
21279 enum LDKSemanticError SemanticError_invalid_signature(void);
21280
21281 /**
21282  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
21283  */
21284 enum LDKSemanticError SemanticError_imprecise_amount(void);
21285
21286 /**
21287  * Checks if two SemanticErrors contain equal inner contents.
21288  * This ignores pointers and is_owned flags and looks at the values in fields.
21289  */
21290 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
21291
21292 /**
21293  * Get the string representation of a SemanticError object
21294  */
21295 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
21296
21297 /**
21298  * Frees any resources used by the SignOrCreationError
21299  */
21300 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
21301
21302 /**
21303  * Creates a copy of the SignOrCreationError
21304  */
21305 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
21306
21307 /**
21308  * Utility method to constructs a new SignError-variant SignOrCreationError
21309  */
21310 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
21311
21312 /**
21313  * Utility method to constructs a new CreationError-variant SignOrCreationError
21314  */
21315 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
21316
21317 /**
21318  * Checks if two SignOrCreationErrors contain equal inner contents.
21319  * This ignores pointers and is_owned flags and looks at the values in fields.
21320  */
21321 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
21322
21323 /**
21324  * Get the string representation of a SignOrCreationError object
21325  */
21326 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
21327
21328 /**
21329  * Utility to construct an invoice. Generally, unless you want to do something like a custom
21330  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
21331  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
21332  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
21333  * that the payment secret is valid when the invoice is paid.
21334  */
21335 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);
21336
21337 /**
21338  * Read a SiPrefix object from a string
21339  */
21340 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
21341
21342 /**
21343  * Read a Invoice object from a string
21344  */
21345 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
21346
21347 /**
21348  * Read a SignedRawInvoice object from a string
21349  */
21350 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
21351
21352 /**
21353  * Get the string representation of a Invoice object
21354  */
21355 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
21356
21357 /**
21358  * Get the string representation of a SignedRawInvoice object
21359  */
21360 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
21361
21362 /**
21363  * Get the string representation of a Currency object
21364  */
21365 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
21366
21367 /**
21368  * Get the string representation of a SiPrefix object
21369  */
21370 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
21371
21372 #endif /* LDK_C_BINDINGS_H */
21373
21374 #include "ldk_ver.h"