Merge pull request #46 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Bitcoin signet
172     */
173    LDKCurrency_Signet,
174    /**
175     * Must be last for serialization purposes
176     */
177    LDKCurrency_Sentinel,
178 } LDKCurrency;
179
180 /**
181  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
182  */
183 typedef enum LDKIOError {
184    LDKIOError_NotFound,
185    LDKIOError_PermissionDenied,
186    LDKIOError_ConnectionRefused,
187    LDKIOError_ConnectionReset,
188    LDKIOError_ConnectionAborted,
189    LDKIOError_NotConnected,
190    LDKIOError_AddrInUse,
191    LDKIOError_AddrNotAvailable,
192    LDKIOError_BrokenPipe,
193    LDKIOError_AlreadyExists,
194    LDKIOError_WouldBlock,
195    LDKIOError_InvalidInput,
196    LDKIOError_InvalidData,
197    LDKIOError_TimedOut,
198    LDKIOError_WriteZero,
199    LDKIOError_Interrupted,
200    LDKIOError_Other,
201    LDKIOError_UnexpectedEof,
202    /**
203     * Must be last for serialization purposes
204     */
205    LDKIOError_Sentinel,
206 } LDKIOError;
207
208 /**
209  * An enum representing the available verbosity levels of the logger.
210  */
211 typedef enum LDKLevel {
212    /**
213     * Designates 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::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
3956 /**
3957  * A payment identifier used to uniquely identify a payment to LDK.
3958  */
3959 typedef struct MUST_USE_STRUCT LDKPaymentId {
3960    /**
3961     * A pointer to the opaque Rust object.
3962     * Nearly everywhere, inner must be non-null, however in places where
3963     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3964     */
3965    LDKnativePaymentId *inner;
3966    /**
3967     * Indicates that this is the only struct which contains the same pointer.
3968     * Rust functions which take ownership of an object provided via an argument require
3969     * this to be true and invalidate the object pointed to by inner.
3970     */
3971    bool is_owned;
3972 } LDKPaymentId;
3973
3974 /**
3975  * The contents of CResult_PaymentIdDecodeErrorZ
3976  */
3977 typedef union LDKCResult_PaymentIdDecodeErrorZPtr {
3978    /**
3979     * A pointer to the contents in the success state.
3980     * Reading from this pointer when `result_ok` is not set is undefined.
3981     */
3982    struct LDKPaymentId *result;
3983    /**
3984     * A pointer to the contents in the error state.
3985     * Reading from this pointer when `result_ok` is set is undefined.
3986     */
3987    struct LDKDecodeError *err;
3988 } LDKCResult_PaymentIdDecodeErrorZPtr;
3989
3990 /**
3991  * A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation,
3992  * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::msgs::DecodeError on failure.
3993  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3994  */
3995 typedef struct LDKCResult_PaymentIdDecodeErrorZ {
3996    /**
3997     * The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
3998     * `err` or `result` depending on the state of `result_ok`.
3999     */
4000    union LDKCResult_PaymentIdDecodeErrorZPtr contents;
4001    /**
4002     * Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
4003     */
4004    bool result_ok;
4005 } LDKCResult_PaymentIdDecodeErrorZ;
4006
4007 /**
4008  * An enum which can either contain a u16 or not
4009  */
4010 typedef enum LDKCOption_u16Z_Tag {
4011    /**
4012     * When we're in this state, this COption_u16Z contains a u16
4013     */
4014    LDKCOption_u16Z_Some,
4015    /**
4016     * When we're in this state, this COption_u16Z contains nothing
4017     */
4018    LDKCOption_u16Z_None,
4019    /**
4020     * Must be last for serialization purposes
4021     */
4022    LDKCOption_u16Z_Sentinel,
4023 } LDKCOption_u16Z_Tag;
4024
4025 typedef struct LDKCOption_u16Z {
4026    LDKCOption_u16Z_Tag tag;
4027    union {
4028       struct {
4029          uint16_t some;
4030       };
4031    };
4032 } LDKCOption_u16Z;
4033
4034 /**
4035  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
4036  * too-high values)
4037  */
4038 typedef enum LDKAPIError_Tag {
4039    /**
4040     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
4041     * are documented, but generally indicates some precondition of a function was violated.
4042     */
4043    LDKAPIError_APIMisuseError,
4044    /**
4045     * Due to a high feerate, we were unable to complete the request.
4046     * For example, this may be returned if the feerate implies we cannot open a channel at the
4047     * requested value, but opening a larger channel would succeed.
4048     */
4049    LDKAPIError_FeeRateTooHigh,
4050    /**
4051     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
4052     * too-many-hops, etc).
4053     */
4054    LDKAPIError_RouteError,
4055    /**
4056     * We were unable to complete the request as the Channel required to do so is unable to
4057     * complete the request (or was not found). This can take many forms, including disconnected
4058     * peer, channel at capacity, channel shutting down, etc.
4059     */
4060    LDKAPIError_ChannelUnavailable,
4061    /**
4062     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4063     * attempted action to fail.
4064     */
4065    LDKAPIError_MonitorUpdateFailed,
4066    /**
4067     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
4068     * with the channel counterparty as negotiated in [`InitFeatures`].
4069     *
4070     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
4071     * a channel or cooperatively close one with this peer (and will have to force-close instead).
4072     *
4073     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
4074     * [`InitFeatures`]: crate::ln::features::InitFeatures
4075     */
4076    LDKAPIError_IncompatibleShutdownScript,
4077    /**
4078     * Must be last for serialization purposes
4079     */
4080    LDKAPIError_Sentinel,
4081 } LDKAPIError_Tag;
4082
4083 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4084    /**
4085     * A human-readable error message
4086     */
4087    struct LDKStr err;
4088 } LDKAPIError_LDKAPIMisuseError_Body;
4089
4090 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4091    /**
4092     * A human-readable error message
4093     */
4094    struct LDKStr err;
4095    /**
4096     * The feerate which was too high.
4097     */
4098    uint32_t feerate;
4099 } LDKAPIError_LDKFeeRateTooHigh_Body;
4100
4101 typedef struct LDKAPIError_LDKRouteError_Body {
4102    /**
4103     * A human-readable error message
4104     */
4105    struct LDKStr err;
4106 } LDKAPIError_LDKRouteError_Body;
4107
4108 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4109    /**
4110     * A human-readable error message
4111     */
4112    struct LDKStr err;
4113 } LDKAPIError_LDKChannelUnavailable_Body;
4114
4115 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
4116    /**
4117     * The incompatible shutdown script.
4118     */
4119    struct LDKShutdownScript script;
4120 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
4121
4122 typedef struct MUST_USE_STRUCT LDKAPIError {
4123    LDKAPIError_Tag tag;
4124    union {
4125       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
4126       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
4127       LDKAPIError_LDKRouteError_Body route_error;
4128       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
4129       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
4130    };
4131 } LDKAPIError;
4132
4133 /**
4134  * The contents of CResult_NoneAPIErrorZ
4135  */
4136 typedef union LDKCResult_NoneAPIErrorZPtr {
4137    /**
4138     * Note that this value is always NULL, as there are no contents in the OK variant
4139     */
4140    void *result;
4141    /**
4142     * A pointer to the contents in the error state.
4143     * Reading from this pointer when `result_ok` is set is undefined.
4144     */
4145    struct LDKAPIError *err;
4146 } LDKCResult_NoneAPIErrorZPtr;
4147
4148 /**
4149  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4150  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
4151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4152  */
4153 typedef struct LDKCResult_NoneAPIErrorZ {
4154    /**
4155     * The contents of this CResult_NoneAPIErrorZ, accessible via either
4156     * `err` or `result` depending on the state of `result_ok`.
4157     */
4158    union LDKCResult_NoneAPIErrorZPtr contents;
4159    /**
4160     * Whether this CResult_NoneAPIErrorZ represents a success state.
4161     */
4162    bool result_ok;
4163 } LDKCResult_NoneAPIErrorZ;
4164
4165 /**
4166  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4167  * This corresponds to std::vector in C++
4168  */
4169 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
4170    /**
4171     * The elements in the array.
4172     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4173     */
4174    struct LDKCResult_NoneAPIErrorZ *data;
4175    /**
4176     * The number of elements pointed to by `data`.
4177     */
4178    uintptr_t datalen;
4179 } LDKCVec_CResult_NoneAPIErrorZZ;
4180
4181 /**
4182  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4183  * This corresponds to std::vector in C++
4184  */
4185 typedef struct LDKCVec_APIErrorZ {
4186    /**
4187     * The elements in the array.
4188     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4189     */
4190    struct LDKAPIError *data;
4191    /**
4192     * The number of elements pointed to by `data`.
4193     */
4194    uintptr_t datalen;
4195 } LDKCVec_APIErrorZ;
4196
4197 /**
4198  * The contents of CResult__u832APIErrorZ
4199  */
4200 typedef union LDKCResult__u832APIErrorZPtr {
4201    /**
4202     * A pointer to the contents in the success state.
4203     * Reading from this pointer when `result_ok` is not set is undefined.
4204     */
4205    struct LDKThirtyTwoBytes *result;
4206    /**
4207     * A pointer to the contents in the error state.
4208     * Reading from this pointer when `result_ok` is set is undefined.
4209     */
4210    struct LDKAPIError *err;
4211 } LDKCResult__u832APIErrorZPtr;
4212
4213 /**
4214  * A CResult__u832APIErrorZ represents the result of a fallible operation,
4215  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4216  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4217  */
4218 typedef struct LDKCResult__u832APIErrorZ {
4219    /**
4220     * The contents of this CResult__u832APIErrorZ, accessible via either
4221     * `err` or `result` depending on the state of `result_ok`.
4222     */
4223    union LDKCResult__u832APIErrorZPtr contents;
4224    /**
4225     * Whether this CResult__u832APIErrorZ represents a success state.
4226     */
4227    bool result_ok;
4228 } LDKCResult__u832APIErrorZ;
4229
4230 /**
4231  * If a payment fails to send, it can be in one of several states. This enum is returned as the
4232  * Err() type describing which state the payment is in, see the description of individual enum
4233  * states for more.
4234  */
4235 typedef enum LDKPaymentSendFailure_Tag {
4236    /**
4237     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
4238     * send the payment at all. No channel state has been changed or messages sent to peers, and
4239     * once you've changed the parameter at error, you can freely retry the payment in full.
4240     */
4241    LDKPaymentSendFailure_ParameterError,
4242    /**
4243     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4244     * from attempting to send the payment at all. No channel state has been changed or messages
4245     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4246     * payment in full.
4247     *
4248     * The results here are ordered the same as the paths in the route object which was passed to
4249     * send_payment.
4250     */
4251    LDKPaymentSendFailure_PathParameterError,
4252    /**
4253     * All paths which were attempted failed to send, with no channel state change taking place.
4254     * You can freely retry the payment in full (though you probably want to do so over different
4255     * paths than the ones selected).
4256     */
4257    LDKPaymentSendFailure_AllFailedRetrySafe,
4258    /**
4259     * Some paths which were attempted failed to send, though possibly not all. At least some
4260     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4261     * in over-/re-payment.
4262     *
4263     * The results here are ordered the same as the paths in the route object which was passed to
4264     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4265     * retried (though there is currently no API with which to do so).
4266     *
4267     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4268     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4269     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4270     * with the latest update_id.
4271     */
4272    LDKPaymentSendFailure_PartialFailure,
4273    /**
4274     * Must be last for serialization purposes
4275     */
4276    LDKPaymentSendFailure_Sentinel,
4277 } LDKPaymentSendFailure_Tag;
4278
4279 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4280    LDKPaymentSendFailure_Tag tag;
4281    union {
4282       struct {
4283          struct LDKAPIError parameter_error;
4284       };
4285       struct {
4286          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4287       };
4288       struct {
4289          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4290       };
4291       struct {
4292          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
4293       };
4294    };
4295 } LDKPaymentSendFailure;
4296
4297 /**
4298  * The contents of CResult_PaymentIdPaymentSendFailureZ
4299  */
4300 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
4301    /**
4302     * A pointer to the contents in the success state.
4303     * Reading from this pointer when `result_ok` is not set is undefined.
4304     */
4305    struct LDKPaymentId *result;
4306    /**
4307     * A pointer to the contents in the error state.
4308     * Reading from this pointer when `result_ok` is set is undefined.
4309     */
4310    struct LDKPaymentSendFailure *err;
4311 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
4312
4313 /**
4314  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4315  * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4316  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4317  */
4318 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
4319    /**
4320     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4321     * `err` or `result` depending on the state of `result_ok`.
4322     */
4323    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
4324    /**
4325     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4326     */
4327    bool result_ok;
4328 } LDKCResult_PaymentIdPaymentSendFailureZ;
4329
4330 /**
4331  * The contents of CResult_NonePaymentSendFailureZ
4332  */
4333 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4334    /**
4335     * Note that this value is always NULL, as there are no contents in the OK variant
4336     */
4337    void *result;
4338    /**
4339     * A pointer to the contents in the error state.
4340     * Reading from this pointer when `result_ok` is set is undefined.
4341     */
4342    struct LDKPaymentSendFailure *err;
4343 } LDKCResult_NonePaymentSendFailureZPtr;
4344
4345 /**
4346  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4347  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4349  */
4350 typedef struct LDKCResult_NonePaymentSendFailureZ {
4351    /**
4352     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4353     * `err` or `result` depending on the state of `result_ok`.
4354     */
4355    union LDKCResult_NonePaymentSendFailureZPtr contents;
4356    /**
4357     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4358     */
4359    bool result_ok;
4360 } LDKCResult_NonePaymentSendFailureZ;
4361
4362 /**
4363  * A tuple of 2 elements. See the individual fields for the types contained.
4364  */
4365 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
4366    /**
4367     * The element at position 0
4368     */
4369    struct LDKThirtyTwoBytes a;
4370    /**
4371     * The element at position 1
4372     */
4373    struct LDKPaymentId b;
4374 } LDKC2Tuple_PaymentHashPaymentIdZ;
4375
4376 /**
4377  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
4378  */
4379 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4380    /**
4381     * A pointer to the contents in the success state.
4382     * Reading from this pointer when `result_ok` is not set is undefined.
4383     */
4384    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
4385    /**
4386     * A pointer to the contents in the error state.
4387     * Reading from this pointer when `result_ok` is set is undefined.
4388     */
4389    struct LDKPaymentSendFailure *err;
4390 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
4391
4392 /**
4393  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
4394  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4395  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4396  */
4397 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4398    /**
4399     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
4400     * `err` or `result` depending on the state of `result_ok`.
4401     */
4402    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
4403    /**
4404     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
4405     */
4406    bool result_ok;
4407 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
4408
4409 /**
4410  * A 4-byte byte array.
4411  */
4412 typedef struct LDKFourBytes {
4413    /**
4414     * The four bytes
4415     */
4416    uint8_t data[4];
4417 } LDKFourBytes;
4418
4419 /**
4420  * A 16-byte byte array.
4421  */
4422 typedef struct LDKSixteenBytes {
4423    /**
4424     * The sixteen bytes
4425     */
4426    uint8_t data[16];
4427 } LDKSixteenBytes;
4428
4429 /**
4430  * A 10-byte byte array.
4431  */
4432 typedef struct LDKTenBytes {
4433    /**
4434     * The ten bytes
4435     */
4436    uint8_t data[10];
4437 } LDKTenBytes;
4438
4439 /**
4440  * An address which can be used to connect to a remote peer
4441  */
4442 typedef enum LDKNetAddress_Tag {
4443    /**
4444     * An IPv4 address/port on which the peer is listening.
4445     */
4446    LDKNetAddress_IPv4,
4447    /**
4448     * An IPv6 address/port on which the peer is listening.
4449     */
4450    LDKNetAddress_IPv6,
4451    /**
4452     * An old-style Tor onion address/port on which the peer is listening.
4453     */
4454    LDKNetAddress_OnionV2,
4455    /**
4456     * A new-style Tor onion address/port on which the peer is listening.
4457     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4458     * wrap as base32 and append \".onion\".
4459     */
4460    LDKNetAddress_OnionV3,
4461    /**
4462     * Must be last for serialization purposes
4463     */
4464    LDKNetAddress_Sentinel,
4465 } LDKNetAddress_Tag;
4466
4467 typedef struct LDKNetAddress_LDKIPv4_Body {
4468    /**
4469     * The 4-byte IPv4 address
4470     */
4471    struct LDKFourBytes addr;
4472    /**
4473     * The port on which the node is listening
4474     */
4475    uint16_t port;
4476 } LDKNetAddress_LDKIPv4_Body;
4477
4478 typedef struct LDKNetAddress_LDKIPv6_Body {
4479    /**
4480     * The 16-byte IPv6 address
4481     */
4482    struct LDKSixteenBytes addr;
4483    /**
4484     * The port on which the node is listening
4485     */
4486    uint16_t port;
4487 } LDKNetAddress_LDKIPv6_Body;
4488
4489 typedef struct LDKNetAddress_LDKOnionV2_Body {
4490    /**
4491     * The bytes (usually encoded in base32 with \".onion\" appended)
4492     */
4493    struct LDKTenBytes addr;
4494    /**
4495     * The port on which the node is listening
4496     */
4497    uint16_t port;
4498 } LDKNetAddress_LDKOnionV2_Body;
4499
4500 typedef struct LDKNetAddress_LDKOnionV3_Body {
4501    /**
4502     * The ed25519 long-term public key of the peer
4503     */
4504    struct LDKThirtyTwoBytes ed25519_pubkey;
4505    /**
4506     * The checksum of the pubkey and version, as included in the onion address
4507     */
4508    uint16_t checksum;
4509    /**
4510     * The version byte, as defined by the Tor Onion v3 spec.
4511     */
4512    uint8_t version;
4513    /**
4514     * The port on which the node is listening
4515     */
4516    uint16_t port;
4517 } LDKNetAddress_LDKOnionV3_Body;
4518
4519 typedef struct MUST_USE_STRUCT LDKNetAddress {
4520    LDKNetAddress_Tag tag;
4521    union {
4522       LDKNetAddress_LDKIPv4_Body i_pv4;
4523       LDKNetAddress_LDKIPv6_Body i_pv6;
4524       LDKNetAddress_LDKOnionV2_Body onion_v2;
4525       LDKNetAddress_LDKOnionV3_Body onion_v3;
4526    };
4527 } LDKNetAddress;
4528
4529 /**
4530  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4531  * This corresponds to std::vector in C++
4532  */
4533 typedef struct LDKCVec_NetAddressZ {
4534    /**
4535     * The elements in the array.
4536     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4537     */
4538    struct LDKNetAddress *data;
4539    /**
4540     * The number of elements pointed to by `data`.
4541     */
4542    uintptr_t datalen;
4543 } LDKCVec_NetAddressZ;
4544
4545 /**
4546  * A tuple of 2 elements. See the individual fields for the types contained.
4547  */
4548 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4549    /**
4550     * The element at position 0
4551     */
4552    struct LDKThirtyTwoBytes a;
4553    /**
4554     * The element at position 1
4555     */
4556    struct LDKThirtyTwoBytes b;
4557 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4558
4559 /**
4560  * The contents of CResult_PaymentSecretAPIErrorZ
4561  */
4562 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4563    /**
4564     * A pointer to the contents in the success state.
4565     * Reading from this pointer when `result_ok` is not set is undefined.
4566     */
4567    struct LDKThirtyTwoBytes *result;
4568    /**
4569     * A pointer to the contents in the error state.
4570     * Reading from this pointer when `result_ok` is set is undefined.
4571     */
4572    struct LDKAPIError *err;
4573 } LDKCResult_PaymentSecretAPIErrorZPtr;
4574
4575 /**
4576  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4577  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4578  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4579  */
4580 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4581    /**
4582     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4583     * `err` or `result` depending on the state of `result_ok`.
4584     */
4585    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4586    /**
4587     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4588     */
4589    bool result_ok;
4590 } LDKCResult_PaymentSecretAPIErrorZ;
4591
4592 /**
4593  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4594  * This corresponds to std::vector in C++
4595  */
4596 typedef struct LDKCVec_ChannelMonitorZ {
4597    /**
4598     * The elements in the array.
4599     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4600     */
4601    struct LDKChannelMonitor *data;
4602    /**
4603     * The number of elements pointed to by `data`.
4604     */
4605    uintptr_t datalen;
4606 } LDKCVec_ChannelMonitorZ;
4607
4608
4609
4610 /**
4611  * An update generated by the underlying Channel itself which contains some new information the
4612  * ChannelMonitor should be made aware of.
4613  */
4614 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4615    /**
4616     * A pointer to the opaque Rust object.
4617     * Nearly everywhere, inner must be non-null, however in places where
4618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4619     */
4620    LDKnativeChannelMonitorUpdate *inner;
4621    /**
4622     * Indicates that this is the only struct which contains the same pointer.
4623     * Rust functions which take ownership of an object provided via an argument require
4624     * this to be true and invalidate the object pointed to by inner.
4625     */
4626    bool is_owned;
4627 } LDKChannelMonitorUpdate;
4628
4629 /**
4630  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4631  * blocks are connected and disconnected.
4632  *
4633  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4634  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4635  * channel state changes and HTLCs are resolved. See method documentation for specific
4636  * requirements.
4637  *
4638  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4639  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4640  * without taking any further action such as persisting the current state.
4641  *
4642  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4643  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4644  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4645  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4646  * multiple instances.
4647  *
4648  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
4649  */
4650 typedef struct LDKWatch {
4651    /**
4652     * An opaque pointer which is passed to your function implementations as an argument.
4653     * This has no meaning in the LDK, and can be NULL or any other value.
4654     */
4655    void *this_arg;
4656    /**
4657     * Watches a channel identified by `funding_txo` using `monitor`.
4658     *
4659     * Implementations are responsible for watching the chain for the funding transaction along
4660     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4661     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4662     *
4663     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
4664     * the given `funding_txo` has previously been registered via `watch_channel`.
4665     *
4666     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4667     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4668     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4669     */
4670    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4671    /**
4672     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4673     *
4674     * Implementations must call [`update_monitor`] with the given update. See
4675     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4676     *
4677     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4678     */
4679    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4680    /**
4681     * Returns any monitor events since the last call. Subsequent calls must only return new
4682     * events.
4683     */
4684    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
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 } LDKWatch;
4691
4692 /**
4693  * An interface to send a transaction to the Bitcoin network.
4694  */
4695 typedef struct LDKBroadcasterInterface {
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     * Sends a transaction out to (hopefully) be mined.
4703     */
4704    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
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 } LDKBroadcasterInterface;
4711
4712 /**
4713  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4714  * own the memory pointed to by data.
4715  */
4716 typedef struct LDKu8slice {
4717    /**
4718     * A pointer to the byte buffer
4719     */
4720    const uint8_t *data;
4721    /**
4722     * The number of bytes pointed to by `data`.
4723     */
4724    uintptr_t datalen;
4725 } LDKu8slice;
4726
4727 /**
4728  * A trait to describe an object which can get user secrets and key material.
4729  */
4730 typedef struct LDKKeysInterface {
4731    /**
4732     * An opaque pointer which is passed to your function implementations as an argument.
4733     * This has no meaning in the LDK, and can be NULL or any other value.
4734     */
4735    void *this_arg;
4736    /**
4737     * Get node secret key (aka node_id or network_key).
4738     *
4739     * This method must return the same value each time it is called.
4740     */
4741    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4742    /**
4743     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4744     *
4745     * This method should return a different value each time it is called, to avoid linking
4746     * on-chain funds across channels as controlled to the same user.
4747     */
4748    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4749    /**
4750     * Get a script pubkey which we will send funds to when closing a channel.
4751     *
4752     * This method should return a different value each time it is called, to avoid linking
4753     * on-chain funds across channels as controlled to the same user.
4754     */
4755    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
4756    /**
4757     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4758     * restarted with some stale data!
4759     *
4760     * This method must return a different value each time it is called.
4761     */
4762    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4763    /**
4764     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4765     * onion packets and for temporary channel IDs. There is no requirement that these be
4766     * persisted anywhere, though they must be unique across restarts.
4767     *
4768     * This method must return a different value each time it is called.
4769     */
4770    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4771    /**
4772     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4773     * This is only called during deserialization of other objects which contain
4774     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4775     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4776     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4777     * you've read all of the provided bytes to ensure no corruption occurred.
4778     */
4779    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4780    /**
4781     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4782     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4783     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4784     * blindly signing the hash.
4785     */
4786    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4787    /**
4788     * Frees any resources associated with this object given its this_arg pointer.
4789     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4790     */
4791    void (*free)(void *this_arg);
4792 } LDKKeysInterface;
4793
4794 /**
4795  * A trait which should be implemented to provide feerate information on a number of time
4796  * horizons.
4797  *
4798  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4799  * called from inside the library in response to chain events, P2P events, or timer events).
4800  */
4801 typedef struct LDKFeeEstimator {
4802    /**
4803     * An opaque pointer which is passed to your function implementations as an argument.
4804     * This has no meaning in the LDK, and can be NULL or any other value.
4805     */
4806    void *this_arg;
4807    /**
4808     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4809     *
4810     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4811     * don't put us below 1 satoshi-per-byte).
4812     *
4813     * This translates to:
4814     *  * satoshis-per-byte * 250
4815     *  * ceil(satoshis-per-kbyte / 4)
4816     */
4817    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4818    /**
4819     * Frees any resources associated with this object given its this_arg pointer.
4820     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4821     */
4822    void (*free)(void *this_arg);
4823 } LDKFeeEstimator;
4824
4825 /**
4826  * A trait encapsulating the operations required of a logger
4827  */
4828 typedef struct LDKLogger {
4829    /**
4830     * An opaque pointer which is passed to your function implementations as an argument.
4831     * This has no meaning in the LDK, and can be NULL or any other value.
4832     */
4833    void *this_arg;
4834    /**
4835     * Logs the `Record`
4836     */
4837    void (*log)(const void *this_arg, const char *record);
4838    /**
4839     * Frees any resources associated with this object given its this_arg pointer.
4840     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4841     */
4842    void (*free)(void *this_arg);
4843 } LDKLogger;
4844
4845
4846
4847 /**
4848  * Manager which keeps track of a number of channels and sends messages to the appropriate
4849  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4850  *
4851  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4852  * to individual Channels.
4853  *
4854  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4855  * all peers during write/read (though does not modify this instance, only the instance being
4856  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4857  * called funding_transaction_generated for outbound channels).
4858  *
4859  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4860  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4861  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4862  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4863  * the serialization process). If the deserialized version is out-of-date compared to the
4864  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4865  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4866  *
4867  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4868  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4869  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4870  * block_connected() to step towards your best block) upon deserialization before using the
4871  * object!
4872  *
4873  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4874  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4875  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4876  * offline for a full minute. In order to track this, you must call
4877  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4878  *
4879  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4880  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4881  * essentially you should default to using a SimpleRefChannelManager, and use a
4882  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4883  * you're using lightning-net-tokio.
4884  */
4885 typedef struct MUST_USE_STRUCT LDKChannelManager {
4886    /**
4887     * A pointer to the opaque Rust object.
4888     * Nearly everywhere, inner must be non-null, however in places where
4889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4890     */
4891    LDKnativeChannelManager *inner;
4892    /**
4893     * Indicates that this is the only struct which contains the same pointer.
4894     * Rust functions which take ownership of an object provided via an argument require
4895     * this to be true and invalidate the object pointed to by inner.
4896     */
4897    bool is_owned;
4898 } LDKChannelManager;
4899
4900 /**
4901  * A tuple of 2 elements. See the individual fields for the types contained.
4902  */
4903 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4904    /**
4905     * The element at position 0
4906     */
4907    struct LDKThirtyTwoBytes a;
4908    /**
4909     * The element at position 1
4910     */
4911    struct LDKChannelManager b;
4912 } LDKC2Tuple_BlockHashChannelManagerZ;
4913
4914 /**
4915  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4916  */
4917 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4918    /**
4919     * A pointer to the contents in the success state.
4920     * Reading from this pointer when `result_ok` is not set is undefined.
4921     */
4922    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4923    /**
4924     * A pointer to the contents in the error state.
4925     * Reading from this pointer when `result_ok` is set is undefined.
4926     */
4927    struct LDKDecodeError *err;
4928 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4929
4930 /**
4931  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4932  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4933  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4934  */
4935 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4936    /**
4937     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4938     * `err` or `result` depending on the state of `result_ok`.
4939     */
4940    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4941    /**
4942     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4943     */
4944    bool result_ok;
4945 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4946
4947
4948
4949 /**
4950  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4951  * with our counterparty.
4952  */
4953 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4954    /**
4955     * A pointer to the opaque Rust object.
4956     * Nearly everywhere, inner must be non-null, however in places where
4957     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4958     */
4959    LDKnativeChannelConfig *inner;
4960    /**
4961     * Indicates that this is the only struct which contains the same pointer.
4962     * Rust functions which take ownership of an object provided via an argument require
4963     * this to be true and invalidate the object pointed to by inner.
4964     */
4965    bool is_owned;
4966 } LDKChannelConfig;
4967
4968 /**
4969  * The contents of CResult_ChannelConfigDecodeErrorZ
4970  */
4971 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4972    /**
4973     * A pointer to the contents in the success state.
4974     * Reading from this pointer when `result_ok` is not set is undefined.
4975     */
4976    struct LDKChannelConfig *result;
4977    /**
4978     * A pointer to the contents in the error state.
4979     * Reading from this pointer when `result_ok` is set is undefined.
4980     */
4981    struct LDKDecodeError *err;
4982 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4983
4984 /**
4985  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4986  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4987  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4988  */
4989 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4990    /**
4991     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4992     * `err` or `result` depending on the state of `result_ok`.
4993     */
4994    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4995    /**
4996     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4997     */
4998    bool result_ok;
4999 } LDKCResult_ChannelConfigDecodeErrorZ;
5000
5001 /**
5002  * The contents of CResult_OutPointDecodeErrorZ
5003  */
5004 typedef union LDKCResult_OutPointDecodeErrorZPtr {
5005    /**
5006     * A pointer to the contents in the success state.
5007     * Reading from this pointer when `result_ok` is not set is undefined.
5008     */
5009    struct LDKOutPoint *result;
5010    /**
5011     * A pointer to the contents in the error state.
5012     * Reading from this pointer when `result_ok` is set is undefined.
5013     */
5014    struct LDKDecodeError *err;
5015 } LDKCResult_OutPointDecodeErrorZPtr;
5016
5017 /**
5018  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5019  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5020  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5021  */
5022 typedef struct LDKCResult_OutPointDecodeErrorZ {
5023    /**
5024     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5025     * `err` or `result` depending on the state of `result_ok`.
5026     */
5027    union LDKCResult_OutPointDecodeErrorZPtr contents;
5028    /**
5029     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
5030     */
5031    bool result_ok;
5032 } LDKCResult_OutPointDecodeErrorZ;
5033
5034 /**
5035  * Defines a type identifier for sending messages over the wire.
5036  *
5037  * Messages implementing this trait specify a type and must be [`Writeable`].
5038  */
5039 typedef struct LDKType {
5040    /**
5041     * An opaque pointer which is passed to your function implementations as an argument.
5042     * This has no meaning in the LDK, and can be NULL or any other value.
5043     */
5044    void *this_arg;
5045    /**
5046     * Returns the type identifying the message payload.
5047     */
5048    uint16_t (*type_id)(const void *this_arg);
5049    /**
5050     * Return a human-readable "debug" string describing this object
5051     */
5052    struct LDKStr (*debug_str)(const void *this_arg);
5053    /**
5054     * Serialize the object into a byte array
5055     */
5056    struct LDKCVec_u8Z (*write)(const void *this_arg);
5057    /**
5058     * Frees any resources associated with this object given its this_arg pointer.
5059     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5060     */
5061    void (*free)(void *this_arg);
5062 } LDKType;
5063
5064 /**
5065  * An enum which can either contain a crate::lightning::ln::wire::Type or not
5066  */
5067 typedef enum LDKCOption_TypeZ_Tag {
5068    /**
5069     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5070     */
5071    LDKCOption_TypeZ_Some,
5072    /**
5073     * When we're in this state, this COption_TypeZ contains nothing
5074     */
5075    LDKCOption_TypeZ_None,
5076    /**
5077     * Must be last for serialization purposes
5078     */
5079    LDKCOption_TypeZ_Sentinel,
5080 } LDKCOption_TypeZ_Tag;
5081
5082 typedef struct LDKCOption_TypeZ {
5083    LDKCOption_TypeZ_Tag tag;
5084    union {
5085       struct {
5086          struct LDKType some;
5087       };
5088    };
5089 } LDKCOption_TypeZ;
5090
5091 /**
5092  * The contents of CResult_COption_TypeZDecodeErrorZ
5093  */
5094 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
5095    /**
5096     * A pointer to the contents in the success state.
5097     * Reading from this pointer when `result_ok` is not set is undefined.
5098     */
5099    struct LDKCOption_TypeZ *result;
5100    /**
5101     * A pointer to the contents in the error state.
5102     * Reading from this pointer when `result_ok` is set is undefined.
5103     */
5104    struct LDKDecodeError *err;
5105 } LDKCResult_COption_TypeZDecodeErrorZPtr;
5106
5107 /**
5108  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5109  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5111  */
5112 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
5113    /**
5114     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5115     * `err` or `result` depending on the state of `result_ok`.
5116     */
5117    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
5118    /**
5119     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5120     */
5121    bool result_ok;
5122 } LDKCResult_COption_TypeZDecodeErrorZ;
5123
5124 /**
5125  * The contents of CResult_SiPrefixNoneZ
5126  */
5127 typedef union LDKCResult_SiPrefixNoneZPtr {
5128    /**
5129     * A pointer to the contents in the success state.
5130     * Reading from this pointer when `result_ok` is not set is undefined.
5131     */
5132    enum LDKSiPrefix *result;
5133    /**
5134     * Note that this value is always NULL, as there are no contents in the Err variant
5135     */
5136    void *err;
5137 } LDKCResult_SiPrefixNoneZPtr;
5138
5139 /**
5140  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5141  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5142  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5143  */
5144 typedef struct LDKCResult_SiPrefixNoneZ {
5145    /**
5146     * The contents of this CResult_SiPrefixNoneZ, accessible via either
5147     * `err` or `result` depending on the state of `result_ok`.
5148     */
5149    union LDKCResult_SiPrefixNoneZPtr contents;
5150    /**
5151     * Whether this CResult_SiPrefixNoneZ represents a success state.
5152     */
5153    bool result_ok;
5154 } LDKCResult_SiPrefixNoneZ;
5155
5156
5157
5158 /**
5159  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
5160  *
5161  * There are three ways to construct an `Invoice`:
5162  *  1. using `InvoiceBuilder`
5163  *  2. using `Invoice::from_signed(SignedRawInvoice)`
5164  *  3. using `str::parse::<Invoice>(&str)`
5165  */
5166 typedef struct MUST_USE_STRUCT LDKInvoice {
5167    /**
5168     * A pointer to the opaque Rust object.
5169     * Nearly everywhere, inner must be non-null, however in places where
5170     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5171     */
5172    LDKnativeInvoice *inner;
5173    /**
5174     * Indicates that this is the only struct which contains the same pointer.
5175     * Rust functions which take ownership of an object provided via an argument require
5176     * this to be true and invalidate the object pointed to by inner.
5177     */
5178    bool is_owned;
5179 } LDKInvoice;
5180
5181 /**
5182  * The contents of CResult_InvoiceNoneZ
5183  */
5184 typedef union LDKCResult_InvoiceNoneZPtr {
5185    /**
5186     * A pointer to the contents in the success state.
5187     * Reading from this pointer when `result_ok` is not set is undefined.
5188     */
5189    struct LDKInvoice *result;
5190    /**
5191     * Note that this value is always NULL, as there are no contents in the Err variant
5192     */
5193    void *err;
5194 } LDKCResult_InvoiceNoneZPtr;
5195
5196 /**
5197  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
5198  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
5199  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5200  */
5201 typedef struct LDKCResult_InvoiceNoneZ {
5202    /**
5203     * The contents of this CResult_InvoiceNoneZ, accessible via either
5204     * `err` or `result` depending on the state of `result_ok`.
5205     */
5206    union LDKCResult_InvoiceNoneZPtr contents;
5207    /**
5208     * Whether this CResult_InvoiceNoneZ represents a success state.
5209     */
5210    bool result_ok;
5211 } LDKCResult_InvoiceNoneZ;
5212
5213
5214
5215 /**
5216  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
5217  * invalid.
5218  *
5219  * # Invariants
5220  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
5221  */
5222 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
5223    /**
5224     * A pointer to the opaque Rust object.
5225     * Nearly everywhere, inner must be non-null, however in places where
5226     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5227     */
5228    LDKnativeSignedRawInvoice *inner;
5229    /**
5230     * Indicates that this is the only struct which contains the same pointer.
5231     * Rust functions which take ownership of an object provided via an argument require
5232     * this to be true and invalidate the object pointed to by inner.
5233     */
5234    bool is_owned;
5235 } LDKSignedRawInvoice;
5236
5237 /**
5238  * The contents of CResult_SignedRawInvoiceNoneZ
5239  */
5240 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
5241    /**
5242     * A pointer to the contents in the success state.
5243     * Reading from this pointer when `result_ok` is not set is undefined.
5244     */
5245    struct LDKSignedRawInvoice *result;
5246    /**
5247     * Note that this value is always NULL, as there are no contents in the Err variant
5248     */
5249    void *err;
5250 } LDKCResult_SignedRawInvoiceNoneZPtr;
5251
5252 /**
5253  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5254  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5255  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5256  */
5257 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
5258    /**
5259     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5260     * `err` or `result` depending on the state of `result_ok`.
5261     */
5262    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
5263    /**
5264     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5265     */
5266    bool result_ok;
5267 } LDKCResult_SignedRawInvoiceNoneZ;
5268
5269
5270
5271 /**
5272  * Represents an syntactically correct Invoice for a payment on the lightning network,
5273  * but without the signature information.
5274  * De- and encoding should not lead to information loss but may lead to different hashes.
5275  *
5276  * For methods without docs see the corresponding methods in `Invoice`.
5277  */
5278 typedef struct MUST_USE_STRUCT LDKRawInvoice {
5279    /**
5280     * A pointer to the opaque Rust object.
5281     * Nearly everywhere, inner must be non-null, however in places where
5282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5283     */
5284    LDKnativeRawInvoice *inner;
5285    /**
5286     * Indicates that this is the only struct which contains the same pointer.
5287     * Rust functions which take ownership of an object provided via an argument require
5288     * this to be true and invalidate the object pointed to by inner.
5289     */
5290    bool is_owned;
5291 } LDKRawInvoice;
5292
5293
5294
5295 /**
5296  * Recoverable signature
5297  */
5298 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
5299    /**
5300     * A pointer to the opaque Rust object.
5301     * Nearly everywhere, inner must be non-null, however in places where
5302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5303     */
5304    LDKnativeInvoiceSignature *inner;
5305    /**
5306     * Indicates that this is the only struct which contains the same pointer.
5307     * Rust functions which take ownership of an object provided via an argument require
5308     * this to be true and invalidate the object pointed to by inner.
5309     */
5310    bool is_owned;
5311 } LDKInvoiceSignature;
5312
5313 /**
5314  * A tuple of 3 elements. See the individual fields for the types contained.
5315  */
5316 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
5317    /**
5318     * The element at position 0
5319     */
5320    struct LDKRawInvoice a;
5321    /**
5322     * The element at position 1
5323     */
5324    struct LDKThirtyTwoBytes b;
5325    /**
5326     * The element at position 2
5327     */
5328    struct LDKInvoiceSignature c;
5329 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
5330
5331
5332
5333 /**
5334  * Payee public key
5335  */
5336 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
5337    /**
5338     * A pointer to the opaque Rust object.
5339     * Nearly everywhere, inner must be non-null, however in places where
5340     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5341     */
5342    LDKnativePayeePubKey *inner;
5343    /**
5344     * Indicates that this is the only struct which contains the same pointer.
5345     * Rust functions which take ownership of an object provided via an argument require
5346     * this to be true and invalidate the object pointed to by inner.
5347     */
5348    bool is_owned;
5349 } LDKPayeePubKey;
5350
5351 /**
5352  * The contents of CResult_PayeePubKeyErrorZ
5353  */
5354 typedef union LDKCResult_PayeePubKeyErrorZPtr {
5355    /**
5356     * A pointer to the contents in the success state.
5357     * Reading from this pointer when `result_ok` is not set is undefined.
5358     */
5359    struct LDKPayeePubKey *result;
5360    /**
5361     * A pointer to the contents in the error state.
5362     * Reading from this pointer when `result_ok` is set is undefined.
5363     */
5364    enum LDKSecp256k1Error *err;
5365 } LDKCResult_PayeePubKeyErrorZPtr;
5366
5367 /**
5368  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5369  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5370  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5371  */
5372 typedef struct LDKCResult_PayeePubKeyErrorZ {
5373    /**
5374     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5375     * `err` or `result` depending on the state of `result_ok`.
5376     */
5377    union LDKCResult_PayeePubKeyErrorZPtr contents;
5378    /**
5379     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
5380     */
5381    bool result_ok;
5382 } LDKCResult_PayeePubKeyErrorZ;
5383
5384
5385
5386 /**
5387  * Private routing information
5388  *
5389  * # Invariants
5390  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
5391  *
5392  */
5393 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
5394    /**
5395     * A pointer to the opaque Rust object.
5396     * Nearly everywhere, inner must be non-null, however in places where
5397     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5398     */
5399    LDKnativePrivateRoute *inner;
5400    /**
5401     * Indicates that this is the only struct which contains the same pointer.
5402     * Rust functions which take ownership of an object provided via an argument require
5403     * this to be true and invalidate the object pointed to by inner.
5404     */
5405    bool is_owned;
5406 } LDKPrivateRoute;
5407
5408 /**
5409  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5410  * This corresponds to std::vector in C++
5411  */
5412 typedef struct LDKCVec_PrivateRouteZ {
5413    /**
5414     * The elements in the array.
5415     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5416     */
5417    struct LDKPrivateRoute *data;
5418    /**
5419     * The number of elements pointed to by `data`.
5420     */
5421    uintptr_t datalen;
5422 } LDKCVec_PrivateRouteZ;
5423
5424
5425
5426 /**
5427  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
5428  * timestamp is positive.
5429  *
5430  * # Invariants
5431  * The UNIX timestamp representing the stored time has to be positive and small enough so that
5432  * a `EpiryTime` can be added to it without an overflow.
5433  */
5434 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
5435    /**
5436     * A pointer to the opaque Rust object.
5437     * Nearly everywhere, inner must be non-null, however in places where
5438     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5439     */
5440    LDKnativePositiveTimestamp *inner;
5441    /**
5442     * Indicates that this is the only struct which contains the same pointer.
5443     * Rust functions which take ownership of an object provided via an argument require
5444     * this to be true and invalidate the object pointed to by inner.
5445     */
5446    bool is_owned;
5447 } LDKPositiveTimestamp;
5448
5449 /**
5450  * The contents of CResult_PositiveTimestampCreationErrorZ
5451  */
5452 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
5453    /**
5454     * A pointer to the contents in the success state.
5455     * Reading from this pointer when `result_ok` is not set is undefined.
5456     */
5457    struct LDKPositiveTimestamp *result;
5458    /**
5459     * A pointer to the contents in the error state.
5460     * Reading from this pointer when `result_ok` is set is undefined.
5461     */
5462    enum LDKCreationError *err;
5463 } LDKCResult_PositiveTimestampCreationErrorZPtr;
5464
5465 /**
5466  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5467  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5468  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5469  */
5470 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
5471    /**
5472     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5473     * `err` or `result` depending on the state of `result_ok`.
5474     */
5475    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
5476    /**
5477     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5478     */
5479    bool result_ok;
5480 } LDKCResult_PositiveTimestampCreationErrorZ;
5481
5482 /**
5483  * The contents of CResult_NoneSemanticErrorZ
5484  */
5485 typedef union LDKCResult_NoneSemanticErrorZPtr {
5486    /**
5487     * Note that this value is always NULL, as there are no contents in the OK variant
5488     */
5489    void *result;
5490    /**
5491     * A pointer to the contents in the error state.
5492     * Reading from this pointer when `result_ok` is set is undefined.
5493     */
5494    enum LDKSemanticError *err;
5495 } LDKCResult_NoneSemanticErrorZPtr;
5496
5497 /**
5498  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5499  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5500  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5501  */
5502 typedef struct LDKCResult_NoneSemanticErrorZ {
5503    /**
5504     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
5505     * `err` or `result` depending on the state of `result_ok`.
5506     */
5507    union LDKCResult_NoneSemanticErrorZPtr contents;
5508    /**
5509     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5510     */
5511    bool result_ok;
5512 } LDKCResult_NoneSemanticErrorZ;
5513
5514 /**
5515  * The contents of CResult_InvoiceSemanticErrorZ
5516  */
5517 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5518    /**
5519     * A pointer to the contents in the success state.
5520     * Reading from this pointer when `result_ok` is not set is undefined.
5521     */
5522    struct LDKInvoice *result;
5523    /**
5524     * A pointer to the contents in the error state.
5525     * Reading from this pointer when `result_ok` is set is undefined.
5526     */
5527    enum LDKSemanticError *err;
5528 } LDKCResult_InvoiceSemanticErrorZPtr;
5529
5530 /**
5531  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5532  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5534  */
5535 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5536    /**
5537     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5538     * `err` or `result` depending on the state of `result_ok`.
5539     */
5540    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5541    /**
5542     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5543     */
5544    bool result_ok;
5545 } LDKCResult_InvoiceSemanticErrorZ;
5546
5547
5548
5549 /**
5550  * Description string
5551  *
5552  * # Invariants
5553  * The description can be at most 639 __bytes__ long
5554  */
5555 typedef struct MUST_USE_STRUCT LDKDescription {
5556    /**
5557     * A pointer to the opaque Rust object.
5558     * Nearly everywhere, inner must be non-null, however in places where
5559     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5560     */
5561    LDKnativeDescription *inner;
5562    /**
5563     * Indicates that this is the only struct which contains the same pointer.
5564     * Rust functions which take ownership of an object provided via an argument require
5565     * this to be true and invalidate the object pointed to by inner.
5566     */
5567    bool is_owned;
5568 } LDKDescription;
5569
5570 /**
5571  * The contents of CResult_DescriptionCreationErrorZ
5572  */
5573 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5574    /**
5575     * A pointer to the contents in the success state.
5576     * Reading from this pointer when `result_ok` is not set is undefined.
5577     */
5578    struct LDKDescription *result;
5579    /**
5580     * A pointer to the contents in the error state.
5581     * Reading from this pointer when `result_ok` is set is undefined.
5582     */
5583    enum LDKCreationError *err;
5584 } LDKCResult_DescriptionCreationErrorZPtr;
5585
5586 /**
5587  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5588  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5589  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5590  */
5591 typedef struct LDKCResult_DescriptionCreationErrorZ {
5592    /**
5593     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5594     * `err` or `result` depending on the state of `result_ok`.
5595     */
5596    union LDKCResult_DescriptionCreationErrorZPtr contents;
5597    /**
5598     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5599     */
5600    bool result_ok;
5601 } LDKCResult_DescriptionCreationErrorZ;
5602
5603
5604
5605 /**
5606  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5607  * expires
5608  *
5609  * # Invariants
5610  * The number of seconds this expiry time represents has to be in the range
5611  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5612  * timestamp
5613  */
5614 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5615    /**
5616     * A pointer to the opaque Rust object.
5617     * Nearly everywhere, inner must be non-null, however in places where
5618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5619     */
5620    LDKnativeExpiryTime *inner;
5621    /**
5622     * Indicates that this is the only struct which contains the same pointer.
5623     * Rust functions which take ownership of an object provided via an argument require
5624     * this to be true and invalidate the object pointed to by inner.
5625     */
5626    bool is_owned;
5627 } LDKExpiryTime;
5628
5629 /**
5630  * The contents of CResult_ExpiryTimeCreationErrorZ
5631  */
5632 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5633    /**
5634     * A pointer to the contents in the success state.
5635     * Reading from this pointer when `result_ok` is not set is undefined.
5636     */
5637    struct LDKExpiryTime *result;
5638    /**
5639     * A pointer to the contents in the error state.
5640     * Reading from this pointer when `result_ok` is set is undefined.
5641     */
5642    enum LDKCreationError *err;
5643 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5644
5645 /**
5646  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5647  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5648  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5649  */
5650 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5651    /**
5652     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5653     * `err` or `result` depending on the state of `result_ok`.
5654     */
5655    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5656    /**
5657     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5658     */
5659    bool result_ok;
5660 } LDKCResult_ExpiryTimeCreationErrorZ;
5661
5662 /**
5663  * The contents of CResult_PrivateRouteCreationErrorZ
5664  */
5665 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5666    /**
5667     * A pointer to the contents in the success state.
5668     * Reading from this pointer when `result_ok` is not set is undefined.
5669     */
5670    struct LDKPrivateRoute *result;
5671    /**
5672     * A pointer to the contents in the error state.
5673     * Reading from this pointer when `result_ok` is set is undefined.
5674     */
5675    enum LDKCreationError *err;
5676 } LDKCResult_PrivateRouteCreationErrorZPtr;
5677
5678 /**
5679  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5680  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5681  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5682  */
5683 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5684    /**
5685     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5686     * `err` or `result` depending on the state of `result_ok`.
5687     */
5688    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5689    /**
5690     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5691     */
5692    bool result_ok;
5693 } LDKCResult_PrivateRouteCreationErrorZ;
5694
5695 /**
5696  * The contents of CResult_StringErrorZ
5697  */
5698 typedef union LDKCResult_StringErrorZPtr {
5699    /**
5700     * A pointer to the contents in the success state.
5701     * Reading from this pointer when `result_ok` is not set is undefined.
5702     */
5703    struct LDKStr *result;
5704    /**
5705     * A pointer to the contents in the error state.
5706     * Reading from this pointer when `result_ok` is set is undefined.
5707     */
5708    enum LDKSecp256k1Error *err;
5709 } LDKCResult_StringErrorZPtr;
5710
5711 /**
5712  * A CResult_StringErrorZ represents the result of a fallible operation,
5713  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5714  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5715  */
5716 typedef struct LDKCResult_StringErrorZ {
5717    /**
5718     * The contents of this CResult_StringErrorZ, accessible via either
5719     * `err` or `result` depending on the state of `result_ok`.
5720     */
5721    union LDKCResult_StringErrorZPtr contents;
5722    /**
5723     * Whether this CResult_StringErrorZ represents a success state.
5724     */
5725    bool result_ok;
5726 } LDKCResult_StringErrorZ;
5727
5728 /**
5729  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5730  */
5731 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5732    /**
5733     * A pointer to the contents in the success state.
5734     * Reading from this pointer when `result_ok` is not set is undefined.
5735     */
5736    struct LDKChannelMonitorUpdate *result;
5737    /**
5738     * A pointer to the contents in the error state.
5739     * Reading from this pointer when `result_ok` is set is undefined.
5740     */
5741    struct LDKDecodeError *err;
5742 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5743
5744 /**
5745  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5746  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5747  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5748  */
5749 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5750    /**
5751     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5752     * `err` or `result` depending on the state of `result_ok`.
5753     */
5754    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5755    /**
5756     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5757     */
5758    bool result_ok;
5759 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5760
5761 /**
5762  * The contents of CResult_HTLCUpdateDecodeErrorZ
5763  */
5764 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
5765    /**
5766     * A pointer to the contents in the success state.
5767     * Reading from this pointer when `result_ok` is not set is undefined.
5768     */
5769    struct LDKHTLCUpdate *result;
5770    /**
5771     * A pointer to the contents in the error state.
5772     * Reading from this pointer when `result_ok` is set is undefined.
5773     */
5774    struct LDKDecodeError *err;
5775 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5776
5777 /**
5778  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5779  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5781  */
5782 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5783    /**
5784     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5785     * `err` or `result` depending on the state of `result_ok`.
5786     */
5787    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5788    /**
5789     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5790     */
5791    bool result_ok;
5792 } LDKCResult_HTLCUpdateDecodeErrorZ;
5793
5794
5795
5796 /**
5797  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5798  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5799  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5800  * corrupted.
5801  * Contains a developer-readable error message.
5802  */
5803 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5804    /**
5805     * A pointer to the opaque Rust object.
5806     * Nearly everywhere, inner must be non-null, however in places where
5807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5808     */
5809    LDKnativeMonitorUpdateError *inner;
5810    /**
5811     * Indicates that this is the only struct which contains the same pointer.
5812     * Rust functions which take ownership of an object provided via an argument require
5813     * this to be true and invalidate the object pointed to by inner.
5814     */
5815    bool is_owned;
5816 } LDKMonitorUpdateError;
5817
5818 /**
5819  * The contents of CResult_NoneMonitorUpdateErrorZ
5820  */
5821 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5822    /**
5823     * Note that this value is always NULL, as there are no contents in the OK variant
5824     */
5825    void *result;
5826    /**
5827     * A pointer to the contents in the error state.
5828     * Reading from this pointer when `result_ok` is set is undefined.
5829     */
5830    struct LDKMonitorUpdateError *err;
5831 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5832
5833 /**
5834  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5835  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5836  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5837  */
5838 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5839    /**
5840     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5841     * `err` or `result` depending on the state of `result_ok`.
5842     */
5843    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5844    /**
5845     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5846     */
5847    bool result_ok;
5848 } LDKCResult_NoneMonitorUpdateErrorZ;
5849
5850 /**
5851  * A tuple of 2 elements. See the individual fields for the types contained.
5852  */
5853 typedef struct LDKC2Tuple_OutPointScriptZ {
5854    /**
5855     * The element at position 0
5856     */
5857    struct LDKOutPoint a;
5858    /**
5859     * The element at position 1
5860     */
5861    struct LDKCVec_u8Z b;
5862 } LDKC2Tuple_OutPointScriptZ;
5863
5864 /**
5865  * A tuple of 2 elements. See the individual fields for the types contained.
5866  */
5867 typedef struct LDKC2Tuple_u32ScriptZ {
5868    /**
5869     * The element at position 0
5870     */
5871    uint32_t a;
5872    /**
5873     * The element at position 1
5874     */
5875    struct LDKCVec_u8Z b;
5876 } LDKC2Tuple_u32ScriptZ;
5877
5878 /**
5879  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5880  * This corresponds to std::vector in C++
5881  */
5882 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5883    /**
5884     * The elements in the array.
5885     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5886     */
5887    struct LDKC2Tuple_u32ScriptZ *data;
5888    /**
5889     * The number of elements pointed to by `data`.
5890     */
5891    uintptr_t datalen;
5892 } LDKCVec_C2Tuple_u32ScriptZZ;
5893
5894 /**
5895  * A tuple of 2 elements. See the individual fields for the types contained.
5896  */
5897 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5898    /**
5899     * The element at position 0
5900     */
5901    struct LDKThirtyTwoBytes a;
5902    /**
5903     * The element at position 1
5904     */
5905    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5906 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5907
5908 /**
5909  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5910  * This corresponds to std::vector in C++
5911  */
5912 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5913    /**
5914     * The elements in the array.
5915     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5916     */
5917    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5918    /**
5919     * The number of elements pointed to by `data`.
5920     */
5921    uintptr_t datalen;
5922 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5923
5924 /**
5925  * Some information provided on receipt of payment depends on whether the payment received is a
5926  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
5927  */
5928 typedef enum LDKPaymentPurpose_Tag {
5929    /**
5930     * Information for receiving a payment that we generated an invoice for.
5931     */
5932    LDKPaymentPurpose_InvoicePayment,
5933    /**
5934     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
5935     * (the payee) providing a preimage.
5936     */
5937    LDKPaymentPurpose_SpontaneousPayment,
5938    /**
5939     * Must be last for serialization purposes
5940     */
5941    LDKPaymentPurpose_Sentinel,
5942 } LDKPaymentPurpose_Tag;
5943
5944 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
5945    /**
5946     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5947     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5948     * [`ChannelManager::claim_funds`].
5949     *
5950     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5951     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5952     *
5953     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5954     */
5955    struct LDKThirtyTwoBytes payment_preimage;
5956    /**
5957     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5958     * number of deanonymization attacks during the routing process.
5959     * It is provided here for your reference, however its accuracy is enforced directly by
5960     * [`ChannelManager`] using the values you previously provided to
5961     * [`ChannelManager::create_inbound_payment`] or
5962     * [`ChannelManager::create_inbound_payment_for_hash`].
5963     *
5964     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5965     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5966     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5967     */
5968    struct LDKThirtyTwoBytes payment_secret;
5969    /**
5970     * This is the `user_payment_id` which was provided to
5971     * [`ChannelManager::create_inbound_payment_for_hash`] or
5972     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5973     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5974     * metadata stored elsewhere.
5975     *
5976     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5977     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5978     */
5979    uint64_t user_payment_id;
5980 } LDKPaymentPurpose_LDKInvoicePayment_Body;
5981
5982 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
5983    LDKPaymentPurpose_Tag tag;
5984    union {
5985       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
5986       struct {
5987          struct LDKThirtyTwoBytes spontaneous_payment;
5988       };
5989    };
5990 } LDKPaymentPurpose;
5991
5992 /**
5993  * The reason the channel was closed. See individual variants more details.
5994  */
5995 typedef enum LDKClosureReason_Tag {
5996    /**
5997     * Closure generated from receiving a peer error message.
5998     *
5999     * Our counterparty may have broadcasted their latest commitment state, and we have
6000     * as well.
6001     */
6002    LDKClosureReason_CounterpartyForceClosed,
6003    /**
6004     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
6005     *
6006     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
6007     */
6008    LDKClosureReason_HolderForceClosed,
6009    /**
6010     * The channel was closed after negotiating a cooperative close and we've now broadcasted
6011     * the cooperative close transaction. Note the shutdown may have been initiated by us.
6012     */
6013    LDKClosureReason_CooperativeClosure,
6014    /**
6015     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
6016     * commitment transaction came from our counterparty, but it may also have come from
6017     * a copy of our own `ChannelMonitor`.
6018     */
6019    LDKClosureReason_CommitmentTxConfirmed,
6020    /**
6021     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
6022     */
6023    LDKClosureReason_ProcessingError,
6024    /**
6025     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
6026     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
6027     * peer again in the future or if the peer disconnected before we finished negotiating
6028     * the channel open. The first case may be caused by incompatible features which our
6029     * counterparty, or we, require.
6030     */
6031    LDKClosureReason_DisconnectedPeer,
6032    /**
6033     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
6034     * the ChannelManager deserialized.
6035     */
6036    LDKClosureReason_OutdatedChannelManager,
6037    /**
6038     * Must be last for serialization purposes
6039     */
6040    LDKClosureReason_Sentinel,
6041 } LDKClosureReason_Tag;
6042
6043 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
6044    /**
6045     * The error which the peer sent us.
6046     *
6047     * The string should be sanitized before it is used (e.g emitted to logs
6048     * or printed to stdout). Otherwise, a well crafted error message may exploit
6049     * a security vulnerability in the terminal emulator or the logging subsystem.
6050     */
6051    struct LDKStr peer_msg;
6052 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
6053
6054 typedef struct LDKClosureReason_LDKProcessingError_Body {
6055    /**
6056     * A developer-readable error message which we generated.
6057     */
6058    struct LDKStr err;
6059 } LDKClosureReason_LDKProcessingError_Body;
6060
6061 typedef struct MUST_USE_STRUCT LDKClosureReason {
6062    LDKClosureReason_Tag tag;
6063    union {
6064       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
6065       LDKClosureReason_LDKProcessingError_Body processing_error;
6066    };
6067 } LDKClosureReason;
6068
6069 /**
6070  * An Event which you should probably take some action in response to.
6071  *
6072  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
6073  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
6074  * written as it makes no sense to respond to it after reconnecting to peers).
6075  */
6076 typedef enum LDKEvent_Tag {
6077    /**
6078     * Used to indicate that the client should generate a funding transaction with the given
6079     * parameters and then call ChannelManager::funding_transaction_generated.
6080     * Generated in ChannelManager message handling.
6081     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
6082     * counterparty can steal your funds!
6083     */
6084    LDKEvent_FundingGenerationReady,
6085    /**
6086     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
6087     * [`ChannelManager::claim_funds`] to get it....
6088     * Note that if the preimage is not known, you should call
6089     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
6090     * network congestion.
6091     * If you fail to call either [`ChannelManager::claim_funds`] or
6092     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
6093     * automatically failed.
6094     *
6095     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
6096     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
6097     */
6098    LDKEvent_PaymentReceived,
6099    /**
6100     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
6101     * and we got back the payment preimage for it).
6102     *
6103     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
6104     * event. In this situation, you SHOULD treat this payment as having succeeded.
6105     */
6106    LDKEvent_PaymentSent,
6107    /**
6108     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
6109     * something. You may wish to retry with a different route.
6110     */
6111    LDKEvent_PaymentPathFailed,
6112    /**
6113     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
6114     * time in the future.
6115     */
6116    LDKEvent_PendingHTLCsForwardable,
6117    /**
6118     * Used to indicate that an output which you should know how to spend was confirmed on chain
6119     * and is now spendable.
6120     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
6121     * counterparty spending them due to some kind of timeout. Thus, you need to store them
6122     * somewhere and spend them when you create on-chain transactions.
6123     */
6124    LDKEvent_SpendableOutputs,
6125    /**
6126     * This event is generated when a payment has been successfully forwarded through us and a
6127     * forwarding fee earned.
6128     */
6129    LDKEvent_PaymentForwarded,
6130    /**
6131     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
6132     */
6133    LDKEvent_ChannelClosed,
6134    /**
6135     * Used to indicate to the user that they can abandon the funding transaction and recycle the
6136     * inputs for another purpose.
6137     */
6138    LDKEvent_DiscardFunding,
6139    /**
6140     * Must be last for serialization purposes
6141     */
6142    LDKEvent_Sentinel,
6143 } LDKEvent_Tag;
6144
6145 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
6146    /**
6147     * The random channel_id we picked which you'll need to pass into
6148     * ChannelManager::funding_transaction_generated.
6149     */
6150    struct LDKThirtyTwoBytes temporary_channel_id;
6151    /**
6152     * The value, in satoshis, that the output should have.
6153     */
6154    uint64_t channel_value_satoshis;
6155    /**
6156     * The script which should be used in the transaction output.
6157     */
6158    struct LDKCVec_u8Z output_script;
6159    /**
6160     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6161     * an inbound channel.
6162     *
6163     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6164     */
6165    uint64_t user_channel_id;
6166 } LDKEvent_LDKFundingGenerationReady_Body;
6167
6168 typedef struct LDKEvent_LDKPaymentReceived_Body {
6169    /**
6170     * The hash for which the preimage should be handed to the ChannelManager.
6171     */
6172    struct LDKThirtyTwoBytes payment_hash;
6173    /**
6174     * The value, in thousandths of a satoshi, that this payment is for.
6175     */
6176    uint64_t amt;
6177    /**
6178     * Information for claiming this received payment, based on whether the purpose of the
6179     * payment is to pay an invoice or to send a spontaneous payment.
6180     */
6181    struct LDKPaymentPurpose purpose;
6182 } LDKEvent_LDKPaymentReceived_Body;
6183
6184 typedef struct LDKEvent_LDKPaymentSent_Body {
6185    /**
6186     * The preimage to the hash given to ChannelManager::send_payment.
6187     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
6188     * store it somehow!
6189     */
6190    struct LDKThirtyTwoBytes payment_preimage;
6191    /**
6192     * The hash which was given to [`ChannelManager::send_payment`].
6193     *
6194     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6195     */
6196    struct LDKThirtyTwoBytes payment_hash;
6197 } LDKEvent_LDKPaymentSent_Body;
6198
6199 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
6200    /**
6201     * The hash which was given to ChannelManager::send_payment.
6202     */
6203    struct LDKThirtyTwoBytes payment_hash;
6204    /**
6205     * Indicates the payment was rejected for some reason by the recipient. This implies that
6206     * the payment has failed, not just the route in question. If this is not set, you may
6207     * retry the payment via a different route.
6208     */
6209    bool rejected_by_dest;
6210    /**
6211     * Any failure information conveyed via the Onion return packet by a node along the failed
6212     * payment route.
6213     *
6214     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
6215     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
6216     *
6217     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
6218     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
6219     */
6220    struct LDKCOption_NetworkUpdateZ network_update;
6221    /**
6222     * For both single-path and multi-path payments, this is set if all paths of the payment have
6223     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
6224     * larger MPP payment were still in flight when this event was generated.
6225     */
6226    bool all_paths_failed;
6227    /**
6228     * The payment path that failed.
6229     */
6230    struct LDKCVec_RouteHopZ path;
6231    /**
6232     * The channel responsible for the failed payment path.
6233     *
6234     * If this is `Some`, then the corresponding channel should be avoided when the payment is
6235     * retried. May be `None` for older [`Event`] serializations.
6236     */
6237    struct LDKCOption_u64Z short_channel_id;
6238 } LDKEvent_LDKPaymentPathFailed_Body;
6239
6240 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
6241    /**
6242     * The minimum amount of time that should be waited prior to calling
6243     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
6244     * you should wait a random amount of time in roughly the range (now + time_forwardable,
6245     * now + 5*time_forwardable).
6246     */
6247    uint64_t time_forwardable;
6248 } LDKEvent_LDKPendingHTLCsForwardable_Body;
6249
6250 typedef struct LDKEvent_LDKSpendableOutputs_Body {
6251    /**
6252     * The outputs which you should store as spendable by you.
6253     */
6254    struct LDKCVec_SpendableOutputDescriptorZ outputs;
6255 } LDKEvent_LDKSpendableOutputs_Body;
6256
6257 typedef struct LDKEvent_LDKPaymentForwarded_Body {
6258    /**
6259     * The fee, in milli-satoshis, which was earned as a result of the payment.
6260     *
6261     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
6262     * was pending, the amount the next hop claimed will have been rounded down to the nearest
6263     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
6264     * claimed the full value in millisatoshis from the source. In this case,
6265     * `claim_from_onchain_tx` will be set.
6266     *
6267     * If the channel which sent us the payment has been force-closed, we will claim the funds
6268     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
6269     * fees which we will spend and will instead set this to `None`. It is possible duplicate
6270     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
6271     * `None`.
6272     */
6273    struct LDKCOption_u64Z fee_earned_msat;
6274    /**
6275     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
6276     * transaction.
6277     */
6278    bool claim_from_onchain_tx;
6279 } LDKEvent_LDKPaymentForwarded_Body;
6280
6281 typedef struct LDKEvent_LDKChannelClosed_Body {
6282    /**
6283     * The channel_id of the channel which has been closed. Note that on-chain transactions
6284     * resolving the channel are likely still awaiting confirmation.
6285     */
6286    struct LDKThirtyTwoBytes channel_id;
6287    /**
6288     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6289     * an inbound channel. This will always be zero for objects serialized with LDK versions
6290     * prior to 0.0.102.
6291     *
6292     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6293     */
6294    uint64_t user_channel_id;
6295    /**
6296     * The reason the channel was closed.
6297     */
6298    struct LDKClosureReason reason;
6299 } LDKEvent_LDKChannelClosed_Body;
6300
6301 typedef struct LDKEvent_LDKDiscardFunding_Body {
6302    /**
6303     * The channel_id of the channel which has been closed.
6304     */
6305    struct LDKThirtyTwoBytes channel_id;
6306    /**
6307     * The full transaction received from the user
6308     */
6309    struct LDKTransaction transaction;
6310 } LDKEvent_LDKDiscardFunding_Body;
6311
6312 typedef struct MUST_USE_STRUCT LDKEvent {
6313    LDKEvent_Tag tag;
6314    union {
6315       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
6316       LDKEvent_LDKPaymentReceived_Body payment_received;
6317       LDKEvent_LDKPaymentSent_Body payment_sent;
6318       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
6319       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
6320       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
6321       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
6322       LDKEvent_LDKChannelClosed_Body channel_closed;
6323       LDKEvent_LDKDiscardFunding_Body discard_funding;
6324    };
6325 } LDKEvent;
6326
6327 /**
6328  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6329  * This corresponds to std::vector in C++
6330  */
6331 typedef struct LDKCVec_EventZ {
6332    /**
6333     * The elements in the array.
6334     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6335     */
6336    struct LDKEvent *data;
6337    /**
6338     * The number of elements pointed to by `data`.
6339     */
6340    uintptr_t datalen;
6341 } LDKCVec_EventZ;
6342
6343 /**
6344  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6345  * This corresponds to std::vector in C++
6346  */
6347 typedef struct LDKCVec_TransactionZ {
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 LDKTransaction *data;
6353    /**
6354     * The number of elements pointed to by `data`.
6355     */
6356    uintptr_t datalen;
6357 } LDKCVec_TransactionZ;
6358
6359 /**
6360  * A tuple of 2 elements. See the individual fields for the types contained.
6361  */
6362 typedef struct LDKC2Tuple_u32TxOutZ {
6363    /**
6364     * The element at position 0
6365     */
6366    uint32_t a;
6367    /**
6368     * The element at position 1
6369     */
6370    struct LDKTxOut b;
6371 } LDKC2Tuple_u32TxOutZ;
6372
6373 /**
6374  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6375  * This corresponds to std::vector in C++
6376  */
6377 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
6378    /**
6379     * The elements in the array.
6380     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6381     */
6382    struct LDKC2Tuple_u32TxOutZ *data;
6383    /**
6384     * The number of elements pointed to by `data`.
6385     */
6386    uintptr_t datalen;
6387 } LDKCVec_C2Tuple_u32TxOutZZ;
6388
6389 /**
6390  * A tuple of 2 elements. See the individual fields for the types contained.
6391  */
6392 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6393    /**
6394     * The element at position 0
6395     */
6396    struct LDKThirtyTwoBytes a;
6397    /**
6398     * The element at position 1
6399     */
6400    struct LDKCVec_C2Tuple_u32TxOutZZ b;
6401 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
6402
6403 /**
6404  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6405  * This corresponds to std::vector in C++
6406  */
6407 typedef struct LDKCVec_TransactionOutputsZ {
6408    /**
6409     * The elements in the array.
6410     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6411     */
6412    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
6413    /**
6414     * The number of elements pointed to by `data`.
6415     */
6416    uintptr_t datalen;
6417 } LDKCVec_TransactionOutputsZ;
6418
6419 /**
6420  * Details about the balance(s) available for spending once the channel appears on chain.
6421  *
6422  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
6423  * be provided.
6424  */
6425 typedef enum LDKBalance_Tag {
6426    /**
6427     * The channel is not yet closed (or the commitment or closing transaction has not yet
6428     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
6429     * force-closed now.
6430     */
6431    LDKBalance_ClaimableOnChannelClose,
6432    /**
6433     * The channel has been closed, and the given balance is ours but awaiting confirmations until
6434     * we consider it spendable.
6435     */
6436    LDKBalance_ClaimableAwaitingConfirmations,
6437    /**
6438     * The channel has been closed, and the given balance should be ours but awaiting spending
6439     * transaction confirmation. If the spending transaction does not confirm in time, it is
6440     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
6441     *
6442     * Once the spending transaction confirms, before it has reached enough confirmations to be
6443     * considered safe from chain reorganizations, the balance will instead be provided via
6444     * [`Balance::ClaimableAwaitingConfirmations`].
6445     */
6446    LDKBalance_ContentiousClaimable,
6447    /**
6448     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
6449     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
6450     * likely to be claimed by our counterparty before we do.
6451     */
6452    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
6453    /**
6454     * Must be last for serialization purposes
6455     */
6456    LDKBalance_Sentinel,
6457 } LDKBalance_Tag;
6458
6459 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
6460    /**
6461     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6462     * required to do so.
6463     */
6464    uint64_t claimable_amount_satoshis;
6465 } LDKBalance_LDKClaimableOnChannelClose_Body;
6466
6467 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
6468    /**
6469     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
6470     * were spent in broadcasting the transaction.
6471     */
6472    uint64_t claimable_amount_satoshis;
6473    /**
6474     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
6475     * amount.
6476     */
6477    uint32_t confirmation_height;
6478 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
6479
6480 typedef struct LDKBalance_LDKContentiousClaimable_Body {
6481    /**
6482     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6483     * required to do so.
6484     */
6485    uint64_t claimable_amount_satoshis;
6486    /**
6487     * The height at which the counterparty may be able to claim the balance if we have not
6488     * done so.
6489     */
6490    uint32_t timeout_height;
6491 } LDKBalance_LDKContentiousClaimable_Body;
6492
6493 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
6494    /**
6495     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6496     * required to do so.
6497     */
6498    uint64_t claimable_amount_satoshis;
6499    /**
6500     * The height at which we will be able to claim the balance if our counterparty has not
6501     * done so.
6502     */
6503    uint32_t claimable_height;
6504 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
6505
6506 typedef struct MUST_USE_STRUCT LDKBalance {
6507    LDKBalance_Tag tag;
6508    union {
6509       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
6510       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
6511       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
6512       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
6513    };
6514 } LDKBalance;
6515
6516 /**
6517  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6518  * This corresponds to std::vector in C++
6519  */
6520 typedef struct LDKCVec_BalanceZ {
6521    /**
6522     * The elements in the array.
6523     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6524     */
6525    struct LDKBalance *data;
6526    /**
6527     * The number of elements pointed to by `data`.
6528     */
6529    uintptr_t datalen;
6530 } LDKCVec_BalanceZ;
6531
6532 /**
6533  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6534  */
6535 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6536    /**
6537     * A pointer to the contents in the success state.
6538     * Reading from this pointer when `result_ok` is not set is undefined.
6539     */
6540    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
6541    /**
6542     * A pointer to the contents in the error state.
6543     * Reading from this pointer when `result_ok` is set is undefined.
6544     */
6545    struct LDKDecodeError *err;
6546 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
6547
6548 /**
6549  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6550  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6551  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6552  */
6553 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6554    /**
6555     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6556     * `err` or `result` depending on the state of `result_ok`.
6557     */
6558    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
6559    /**
6560     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6561     */
6562    bool result_ok;
6563 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
6564
6565 /**
6566  * The contents of CResult_NoneLightningErrorZ
6567  */
6568 typedef union LDKCResult_NoneLightningErrorZPtr {
6569    /**
6570     * Note that this value is always NULL, as there are no contents in the OK variant
6571     */
6572    void *result;
6573    /**
6574     * A pointer to the contents in the error state.
6575     * Reading from this pointer when `result_ok` is set is undefined.
6576     */
6577    struct LDKLightningError *err;
6578 } LDKCResult_NoneLightningErrorZPtr;
6579
6580 /**
6581  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6582  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6584  */
6585 typedef struct LDKCResult_NoneLightningErrorZ {
6586    /**
6587     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6588     * `err` or `result` depending on the state of `result_ok`.
6589     */
6590    union LDKCResult_NoneLightningErrorZPtr contents;
6591    /**
6592     * Whether this CResult_NoneLightningErrorZ represents a success state.
6593     */
6594    bool result_ok;
6595 } LDKCResult_NoneLightningErrorZ;
6596
6597 /**
6598  * A tuple of 2 elements. See the individual fields for the types contained.
6599  */
6600 typedef struct LDKC2Tuple_PublicKeyTypeZ {
6601    /**
6602     * The element at position 0
6603     */
6604    struct LDKPublicKey a;
6605    /**
6606     * The element at position 1
6607     */
6608    struct LDKType b;
6609 } LDKC2Tuple_PublicKeyTypeZ;
6610
6611 /**
6612  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
6613  * This corresponds to std::vector in C++
6614  */
6615 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
6616    /**
6617     * The elements in the array.
6618     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6619     */
6620    struct LDKC2Tuple_PublicKeyTypeZ *data;
6621    /**
6622     * The number of elements pointed to by `data`.
6623     */
6624    uintptr_t datalen;
6625 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
6626
6627 /**
6628  * The contents of CResult_boolLightningErrorZ
6629  */
6630 typedef union LDKCResult_boolLightningErrorZPtr {
6631    /**
6632     * A pointer to the contents in the success state.
6633     * Reading from this pointer when `result_ok` is not set is undefined.
6634     */
6635    bool *result;
6636    /**
6637     * A pointer to the contents in the error state.
6638     * Reading from this pointer when `result_ok` is set is undefined.
6639     */
6640    struct LDKLightningError *err;
6641 } LDKCResult_boolLightningErrorZPtr;
6642
6643 /**
6644  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
6645  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6647  */
6648 typedef struct LDKCResult_boolLightningErrorZ {
6649    /**
6650     * The contents of this CResult_boolLightningErrorZ, accessible via either
6651     * `err` or `result` depending on the state of `result_ok`.
6652     */
6653    union LDKCResult_boolLightningErrorZPtr contents;
6654    /**
6655     * Whether this CResult_boolLightningErrorZ represents a success state.
6656     */
6657    bool result_ok;
6658 } LDKCResult_boolLightningErrorZ;
6659
6660 /**
6661  * A tuple of 3 elements. See the individual fields for the types contained.
6662  */
6663 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6664    /**
6665     * The element at position 0
6666     */
6667    struct LDKChannelAnnouncement a;
6668    /**
6669     * The element at position 1
6670     */
6671    struct LDKChannelUpdate b;
6672    /**
6673     * The element at position 2
6674     */
6675    struct LDKChannelUpdate c;
6676 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
6677
6678 /**
6679  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6680  * This corresponds to std::vector in C++
6681  */
6682 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6683    /**
6684     * The elements in the array.
6685     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6686     */
6687    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
6688    /**
6689     * The number of elements pointed to by `data`.
6690     */
6691    uintptr_t datalen;
6692 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
6693
6694 /**
6695  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6696  * This corresponds to std::vector in C++
6697  */
6698 typedef struct LDKCVec_NodeAnnouncementZ {
6699    /**
6700     * The elements in the array.
6701     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6702     */
6703    struct LDKNodeAnnouncement *data;
6704    /**
6705     * The number of elements pointed to by `data`.
6706     */
6707    uintptr_t datalen;
6708 } LDKCVec_NodeAnnouncementZ;
6709
6710 /**
6711  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6712  * This corresponds to std::vector in C++
6713  */
6714 typedef struct LDKCVec_PublicKeyZ {
6715    /**
6716     * The elements in the array.
6717     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6718     */
6719    struct LDKPublicKey *data;
6720    /**
6721     * The number of elements pointed to by `data`.
6722     */
6723    uintptr_t datalen;
6724 } LDKCVec_PublicKeyZ;
6725
6726
6727
6728 /**
6729  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
6730  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
6731  * descriptor.
6732  */
6733 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
6734    /**
6735     * A pointer to the opaque Rust object.
6736     * Nearly everywhere, inner must be non-null, however in places where
6737     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6738     */
6739    LDKnativePeerHandleError *inner;
6740    /**
6741     * Indicates that this is the only struct which contains the same pointer.
6742     * Rust functions which take ownership of an object provided via an argument require
6743     * this to be true and invalidate the object pointed to by inner.
6744     */
6745    bool is_owned;
6746 } LDKPeerHandleError;
6747
6748 /**
6749  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
6750  */
6751 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
6752    /**
6753     * A pointer to the contents in the success state.
6754     * Reading from this pointer when `result_ok` is not set is undefined.
6755     */
6756    struct LDKCVec_u8Z *result;
6757    /**
6758     * A pointer to the contents in the error state.
6759     * Reading from this pointer when `result_ok` is set is undefined.
6760     */
6761    struct LDKPeerHandleError *err;
6762 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
6763
6764 /**
6765  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6766  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6767  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6768  */
6769 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
6770    /**
6771     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6772     * `err` or `result` depending on the state of `result_ok`.
6773     */
6774    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
6775    /**
6776     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6777     */
6778    bool result_ok;
6779 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
6780
6781 /**
6782  * The contents of CResult_NonePeerHandleErrorZ
6783  */
6784 typedef union LDKCResult_NonePeerHandleErrorZPtr {
6785    /**
6786     * Note that this value is always NULL, as there are no contents in the OK variant
6787     */
6788    void *result;
6789    /**
6790     * A pointer to the contents in the error state.
6791     * Reading from this pointer when `result_ok` is set is undefined.
6792     */
6793    struct LDKPeerHandleError *err;
6794 } LDKCResult_NonePeerHandleErrorZPtr;
6795
6796 /**
6797  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6798  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6799  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6800  */
6801 typedef struct LDKCResult_NonePeerHandleErrorZ {
6802    /**
6803     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6804     * `err` or `result` depending on the state of `result_ok`.
6805     */
6806    union LDKCResult_NonePeerHandleErrorZPtr contents;
6807    /**
6808     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
6809     */
6810    bool result_ok;
6811 } LDKCResult_NonePeerHandleErrorZ;
6812
6813 /**
6814  * The contents of CResult_boolPeerHandleErrorZ
6815  */
6816 typedef union LDKCResult_boolPeerHandleErrorZPtr {
6817    /**
6818     * A pointer to the contents in the success state.
6819     * Reading from this pointer when `result_ok` is not set is undefined.
6820     */
6821    bool *result;
6822    /**
6823     * A pointer to the contents in the error state.
6824     * Reading from this pointer when `result_ok` is set is undefined.
6825     */
6826    struct LDKPeerHandleError *err;
6827 } LDKCResult_boolPeerHandleErrorZPtr;
6828
6829 /**
6830  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
6831  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6832  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6833  */
6834 typedef struct LDKCResult_boolPeerHandleErrorZ {
6835    /**
6836     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
6837     * `err` or `result` depending on the state of `result_ok`.
6838     */
6839    union LDKCResult_boolPeerHandleErrorZPtr contents;
6840    /**
6841     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
6842     */
6843    bool result_ok;
6844 } LDKCResult_boolPeerHandleErrorZ;
6845
6846
6847
6848 /**
6849  * Represents the compressed public key of a node
6850  */
6851 typedef struct MUST_USE_STRUCT LDKNodeId {
6852    /**
6853     * A pointer to the opaque Rust object.
6854     * Nearly everywhere, inner must be non-null, however in places where
6855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6856     */
6857    LDKnativeNodeId *inner;
6858    /**
6859     * Indicates that this is the only struct which contains the same pointer.
6860     * Rust functions which take ownership of an object provided via an argument require
6861     * this to be true and invalidate the object pointed to by inner.
6862     */
6863    bool is_owned;
6864 } LDKNodeId;
6865
6866 /**
6867  * The contents of CResult_NodeIdDecodeErrorZ
6868  */
6869 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
6870    /**
6871     * A pointer to the contents in the success state.
6872     * Reading from this pointer when `result_ok` is not set is undefined.
6873     */
6874    struct LDKNodeId *result;
6875    /**
6876     * A pointer to the contents in the error state.
6877     * Reading from this pointer when `result_ok` is set is undefined.
6878     */
6879    struct LDKDecodeError *err;
6880 } LDKCResult_NodeIdDecodeErrorZPtr;
6881
6882 /**
6883  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6884  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6886  */
6887 typedef struct LDKCResult_NodeIdDecodeErrorZ {
6888    /**
6889     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6890     * `err` or `result` depending on the state of `result_ok`.
6891     */
6892    union LDKCResult_NodeIdDecodeErrorZPtr contents;
6893    /**
6894     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6895     */
6896    bool result_ok;
6897 } LDKCResult_NodeIdDecodeErrorZ;
6898
6899 /**
6900  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6901  * UTXOs.
6902  */
6903 typedef struct LDKAccess {
6904    /**
6905     * An opaque pointer which is passed to your function implementations as an argument.
6906     * This has no meaning in the LDK, and can be NULL or any other value.
6907     */
6908    void *this_arg;
6909    /**
6910     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6911     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6912     * is unknown.
6913     *
6914     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6915     */
6916    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6917    /**
6918     * Frees any resources associated with this object given its this_arg pointer.
6919     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6920     */
6921    void (*free)(void *this_arg);
6922 } LDKAccess;
6923
6924 /**
6925  * An enum which can either contain a crate::lightning::chain::Access or not
6926  */
6927 typedef enum LDKCOption_AccessZ_Tag {
6928    /**
6929     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
6930     */
6931    LDKCOption_AccessZ_Some,
6932    /**
6933     * When we're in this state, this COption_AccessZ contains nothing
6934     */
6935    LDKCOption_AccessZ_None,
6936    /**
6937     * Must be last for serialization purposes
6938     */
6939    LDKCOption_AccessZ_Sentinel,
6940 } LDKCOption_AccessZ_Tag;
6941
6942 typedef struct LDKCOption_AccessZ {
6943    LDKCOption_AccessZ_Tag tag;
6944    union {
6945       struct {
6946          struct LDKAccess some;
6947       };
6948    };
6949 } LDKCOption_AccessZ;
6950
6951
6952
6953 /**
6954  * Details about one direction of a channel. Received
6955  * within a channel update.
6956  */
6957 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
6958    /**
6959     * A pointer to the opaque Rust object.
6960     * Nearly everywhere, inner must be non-null, however in places where
6961     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6962     */
6963    LDKnativeDirectionalChannelInfo *inner;
6964    /**
6965     * Indicates that this is the only struct which contains the same pointer.
6966     * Rust functions which take ownership of an object provided via an argument require
6967     * this to be true and invalidate the object pointed to by inner.
6968     */
6969    bool is_owned;
6970 } LDKDirectionalChannelInfo;
6971
6972 /**
6973  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
6974  */
6975 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
6976    /**
6977     * A pointer to the contents in the success state.
6978     * Reading from this pointer when `result_ok` is not set is undefined.
6979     */
6980    struct LDKDirectionalChannelInfo *result;
6981    /**
6982     * A pointer to the contents in the error state.
6983     * Reading from this pointer when `result_ok` is set is undefined.
6984     */
6985    struct LDKDecodeError *err;
6986 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
6987
6988 /**
6989  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
6990  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6991  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6992  */
6993 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
6994    /**
6995     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
6996     * `err` or `result` depending on the state of `result_ok`.
6997     */
6998    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
6999    /**
7000     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7001     */
7002    bool result_ok;
7003 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
7004
7005
7006
7007 /**
7008  * Details about a channel (both directions).
7009  * Received within a channel announcement.
7010  */
7011 typedef struct MUST_USE_STRUCT LDKChannelInfo {
7012    /**
7013     * A pointer to the opaque Rust object.
7014     * Nearly everywhere, inner must be non-null, however in places where
7015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7016     */
7017    LDKnativeChannelInfo *inner;
7018    /**
7019     * Indicates that this is the only struct which contains the same pointer.
7020     * Rust functions which take ownership of an object provided via an argument require
7021     * this to be true and invalidate the object pointed to by inner.
7022     */
7023    bool is_owned;
7024 } LDKChannelInfo;
7025
7026 /**
7027  * The contents of CResult_ChannelInfoDecodeErrorZ
7028  */
7029 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
7030    /**
7031     * A pointer to the contents in the success state.
7032     * Reading from this pointer when `result_ok` is not set is undefined.
7033     */
7034    struct LDKChannelInfo *result;
7035    /**
7036     * A pointer to the contents in the error state.
7037     * Reading from this pointer when `result_ok` is set is undefined.
7038     */
7039    struct LDKDecodeError *err;
7040 } LDKCResult_ChannelInfoDecodeErrorZPtr;
7041
7042 /**
7043  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7044  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7046  */
7047 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
7048    /**
7049     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7050     * `err` or `result` depending on the state of `result_ok`.
7051     */
7052    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7053    /**
7054     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7055     */
7056    bool result_ok;
7057 } LDKCResult_ChannelInfoDecodeErrorZ;
7058
7059
7060
7061 /**
7062  * Fees for routing via a given channel or a node
7063  */
7064 typedef struct MUST_USE_STRUCT LDKRoutingFees {
7065    /**
7066     * A pointer to the opaque Rust object.
7067     * Nearly everywhere, inner must be non-null, however in places where
7068     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7069     */
7070    LDKnativeRoutingFees *inner;
7071    /**
7072     * Indicates that this is the only struct which contains the same pointer.
7073     * Rust functions which take ownership of an object provided via an argument require
7074     * this to be true and invalidate the object pointed to by inner.
7075     */
7076    bool is_owned;
7077 } LDKRoutingFees;
7078
7079 /**
7080  * The contents of CResult_RoutingFeesDecodeErrorZ
7081  */
7082 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
7083    /**
7084     * A pointer to the contents in the success state.
7085     * Reading from this pointer when `result_ok` is not set is undefined.
7086     */
7087    struct LDKRoutingFees *result;
7088    /**
7089     * A pointer to the contents in the error state.
7090     * Reading from this pointer when `result_ok` is set is undefined.
7091     */
7092    struct LDKDecodeError *err;
7093 } LDKCResult_RoutingFeesDecodeErrorZPtr;
7094
7095 /**
7096  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7097  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7098  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7099  */
7100 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
7101    /**
7102     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7103     * `err` or `result` depending on the state of `result_ok`.
7104     */
7105    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
7106    /**
7107     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7108     */
7109    bool result_ok;
7110 } LDKCResult_RoutingFeesDecodeErrorZ;
7111
7112
7113
7114 /**
7115  * Information received in the latest node_announcement from this node.
7116  */
7117 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7118    /**
7119     * A pointer to the opaque Rust object.
7120     * Nearly everywhere, inner must be non-null, however in places where
7121     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7122     */
7123    LDKnativeNodeAnnouncementInfo *inner;
7124    /**
7125     * Indicates that this is the only struct which contains the same pointer.
7126     * Rust functions which take ownership of an object provided via an argument require
7127     * this to be true and invalidate the object pointed to by inner.
7128     */
7129    bool is_owned;
7130 } LDKNodeAnnouncementInfo;
7131
7132 /**
7133  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7134  */
7135 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7136    /**
7137     * A pointer to the contents in the success state.
7138     * Reading from this pointer when `result_ok` is not set is undefined.
7139     */
7140    struct LDKNodeAnnouncementInfo *result;
7141    /**
7142     * A pointer to the contents in the error state.
7143     * Reading from this pointer when `result_ok` is set is undefined.
7144     */
7145    struct LDKDecodeError *err;
7146 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7147
7148 /**
7149  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7150  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7152  */
7153 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7154    /**
7155     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7156     * `err` or `result` depending on the state of `result_ok`.
7157     */
7158    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7159    /**
7160     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7161     */
7162    bool result_ok;
7163 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7164
7165 /**
7166  * A dynamically-allocated array of u64s of arbitrary size.
7167  * This corresponds to std::vector in C++
7168  */
7169 typedef struct LDKCVec_u64Z {
7170    /**
7171     * The elements in the array.
7172     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7173     */
7174    uint64_t *data;
7175    /**
7176     * The number of elements pointed to by `data`.
7177     */
7178    uintptr_t datalen;
7179 } LDKCVec_u64Z;
7180
7181
7182
7183 /**
7184  * Details about a node in the network, known from the network announcement.
7185  */
7186 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7187    /**
7188     * A pointer to the opaque Rust object.
7189     * Nearly everywhere, inner must be non-null, however in places where
7190     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7191     */
7192    LDKnativeNodeInfo *inner;
7193    /**
7194     * Indicates that this is the only struct which contains the same pointer.
7195     * Rust functions which take ownership of an object provided via an argument require
7196     * this to be true and invalidate the object pointed to by inner.
7197     */
7198    bool is_owned;
7199 } LDKNodeInfo;
7200
7201 /**
7202  * The contents of CResult_NodeInfoDecodeErrorZ
7203  */
7204 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7205    /**
7206     * A pointer to the contents in the success state.
7207     * Reading from this pointer when `result_ok` is not set is undefined.
7208     */
7209    struct LDKNodeInfo *result;
7210    /**
7211     * A pointer to the contents in the error state.
7212     * Reading from this pointer when `result_ok` is set is undefined.
7213     */
7214    struct LDKDecodeError *err;
7215 } LDKCResult_NodeInfoDecodeErrorZPtr;
7216
7217 /**
7218  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7219  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7220  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7221  */
7222 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7223    /**
7224     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7225     * `err` or `result` depending on the state of `result_ok`.
7226     */
7227    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7228    /**
7229     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7230     */
7231    bool result_ok;
7232 } LDKCResult_NodeInfoDecodeErrorZ;
7233
7234
7235
7236 /**
7237  * Represents the network as nodes and channels between them
7238  */
7239 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
7240    /**
7241     * A pointer to the opaque Rust object.
7242     * Nearly everywhere, inner must be non-null, however in places where
7243     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7244     */
7245    LDKnativeNetworkGraph *inner;
7246    /**
7247     * Indicates that this is the only struct which contains the same pointer.
7248     * Rust functions which take ownership of an object provided via an argument require
7249     * this to be true and invalidate the object pointed to by inner.
7250     */
7251    bool is_owned;
7252 } LDKNetworkGraph;
7253
7254 /**
7255  * The contents of CResult_NetworkGraphDecodeErrorZ
7256  */
7257 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7258    /**
7259     * A pointer to the contents in the success state.
7260     * Reading from this pointer when `result_ok` is not set is undefined.
7261     */
7262    struct LDKNetworkGraph *result;
7263    /**
7264     * A pointer to the contents in the error state.
7265     * Reading from this pointer when `result_ok` is set is undefined.
7266     */
7267    struct LDKDecodeError *err;
7268 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7269
7270 /**
7271  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7272  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7273  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7274  */
7275 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7276    /**
7277     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7278     * `err` or `result` depending on the state of `result_ok`.
7279     */
7280    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7281    /**
7282     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7283     */
7284    bool result_ok;
7285 } LDKCResult_NetworkGraphDecodeErrorZ;
7286
7287 /**
7288  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7289  */
7290 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7291    /**
7292     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7293     */
7294    LDKCOption_CVec_NetAddressZZ_Some,
7295    /**
7296     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7297     */
7298    LDKCOption_CVec_NetAddressZZ_None,
7299    /**
7300     * Must be last for serialization purposes
7301     */
7302    LDKCOption_CVec_NetAddressZZ_Sentinel,
7303 } LDKCOption_CVec_NetAddressZZ_Tag;
7304
7305 typedef struct LDKCOption_CVec_NetAddressZZ {
7306    LDKCOption_CVec_NetAddressZZ_Tag tag;
7307    union {
7308       struct {
7309          struct LDKCVec_NetAddressZ some;
7310       };
7311    };
7312 } LDKCOption_CVec_NetAddressZZ;
7313
7314 /**
7315  * The contents of CResult_NetAddressu8Z
7316  */
7317 typedef union LDKCResult_NetAddressu8ZPtr {
7318    /**
7319     * A pointer to the contents in the success state.
7320     * Reading from this pointer when `result_ok` is not set is undefined.
7321     */
7322    struct LDKNetAddress *result;
7323    /**
7324     * A pointer to the contents in the error state.
7325     * Reading from this pointer when `result_ok` is set is undefined.
7326     */
7327    uint8_t *err;
7328 } LDKCResult_NetAddressu8ZPtr;
7329
7330 /**
7331  * A CResult_NetAddressu8Z represents the result of a fallible operation,
7332  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7333  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7334  */
7335 typedef struct LDKCResult_NetAddressu8Z {
7336    /**
7337     * The contents of this CResult_NetAddressu8Z, accessible via either
7338     * `err` or `result` depending on the state of `result_ok`.
7339     */
7340    union LDKCResult_NetAddressu8ZPtr contents;
7341    /**
7342     * Whether this CResult_NetAddressu8Z represents a success state.
7343     */
7344    bool result_ok;
7345 } LDKCResult_NetAddressu8Z;
7346
7347 /**
7348  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7349  */
7350 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7351    /**
7352     * A pointer to the contents in the success state.
7353     * Reading from this pointer when `result_ok` is not set is undefined.
7354     */
7355    struct LDKCResult_NetAddressu8Z *result;
7356    /**
7357     * A pointer to the contents in the error state.
7358     * Reading from this pointer when `result_ok` is set is undefined.
7359     */
7360    struct LDKDecodeError *err;
7361 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
7362
7363 /**
7364  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7365  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7366  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7367  */
7368 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
7369    /**
7370     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7371     * `err` or `result` depending on the state of `result_ok`.
7372     */
7373    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
7374    /**
7375     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7376     */
7377    bool result_ok;
7378 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
7379
7380 /**
7381  * The contents of CResult_NetAddressDecodeErrorZ
7382  */
7383 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
7384    /**
7385     * A pointer to the contents in the success state.
7386     * Reading from this pointer when `result_ok` is not set is undefined.
7387     */
7388    struct LDKNetAddress *result;
7389    /**
7390     * A pointer to the contents in the error state.
7391     * Reading from this pointer when `result_ok` is set is undefined.
7392     */
7393    struct LDKDecodeError *err;
7394 } LDKCResult_NetAddressDecodeErrorZPtr;
7395
7396 /**
7397  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7398  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7399  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7400  */
7401 typedef struct LDKCResult_NetAddressDecodeErrorZ {
7402    /**
7403     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7404     * `err` or `result` depending on the state of `result_ok`.
7405     */
7406    union LDKCResult_NetAddressDecodeErrorZPtr contents;
7407    /**
7408     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7409     */
7410    bool result_ok;
7411 } LDKCResult_NetAddressDecodeErrorZ;
7412
7413
7414
7415 /**
7416  * An update_add_htlc message to be sent or received from a peer
7417  */
7418 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
7419    /**
7420     * A pointer to the opaque Rust object.
7421     * Nearly everywhere, inner must be non-null, however in places where
7422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7423     */
7424    LDKnativeUpdateAddHTLC *inner;
7425    /**
7426     * Indicates that this is the only struct which contains the same pointer.
7427     * Rust functions which take ownership of an object provided via an argument require
7428     * this to be true and invalidate the object pointed to by inner.
7429     */
7430    bool is_owned;
7431 } LDKUpdateAddHTLC;
7432
7433 /**
7434  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7435  * This corresponds to std::vector in C++
7436  */
7437 typedef struct LDKCVec_UpdateAddHTLCZ {
7438    /**
7439     * The elements in the array.
7440     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7441     */
7442    struct LDKUpdateAddHTLC *data;
7443    /**
7444     * The number of elements pointed to by `data`.
7445     */
7446    uintptr_t datalen;
7447 } LDKCVec_UpdateAddHTLCZ;
7448
7449
7450
7451 /**
7452  * An update_fulfill_htlc message to be sent or received from a peer
7453  */
7454 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
7455    /**
7456     * A pointer to the opaque Rust object.
7457     * Nearly everywhere, inner must be non-null, however in places where
7458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7459     */
7460    LDKnativeUpdateFulfillHTLC *inner;
7461    /**
7462     * Indicates that this is the only struct which contains the same pointer.
7463     * Rust functions which take ownership of an object provided via an argument require
7464     * this to be true and invalidate the object pointed to by inner.
7465     */
7466    bool is_owned;
7467 } LDKUpdateFulfillHTLC;
7468
7469 /**
7470  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7471  * This corresponds to std::vector in C++
7472  */
7473 typedef struct LDKCVec_UpdateFulfillHTLCZ {
7474    /**
7475     * The elements in the array.
7476     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7477     */
7478    struct LDKUpdateFulfillHTLC *data;
7479    /**
7480     * The number of elements pointed to by `data`.
7481     */
7482    uintptr_t datalen;
7483 } LDKCVec_UpdateFulfillHTLCZ;
7484
7485
7486
7487 /**
7488  * An update_fail_htlc message to be sent or received from a peer
7489  */
7490 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
7491    /**
7492     * A pointer to the opaque Rust object.
7493     * Nearly everywhere, inner must be non-null, however in places where
7494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7495     */
7496    LDKnativeUpdateFailHTLC *inner;
7497    /**
7498     * Indicates that this is the only struct which contains the same pointer.
7499     * Rust functions which take ownership of an object provided via an argument require
7500     * this to be true and invalidate the object pointed to by inner.
7501     */
7502    bool is_owned;
7503 } LDKUpdateFailHTLC;
7504
7505 /**
7506  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
7507  * This corresponds to std::vector in C++
7508  */
7509 typedef struct LDKCVec_UpdateFailHTLCZ {
7510    /**
7511     * The elements in the array.
7512     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7513     */
7514    struct LDKUpdateFailHTLC *data;
7515    /**
7516     * The number of elements pointed to by `data`.
7517     */
7518    uintptr_t datalen;
7519 } LDKCVec_UpdateFailHTLCZ;
7520
7521
7522
7523 /**
7524  * An update_fail_malformed_htlc message to be sent or received from a peer
7525  */
7526 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
7527    /**
7528     * A pointer to the opaque Rust object.
7529     * Nearly everywhere, inner must be non-null, however in places where
7530     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7531     */
7532    LDKnativeUpdateFailMalformedHTLC *inner;
7533    /**
7534     * Indicates that this is the only struct which contains the same pointer.
7535     * Rust functions which take ownership of an object provided via an argument require
7536     * this to be true and invalidate the object pointed to by inner.
7537     */
7538    bool is_owned;
7539 } LDKUpdateFailMalformedHTLC;
7540
7541 /**
7542  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
7543  * This corresponds to std::vector in C++
7544  */
7545 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
7546    /**
7547     * The elements in the array.
7548     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7549     */
7550    struct LDKUpdateFailMalformedHTLC *data;
7551    /**
7552     * The number of elements pointed to by `data`.
7553     */
7554    uintptr_t datalen;
7555 } LDKCVec_UpdateFailMalformedHTLCZ;
7556
7557 /**
7558  * The contents of CResult_AcceptChannelDecodeErrorZ
7559  */
7560 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
7561    /**
7562     * A pointer to the contents in the success state.
7563     * Reading from this pointer when `result_ok` is not set is undefined.
7564     */
7565    struct LDKAcceptChannel *result;
7566    /**
7567     * A pointer to the contents in the error state.
7568     * Reading from this pointer when `result_ok` is set is undefined.
7569     */
7570    struct LDKDecodeError *err;
7571 } LDKCResult_AcceptChannelDecodeErrorZPtr;
7572
7573 /**
7574  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
7575  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7576  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7577  */
7578 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
7579    /**
7580     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
7581     * `err` or `result` depending on the state of `result_ok`.
7582     */
7583    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
7584    /**
7585     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
7586     */
7587    bool result_ok;
7588 } LDKCResult_AcceptChannelDecodeErrorZ;
7589
7590 /**
7591  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
7592  */
7593 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
7594    /**
7595     * A pointer to the contents in the success state.
7596     * Reading from this pointer when `result_ok` is not set is undefined.
7597     */
7598    struct LDKAnnouncementSignatures *result;
7599    /**
7600     * A pointer to the contents in the error state.
7601     * Reading from this pointer when `result_ok` is set is undefined.
7602     */
7603    struct LDKDecodeError *err;
7604 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
7605
7606 /**
7607  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
7608  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
7609  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7610  */
7611 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
7612    /**
7613     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
7614     * `err` or `result` depending on the state of `result_ok`.
7615     */
7616    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
7617    /**
7618     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
7619     */
7620    bool result_ok;
7621 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
7622
7623 /**
7624  * The contents of CResult_ChannelReestablishDecodeErrorZ
7625  */
7626 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
7627    /**
7628     * A pointer to the contents in the success state.
7629     * Reading from this pointer when `result_ok` is not set is undefined.
7630     */
7631    struct LDKChannelReestablish *result;
7632    /**
7633     * A pointer to the contents in the error state.
7634     * Reading from this pointer when `result_ok` is set is undefined.
7635     */
7636    struct LDKDecodeError *err;
7637 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
7638
7639 /**
7640  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
7641  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
7642  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7643  */
7644 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
7645    /**
7646     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
7647     * `err` or `result` depending on the state of `result_ok`.
7648     */
7649    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
7650    /**
7651     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
7652     */
7653    bool result_ok;
7654 } LDKCResult_ChannelReestablishDecodeErrorZ;
7655
7656 /**
7657  * The contents of CResult_ClosingSignedDecodeErrorZ
7658  */
7659 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
7660    /**
7661     * A pointer to the contents in the success state.
7662     * Reading from this pointer when `result_ok` is not set is undefined.
7663     */
7664    struct LDKClosingSigned *result;
7665    /**
7666     * A pointer to the contents in the error state.
7667     * Reading from this pointer when `result_ok` is set is undefined.
7668     */
7669    struct LDKDecodeError *err;
7670 } LDKCResult_ClosingSignedDecodeErrorZPtr;
7671
7672 /**
7673  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
7674  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7675  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7676  */
7677 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
7678    /**
7679     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
7680     * `err` or `result` depending on the state of `result_ok`.
7681     */
7682    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
7683    /**
7684     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
7685     */
7686    bool result_ok;
7687 } LDKCResult_ClosingSignedDecodeErrorZ;
7688
7689
7690
7691 /**
7692  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
7693  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
7694  * to use.
7695  */
7696 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
7697    /**
7698     * A pointer to the opaque Rust object.
7699     * Nearly everywhere, inner must be non-null, however in places where
7700     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7701     */
7702    LDKnativeClosingSignedFeeRange *inner;
7703    /**
7704     * Indicates that this is the only struct which contains the same pointer.
7705     * Rust functions which take ownership of an object provided via an argument require
7706     * this to be true and invalidate the object pointed to by inner.
7707     */
7708    bool is_owned;
7709 } LDKClosingSignedFeeRange;
7710
7711 /**
7712  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
7713  */
7714 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
7715    /**
7716     * A pointer to the contents in the success state.
7717     * Reading from this pointer when `result_ok` is not set is undefined.
7718     */
7719    struct LDKClosingSignedFeeRange *result;
7720    /**
7721     * A pointer to the contents in the error state.
7722     * Reading from this pointer when `result_ok` is set is undefined.
7723     */
7724    struct LDKDecodeError *err;
7725 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
7726
7727 /**
7728  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
7729  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7730  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7731  */
7732 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
7733    /**
7734     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
7735     * `err` or `result` depending on the state of `result_ok`.
7736     */
7737    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
7738    /**
7739     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
7740     */
7741    bool result_ok;
7742 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
7743
7744
7745
7746 /**
7747  * A commitment_signed message to be sent or received from a peer
7748  */
7749 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
7750    /**
7751     * A pointer to the opaque Rust object.
7752     * Nearly everywhere, inner must be non-null, however in places where
7753     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7754     */
7755    LDKnativeCommitmentSigned *inner;
7756    /**
7757     * Indicates that this is the only struct which contains the same pointer.
7758     * Rust functions which take ownership of an object provided via an argument require
7759     * this to be true and invalidate the object pointed to by inner.
7760     */
7761    bool is_owned;
7762 } LDKCommitmentSigned;
7763
7764 /**
7765  * The contents of CResult_CommitmentSignedDecodeErrorZ
7766  */
7767 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
7768    /**
7769     * A pointer to the contents in the success state.
7770     * Reading from this pointer when `result_ok` is not set is undefined.
7771     */
7772    struct LDKCommitmentSigned *result;
7773    /**
7774     * A pointer to the contents in the error state.
7775     * Reading from this pointer when `result_ok` is set is undefined.
7776     */
7777    struct LDKDecodeError *err;
7778 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
7779
7780 /**
7781  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
7782  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7784  */
7785 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
7786    /**
7787     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
7788     * `err` or `result` depending on the state of `result_ok`.
7789     */
7790    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
7791    /**
7792     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
7793     */
7794    bool result_ok;
7795 } LDKCResult_CommitmentSignedDecodeErrorZ;
7796
7797 /**
7798  * The contents of CResult_FundingCreatedDecodeErrorZ
7799  */
7800 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
7801    /**
7802     * A pointer to the contents in the success state.
7803     * Reading from this pointer when `result_ok` is not set is undefined.
7804     */
7805    struct LDKFundingCreated *result;
7806    /**
7807     * A pointer to the contents in the error state.
7808     * Reading from this pointer when `result_ok` is set is undefined.
7809     */
7810    struct LDKDecodeError *err;
7811 } LDKCResult_FundingCreatedDecodeErrorZPtr;
7812
7813 /**
7814  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
7815  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
7816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7817  */
7818 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
7819    /**
7820     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
7821     * `err` or `result` depending on the state of `result_ok`.
7822     */
7823    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
7824    /**
7825     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
7826     */
7827    bool result_ok;
7828 } LDKCResult_FundingCreatedDecodeErrorZ;
7829
7830 /**
7831  * The contents of CResult_FundingSignedDecodeErrorZ
7832  */
7833 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
7834    /**
7835     * A pointer to the contents in the success state.
7836     * Reading from this pointer when `result_ok` is not set is undefined.
7837     */
7838    struct LDKFundingSigned *result;
7839    /**
7840     * A pointer to the contents in the error state.
7841     * Reading from this pointer when `result_ok` is set is undefined.
7842     */
7843    struct LDKDecodeError *err;
7844 } LDKCResult_FundingSignedDecodeErrorZPtr;
7845
7846 /**
7847  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
7848  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7849  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7850  */
7851 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
7852    /**
7853     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
7854     * `err` or `result` depending on the state of `result_ok`.
7855     */
7856    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
7857    /**
7858     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
7859     */
7860    bool result_ok;
7861 } LDKCResult_FundingSignedDecodeErrorZ;
7862
7863 /**
7864  * The contents of CResult_FundingLockedDecodeErrorZ
7865  */
7866 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
7867    /**
7868     * A pointer to the contents in the success state.
7869     * Reading from this pointer when `result_ok` is not set is undefined.
7870     */
7871    struct LDKFundingLocked *result;
7872    /**
7873     * A pointer to the contents in the error state.
7874     * Reading from this pointer when `result_ok` is set is undefined.
7875     */
7876    struct LDKDecodeError *err;
7877 } LDKCResult_FundingLockedDecodeErrorZPtr;
7878
7879 /**
7880  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
7881  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
7882  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7883  */
7884 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
7885    /**
7886     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
7887     * `err` or `result` depending on the state of `result_ok`.
7888     */
7889    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
7890    /**
7891     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
7892     */
7893    bool result_ok;
7894 } LDKCResult_FundingLockedDecodeErrorZ;
7895
7896
7897
7898 /**
7899  * An init message to be sent or received from a peer
7900  */
7901 typedef struct MUST_USE_STRUCT LDKInit {
7902    /**
7903     * A pointer to the opaque Rust object.
7904     * Nearly everywhere, inner must be non-null, however in places where
7905     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7906     */
7907    LDKnativeInit *inner;
7908    /**
7909     * Indicates that this is the only struct which contains the same pointer.
7910     * Rust functions which take ownership of an object provided via an argument require
7911     * this to be true and invalidate the object pointed to by inner.
7912     */
7913    bool is_owned;
7914 } LDKInit;
7915
7916 /**
7917  * The contents of CResult_InitDecodeErrorZ
7918  */
7919 typedef union LDKCResult_InitDecodeErrorZPtr {
7920    /**
7921     * A pointer to the contents in the success state.
7922     * Reading from this pointer when `result_ok` is not set is undefined.
7923     */
7924    struct LDKInit *result;
7925    /**
7926     * A pointer to the contents in the error state.
7927     * Reading from this pointer when `result_ok` is set is undefined.
7928     */
7929    struct LDKDecodeError *err;
7930 } LDKCResult_InitDecodeErrorZPtr;
7931
7932 /**
7933  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
7934  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
7935  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7936  */
7937 typedef struct LDKCResult_InitDecodeErrorZ {
7938    /**
7939     * The contents of this CResult_InitDecodeErrorZ, accessible via either
7940     * `err` or `result` depending on the state of `result_ok`.
7941     */
7942    union LDKCResult_InitDecodeErrorZPtr contents;
7943    /**
7944     * Whether this CResult_InitDecodeErrorZ represents a success state.
7945     */
7946    bool result_ok;
7947 } LDKCResult_InitDecodeErrorZ;
7948
7949 /**
7950  * The contents of CResult_OpenChannelDecodeErrorZ
7951  */
7952 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
7953    /**
7954     * A pointer to the contents in the success state.
7955     * Reading from this pointer when `result_ok` is not set is undefined.
7956     */
7957    struct LDKOpenChannel *result;
7958    /**
7959     * A pointer to the contents in the error state.
7960     * Reading from this pointer when `result_ok` is set is undefined.
7961     */
7962    struct LDKDecodeError *err;
7963 } LDKCResult_OpenChannelDecodeErrorZPtr;
7964
7965 /**
7966  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
7967  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7968  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7969  */
7970 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
7971    /**
7972     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
7973     * `err` or `result` depending on the state of `result_ok`.
7974     */
7975    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
7976    /**
7977     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
7978     */
7979    bool result_ok;
7980 } LDKCResult_OpenChannelDecodeErrorZ;
7981
7982 /**
7983  * The contents of CResult_RevokeAndACKDecodeErrorZ
7984  */
7985 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
7986    /**
7987     * A pointer to the contents in the success state.
7988     * Reading from this pointer when `result_ok` is not set is undefined.
7989     */
7990    struct LDKRevokeAndACK *result;
7991    /**
7992     * A pointer to the contents in the error state.
7993     * Reading from this pointer when `result_ok` is set is undefined.
7994     */
7995    struct LDKDecodeError *err;
7996 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
7997
7998 /**
7999  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
8000  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
8001  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8002  */
8003 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
8004    /**
8005     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
8006     * `err` or `result` depending on the state of `result_ok`.
8007     */
8008    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
8009    /**
8010     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
8011     */
8012    bool result_ok;
8013 } LDKCResult_RevokeAndACKDecodeErrorZ;
8014
8015 /**
8016  * The contents of CResult_ShutdownDecodeErrorZ
8017  */
8018 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
8019    /**
8020     * A pointer to the contents in the success state.
8021     * Reading from this pointer when `result_ok` is not set is undefined.
8022     */
8023    struct LDKShutdown *result;
8024    /**
8025     * A pointer to the contents in the error state.
8026     * Reading from this pointer when `result_ok` is set is undefined.
8027     */
8028    struct LDKDecodeError *err;
8029 } LDKCResult_ShutdownDecodeErrorZPtr;
8030
8031 /**
8032  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
8033  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
8034  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8035  */
8036 typedef struct LDKCResult_ShutdownDecodeErrorZ {
8037    /**
8038     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
8039     * `err` or `result` depending on the state of `result_ok`.
8040     */
8041    union LDKCResult_ShutdownDecodeErrorZPtr contents;
8042    /**
8043     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
8044     */
8045    bool result_ok;
8046 } LDKCResult_ShutdownDecodeErrorZ;
8047
8048 /**
8049  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
8050  */
8051 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
8052    /**
8053     * A pointer to the contents in the success state.
8054     * Reading from this pointer when `result_ok` is not set is undefined.
8055     */
8056    struct LDKUpdateFailHTLC *result;
8057    /**
8058     * A pointer to the contents in the error state.
8059     * Reading from this pointer when `result_ok` is set is undefined.
8060     */
8061    struct LDKDecodeError *err;
8062 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
8063
8064 /**
8065  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
8066  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8068  */
8069 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
8070    /**
8071     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
8072     * `err` or `result` depending on the state of `result_ok`.
8073     */
8074    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
8075    /**
8076     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
8077     */
8078    bool result_ok;
8079 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
8080
8081 /**
8082  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
8083  */
8084 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
8085    /**
8086     * A pointer to the contents in the success state.
8087     * Reading from this pointer when `result_ok` is not set is undefined.
8088     */
8089    struct LDKUpdateFailMalformedHTLC *result;
8090    /**
8091     * A pointer to the contents in the error state.
8092     * Reading from this pointer when `result_ok` is set is undefined.
8093     */
8094    struct LDKDecodeError *err;
8095 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
8096
8097 /**
8098  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
8099  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8101  */
8102 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
8103    /**
8104     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
8105     * `err` or `result` depending on the state of `result_ok`.
8106     */
8107    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
8108    /**
8109     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
8110     */
8111    bool result_ok;
8112 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
8113
8114
8115
8116 /**
8117  * An update_fee message to be sent or received from a peer
8118  */
8119 typedef struct MUST_USE_STRUCT LDKUpdateFee {
8120    /**
8121     * A pointer to the opaque Rust object.
8122     * Nearly everywhere, inner must be non-null, however in places where
8123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8124     */
8125    LDKnativeUpdateFee *inner;
8126    /**
8127     * Indicates that this is the only struct which contains the same pointer.
8128     * Rust functions which take ownership of an object provided via an argument require
8129     * this to be true and invalidate the object pointed to by inner.
8130     */
8131    bool is_owned;
8132 } LDKUpdateFee;
8133
8134 /**
8135  * The contents of CResult_UpdateFeeDecodeErrorZ
8136  */
8137 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
8138    /**
8139     * A pointer to the contents in the success state.
8140     * Reading from this pointer when `result_ok` is not set is undefined.
8141     */
8142    struct LDKUpdateFee *result;
8143    /**
8144     * A pointer to the contents in the error state.
8145     * Reading from this pointer when `result_ok` is set is undefined.
8146     */
8147    struct LDKDecodeError *err;
8148 } LDKCResult_UpdateFeeDecodeErrorZPtr;
8149
8150 /**
8151  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
8152  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
8153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8154  */
8155 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
8156    /**
8157     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
8158     * `err` or `result` depending on the state of `result_ok`.
8159     */
8160    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
8161    /**
8162     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
8163     */
8164    bool result_ok;
8165 } LDKCResult_UpdateFeeDecodeErrorZ;
8166
8167 /**
8168  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
8169  */
8170 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
8171    /**
8172     * A pointer to the contents in the success state.
8173     * Reading from this pointer when `result_ok` is not set is undefined.
8174     */
8175    struct LDKUpdateFulfillHTLC *result;
8176    /**
8177     * A pointer to the contents in the error state.
8178     * Reading from this pointer when `result_ok` is set is undefined.
8179     */
8180    struct LDKDecodeError *err;
8181 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
8182
8183 /**
8184  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
8185  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8187  */
8188 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
8189    /**
8190     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
8191     * `err` or `result` depending on the state of `result_ok`.
8192     */
8193    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
8194    /**
8195     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
8196     */
8197    bool result_ok;
8198 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
8199
8200 /**
8201  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
8202  */
8203 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
8204    /**
8205     * A pointer to the contents in the success state.
8206     * Reading from this pointer when `result_ok` is not set is undefined.
8207     */
8208    struct LDKUpdateAddHTLC *result;
8209    /**
8210     * A pointer to the contents in the error state.
8211     * Reading from this pointer when `result_ok` is set is undefined.
8212     */
8213    struct LDKDecodeError *err;
8214 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
8215
8216 /**
8217  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
8218  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8219  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8220  */
8221 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
8222    /**
8223     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
8224     * `err` or `result` depending on the state of `result_ok`.
8225     */
8226    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
8227    /**
8228     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
8229     */
8230    bool result_ok;
8231 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
8232
8233
8234
8235 /**
8236  * A ping message to be sent or received from a peer
8237  */
8238 typedef struct MUST_USE_STRUCT LDKPing {
8239    /**
8240     * A pointer to the opaque Rust object.
8241     * Nearly everywhere, inner must be non-null, however in places where
8242     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8243     */
8244    LDKnativePing *inner;
8245    /**
8246     * Indicates that this is the only struct which contains the same pointer.
8247     * Rust functions which take ownership of an object provided via an argument require
8248     * this to be true and invalidate the object pointed to by inner.
8249     */
8250    bool is_owned;
8251 } LDKPing;
8252
8253 /**
8254  * The contents of CResult_PingDecodeErrorZ
8255  */
8256 typedef union LDKCResult_PingDecodeErrorZPtr {
8257    /**
8258     * A pointer to the contents in the success state.
8259     * Reading from this pointer when `result_ok` is not set is undefined.
8260     */
8261    struct LDKPing *result;
8262    /**
8263     * A pointer to the contents in the error state.
8264     * Reading from this pointer when `result_ok` is set is undefined.
8265     */
8266    struct LDKDecodeError *err;
8267 } LDKCResult_PingDecodeErrorZPtr;
8268
8269 /**
8270  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
8271  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
8272  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8273  */
8274 typedef struct LDKCResult_PingDecodeErrorZ {
8275    /**
8276     * The contents of this CResult_PingDecodeErrorZ, accessible via either
8277     * `err` or `result` depending on the state of `result_ok`.
8278     */
8279    union LDKCResult_PingDecodeErrorZPtr contents;
8280    /**
8281     * Whether this CResult_PingDecodeErrorZ represents a success state.
8282     */
8283    bool result_ok;
8284 } LDKCResult_PingDecodeErrorZ;
8285
8286
8287
8288 /**
8289  * A pong message to be sent or received from a peer
8290  */
8291 typedef struct MUST_USE_STRUCT LDKPong {
8292    /**
8293     * A pointer to the opaque Rust object.
8294     * Nearly everywhere, inner must be non-null, however in places where
8295     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8296     */
8297    LDKnativePong *inner;
8298    /**
8299     * Indicates that this is the only struct which contains the same pointer.
8300     * Rust functions which take ownership of an object provided via an argument require
8301     * this to be true and invalidate the object pointed to by inner.
8302     */
8303    bool is_owned;
8304 } LDKPong;
8305
8306 /**
8307  * The contents of CResult_PongDecodeErrorZ
8308  */
8309 typedef union LDKCResult_PongDecodeErrorZPtr {
8310    /**
8311     * A pointer to the contents in the success state.
8312     * Reading from this pointer when `result_ok` is not set is undefined.
8313     */
8314    struct LDKPong *result;
8315    /**
8316     * A pointer to the contents in the error state.
8317     * Reading from this pointer when `result_ok` is set is undefined.
8318     */
8319    struct LDKDecodeError *err;
8320 } LDKCResult_PongDecodeErrorZPtr;
8321
8322 /**
8323  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
8324  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
8325  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8326  */
8327 typedef struct LDKCResult_PongDecodeErrorZ {
8328    /**
8329     * The contents of this CResult_PongDecodeErrorZ, accessible via either
8330     * `err` or `result` depending on the state of `result_ok`.
8331     */
8332    union LDKCResult_PongDecodeErrorZPtr contents;
8333    /**
8334     * Whether this CResult_PongDecodeErrorZ represents a success state.
8335     */
8336    bool result_ok;
8337 } LDKCResult_PongDecodeErrorZ;
8338
8339 /**
8340  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
8341  */
8342 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8343    /**
8344     * A pointer to the contents in the success state.
8345     * Reading from this pointer when `result_ok` is not set is undefined.
8346     */
8347    struct LDKUnsignedChannelAnnouncement *result;
8348    /**
8349     * A pointer to the contents in the error state.
8350     * Reading from this pointer when `result_ok` is set is undefined.
8351     */
8352    struct LDKDecodeError *err;
8353 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
8354
8355 /**
8356  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8357  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8358  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8359  */
8360 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
8361    /**
8362     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
8363     * `err` or `result` depending on the state of `result_ok`.
8364     */
8365    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
8366    /**
8367     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
8368     */
8369    bool result_ok;
8370 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
8371
8372 /**
8373  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
8374  */
8375 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
8376    /**
8377     * A pointer to the contents in the success state.
8378     * Reading from this pointer when `result_ok` is not set is undefined.
8379     */
8380    struct LDKChannelAnnouncement *result;
8381    /**
8382     * A pointer to the contents in the error state.
8383     * Reading from this pointer when `result_ok` is set is undefined.
8384     */
8385    struct LDKDecodeError *err;
8386 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
8387
8388 /**
8389  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8390  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8391  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8392  */
8393 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
8394    /**
8395     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8396     * `err` or `result` depending on the state of `result_ok`.
8397     */
8398    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
8399    /**
8400     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8401     */
8402    bool result_ok;
8403 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
8404
8405
8406
8407 /**
8408  * The unsigned part of a channel_update
8409  */
8410 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8411    /**
8412     * A pointer to the opaque Rust object.
8413     * Nearly everywhere, inner must be non-null, however in places where
8414     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8415     */
8416    LDKnativeUnsignedChannelUpdate *inner;
8417    /**
8418     * Indicates that this is the only struct which contains the same pointer.
8419     * Rust functions which take ownership of an object provided via an argument require
8420     * this to be true and invalidate the object pointed to by inner.
8421     */
8422    bool is_owned;
8423 } LDKUnsignedChannelUpdate;
8424
8425 /**
8426  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8427  */
8428 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
8429    /**
8430     * A pointer to the contents in the success state.
8431     * Reading from this pointer when `result_ok` is not set is undefined.
8432     */
8433    struct LDKUnsignedChannelUpdate *result;
8434    /**
8435     * A pointer to the contents in the error state.
8436     * Reading from this pointer when `result_ok` is set is undefined.
8437     */
8438    struct LDKDecodeError *err;
8439 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
8440
8441 /**
8442  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8443  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8444  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8445  */
8446 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
8447    /**
8448     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8449     * `err` or `result` depending on the state of `result_ok`.
8450     */
8451    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
8452    /**
8453     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8454     */
8455    bool result_ok;
8456 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
8457
8458 /**
8459  * The contents of CResult_ChannelUpdateDecodeErrorZ
8460  */
8461 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
8462    /**
8463     * A pointer to the contents in the success state.
8464     * Reading from this pointer when `result_ok` is not set is undefined.
8465     */
8466    struct LDKChannelUpdate *result;
8467    /**
8468     * A pointer to the contents in the error state.
8469     * Reading from this pointer when `result_ok` is set is undefined.
8470     */
8471    struct LDKDecodeError *err;
8472 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
8473
8474 /**
8475  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8476  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8477  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8478  */
8479 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
8480    /**
8481     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8482     * `err` or `result` depending on the state of `result_ok`.
8483     */
8484    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
8485    /**
8486     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8487     */
8488    bool result_ok;
8489 } LDKCResult_ChannelUpdateDecodeErrorZ;
8490
8491 /**
8492  * The contents of CResult_ErrorMessageDecodeErrorZ
8493  */
8494 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
8495    /**
8496     * A pointer to the contents in the success state.
8497     * Reading from this pointer when `result_ok` is not set is undefined.
8498     */
8499    struct LDKErrorMessage *result;
8500    /**
8501     * A pointer to the contents in the error state.
8502     * Reading from this pointer when `result_ok` is set is undefined.
8503     */
8504    struct LDKDecodeError *err;
8505 } LDKCResult_ErrorMessageDecodeErrorZPtr;
8506
8507 /**
8508  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8509  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8510  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8511  */
8512 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
8513    /**
8514     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8515     * `err` or `result` depending on the state of `result_ok`.
8516     */
8517    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
8518    /**
8519     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8520     */
8521    bool result_ok;
8522 } LDKCResult_ErrorMessageDecodeErrorZ;
8523
8524
8525
8526 /**
8527  * The unsigned part of a node_announcement
8528  */
8529 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8530    /**
8531     * A pointer to the opaque Rust object.
8532     * Nearly everywhere, inner must be non-null, however in places where
8533     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8534     */
8535    LDKnativeUnsignedNodeAnnouncement *inner;
8536    /**
8537     * Indicates that this is the only struct which contains the same pointer.
8538     * Rust functions which take ownership of an object provided via an argument require
8539     * this to be true and invalidate the object pointed to by inner.
8540     */
8541    bool is_owned;
8542 } LDKUnsignedNodeAnnouncement;
8543
8544 /**
8545  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8546  */
8547 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8548    /**
8549     * A pointer to the contents in the success state.
8550     * Reading from this pointer when `result_ok` is not set is undefined.
8551     */
8552    struct LDKUnsignedNodeAnnouncement *result;
8553    /**
8554     * A pointer to the contents in the error state.
8555     * Reading from this pointer when `result_ok` is set is undefined.
8556     */
8557    struct LDKDecodeError *err;
8558 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
8559
8560 /**
8561  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8562  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8563  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8564  */
8565 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
8566    /**
8567     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8568     * `err` or `result` depending on the state of `result_ok`.
8569     */
8570    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
8571    /**
8572     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8573     */
8574    bool result_ok;
8575 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
8576
8577 /**
8578  * The contents of CResult_NodeAnnouncementDecodeErrorZ
8579  */
8580 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
8581    /**
8582     * A pointer to the contents in the success state.
8583     * Reading from this pointer when `result_ok` is not set is undefined.
8584     */
8585    struct LDKNodeAnnouncement *result;
8586    /**
8587     * A pointer to the contents in the error state.
8588     * Reading from this pointer when `result_ok` is set is undefined.
8589     */
8590    struct LDKDecodeError *err;
8591 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
8592
8593 /**
8594  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8595  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8596  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8597  */
8598 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
8599    /**
8600     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8601     * `err` or `result` depending on the state of `result_ok`.
8602     */
8603    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
8604    /**
8605     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8606     */
8607    bool result_ok;
8608 } LDKCResult_NodeAnnouncementDecodeErrorZ;
8609
8610 /**
8611  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8612  */
8613 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
8614    /**
8615     * A pointer to the contents in the success state.
8616     * Reading from this pointer when `result_ok` is not set is undefined.
8617     */
8618    struct LDKQueryShortChannelIds *result;
8619    /**
8620     * A pointer to the contents in the error state.
8621     * Reading from this pointer when `result_ok` is set is undefined.
8622     */
8623    struct LDKDecodeError *err;
8624 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
8625
8626 /**
8627  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8628  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8629  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8630  */
8631 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
8632    /**
8633     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8634     * `err` or `result` depending on the state of `result_ok`.
8635     */
8636    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
8637    /**
8638     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8639     */
8640    bool result_ok;
8641 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
8642
8643
8644
8645 /**
8646  * A reply_short_channel_ids_end message is sent as a reply to a
8647  * query_short_channel_ids message. The query recipient makes a best
8648  * effort to respond based on their local network view which may not be
8649  * a perfect view of the network.
8650  */
8651 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
8652    /**
8653     * A pointer to the opaque Rust object.
8654     * Nearly everywhere, inner must be non-null, however in places where
8655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8656     */
8657    LDKnativeReplyShortChannelIdsEnd *inner;
8658    /**
8659     * Indicates that this is the only struct which contains the same pointer.
8660     * Rust functions which take ownership of an object provided via an argument require
8661     * this to be true and invalidate the object pointed to by inner.
8662     */
8663    bool is_owned;
8664 } LDKReplyShortChannelIdsEnd;
8665
8666 /**
8667  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8668  */
8669 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8670    /**
8671     * A pointer to the contents in the success state.
8672     * Reading from this pointer when `result_ok` is not set is undefined.
8673     */
8674    struct LDKReplyShortChannelIdsEnd *result;
8675    /**
8676     * A pointer to the contents in the error state.
8677     * Reading from this pointer when `result_ok` is set is undefined.
8678     */
8679    struct LDKDecodeError *err;
8680 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
8681
8682 /**
8683  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8684  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8686  */
8687 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
8688    /**
8689     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8690     * `err` or `result` depending on the state of `result_ok`.
8691     */
8692    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
8693    /**
8694     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8695     */
8696    bool result_ok;
8697 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
8698
8699 /**
8700  * The contents of CResult_QueryChannelRangeDecodeErrorZ
8701  */
8702 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
8703    /**
8704     * A pointer to the contents in the success state.
8705     * Reading from this pointer when `result_ok` is not set is undefined.
8706     */
8707    struct LDKQueryChannelRange *result;
8708    /**
8709     * A pointer to the contents in the error state.
8710     * Reading from this pointer when `result_ok` is set is undefined.
8711     */
8712    struct LDKDecodeError *err;
8713 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
8714
8715 /**
8716  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8717  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8719  */
8720 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
8721    /**
8722     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8723     * `err` or `result` depending on the state of `result_ok`.
8724     */
8725    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
8726    /**
8727     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8728     */
8729    bool result_ok;
8730 } LDKCResult_QueryChannelRangeDecodeErrorZ;
8731
8732 /**
8733  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
8734  */
8735 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
8736    /**
8737     * A pointer to the contents in the success state.
8738     * Reading from this pointer when `result_ok` is not set is undefined.
8739     */
8740    struct LDKReplyChannelRange *result;
8741    /**
8742     * A pointer to the contents in the error state.
8743     * Reading from this pointer when `result_ok` is set is undefined.
8744     */
8745    struct LDKDecodeError *err;
8746 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
8747
8748 /**
8749  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8750  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8752  */
8753 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
8754    /**
8755     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8756     * `err` or `result` depending on the state of `result_ok`.
8757     */
8758    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
8759    /**
8760     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8761     */
8762    bool result_ok;
8763 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
8764
8765
8766
8767 /**
8768  * A gossip_timestamp_filter message is used by a node to request
8769  * gossip relay for messages in the requested time range when the
8770  * gossip_queries feature has been negotiated.
8771  */
8772 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
8773    /**
8774     * A pointer to the opaque Rust object.
8775     * Nearly everywhere, inner must be non-null, however in places where
8776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8777     */
8778    LDKnativeGossipTimestampFilter *inner;
8779    /**
8780     * Indicates that this is the only struct which contains the same pointer.
8781     * Rust functions which take ownership of an object provided via an argument require
8782     * this to be true and invalidate the object pointed to by inner.
8783     */
8784    bool is_owned;
8785 } LDKGossipTimestampFilter;
8786
8787 /**
8788  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
8789  */
8790 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
8791    /**
8792     * A pointer to the contents in the success state.
8793     * Reading from this pointer when `result_ok` is not set is undefined.
8794     */
8795    struct LDKGossipTimestampFilter *result;
8796    /**
8797     * A pointer to the contents in the error state.
8798     * Reading from this pointer when `result_ok` is set is undefined.
8799     */
8800    struct LDKDecodeError *err;
8801 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
8802
8803 /**
8804  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8805  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8807  */
8808 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
8809    /**
8810     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8811     * `err` or `result` depending on the state of `result_ok`.
8812     */
8813    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
8814    /**
8815     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8816     */
8817    bool result_ok;
8818 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
8819
8820 /**
8821  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
8822  * may occur.
8823  */
8824 typedef enum LDKSignOrCreationError_Tag {
8825    /**
8826     * An error occurred during signing
8827     */
8828    LDKSignOrCreationError_SignError,
8829    /**
8830     * An error occurred while building the transaction
8831     */
8832    LDKSignOrCreationError_CreationError,
8833    /**
8834     * Must be last for serialization purposes
8835     */
8836    LDKSignOrCreationError_Sentinel,
8837 } LDKSignOrCreationError_Tag;
8838
8839 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
8840    LDKSignOrCreationError_Tag tag;
8841    union {
8842       struct {
8843          enum LDKCreationError creation_error;
8844       };
8845    };
8846 } LDKSignOrCreationError;
8847
8848 /**
8849  * The contents of CResult_InvoiceSignOrCreationErrorZ
8850  */
8851 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
8852    /**
8853     * A pointer to the contents in the success state.
8854     * Reading from this pointer when `result_ok` is not set is undefined.
8855     */
8856    struct LDKInvoice *result;
8857    /**
8858     * A pointer to the contents in the error state.
8859     * Reading from this pointer when `result_ok` is set is undefined.
8860     */
8861    struct LDKSignOrCreationError *err;
8862 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
8863
8864 /**
8865  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
8866  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
8867  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8868  */
8869 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
8870    /**
8871     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
8872     * `err` or `result` depending on the state of `result_ok`.
8873     */
8874    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
8875    /**
8876     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
8877     */
8878    bool result_ok;
8879 } LDKCResult_InvoiceSignOrCreationErrorZ;
8880
8881
8882
8883 /**
8884  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8885  *
8886  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8887  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8888  * the return value of [`Filter::register_output`].
8889  *
8890  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8891  * may have been spent there. See [`Filter::register_output`] for details.
8892  *
8893  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8894  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8895  */
8896 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8897    /**
8898     * A pointer to the opaque Rust object.
8899     * Nearly everywhere, inner must be non-null, however in places where
8900     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8901     */
8902    LDKnativeWatchedOutput *inner;
8903    /**
8904     * Indicates that this is the only struct which contains the same pointer.
8905     * Rust functions which take ownership of an object provided via an argument require
8906     * this to be true and invalidate the object pointed to by inner.
8907     */
8908    bool is_owned;
8909 } LDKWatchedOutput;
8910
8911 /**
8912  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8913  * channels.
8914  *
8915  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8916  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8917  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8918  * receiving full blocks from a chain source, any further filtering is unnecessary.
8919  *
8920  * After an output has been registered, subsequent block retrievals from the chain source must not
8921  * exclude any transactions matching the new criteria nor any in-block descendants of such
8922  * transactions.
8923  *
8924  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8925  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8926  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8927  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8928  *
8929  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
8930  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8931  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8932  */
8933 typedef struct LDKFilter {
8934    /**
8935     * An opaque pointer which is passed to your function implementations as an argument.
8936     * This has no meaning in the LDK, and can be NULL or any other value.
8937     */
8938    void *this_arg;
8939    /**
8940     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8941     * a spending condition.
8942     */
8943    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8944    /**
8945     * Registers interest in spends of a transaction output.
8946     *
8947     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8948     * output that is found in the corresponding block along with its index.
8949     *
8950     * This return value is useful for Electrum clients in order to supply in-block descendant
8951     * transactions which otherwise were not included. This is not necessary for other clients if
8952     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8953     * full block).
8954     */
8955    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8956    /**
8957     * Frees any resources associated with this object given its this_arg pointer.
8958     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8959     */
8960    void (*free)(void *this_arg);
8961 } LDKFilter;
8962
8963 /**
8964  * An enum which can either contain a crate::lightning::chain::Filter or not
8965  */
8966 typedef enum LDKCOption_FilterZ_Tag {
8967    /**
8968     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
8969     */
8970    LDKCOption_FilterZ_Some,
8971    /**
8972     * When we're in this state, this COption_FilterZ contains nothing
8973     */
8974    LDKCOption_FilterZ_None,
8975    /**
8976     * Must be last for serialization purposes
8977     */
8978    LDKCOption_FilterZ_Sentinel,
8979 } LDKCOption_FilterZ_Tag;
8980
8981 typedef struct LDKCOption_FilterZ {
8982    LDKCOption_FilterZ_Tag tag;
8983    union {
8984       struct {
8985          struct LDKFilter some;
8986       };
8987    };
8988 } LDKCOption_FilterZ;
8989
8990
8991
8992 /**
8993  * A read-only reference to a current ChannelMonitor.
8994  *
8995  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
8996  * released.
8997  */
8998 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
8999    /**
9000     * A pointer to the opaque Rust object.
9001     * Nearly everywhere, inner must be non-null, however in places where
9002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9003     */
9004    LDKnativeLockedChannelMonitor *inner;
9005    /**
9006     * Indicates that this is the only struct which contains the same pointer.
9007     * Rust functions which take ownership of an object provided via an argument require
9008     * this to be true and invalidate the object pointed to by inner.
9009     */
9010    bool is_owned;
9011 } LDKLockedChannelMonitor;
9012
9013 /**
9014  * The contents of CResult_LockedChannelMonitorNoneZ
9015  */
9016 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
9017    /**
9018     * A pointer to the contents in the success state.
9019     * Reading from this pointer when `result_ok` is not set is undefined.
9020     */
9021    struct LDKLockedChannelMonitor *result;
9022    /**
9023     * Note that this value is always NULL, as there are no contents in the Err variant
9024     */
9025    void *err;
9026 } LDKCResult_LockedChannelMonitorNoneZPtr;
9027
9028 /**
9029  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
9030  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
9031  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9032  */
9033 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
9034    /**
9035     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
9036     * `err` or `result` depending on the state of `result_ok`.
9037     */
9038    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
9039    /**
9040     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
9041     */
9042    bool result_ok;
9043 } LDKCResult_LockedChannelMonitorNoneZ;
9044
9045 /**
9046  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
9047  * This corresponds to std::vector in C++
9048  */
9049 typedef struct LDKCVec_OutPointZ {
9050    /**
9051     * The elements in the array.
9052     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9053     */
9054    struct LDKOutPoint *data;
9055    /**
9056     * The number of elements pointed to by `data`.
9057     */
9058    uintptr_t datalen;
9059 } LDKCVec_OutPointZ;
9060
9061 /**
9062  * A trait indicating an object may generate message send events
9063  */
9064 typedef struct LDKMessageSendEventsProvider {
9065    /**
9066     * An opaque pointer which is passed to your function implementations as an argument.
9067     * This has no meaning in the LDK, and can be NULL or any other value.
9068     */
9069    void *this_arg;
9070    /**
9071     * Gets the list of pending events which were generated by previous actions, clearing the list
9072     * in the process.
9073     */
9074    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
9075    /**
9076     * Frees any resources associated with this object given its this_arg pointer.
9077     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9078     */
9079    void (*free)(void *this_arg);
9080 } LDKMessageSendEventsProvider;
9081
9082 /**
9083  * A trait implemented for objects handling events from [`EventsProvider`].
9084  */
9085 typedef struct LDKEventHandler {
9086    /**
9087     * An opaque pointer which is passed to your function implementations as an argument.
9088     * This has no meaning in the LDK, and can be NULL or any other value.
9089     */
9090    void *this_arg;
9091    /**
9092     * Handles the given [`Event`].
9093     *
9094     * See [`EventsProvider`] for details that must be considered when implementing this method.
9095     */
9096    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
9097    /**
9098     * Frees any resources associated with this object given its this_arg pointer.
9099     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9100     */
9101    void (*free)(void *this_arg);
9102 } LDKEventHandler;
9103
9104 /**
9105  * A trait indicating an object may generate events.
9106  *
9107  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
9108  *
9109  * # Requirements
9110  *
9111  * See [`process_pending_events`] for requirements around event processing.
9112  *
9113  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
9114  * event since the last invocation. The handler must either act upon the event immediately
9115  * or preserve it for later handling.
9116  *
9117  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
9118  * consult the provider's documentation on the implication of processing events and how a handler
9119  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
9120  * [`ChainMonitor::process_pending_events`]).
9121  *
9122  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
9123  * own type(s).
9124  *
9125  * [`process_pending_events`]: Self::process_pending_events
9126  * [`handle_event`]: EventHandler::handle_event
9127  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
9128  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
9129  */
9130 typedef struct LDKEventsProvider {
9131    /**
9132     * An opaque pointer which is passed to your function implementations as an argument.
9133     * This has no meaning in the LDK, and can be NULL or any other value.
9134     */
9135    void *this_arg;
9136    /**
9137     * Processes any events generated since the last call using the given event handler.
9138     *
9139     * Subsequent calls must only process new events. However, handlers must be capable of handling
9140     * duplicate events across process restarts. This may occur if the provider was recovered from
9141     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
9142     */
9143    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
9144    /**
9145     * Frees any resources associated with this object given its this_arg pointer.
9146     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9147     */
9148    void (*free)(void *this_arg);
9149 } LDKEventsProvider;
9150
9151
9152
9153 /**
9154  * Configuration we set when applicable.
9155  *
9156  * Default::default() provides sane defaults.
9157  */
9158 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
9159    /**
9160     * A pointer to the opaque Rust object.
9161     * Nearly everywhere, inner must be non-null, however in places where
9162     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9163     */
9164    LDKnativeChannelHandshakeConfig *inner;
9165    /**
9166     * Indicates that this is the only struct which contains the same pointer.
9167     * Rust functions which take ownership of an object provided via an argument require
9168     * this to be true and invalidate the object pointed to by inner.
9169     */
9170    bool is_owned;
9171 } LDKChannelHandshakeConfig;
9172
9173
9174
9175 /**
9176  * Optional channel limits which are applied during channel creation.
9177  *
9178  * These limits are only applied to our counterparty's limits, not our own.
9179  *
9180  * Use 0/<type>::max_value() as appropriate to skip checking.
9181  *
9182  * Provides sane defaults for most configurations.
9183  *
9184  * Most additional limits are disabled except those with which specify a default in individual
9185  * field documentation. Note that this may result in barely-usable channels, but since they
9186  * are applied mostly only to incoming channels that's not much of a problem.
9187  */
9188 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
9189    /**
9190     * A pointer to the opaque Rust object.
9191     * Nearly everywhere, inner must be non-null, however in places where
9192     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9193     */
9194    LDKnativeChannelHandshakeLimits *inner;
9195    /**
9196     * Indicates that this is the only struct which contains the same pointer.
9197     * Rust functions which take ownership of an object provided via an argument require
9198     * this to be true and invalidate the object pointed to by inner.
9199     */
9200    bool is_owned;
9201 } LDKChannelHandshakeLimits;
9202
9203
9204
9205 /**
9206  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
9207  *
9208  * Default::default() provides sane defaults for most configurations
9209  * (but currently with 0 relay fees!)
9210  */
9211 typedef struct MUST_USE_STRUCT LDKUserConfig {
9212    /**
9213     * A pointer to the opaque Rust object.
9214     * Nearly everywhere, inner must be non-null, however in places where
9215     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9216     */
9217    LDKnativeUserConfig *inner;
9218    /**
9219     * Indicates that this is the only struct which contains the same pointer.
9220     * Rust functions which take ownership of an object provided via an argument require
9221     * this to be true and invalidate the object pointed to by inner.
9222     */
9223    bool is_owned;
9224 } LDKUserConfig;
9225
9226
9227
9228 /**
9229  * The best known block as identified by its hash and height.
9230  */
9231 typedef struct MUST_USE_STRUCT LDKBestBlock {
9232    /**
9233     * A pointer to the opaque Rust object.
9234     * Nearly everywhere, inner must be non-null, however in places where
9235     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9236     */
9237    LDKnativeBestBlock *inner;
9238    /**
9239     * Indicates that this is the only struct which contains the same pointer.
9240     * Rust functions which take ownership of an object provided via an argument require
9241     * this to be true and invalidate the object pointed to by inner.
9242     */
9243    bool is_owned;
9244 } LDKBestBlock;
9245
9246 /**
9247  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
9248  * chain.
9249  *
9250  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
9251  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
9252  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
9253  * when needed.
9254  */
9255 typedef struct LDKListen {
9256    /**
9257     * An opaque pointer which is passed to your function implementations as an argument.
9258     * This has no meaning in the LDK, and can be NULL or any other value.
9259     */
9260    void *this_arg;
9261    /**
9262     * Notifies the listener that a block was added at the given height.
9263     */
9264    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
9265    /**
9266     * Notifies the listener that a block was removed at the given height.
9267     */
9268    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9269    /**
9270     * Frees any resources associated with this object given its this_arg pointer.
9271     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9272     */
9273    void (*free)(void *this_arg);
9274 } LDKListen;
9275
9276 /**
9277  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
9278  * unconfirmed during a chain reorganization.
9279  *
9280  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
9281  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
9282  * related to registered transactions and outputs. Upon notification, it would pass along the
9283  * matching transactions using this interface.
9284  *
9285  * # Use
9286  *
9287  * The intended use is as follows:
9288  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
9289  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
9290  *   that has been reorganized out of the chain.
9291  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
9292  *
9293  * # Order
9294  *
9295  * Clients must call these methods in chain order. Specifically:
9296  * - Transactions confirmed in a block must be given before transactions confirmed in a later
9297  *   block.
9298  * - Dependent transactions within the same block must be given in topological order, possibly in
9299  *   separate calls.
9300  * - Unconfirmed transactions must be given after the original confirmations and before any
9301  *   reconfirmation.
9302  *
9303  * See individual method documentation for further details.
9304  *
9305  * [`transactions_confirmed`]: Self::transactions_confirmed
9306  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9307  * [`best_block_updated`]: Self::best_block_updated
9308  * [`get_relevant_txids`]: Self::get_relevant_txids
9309  */
9310 typedef struct LDKConfirm {
9311    /**
9312     * An opaque pointer which is passed to your function implementations as an argument.
9313     * This has no meaning in the LDK, and can be NULL or any other value.
9314     */
9315    void *this_arg;
9316    /**
9317     * Processes transactions confirmed in a block with a given header and height.
9318     *
9319     * Should be called for any transactions registered by [`Filter::register_tx`] or any
9320     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
9321     * appearing in the same block do not need to be included in the same call; instead, multiple
9322     * calls with additional transactions may be made so long as they are made in [chain order].
9323     *
9324     * May be called before or after [`best_block_updated`] for the corresponding block. However,
9325     * in the event of a chain reorganization, it must not be called with a `header` that is no
9326     * longer in the chain as of the last call to [`best_block_updated`].
9327     *
9328     * [chain order]: Confirm#Order
9329     * [`best_block_updated`]: Self::best_block_updated
9330     */
9331    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
9332    /**
9333     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
9334     *
9335     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
9336     * reorganized out of the best chain. Once called, the given transaction should not be returned
9337     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
9338     *
9339     * [`get_relevant_txids`]: Self::get_relevant_txids
9340     * [`transactions_confirmed`]: Self::transactions_confirmed
9341     */
9342    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
9343    /**
9344     * Processes an update to the best header connected at the given height.
9345     *
9346     * Should be called when a new header is available but may be skipped for intermediary blocks
9347     * if they become available at the same time.
9348     */
9349    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9350    /**
9351     * Returns transactions that should be monitored for reorganization out of the chain.
9352     *
9353     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
9354     * confirmations to be safe from a chain reorganization. Should not include any transactions
9355     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
9356     *
9357     * May be called to determine the subset of transactions that must still be monitored for
9358     * reorganization. Will be idempotent between calls but may change as a result of calls to the
9359     * other interface methods. Thus, this is useful to determine which transactions may need to be
9360     * given to [`transaction_unconfirmed`].
9361     *
9362     * [`transactions_confirmed`]: Self::transactions_confirmed
9363     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9364     */
9365    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
9366    /**
9367     * Frees any resources associated with this object given its this_arg pointer.
9368     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9369     */
9370    void (*free)(void *this_arg);
9371 } LDKConfirm;
9372
9373 /**
9374  * `Persist` defines behavior for persisting channel monitors: this could mean
9375  * writing once to disk, and/or uploading to one or more backup services.
9376  *
9377  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
9378  * to disk/backups. And, on every update, you **must** persist either the
9379  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
9380  * of situations such as revoking a transaction, then crashing before this
9381  * revocation can be persisted, then unintentionally broadcasting a revoked
9382  * transaction and losing money. This is a risk because previous channel states
9383  * are toxic, so it's important that whatever channel state is persisted is
9384  * kept up-to-date.
9385  */
9386 typedef struct LDKPersist {
9387    /**
9388     * An opaque pointer which is passed to your function implementations as an argument.
9389     * This has no meaning in the LDK, and can be NULL or any other value.
9390     */
9391    void *this_arg;
9392    /**
9393     * Persist a new channel's data. The data can be stored any way you want, but
9394     * the identifier provided by Rust-Lightning is the channel's outpoint (and
9395     * it is up to you to maintain a correct mapping between the outpoint and the
9396     * stored channel data). Note that you **must** persist every new monitor to
9397     * disk. See the `Persist` trait documentation for more details.
9398     *
9399     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
9400     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9401     *
9402     * [`Writeable::write`]: crate::util::ser::Writeable::write
9403     */
9404    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
9405    /**
9406     * Update one channel's data. The provided `ChannelMonitor` has already
9407     * applied the given update.
9408     *
9409     * Note that on every update, you **must** persist either the
9410     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
9411     * the `Persist` trait documentation for more details.
9412     *
9413     * If an implementer chooses to persist the updates only, they need to make
9414     * sure that all the updates are applied to the `ChannelMonitors` *before*
9415     * the set of channel monitors is given to the `ChannelManager`
9416     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
9417     * applying a monitor update to a monitor. If full `ChannelMonitors` are
9418     * persisted, then there is no need to persist individual updates.
9419     *
9420     * Note that there could be a performance tradeoff between persisting complete
9421     * channel monitors on every update vs. persisting only updates and applying
9422     * them in batches. The size of each monitor grows `O(number of state updates)`
9423     * whereas updates are small and `O(1)`.
9424     *
9425     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
9426     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
9427     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9428     *
9429     * [`Writeable::write`]: crate::util::ser::Writeable::write
9430     */
9431    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);
9432    /**
9433     * Frees any resources associated with this object given its this_arg pointer.
9434     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9435     */
9436    void (*free)(void *this_arg);
9437 } LDKPersist;
9438
9439
9440
9441 /**
9442  * An implementation of [`chain::Watch`] for monitoring channels.
9443  *
9444  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
9445  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
9446  * or used independently to monitor channels remotely. See the [module-level documentation] for
9447  * details.
9448  *
9449  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9450  * [module-level documentation]: crate::chain::chainmonitor
9451  */
9452 typedef struct MUST_USE_STRUCT LDKChainMonitor {
9453    /**
9454     * A pointer to the opaque Rust object.
9455     * Nearly everywhere, inner must be non-null, however in places where
9456     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9457     */
9458    LDKnativeChainMonitor *inner;
9459    /**
9460     * Indicates that this is the only struct which contains the same pointer.
9461     * Rust functions which take ownership of an object provided via an argument require
9462     * this to be true and invalidate the object pointed to by inner.
9463     */
9464    bool is_owned;
9465 } LDKChainMonitor;
9466
9467
9468
9469 /**
9470  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
9471  * and derives keys from that.
9472  *
9473  * Your node_id is seed/0'
9474  * ChannelMonitor closes may use seed/1'
9475  * Cooperative closes may use seed/2'
9476  * The two close keys may be needed to claim on-chain funds!
9477  */
9478 typedef struct MUST_USE_STRUCT LDKKeysManager {
9479    /**
9480     * A pointer to the opaque Rust object.
9481     * Nearly everywhere, inner must be non-null, however in places where
9482     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9483     */
9484    LDKnativeKeysManager *inner;
9485    /**
9486     * Indicates that this is the only struct which contains the same pointer.
9487     * Rust functions which take ownership of an object provided via an argument require
9488     * this to be true and invalidate the object pointed to by inner.
9489     */
9490    bool is_owned;
9491 } LDKKeysManager;
9492
9493
9494
9495 /**
9496  * Chain-related parameters used to construct a new `ChannelManager`.
9497  *
9498  * Typically, the block-specific parameters are derived from the best block hash for the network,
9499  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
9500  * are not needed when deserializing a previously constructed `ChannelManager`.
9501  */
9502 typedef struct MUST_USE_STRUCT LDKChainParameters {
9503    /**
9504     * A pointer to the opaque Rust object.
9505     * Nearly everywhere, inner must be non-null, however in places where
9506     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9507     */
9508    LDKnativeChainParameters *inner;
9509    /**
9510     * Indicates that this is the only struct which contains the same pointer.
9511     * Rust functions which take ownership of an object provided via an argument require
9512     * this to be true and invalidate the object pointed to by inner.
9513     */
9514    bool is_owned;
9515 } LDKChainParameters;
9516
9517
9518
9519 /**
9520  * Information needed for constructing an invoice route hint for this channel.
9521  */
9522 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
9523    /**
9524     * A pointer to the opaque Rust object.
9525     * Nearly everywhere, inner must be non-null, however in places where
9526     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9527     */
9528    LDKnativeCounterpartyForwardingInfo *inner;
9529    /**
9530     * Indicates that this is the only struct which contains the same pointer.
9531     * Rust functions which take ownership of an object provided via an argument require
9532     * this to be true and invalidate the object pointed to by inner.
9533     */
9534    bool is_owned;
9535 } LDKCounterpartyForwardingInfo;
9536
9537
9538
9539 /**
9540  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
9541  * to better separate parameters.
9542  */
9543 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
9544    /**
9545     * A pointer to the opaque Rust object.
9546     * Nearly everywhere, inner must be non-null, however in places where
9547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9548     */
9549    LDKnativeChannelCounterparty *inner;
9550    /**
9551     * Indicates that this is the only struct which contains the same pointer.
9552     * Rust functions which take ownership of an object provided via an argument require
9553     * this to be true and invalidate the object pointed to by inner.
9554     */
9555    bool is_owned;
9556 } LDKChannelCounterparty;
9557
9558 /**
9559  * A 3-byte byte array.
9560  */
9561 typedef struct LDKThreeBytes {
9562    /**
9563     * The three bytes
9564     */
9565    uint8_t data[3];
9566 } LDKThreeBytes;
9567
9568 /**
9569  * A trait to describe an object which can receive channel messages.
9570  *
9571  * Messages MAY be called in parallel when they originate from different their_node_ids, however
9572  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
9573  */
9574 typedef struct LDKChannelMessageHandler {
9575    /**
9576     * An opaque pointer which is passed to your function implementations as an argument.
9577     * This has no meaning in the LDK, and can be NULL or any other value.
9578     */
9579    void *this_arg;
9580    /**
9581     * Handle an incoming open_channel message from the given peer.
9582     */
9583    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
9584    /**
9585     * Handle an incoming accept_channel message from the given peer.
9586     */
9587    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
9588    /**
9589     * Handle an incoming funding_created message from the given peer.
9590     */
9591    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
9592    /**
9593     * Handle an incoming funding_signed message from the given peer.
9594     */
9595    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
9596    /**
9597     * Handle an incoming funding_locked message from the given peer.
9598     */
9599    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
9600    /**
9601     * Handle an incoming shutdown message from the given peer.
9602     */
9603    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);
9604    /**
9605     * Handle an incoming closing_signed message from the given peer.
9606     */
9607    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
9608    /**
9609     * Handle an incoming update_add_htlc message from the given peer.
9610     */
9611    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
9612    /**
9613     * Handle an incoming update_fulfill_htlc message from the given peer.
9614     */
9615    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
9616    /**
9617     * Handle an incoming update_fail_htlc message from the given peer.
9618     */
9619    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
9620    /**
9621     * Handle an incoming update_fail_malformed_htlc message from the given peer.
9622     */
9623    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
9624    /**
9625     * Handle an incoming commitment_signed message from the given peer.
9626     */
9627    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
9628    /**
9629     * Handle an incoming revoke_and_ack message from the given peer.
9630     */
9631    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
9632    /**
9633     * Handle an incoming update_fee message from the given peer.
9634     */
9635    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
9636    /**
9637     * Handle an incoming announcement_signatures message from the given peer.
9638     */
9639    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
9640    /**
9641     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
9642     * is believed to be possible in the future (eg they're sending us messages we don't
9643     * understand or indicate they require unknown feature bits), no_connection_possible is set
9644     * and any outstanding channels should be failed.
9645     */
9646    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
9647    /**
9648     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
9649     */
9650    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
9651    /**
9652     * Handle an incoming channel_reestablish message from the given peer.
9653     */
9654    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
9655    /**
9656     * Handle an incoming channel update from the given peer.
9657     */
9658    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
9659    /**
9660     * Handle an incoming error message from the given peer.
9661     */
9662    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
9663    /**
9664     * Implementation of MessageSendEventsProvider for this object.
9665     */
9666    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
9667    /**
9668     * Frees any resources associated with this object given its this_arg pointer.
9669     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9670     */
9671    void (*free)(void *this_arg);
9672 } LDKChannelMessageHandler;
9673
9674
9675
9676 /**
9677  * Arguments for the creation of a ChannelManager that are not deserialized.
9678  *
9679  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
9680  * is:
9681  * 1) Deserialize all stored ChannelMonitors.
9682  * 2) Deserialize the ChannelManager by filling in this struct and calling:
9683  *    <(BlockHash, ChannelManager)>::read(reader, args)
9684  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
9685  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
9686  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
9687  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
9688  *    ChannelMonitor::get_funding_txo().
9689  * 4) Reconnect blocks on your ChannelMonitors.
9690  * 5) Disconnect/connect blocks on the ChannelManager.
9691  * 6) Move the ChannelMonitors into your local chain::Watch.
9692  *
9693  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
9694  * call any other methods on the newly-deserialized ChannelManager.
9695  *
9696  * Note that because some channels may be closed during deserialization, it is critical that you
9697  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
9698  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
9699  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
9700  * not force-close the same channels but consider them live), you may end up revoking a state for
9701  * which you've already broadcasted the transaction.
9702  */
9703 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
9704    /**
9705     * A pointer to the opaque Rust object.
9706     * Nearly everywhere, inner must be non-null, however in places where
9707     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9708     */
9709    LDKnativeChannelManagerReadArgs *inner;
9710    /**
9711     * Indicates that this is the only struct which contains the same pointer.
9712     * Rust functions which take ownership of an object provided via an argument require
9713     * this to be true and invalidate the object pointed to by inner.
9714     */
9715    bool is_owned;
9716 } LDKChannelManagerReadArgs;
9717
9718
9719
9720 /**
9721  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
9722  * This is used to convince the recipient that the channel is at a certain commitment
9723  * number even if they lost that data due to a local failure.  Of course, the peer may lie
9724  * and even later commitments may have been revoked.
9725  */
9726 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
9727    /**
9728     * A pointer to the opaque Rust object.
9729     * Nearly everywhere, inner must be non-null, however in places where
9730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9731     */
9732    LDKnativeDataLossProtect *inner;
9733    /**
9734     * Indicates that this is the only struct which contains the same pointer.
9735     * Rust functions which take ownership of an object provided via an argument require
9736     * this to be true and invalidate the object pointed to by inner.
9737     */
9738    bool is_owned;
9739 } LDKDataLossProtect;
9740
9741 /**
9742  * A trait to describe an object which can receive routing messages.
9743  *
9744  * # Implementor DoS Warnings
9745  *
9746  * For `gossip_queries` messages there are potential DoS vectors when handling
9747  * inbound queries. Implementors using an on-disk network graph should be aware of
9748  * repeated disk I/O for queries accessing different parts of the network graph.
9749  */
9750 typedef struct LDKRoutingMessageHandler {
9751    /**
9752     * An opaque pointer which is passed to your function implementations as an argument.
9753     * This has no meaning in the LDK, and can be NULL or any other value.
9754     */
9755    void *this_arg;
9756    /**
9757     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
9758     * false or returning an Err otherwise.
9759     */
9760    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
9761    /**
9762     * Handle a channel_announcement message, returning true if it should be forwarded on, false
9763     * or returning an Err otherwise.
9764     */
9765    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
9766    /**
9767     * Handle an incoming channel_update message, returning true if it should be forwarded on,
9768     * false or returning an Err otherwise.
9769     */
9770    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
9771    /**
9772     * Gets a subset of the channel announcements and updates required to dump our routing table
9773     * to a remote node, starting at the short_channel_id indicated by starting_point and
9774     * including the batch_amount entries immediately higher in numerical value than starting_point.
9775     */
9776    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
9777    /**
9778     * Gets a subset of the node announcements required to dump our routing table to a remote node,
9779     * starting at the node *after* the provided publickey and including batch_amount entries
9780     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
9781     * If None is provided for starting_point, we start at the first node.
9782     *
9783     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
9784     */
9785    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
9786    /**
9787     * Called when a connection is established with a peer. This can be used to
9788     * perform routing table synchronization using a strategy defined by the
9789     * implementor.
9790     */
9791    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
9792    /**
9793     * Handles the reply of a query we initiated to learn about channels
9794     * for a given range of blocks. We can expect to receive one or more
9795     * replies to a single query.
9796     */
9797    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
9798    /**
9799     * Handles the reply of a query we initiated asking for routing gossip
9800     * messages for a list of channels. We should receive this message when
9801     * a node has completed its best effort to send us the pertaining routing
9802     * gossip messages.
9803     */
9804    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
9805    /**
9806     * Handles when a peer asks us to send a list of short_channel_ids
9807     * for the requested range of blocks.
9808     */
9809    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
9810    /**
9811     * Handles when a peer asks us to send routing gossip messages for a
9812     * list of short_channel_ids.
9813     */
9814    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
9815    /**
9816     * Implementation of MessageSendEventsProvider for this object.
9817     */
9818    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
9819    /**
9820     * Frees any resources associated with this object given its this_arg pointer.
9821     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9822     */
9823    void (*free)(void *this_arg);
9824 } LDKRoutingMessageHandler;
9825
9826 /**
9827  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
9828  * decoders.
9829  */
9830 typedef struct LDKCustomMessageReader {
9831    /**
9832     * An opaque pointer which is passed to your function implementations as an argument.
9833     * This has no meaning in the LDK, and can be NULL or any other value.
9834     */
9835    void *this_arg;
9836    /**
9837     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
9838     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
9839     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
9840     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
9841     */
9842    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
9843    /**
9844     * Frees any resources associated with this object given its this_arg pointer.
9845     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9846     */
9847    void (*free)(void *this_arg);
9848 } LDKCustomMessageReader;
9849
9850 /**
9851  * Handler for BOLT1-compliant messages.
9852  */
9853 typedef struct LDKCustomMessageHandler {
9854    /**
9855     * An opaque pointer which is passed to your function implementations as an argument.
9856     * This has no meaning in the LDK, and can be NULL or any other value.
9857     */
9858    void *this_arg;
9859    /**
9860     * Called with the message type that was received and the buffer to be read.
9861     * Can return a `MessageHandlingError` if the message could not be handled.
9862     */
9863    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
9864    /**
9865     * Gets the list of pending messages which were generated by the custom message
9866     * handler, clearing the list in the process. The first tuple element must
9867     * correspond to the intended recipients node ids. If no connection to one of the
9868     * specified node does not exist, the message is simply not sent to it.
9869     */
9870    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
9871    /**
9872     * Implementation of CustomMessageReader for this object.
9873     */
9874    struct LDKCustomMessageReader CustomMessageReader;
9875    /**
9876     * Frees any resources associated with this object given its this_arg pointer.
9877     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9878     */
9879    void (*free)(void *this_arg);
9880 } LDKCustomMessageHandler;
9881
9882
9883
9884 /**
9885  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
9886  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
9887  */
9888 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
9889    /**
9890     * A pointer to the opaque Rust object.
9891     * Nearly everywhere, inner must be non-null, however in places where
9892     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9893     */
9894    LDKnativeIgnoringMessageHandler *inner;
9895    /**
9896     * Indicates that this is the only struct which contains the same pointer.
9897     * Rust functions which take ownership of an object provided via an argument require
9898     * this to be true and invalidate the object pointed to by inner.
9899     */
9900    bool is_owned;
9901 } LDKIgnoringMessageHandler;
9902
9903
9904
9905 /**
9906  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
9907  * You can provide one of these as the route_handler in a MessageHandler.
9908  */
9909 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
9910    /**
9911     * A pointer to the opaque Rust object.
9912     * Nearly everywhere, inner must be non-null, however in places where
9913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9914     */
9915    LDKnativeErroringMessageHandler *inner;
9916    /**
9917     * Indicates that this is the only struct which contains the same pointer.
9918     * Rust functions which take ownership of an object provided via an argument require
9919     * this to be true and invalidate the object pointed to by inner.
9920     */
9921    bool is_owned;
9922 } LDKErroringMessageHandler;
9923
9924
9925
9926 /**
9927  * Provides references to trait impls which handle different types of messages.
9928  */
9929 typedef struct MUST_USE_STRUCT LDKMessageHandler {
9930    /**
9931     * A pointer to the opaque Rust object.
9932     * Nearly everywhere, inner must be non-null, however in places where
9933     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9934     */
9935    LDKnativeMessageHandler *inner;
9936    /**
9937     * Indicates that this is the only struct which contains the same pointer.
9938     * Rust functions which take ownership of an object provided via an argument require
9939     * this to be true and invalidate the object pointed to by inner.
9940     */
9941    bool is_owned;
9942 } LDKMessageHandler;
9943
9944 /**
9945  * Provides an object which can be used to send data to and which uniquely identifies a connection
9946  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
9947  * implement Hash to meet the PeerManager API.
9948  *
9949  * For efficiency, Clone should be relatively cheap for this type.
9950  *
9951  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
9952  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
9953  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
9954  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
9955  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
9956  * to simply use another value which is guaranteed to be globally unique instead.
9957  */
9958 typedef struct LDKSocketDescriptor {
9959    /**
9960     * An opaque pointer which is passed to your function implementations as an argument.
9961     * This has no meaning in the LDK, and can be NULL or any other value.
9962     */
9963    void *this_arg;
9964    /**
9965     * Attempts to send some data from the given slice to the peer.
9966     *
9967     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
9968     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
9969     * called and further write attempts may occur until that time.
9970     *
9971     * If the returned size is smaller than `data.len()`, a
9972     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
9973     * written. Additionally, until a `send_data` event completes fully, no further
9974     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
9975     * prevent denial-of-service issues, you should not read or buffer any data from the socket
9976     * until then.
9977     *
9978     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
9979     * (indicating that read events should be paused to prevent DoS in the send buffer),
9980     * `resume_read` may be set indicating that read events on this descriptor should resume. A
9981     * `resume_read` of false carries no meaning, and should not cause any action.
9982     */
9983    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
9984    /**
9985     * Disconnect the socket pointed to by this SocketDescriptor.
9986     *
9987     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
9988     * call (doing so is a noop).
9989     */
9990    void (*disconnect_socket)(void *this_arg);
9991    /**
9992     * Checks if two objects are equal given this object's this_arg pointer and another object.
9993     */
9994    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
9995    /**
9996     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
9997     * This is used, for example, for inclusion of this object in a hash map.
9998     */
9999    uint64_t (*hash)(const void *this_arg);
10000    /**
10001     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
10002     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
10003     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
10004     */
10005    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
10006    /**
10007     * Frees any resources associated with this object given its this_arg pointer.
10008     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10009     */
10010    void (*free)(void *this_arg);
10011 } LDKSocketDescriptor;
10012
10013
10014
10015 /**
10016  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
10017  * socket events into messages which it passes on to its [`MessageHandler`].
10018  *
10019  * Locks are taken internally, so you must never assume that reentrancy from a
10020  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
10021  *
10022  * Calls to [`read_event`] will decode relevant messages and pass them to the
10023  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
10024  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
10025  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
10026  * calls only after previous ones have returned.
10027  *
10028  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
10029  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
10030  * essentially you should default to using a SimpleRefPeerManager, and use a
10031  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
10032  * you're using lightning-net-tokio.
10033  *
10034  * [`read_event`]: PeerManager::read_event
10035  */
10036 typedef struct MUST_USE_STRUCT LDKPeerManager {
10037    /**
10038     * A pointer to the opaque Rust object.
10039     * Nearly everywhere, inner must be non-null, however in places where
10040     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10041     */
10042    LDKnativePeerManager *inner;
10043    /**
10044     * Indicates that this is the only struct which contains the same pointer.
10045     * Rust functions which take ownership of an object provided via an argument require
10046     * this to be true and invalidate the object pointed to by inner.
10047     */
10048    bool is_owned;
10049 } LDKPeerManager;
10050
10051
10052
10053 /**
10054  * Static channel fields used to build transactions given per-commitment fields, organized by
10055  * broadcaster/countersignatory.
10056  *
10057  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
10058  * as_holder_broadcastable and as_counterparty_broadcastable functions.
10059  */
10060 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
10061    /**
10062     * A pointer to the opaque Rust object.
10063     * Nearly everywhere, inner must be non-null, however in places where
10064     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10065     */
10066    LDKnativeDirectedChannelTransactionParameters *inner;
10067    /**
10068     * Indicates that this is the only struct which contains the same pointer.
10069     * Rust functions which take ownership of an object provided via an argument require
10070     * this to be true and invalidate the object pointed to by inner.
10071     */
10072    bool is_owned;
10073 } LDKDirectedChannelTransactionParameters;
10074
10075 /**
10076  * An interface used to score payment channels for path finding.
10077  *
10078  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
10079  */
10080 typedef struct LDKScore {
10081    /**
10082     * An opaque pointer which is passed to your function implementations as an argument.
10083     * This has no meaning in the LDK, and can be NULL or any other value.
10084     */
10085    void *this_arg;
10086    /**
10087     * Returns the fee in msats willing to be paid to avoid routing through the given channel.
10088     */
10089    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id);
10090    /**
10091     * Frees any resources associated with this object given its this_arg pointer.
10092     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10093     */
10094    void (*free)(void *this_arg);
10095 } LDKScore;
10096
10097
10098
10099 /**
10100  * A read-only view of [`NetworkGraph`].
10101  */
10102 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
10103    /**
10104     * A pointer to the opaque Rust object.
10105     * Nearly everywhere, inner must be non-null, however in places where
10106     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10107     */
10108    LDKnativeReadOnlyNetworkGraph *inner;
10109    /**
10110     * Indicates that this is the only struct which contains the same pointer.
10111     * Rust functions which take ownership of an object provided via an argument require
10112     * this to be true and invalidate the object pointed to by inner.
10113     */
10114    bool is_owned;
10115 } LDKReadOnlyNetworkGraph;
10116
10117
10118
10119 /**
10120  * Receives and validates network updates from peers,
10121  * stores authentic and relevant data as a network graph.
10122  * This network graph is then used for routing payments.
10123  * Provides interface to help with initial routing sync by
10124  * serving historical announcements.
10125  *
10126  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
10127  * [`NetworkGraph`].
10128  */
10129 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
10130    /**
10131     * A pointer to the opaque Rust object.
10132     * Nearly everywhere, inner must be non-null, however in places where
10133     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10134     */
10135    LDKnativeNetGraphMsgHandler *inner;
10136    /**
10137     * Indicates that this is the only struct which contains the same pointer.
10138     * Rust functions which take ownership of an object provided via an argument require
10139     * this to be true and invalidate the object pointed to by inner.
10140     */
10141    bool is_owned;
10142 } LDKNetGraphMsgHandler;
10143
10144
10145
10146 /**
10147  * A channel descriptor for a hop along a payment path.
10148  */
10149 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
10150    /**
10151     * A pointer to the opaque Rust object.
10152     * Nearly everywhere, inner must be non-null, however in places where
10153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10154     */
10155    LDKnativeRouteHintHop *inner;
10156    /**
10157     * Indicates that this is the only struct which contains the same pointer.
10158     * Rust functions which take ownership of an object provided via an argument require
10159     * this to be true and invalidate the object pointed to by inner.
10160     */
10161    bool is_owned;
10162 } LDKRouteHintHop;
10163
10164
10165
10166 /**
10167  * [`routing::Score`] implementation that provides reasonable default behavior.
10168  *
10169  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
10170  * slightly higher fees are available.
10171  *
10172  * See [module-level documentation] for usage.
10173  *
10174  * [module-level documentation]: crate::routing::scorer
10175  */
10176 typedef struct MUST_USE_STRUCT LDKScorer {
10177    /**
10178     * A pointer to the opaque Rust object.
10179     * Nearly everywhere, inner must be non-null, however in places where
10180     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10181     */
10182    LDKnativeScorer *inner;
10183    /**
10184     * Indicates that this is the only struct which contains the same pointer.
10185     * Rust functions which take ownership of an object provided via an argument require
10186     * this to be true and invalidate the object pointed to by inner.
10187     */
10188    bool is_owned;
10189 } LDKScorer;
10190
10191
10192
10193 /**
10194  * FilesystemPersister persists channel data on disk, where each channel's
10195  * data is stored in a file named after its funding outpoint.
10196  *
10197  * Warning: this module does the best it can with calls to persist data, but it
10198  * can only guarantee that the data is passed to the drive. It is up to the
10199  * drive manufacturers to do the actual persistence properly, which they often
10200  * don't (especially on consumer-grade hardware). Therefore, it is up to the
10201  * user to validate their entire storage stack, to ensure the writes are
10202  * persistent.
10203  * Corollary: especially when dealing with larger amounts of money, it is best
10204  * practice to have multiple channel data backups and not rely only on one
10205  * FilesystemPersister.
10206  */
10207 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
10208    /**
10209     * A pointer to the opaque Rust object.
10210     * Nearly everywhere, inner must be non-null, however in places where
10211     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10212     */
10213    LDKnativeFilesystemPersister *inner;
10214    /**
10215     * Indicates that this is the only struct which contains the same pointer.
10216     * Rust functions which take ownership of an object provided via an argument require
10217     * this to be true and invalidate the object pointed to by inner.
10218     */
10219    bool is_owned;
10220 } LDKFilesystemPersister;
10221
10222
10223
10224 /**
10225  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
10226  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
10227  * responsibilities are:
10228  * * Processing [`Event`]s with a user-provided [`EventHandler`].
10229  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
10230  *   writing it to disk/backups by invoking the callback given to it at startup.
10231  *   [`ChannelManager`] persistence should be done in the background.
10232  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
10233  *   at the appropriate intervals.
10234  *
10235  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
10236  * upon as doing so may result in high latency.
10237  *
10238  * # Note
10239  *
10240  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
10241  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
10242  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
10243  * unilateral chain closure fees are at risk.
10244  *
10245  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
10246  * [`Event`]: lightning::util::events::Event
10247  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
10248  */
10249 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
10250    /**
10251     * A pointer to the opaque Rust object.
10252     * Nearly everywhere, inner must be non-null, however in places where
10253     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10254     */
10255    LDKnativeBackgroundProcessor *inner;
10256    /**
10257     * Indicates that this is the only struct which contains the same pointer.
10258     * Rust functions which take ownership of an object provided via an argument require
10259     * this to be true and invalidate the object pointed to by inner.
10260     */
10261    bool is_owned;
10262 } LDKBackgroundProcessor;
10263
10264 /**
10265  * Trait which handles persisting a [`ChannelManager`] to disk.
10266  *
10267  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10268  */
10269 typedef struct LDKChannelManagerPersister {
10270    /**
10271     * An opaque pointer which is passed to your function implementations as an argument.
10272     * This has no meaning in the LDK, and can be NULL or any other value.
10273     */
10274    void *this_arg;
10275    /**
10276     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
10277     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
10278     *
10279     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10280     */
10281    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
10282    /**
10283     * Frees any resources associated with this object given its this_arg pointer.
10284     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10285     */
10286    void (*free)(void *this_arg);
10287 } LDKChannelManagerPersister;
10288
10289
10290
10291 /**
10292  * Data of the `RawInvoice` that is encoded in the data part
10293  */
10294 typedef struct MUST_USE_STRUCT LDKRawDataPart {
10295    /**
10296     * A pointer to the opaque Rust object.
10297     * Nearly everywhere, inner must be non-null, however in places where
10298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10299     */
10300    LDKnativeRawDataPart *inner;
10301    /**
10302     * Indicates that this is the only struct which contains the same pointer.
10303     * Rust functions which take ownership of an object provided via an argument require
10304     * this to be true and invalidate the object pointed to by inner.
10305     */
10306    bool is_owned;
10307 } LDKRawDataPart;
10308
10309
10310
10311 /**
10312  * SHA-256 hash
10313  */
10314 typedef struct MUST_USE_STRUCT LDKSha256 {
10315    /**
10316     * A pointer to the opaque Rust object.
10317     * Nearly everywhere, inner must be non-null, however in places where
10318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10319     */
10320    LDKnativeSha256 *inner;
10321    /**
10322     * Indicates that this is the only struct which contains the same pointer.
10323     * Rust functions which take ownership of an object provided via an argument require
10324     * this to be true and invalidate the object pointed to by inner.
10325     */
10326    bool is_owned;
10327 } LDKSha256;
10328
10329
10330
10331 /**
10332  * `min_final_cltv_expiry` to use for the last HTLC in the route
10333  */
10334 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
10335    /**
10336     * A pointer to the opaque Rust object.
10337     * Nearly everywhere, inner must be non-null, however in places where
10338     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10339     */
10340    LDKnativeMinFinalCltvExpiry *inner;
10341    /**
10342     * Indicates that this is the only struct which contains the same pointer.
10343     * Rust functions which take ownership of an object provided via an argument require
10344     * this to be true and invalidate the object pointed to by inner.
10345     */
10346    bool is_owned;
10347 } LDKMinFinalCltvExpiry;
10348
10349 /**
10350  * Integer in the range `0..32`
10351  */
10352 typedef struct LDKu5 {
10353    uint8_t _0;
10354 } LDKu5;
10355
10356 /**
10357  * A 20-byte byte array.
10358  */
10359 typedef struct LDKTwentyBytes {
10360    /**
10361     * The twenty bytes
10362     */
10363    uint8_t data[20];
10364 } LDKTwentyBytes;
10365
10366 /**
10367  * Fallback address in case no LN payment is possible
10368  */
10369 typedef enum LDKFallback_Tag {
10370    LDKFallback_SegWitProgram,
10371    LDKFallback_PubKeyHash,
10372    LDKFallback_ScriptHash,
10373    /**
10374     * Must be last for serialization purposes
10375     */
10376    LDKFallback_Sentinel,
10377 } LDKFallback_Tag;
10378
10379 typedef struct LDKFallback_LDKSegWitProgram_Body {
10380    struct LDKu5 version;
10381    struct LDKCVec_u8Z program;
10382 } LDKFallback_LDKSegWitProgram_Body;
10383
10384 typedef struct MUST_USE_STRUCT LDKFallback {
10385    LDKFallback_Tag tag;
10386    union {
10387       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
10388       struct {
10389          struct LDKTwentyBytes pub_key_hash;
10390       };
10391       struct {
10392          struct LDKTwentyBytes script_hash;
10393       };
10394    };
10395 } LDKFallback;
10396
10397 extern const uintptr_t MAX_BUF_SIZE;
10398
10399 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
10400
10401 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
10402
10403 extern const uint32_t ANTI_REORG_DELAY;
10404
10405 extern const uint16_t BREAKDOWN_TIMEOUT;
10406
10407 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
10408
10409 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
10410
10411 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
10412
10413 extern const uint64_t DEFAULT_EXPIRY_TIME;
10414
10415 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
10416
10417 extern const uint8_t TAG_PAYMENT_HASH;
10418
10419 extern const uint8_t TAG_DESCRIPTION;
10420
10421 extern const uint8_t TAG_PAYEE_PUB_KEY;
10422
10423 extern const uint8_t TAG_DESCRIPTION_HASH;
10424
10425 extern const uint8_t TAG_EXPIRY_TIME;
10426
10427 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
10428
10429 extern const uint8_t TAG_FALLBACK;
10430
10431 extern const uint8_t TAG_PRIVATE_ROUTE;
10432
10433 extern const uint8_t TAG_PAYMENT_SECRET;
10434
10435 extern const uint8_t TAG_FEATURES;
10436
10437 struct LDKStr _ldk_get_compiled_version(void);
10438
10439 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
10440
10441 /**
10442  * Frees the data buffer, if data_is_owned is set and datalen > 0.
10443  */
10444 void Transaction_free(struct LDKTransaction _res);
10445
10446 /**
10447  * Convenience function for constructing a new TxOut
10448  */
10449 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
10450
10451 /**
10452  * Frees the data pointed to by script_pubkey.
10453  */
10454 void TxOut_free(struct LDKTxOut _res);
10455
10456 /**
10457  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
10458  */
10459 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
10460
10461 /**
10462  * Frees the data buffer, if chars_is_owned is set and len > 0.
10463  */
10464 void Str_free(struct LDKStr _res);
10465
10466 /**
10467  * Creates a new CResult_SecretKeyErrorZ in the success state.
10468  */
10469 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
10470
10471 /**
10472  * Creates a new CResult_SecretKeyErrorZ in the error state.
10473  */
10474 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
10475
10476 /**
10477  * Frees any resources used by the CResult_SecretKeyErrorZ.
10478  */
10479 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
10480
10481 /**
10482  * Creates a new CResult_PublicKeyErrorZ in the success state.
10483  */
10484 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
10485
10486 /**
10487  * Creates a new CResult_PublicKeyErrorZ in the error state.
10488  */
10489 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
10490
10491 /**
10492  * Frees any resources used by the CResult_PublicKeyErrorZ.
10493  */
10494 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
10495
10496 /**
10497  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10498  * but with all dynamically-allocated buffers duplicated in new buffers.
10499  */
10500 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
10501
10502 /**
10503  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
10504  */
10505 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
10506
10507 /**
10508  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
10509  */
10510 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
10511
10512 /**
10513  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
10514  */
10515 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
10516
10517 /**
10518  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
10519  * but with all dynamically-allocated buffers duplicated in new buffers.
10520  */
10521 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
10522
10523 /**
10524  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
10525  */
10526 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
10527
10528 /**
10529  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
10530  */
10531 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
10532
10533 /**
10534  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
10535  */
10536 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
10537
10538 /**
10539  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
10540  * but with all dynamically-allocated buffers duplicated in new buffers.
10541  */
10542 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
10543
10544 /**
10545  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
10546  */
10547 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
10548
10549 /**
10550  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
10551  */
10552 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
10553
10554 /**
10555  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
10556  */
10557 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
10558
10559 /**
10560  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
10561  * but with all dynamically-allocated buffers duplicated in new buffers.
10562  */
10563 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
10564
10565 /**
10566  * Constructs a new COption_u32Z containing a u32
10567  */
10568 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
10569
10570 /**
10571  * Constructs a new COption_u32Z containing nothing
10572  */
10573 struct LDKCOption_u32Z COption_u32Z_none(void);
10574
10575 /**
10576  * Frees any resources associated with the u32, if we are in the Some state
10577  */
10578 void COption_u32Z_free(struct LDKCOption_u32Z _res);
10579
10580 /**
10581  * Creates a new COption_u32Z which has the same data as `orig`
10582  * but with all dynamically-allocated buffers duplicated in new buffers.
10583  */
10584 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
10585
10586 /**
10587  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
10588  */
10589 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
10590
10591 /**
10592  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
10593  */
10594 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
10595
10596 /**
10597  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
10598  */
10599 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
10600
10601 /**
10602  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
10603  * but with all dynamically-allocated buffers duplicated in new buffers.
10604  */
10605 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
10606
10607 /**
10608  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
10609  */
10610 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
10611
10612 /**
10613  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
10614  */
10615 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
10616
10617 /**
10618  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
10619  */
10620 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
10621
10622 /**
10623  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
10624  * but with all dynamically-allocated buffers duplicated in new buffers.
10625  */
10626 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
10627
10628 /**
10629  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
10630  */
10631 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
10632
10633 /**
10634  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
10635  */
10636 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
10637
10638 /**
10639  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
10640  */
10641 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
10642
10643 /**
10644  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
10645  * but with all dynamically-allocated buffers duplicated in new buffers.
10646  */
10647 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
10648
10649 /**
10650  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10651  */
10652 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
10653
10654 /**
10655  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
10656  */
10657 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
10658
10659 /**
10660  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
10661  */
10662 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10663
10664 /**
10665  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
10666  */
10667 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
10668
10669 /**
10670  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
10671  * but with all dynamically-allocated buffers duplicated in new buffers.
10672  */
10673 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10674
10675 /**
10676  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
10677  */
10678 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
10679
10680 /**
10681  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
10682  */
10683 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10684
10685 /**
10686  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
10687  */
10688 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
10689
10690 /**
10691  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
10692  * but with all dynamically-allocated buffers duplicated in new buffers.
10693  */
10694 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10695
10696 /**
10697  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
10698  */
10699 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
10700
10701 /**
10702  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
10703  */
10704 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
10705
10706 /**
10707  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
10708  */
10709 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
10710
10711 /**
10712  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
10713  */
10714 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
10715
10716 /**
10717  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
10718  */
10719 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
10720
10721 /**
10722  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
10723  */
10724 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
10725
10726 /**
10727  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
10728  * but with all dynamically-allocated buffers duplicated in new buffers.
10729  */
10730 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
10731
10732 /**
10733  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
10734  */
10735 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
10736
10737 /**
10738  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
10739  */
10740 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
10741
10742 /**
10743  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
10744  */
10745 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
10746
10747 /**
10748  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
10749  */
10750 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
10751
10752 /**
10753  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
10754  */
10755 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
10756
10757 /**
10758  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
10759  */
10760 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
10761
10762 /**
10763  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
10764  * but with all dynamically-allocated buffers duplicated in new buffers.
10765  */
10766 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
10767
10768 /**
10769  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
10770  */
10771 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
10772
10773 /**
10774  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
10775  */
10776 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
10777
10778 /**
10779  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
10780  */
10781 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
10782
10783 /**
10784  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
10785  * but with all dynamically-allocated buffers duplicated in new buffers.
10786  */
10787 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
10788
10789 /**
10790  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
10791  */
10792 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
10793
10794 /**
10795  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
10796  */
10797 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
10798
10799 /**
10800  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
10801  */
10802 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
10803
10804 /**
10805  * Creates a new CResult_NoneErrorZ in the success state.
10806  */
10807 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
10808
10809 /**
10810  * Creates a new CResult_NoneErrorZ in the error state.
10811  */
10812 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
10813
10814 /**
10815  * Frees any resources used by the CResult_NoneErrorZ.
10816  */
10817 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
10818
10819 /**
10820  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
10821  * but with all dynamically-allocated buffers duplicated in new buffers.
10822  */
10823 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
10824
10825 /**
10826  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
10827  */
10828 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
10829
10830 /**
10831  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
10832  */
10833 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
10834
10835 /**
10836  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
10837  */
10838 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
10839
10840 /**
10841  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
10842  * but with all dynamically-allocated buffers duplicated in new buffers.
10843  */
10844 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
10845
10846 /**
10847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10848  */
10849 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
10850
10851 /**
10852  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10853  */
10854 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
10855
10856 /**
10857  * Creates a new CResult_RouteDecodeErrorZ in the success state.
10858  */
10859 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
10860
10861 /**
10862  * Creates a new CResult_RouteDecodeErrorZ in the error state.
10863  */
10864 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
10865
10866 /**
10867  * Frees any resources used by the CResult_RouteDecodeErrorZ.
10868  */
10869 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
10870
10871 /**
10872  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
10873  * but with all dynamically-allocated buffers duplicated in new buffers.
10874  */
10875 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
10876
10877 /**
10878  * Constructs a new COption_u64Z containing a u64
10879  */
10880 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
10881
10882 /**
10883  * Constructs a new COption_u64Z containing nothing
10884  */
10885 struct LDKCOption_u64Z COption_u64Z_none(void);
10886
10887 /**
10888  * Frees any resources associated with the u64, if we are in the Some state
10889  */
10890 void COption_u64Z_free(struct LDKCOption_u64Z _res);
10891
10892 /**
10893  * Creates a new COption_u64Z which has the same data as `orig`
10894  * but with all dynamically-allocated buffers duplicated in new buffers.
10895  */
10896 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
10897
10898 /**
10899  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10900  */
10901 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
10902
10903 /**
10904  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10905  */
10906 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
10907
10908 /**
10909  * Creates a new CResult_RouteLightningErrorZ in the success state.
10910  */
10911 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
10912
10913 /**
10914  * Creates a new CResult_RouteLightningErrorZ in the error state.
10915  */
10916 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
10917
10918 /**
10919  * Frees any resources used by the CResult_RouteLightningErrorZ.
10920  */
10921 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
10922
10923 /**
10924  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
10925  * but with all dynamically-allocated buffers duplicated in new buffers.
10926  */
10927 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
10928
10929 /**
10930  * Creates a new CResult_TxOutAccessErrorZ in the success state.
10931  */
10932 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
10933
10934 /**
10935  * Creates a new CResult_TxOutAccessErrorZ in the error state.
10936  */
10937 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
10938
10939 /**
10940  * Frees any resources used by the CResult_TxOutAccessErrorZ.
10941  */
10942 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
10943
10944 /**
10945  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
10946  * but with all dynamically-allocated buffers duplicated in new buffers.
10947  */
10948 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
10949
10950 /**
10951  * Creates a new tuple which has the same data as `orig`
10952  * but with all dynamically-allocated buffers duplicated in new buffers.
10953  */
10954 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
10955
10956 /**
10957  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
10958  */
10959 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
10960
10961 /**
10962  * Frees any resources used by the C2Tuple_usizeTransactionZ.
10963  */
10964 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
10965
10966 /**
10967  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10968  */
10969 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
10970
10971 /**
10972  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10973  */
10974 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
10975
10976 /**
10977  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
10978  */
10979 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
10980
10981 /**
10982  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
10983  */
10984 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
10985
10986 /**
10987  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
10988  */
10989 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
10990
10991 /**
10992  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
10993  * but with all dynamically-allocated buffers duplicated in new buffers.
10994  */
10995 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
10996
10997 /**
10998  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10999  */
11000 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
11001
11002 /**
11003  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
11004  */
11005 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
11006
11007 /**
11008  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
11009  */
11010 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
11011
11012 /**
11013  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
11014  */
11015 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
11016
11017 /**
11018  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
11019  * but with all dynamically-allocated buffers duplicated in new buffers.
11020  */
11021 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
11022
11023 /**
11024  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
11025  */
11026 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
11027
11028 /**
11029  * Constructs a new COption_NetworkUpdateZ containing nothing
11030  */
11031 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
11032
11033 /**
11034  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
11035  */
11036 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
11037
11038 /**
11039  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
11040  * but with all dynamically-allocated buffers duplicated in new buffers.
11041  */
11042 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
11043
11044 /**
11045  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11046  */
11047 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
11048
11049 /**
11050  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11051  */
11052 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
11053
11054 /**
11055  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
11056  */
11057 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
11058
11059 /**
11060  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
11061  */
11062 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11063
11064 /**
11065  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
11066  */
11067 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
11068
11069 /**
11070  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
11071  */
11072 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
11073
11074 /**
11075  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
11076  */
11077 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11078
11079 /**
11080  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
11081  */
11082 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
11083
11084 /**
11085  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
11086  */
11087 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
11088
11089 /**
11090  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
11091  */
11092 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11093
11094 /**
11095  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
11096  */
11097 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
11098
11099 /**
11100  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
11101  */
11102 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
11103
11104 /**
11105  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
11106  */
11107 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11108
11109 /**
11110  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
11111  */
11112 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
11113
11114 /**
11115  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
11116  */
11117 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
11118
11119 /**
11120  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
11121  */
11122 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11123
11124 /**
11125  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
11126  */
11127 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
11128
11129 /**
11130  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11131  * but with all dynamically-allocated buffers duplicated in new buffers.
11132  */
11133 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11134
11135 /**
11136  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
11137  */
11138 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
11139
11140 /**
11141  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
11142  */
11143 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11144
11145 /**
11146  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
11147  */
11148 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
11149
11150 /**
11151  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11152  * but with all dynamically-allocated buffers duplicated in new buffers.
11153  */
11154 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11155
11156 /**
11157  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
11158  */
11159 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
11160
11161 /**
11162  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
11163  */
11164 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11165
11166 /**
11167  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
11168  */
11169 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
11170
11171 /**
11172  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
11173  * but with all dynamically-allocated buffers duplicated in new buffers.
11174  */
11175 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11176
11177 /**
11178  * Creates a new CResult_NoneNoneZ in the success state.
11179  */
11180 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
11181
11182 /**
11183  * Creates a new CResult_NoneNoneZ in the error state.
11184  */
11185 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
11186
11187 /**
11188  * Frees any resources used by the CResult_NoneNoneZ.
11189  */
11190 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
11191
11192 /**
11193  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
11194  * but with all dynamically-allocated buffers duplicated in new buffers.
11195  */
11196 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
11197
11198 /**
11199  * Creates a new tuple which has the same data as `orig`
11200  * but with all dynamically-allocated buffers duplicated in new buffers.
11201  */
11202 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
11203
11204 /**
11205  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
11206  */
11207 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
11208
11209 /**
11210  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
11211  */
11212 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
11213
11214 /**
11215  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
11216  */
11217 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
11218
11219 /**
11220  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
11221  */
11222 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
11223
11224 /**
11225  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
11226  */
11227 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
11228
11229 /**
11230  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
11231  * but with all dynamically-allocated buffers duplicated in new buffers.
11232  */
11233 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
11234
11235 /**
11236  * Creates a new CResult_SignatureNoneZ in the success state.
11237  */
11238 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
11239
11240 /**
11241  * Creates a new CResult_SignatureNoneZ in the error state.
11242  */
11243 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
11244
11245 /**
11246  * Frees any resources used by the CResult_SignatureNoneZ.
11247  */
11248 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
11249
11250 /**
11251  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
11252  * but with all dynamically-allocated buffers duplicated in new buffers.
11253  */
11254 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
11255
11256 /**
11257  * Creates a new CResult_SignDecodeErrorZ in the success state.
11258  */
11259 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
11260
11261 /**
11262  * Creates a new CResult_SignDecodeErrorZ in the error state.
11263  */
11264 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
11265
11266 /**
11267  * Frees any resources used by the CResult_SignDecodeErrorZ.
11268  */
11269 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
11270
11271 /**
11272  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
11273  * but with all dynamically-allocated buffers duplicated in new buffers.
11274  */
11275 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
11276
11277 /**
11278  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11279  */
11280 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
11281
11282 /**
11283  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
11284  */
11285 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
11286
11287 /**
11288  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
11289  */
11290 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
11291
11292 /**
11293  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
11294  */
11295 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
11296
11297 /**
11298  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
11299  * but with all dynamically-allocated buffers duplicated in new buffers.
11300  */
11301 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
11302
11303 /**
11304  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11305  */
11306 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
11307
11308 /**
11309  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
11310  */
11311 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
11312
11313 /**
11314  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
11315  */
11316 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
11317
11318 /**
11319  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
11320  */
11321 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
11322
11323 /**
11324  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
11325  * but with all dynamically-allocated buffers duplicated in new buffers.
11326  */
11327 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
11328
11329 /**
11330  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
11331  */
11332 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
11333
11334 /**
11335  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
11336  */
11337 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
11338
11339 /**
11340  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
11341  */
11342 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
11343
11344 /**
11345  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
11346  * but with all dynamically-allocated buffers duplicated in new buffers.
11347  */
11348 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
11349
11350 /**
11351  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11352  */
11353 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
11354
11355 /**
11356  * Creates a new CResult_TransactionNoneZ in the success state.
11357  */
11358 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
11359
11360 /**
11361  * Creates a new CResult_TransactionNoneZ in the error state.
11362  */
11363 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
11364
11365 /**
11366  * Frees any resources used by the CResult_TransactionNoneZ.
11367  */
11368 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
11369
11370 /**
11371  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
11372  * but with all dynamically-allocated buffers duplicated in new buffers.
11373  */
11374 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
11375
11376 /**
11377  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
11378  */
11379 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
11380
11381 /**
11382  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
11383  */
11384 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
11385
11386 /**
11387  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11388  */
11389 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
11390
11391 /**
11392  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
11393  */
11394 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
11395
11396 /**
11397  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
11398  */
11399 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
11400
11401 /**
11402  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
11403  */
11404 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
11405
11406 /**
11407  * Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
11408  */
11409 struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o);
11410
11411 /**
11412  * Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
11413  */
11414 struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e);
11415
11416 /**
11417  * Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
11418  */
11419 void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res);
11420
11421 /**
11422  * Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
11423  * but with all dynamically-allocated buffers duplicated in new buffers.
11424  */
11425 struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig);
11426
11427 /**
11428  * Constructs a new COption_u16Z containing a u16
11429  */
11430 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
11431
11432 /**
11433  * Constructs a new COption_u16Z containing nothing
11434  */
11435 struct LDKCOption_u16Z COption_u16Z_none(void);
11436
11437 /**
11438  * Frees any resources associated with the u16, if we are in the Some state
11439  */
11440 void COption_u16Z_free(struct LDKCOption_u16Z _res);
11441
11442 /**
11443  * Creates a new COption_u16Z which has the same data as `orig`
11444  * but with all dynamically-allocated buffers duplicated in new buffers.
11445  */
11446 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
11447
11448 /**
11449  * Creates a new CResult_NoneAPIErrorZ in the success state.
11450  */
11451 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
11452
11453 /**
11454  * Creates a new CResult_NoneAPIErrorZ in the error state.
11455  */
11456 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
11457
11458 /**
11459  * Frees any resources used by the CResult_NoneAPIErrorZ.
11460  */
11461 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11462
11463 /**
11464  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11465  * but with all dynamically-allocated buffers duplicated in new buffers.
11466  */
11467 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11468
11469 /**
11470  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11471  */
11472 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11473
11474 /**
11475  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11476  */
11477 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11478
11479 /**
11480  * Creates a new CResult__u832APIErrorZ in the success state.
11481  */
11482 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
11483
11484 /**
11485  * Creates a new CResult__u832APIErrorZ in the error state.
11486  */
11487 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
11488
11489 /**
11490  * Frees any resources used by the CResult__u832APIErrorZ.
11491  */
11492 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
11493
11494 /**
11495  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
11496  * but with all dynamically-allocated buffers duplicated in new buffers.
11497  */
11498 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
11499
11500 /**
11501  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
11502  */
11503 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o);
11504
11505 /**
11506  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
11507  */
11508 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11509
11510 /**
11511  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
11512  */
11513 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
11514
11515 /**
11516  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
11517  * but with all dynamically-allocated buffers duplicated in new buffers.
11518  */
11519 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
11520
11521 /**
11522  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11523  */
11524 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11525
11526 /**
11527  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11528  */
11529 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11530
11531 /**
11532  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11533  */
11534 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11535
11536 /**
11537  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11538  * but with all dynamically-allocated buffers duplicated in new buffers.
11539  */
11540 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11541
11542 /**
11543  * Creates a new tuple which has the same data as `orig`
11544  * but with all dynamically-allocated buffers duplicated in new buffers.
11545  */
11546 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
11547
11548 /**
11549  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
11550  */
11551 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b);
11552
11553 /**
11554  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
11555  */
11556 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
11557
11558 /**
11559  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
11560  */
11561 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
11562
11563 /**
11564  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
11565  */
11566 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11567
11568 /**
11569  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
11570  */
11571 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
11572
11573 /**
11574  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
11575  * but with all dynamically-allocated buffers duplicated in new buffers.
11576  */
11577 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
11578
11579 /**
11580  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11581  */
11582 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
11583
11584 /**
11585  * Creates a new tuple which has the same data as `orig`
11586  * but with all dynamically-allocated buffers duplicated in new buffers.
11587  */
11588 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
11589
11590 /**
11591  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11592  */
11593 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11594
11595 /**
11596  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11597  */
11598 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11599
11600 /**
11601  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11602  */
11603 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11604
11605 /**
11606  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11607  */
11608 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11609
11610 /**
11611  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11612  */
11613 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11614
11615 /**
11616  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
11617  * but with all dynamically-allocated buffers duplicated in new buffers.
11618  */
11619 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
11620
11621 /**
11622  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11623  */
11624 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11625
11626 /**
11627  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11628  */
11629 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11630
11631 /**
11632  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11633  */
11634 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11635
11636 /**
11637  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11638  */
11639 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11640
11641 /**
11642  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11643  */
11644 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11645
11646 /**
11647  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11648  */
11649 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11650
11651 /**
11652  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11653  */
11654 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
11655
11656 /**
11657  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11658  */
11659 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
11660
11661 /**
11662  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11663  */
11664 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
11665
11666 /**
11667  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11668  * but with all dynamically-allocated buffers duplicated in new buffers.
11669  */
11670 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
11671
11672 /**
11673  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
11674  */
11675 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
11676
11677 /**
11678  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
11679  */
11680 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
11681
11682 /**
11683  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
11684  */
11685 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
11686
11687 /**
11688  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
11689  * but with all dynamically-allocated buffers duplicated in new buffers.
11690  */
11691 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
11692
11693 /**
11694  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11695  */
11696 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
11697
11698 /**
11699  * Constructs a new COption_TypeZ containing nothing
11700  */
11701 struct LDKCOption_TypeZ COption_TypeZ_none(void);
11702
11703 /**
11704  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11705  */
11706 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
11707
11708 /**
11709  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11710  */
11711 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
11712
11713 /**
11714  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11715  */
11716 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
11717
11718 /**
11719  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11720  */
11721 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
11722
11723 /**
11724  * Creates a new CResult_SiPrefixNoneZ in the success state.
11725  */
11726 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
11727
11728 /**
11729  * Creates a new CResult_SiPrefixNoneZ in the error state.
11730  */
11731 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
11732
11733 /**
11734  * Frees any resources used by the CResult_SiPrefixNoneZ.
11735  */
11736 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
11737
11738 /**
11739  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
11740  * but with all dynamically-allocated buffers duplicated in new buffers.
11741  */
11742 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
11743
11744 /**
11745  * Creates a new CResult_InvoiceNoneZ in the success state.
11746  */
11747 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
11748
11749 /**
11750  * Creates a new CResult_InvoiceNoneZ in the error state.
11751  */
11752 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
11753
11754 /**
11755  * Frees any resources used by the CResult_InvoiceNoneZ.
11756  */
11757 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
11758
11759 /**
11760  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
11761  * but with all dynamically-allocated buffers duplicated in new buffers.
11762  */
11763 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
11764
11765 /**
11766  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
11767  */
11768 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
11769
11770 /**
11771  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
11772  */
11773 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
11774
11775 /**
11776  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
11777  */
11778 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
11779
11780 /**
11781  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
11782  * but with all dynamically-allocated buffers duplicated in new buffers.
11783  */
11784 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
11785
11786 /**
11787  * Creates a new tuple which has the same data as `orig`
11788  * but with all dynamically-allocated buffers duplicated in new buffers.
11789  */
11790 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
11791
11792 /**
11793  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
11794  */
11795 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
11796
11797 /**
11798  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
11799  */
11800 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
11801
11802 /**
11803  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
11804  */
11805 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
11806
11807 /**
11808  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
11809  */
11810 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
11811
11812 /**
11813  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
11814  */
11815 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
11816
11817 /**
11818  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
11819  * but with all dynamically-allocated buffers duplicated in new buffers.
11820  */
11821 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
11822
11823 /**
11824  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11825  */
11826 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
11827
11828 /**
11829  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
11830  */
11831 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
11832
11833 /**
11834  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
11835  */
11836 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
11837
11838 /**
11839  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
11840  */
11841 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
11842
11843 /**
11844  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
11845  * but with all dynamically-allocated buffers duplicated in new buffers.
11846  */
11847 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
11848
11849 /**
11850  * Creates a new CResult_NoneSemanticErrorZ in the success state.
11851  */
11852 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
11853
11854 /**
11855  * Creates a new CResult_NoneSemanticErrorZ in the error state.
11856  */
11857 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
11858
11859 /**
11860  * Frees any resources used by the CResult_NoneSemanticErrorZ.
11861  */
11862 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
11863
11864 /**
11865  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
11866  * but with all dynamically-allocated buffers duplicated in new buffers.
11867  */
11868 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
11869
11870 /**
11871  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
11872  */
11873 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
11874
11875 /**
11876  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
11877  */
11878 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
11879
11880 /**
11881  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
11882  */
11883 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
11884
11885 /**
11886  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
11887  * but with all dynamically-allocated buffers duplicated in new buffers.
11888  */
11889 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
11890
11891 /**
11892  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
11893  */
11894 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
11895
11896 /**
11897  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
11898  */
11899 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
11900
11901 /**
11902  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
11903  */
11904 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
11905
11906 /**
11907  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
11908  * but with all dynamically-allocated buffers duplicated in new buffers.
11909  */
11910 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
11911
11912 /**
11913  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
11914  */
11915 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
11916
11917 /**
11918  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
11919  */
11920 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
11921
11922 /**
11923  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
11924  */
11925 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
11926
11927 /**
11928  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
11929  * but with all dynamically-allocated buffers duplicated in new buffers.
11930  */
11931 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
11932
11933 /**
11934  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
11935  */
11936 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
11937
11938 /**
11939  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
11940  */
11941 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
11942
11943 /**
11944  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
11945  */
11946 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
11947
11948 /**
11949  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
11950  * but with all dynamically-allocated buffers duplicated in new buffers.
11951  */
11952 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
11953
11954 /**
11955  * Creates a new CResult_StringErrorZ in the success state.
11956  */
11957 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
11958
11959 /**
11960  * Creates a new CResult_StringErrorZ in the error state.
11961  */
11962 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
11963
11964 /**
11965  * Frees any resources used by the CResult_StringErrorZ.
11966  */
11967 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
11968
11969 /**
11970  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11971  */
11972 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
11973
11974 /**
11975  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11976  */
11977 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11978
11979 /**
11980  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11981  */
11982 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
11983
11984 /**
11985  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11986  * but with all dynamically-allocated buffers duplicated in new buffers.
11987  */
11988 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
11989
11990 /**
11991  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11992  */
11993 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
11994
11995 /**
11996  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11997  */
11998 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11999
12000 /**
12001  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12002  */
12003 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
12004
12005 /**
12006  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12007  * but with all dynamically-allocated buffers duplicated in new buffers.
12008  */
12009 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
12010
12011 /**
12012  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
12013  */
12014 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
12015
12016 /**
12017  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
12018  */
12019 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
12020
12021 /**
12022  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
12023  */
12024 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
12025
12026 /**
12027  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
12028  * but with all dynamically-allocated buffers duplicated in new buffers.
12029  */
12030 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
12031
12032 /**
12033  * Creates a new tuple which has the same data as `orig`
12034  * but with all dynamically-allocated buffers duplicated in new buffers.
12035  */
12036 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
12037
12038 /**
12039  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
12040  */
12041 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
12042
12043 /**
12044  * Frees any resources used by the C2Tuple_OutPointScriptZ.
12045  */
12046 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
12047
12048 /**
12049  * Creates a new tuple which has the same data as `orig`
12050  * but with all dynamically-allocated buffers duplicated in new buffers.
12051  */
12052 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
12053
12054 /**
12055  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
12056  */
12057 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
12058
12059 /**
12060  * Frees any resources used by the C2Tuple_u32ScriptZ.
12061  */
12062 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
12063
12064 /**
12065  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12066  */
12067 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
12068
12069 /**
12070  * Creates a new tuple which has the same data as `orig`
12071  * but with all dynamically-allocated buffers duplicated in new buffers.
12072  */
12073 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
12074
12075 /**
12076  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
12077  */
12078 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
12079
12080 /**
12081  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
12082  */
12083 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
12084
12085 /**
12086  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12087  */
12088 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
12089
12090 /**
12091  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12092  */
12093 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
12094
12095 /**
12096  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12097  */
12098 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
12099
12100 /**
12101  * Creates a new tuple which has the same data as `orig`
12102  * but with all dynamically-allocated buffers duplicated in new buffers.
12103  */
12104 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
12105
12106 /**
12107  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
12108  */
12109 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
12110
12111 /**
12112  * Frees any resources used by the C2Tuple_u32TxOutZ.
12113  */
12114 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
12115
12116 /**
12117  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12118  */
12119 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
12120
12121 /**
12122  * Creates a new tuple which has the same data as `orig`
12123  * but with all dynamically-allocated buffers duplicated in new buffers.
12124  */
12125 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
12126
12127 /**
12128  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12129  */
12130 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
12131
12132 /**
12133  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12134  */
12135 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
12136
12137 /**
12138  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12139  */
12140 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
12141
12142 /**
12143  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12144  */
12145 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
12146
12147 /**
12148  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12149  */
12150 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
12151
12152 /**
12153  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12154  */
12155 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
12156
12157 /**
12158  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12159  */
12160 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
12161
12162 /**
12163  * Creates a new CResult_NoneLightningErrorZ in the success state.
12164  */
12165 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
12166
12167 /**
12168  * Creates a new CResult_NoneLightningErrorZ in the error state.
12169  */
12170 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
12171
12172 /**
12173  * Frees any resources used by the CResult_NoneLightningErrorZ.
12174  */
12175 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
12176
12177 /**
12178  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
12179  * but with all dynamically-allocated buffers duplicated in new buffers.
12180  */
12181 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
12182
12183 /**
12184  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12185  */
12186 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
12187
12188 /**
12189  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12190  */
12191 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
12192
12193 /**
12194  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12195  */
12196 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
12197
12198 /**
12199  * Creates a new CResult_boolLightningErrorZ in the success state.
12200  */
12201 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
12202
12203 /**
12204  * Creates a new CResult_boolLightningErrorZ in the error state.
12205  */
12206 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
12207
12208 /**
12209  * Frees any resources used by the CResult_boolLightningErrorZ.
12210  */
12211 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
12212
12213 /**
12214  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
12215  * but with all dynamically-allocated buffers duplicated in new buffers.
12216  */
12217 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
12218
12219 /**
12220  * Creates a new tuple which has the same data as `orig`
12221  * but with all dynamically-allocated buffers duplicated in new buffers.
12222  */
12223 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
12224
12225 /**
12226  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
12227  */
12228 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
12229
12230 /**
12231  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
12232  */
12233 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
12234
12235 /**
12236  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12237  */
12238 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
12239
12240 /**
12241  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12242  */
12243 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
12244
12245 /**
12246  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12247  */
12248 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
12249
12250 /**
12251  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12252  */
12253 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
12254
12255 /**
12256  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12257  */
12258 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12259
12260 /**
12261  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12262  */
12263 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
12264
12265 /**
12266  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12267  * but with all dynamically-allocated buffers duplicated in new buffers.
12268  */
12269 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
12270
12271 /**
12272  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
12273  */
12274 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
12275
12276 /**
12277  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
12278  */
12279 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
12280
12281 /**
12282  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
12283  */
12284 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
12285
12286 /**
12287  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12288  * but with all dynamically-allocated buffers duplicated in new buffers.
12289  */
12290 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
12291
12292 /**
12293  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
12294  */
12295 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
12296
12297 /**
12298  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
12299  */
12300 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12301
12302 /**
12303  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
12304  */
12305 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
12306
12307 /**
12308  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12309  * but with all dynamically-allocated buffers duplicated in new buffers.
12310  */
12311 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
12312
12313 /**
12314  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
12315  */
12316 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
12317
12318 /**
12319  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
12320  */
12321 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
12322
12323 /**
12324  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
12325  */
12326 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
12327
12328 /**
12329  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
12330  * but with all dynamically-allocated buffers duplicated in new buffers.
12331  */
12332 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
12333
12334 /**
12335  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
12336  */
12337 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
12338
12339 /**
12340  * Constructs a new COption_AccessZ containing nothing
12341  */
12342 struct LDKCOption_AccessZ COption_AccessZ_none(void);
12343
12344 /**
12345  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
12346  */
12347 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
12348
12349 /**
12350  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
12351  */
12352 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
12353
12354 /**
12355  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
12356  */
12357 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
12358
12359 /**
12360  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
12361  */
12362 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
12363
12364 /**
12365  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
12366  * but with all dynamically-allocated buffers duplicated in new buffers.
12367  */
12368 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
12369
12370 /**
12371  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
12372  */
12373 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
12374
12375 /**
12376  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
12377  */
12378 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
12379
12380 /**
12381  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
12382  */
12383 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
12384
12385 /**
12386  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
12387  * but with all dynamically-allocated buffers duplicated in new buffers.
12388  */
12389 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
12390
12391 /**
12392  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
12393  */
12394 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
12395
12396 /**
12397  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
12398  */
12399 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
12400
12401 /**
12402  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
12403  */
12404 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
12405
12406 /**
12407  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
12408  * but with all dynamically-allocated buffers duplicated in new buffers.
12409  */
12410 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
12411
12412 /**
12413  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
12414  */
12415 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
12416
12417 /**
12418  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
12419  */
12420 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
12421
12422 /**
12423  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
12424  */
12425 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
12426
12427 /**
12428  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
12429  * but with all dynamically-allocated buffers duplicated in new buffers.
12430  */
12431 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
12432
12433 /**
12434  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12435  */
12436 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
12437
12438 /**
12439  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
12440  */
12441 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
12442
12443 /**
12444  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
12445  */
12446 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
12447
12448 /**
12449  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
12450  */
12451 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
12452
12453 /**
12454  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
12455  * but with all dynamically-allocated buffers duplicated in new buffers.
12456  */
12457 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
12458
12459 /**
12460  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
12461  */
12462 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
12463
12464 /**
12465  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
12466  */
12467 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
12468
12469 /**
12470  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
12471  */
12472 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
12473
12474 /**
12475  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
12476  * but with all dynamically-allocated buffers duplicated in new buffers.
12477  */
12478 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
12479
12480 /**
12481  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
12482  */
12483 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
12484
12485 /**
12486  * Constructs a new COption_CVec_NetAddressZZ containing nothing
12487  */
12488 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
12489
12490 /**
12491  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
12492  */
12493 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
12494
12495 /**
12496  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
12497  * but with all dynamically-allocated buffers duplicated in new buffers.
12498  */
12499 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
12500
12501 /**
12502  * Creates a new CResult_NetAddressu8Z in the success state.
12503  */
12504 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
12505
12506 /**
12507  * Creates a new CResult_NetAddressu8Z in the error state.
12508  */
12509 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
12510
12511 /**
12512  * Frees any resources used by the CResult_NetAddressu8Z.
12513  */
12514 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
12515
12516 /**
12517  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
12518  * but with all dynamically-allocated buffers duplicated in new buffers.
12519  */
12520 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
12521
12522 /**
12523  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
12524  */
12525 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
12526
12527 /**
12528  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
12529  */
12530 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
12531
12532 /**
12533  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
12534  */
12535 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
12536
12537 /**
12538  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
12539  * but with all dynamically-allocated buffers duplicated in new buffers.
12540  */
12541 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
12542
12543 /**
12544  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12545  */
12546 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
12547
12548 /**
12549  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12550  */
12551 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
12552
12553 /**
12554  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12555  */
12556 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
12557
12558 /**
12559  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12560  * but with all dynamically-allocated buffers duplicated in new buffers.
12561  */
12562 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
12563
12564 /**
12565  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12566  */
12567 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
12568
12569 /**
12570  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12571  */
12572 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
12573
12574 /**
12575  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12576  */
12577 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
12578
12579 /**
12580  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12581  */
12582 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
12583
12584 /**
12585  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12586  */
12587 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
12588
12589 /**
12590  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12591  */
12592 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
12593
12594 /**
12595  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12596  */
12597 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
12598
12599 /**
12600  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12601  * but with all dynamically-allocated buffers duplicated in new buffers.
12602  */
12603 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
12604
12605 /**
12606  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12607  */
12608 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
12609
12610 /**
12611  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12612  */
12613 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
12614
12615 /**
12616  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12617  */
12618 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
12619
12620 /**
12621  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12622  * but with all dynamically-allocated buffers duplicated in new buffers.
12623  */
12624 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
12625
12626 /**
12627  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12628  */
12629 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
12630
12631 /**
12632  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12633  */
12634 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
12635
12636 /**
12637  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12638  */
12639 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
12640
12641 /**
12642  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12643  * but with all dynamically-allocated buffers duplicated in new buffers.
12644  */
12645 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
12646
12647 /**
12648  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12649  */
12650 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
12651
12652 /**
12653  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12654  */
12655 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
12656
12657 /**
12658  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12659  */
12660 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
12661
12662 /**
12663  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12664  * but with all dynamically-allocated buffers duplicated in new buffers.
12665  */
12666 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
12667
12668 /**
12669  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12670  */
12671 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
12672
12673 /**
12674  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12675  */
12676 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
12677
12678 /**
12679  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12680  */
12681 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
12682
12683 /**
12684  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12685  * but with all dynamically-allocated buffers duplicated in new buffers.
12686  */
12687 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
12688
12689 /**
12690  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12691  */
12692 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
12693
12694 /**
12695  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12696  */
12697 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
12698
12699 /**
12700  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12701  */
12702 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
12703
12704 /**
12705  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12706  * but with all dynamically-allocated buffers duplicated in new buffers.
12707  */
12708 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
12709
12710 /**
12711  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12712  */
12713 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
12714
12715 /**
12716  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12717  */
12718 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
12719
12720 /**
12721  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12722  */
12723 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
12724
12725 /**
12726  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12727  * but with all dynamically-allocated buffers duplicated in new buffers.
12728  */
12729 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
12730
12731 /**
12732  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12733  */
12734 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
12735
12736 /**
12737  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12738  */
12739 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
12740
12741 /**
12742  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12743  */
12744 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
12745
12746 /**
12747  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12748  * but with all dynamically-allocated buffers duplicated in new buffers.
12749  */
12750 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
12751
12752 /**
12753  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12754  */
12755 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
12756
12757 /**
12758  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12759  */
12760 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
12761
12762 /**
12763  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12764  */
12765 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
12766
12767 /**
12768  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12769  * but with all dynamically-allocated buffers duplicated in new buffers.
12770  */
12771 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
12772
12773 /**
12774  * Creates a new CResult_InitDecodeErrorZ in the success state.
12775  */
12776 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
12777
12778 /**
12779  * Creates a new CResult_InitDecodeErrorZ in the error state.
12780  */
12781 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
12782
12783 /**
12784  * Frees any resources used by the CResult_InitDecodeErrorZ.
12785  */
12786 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
12787
12788 /**
12789  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12790  * but with all dynamically-allocated buffers duplicated in new buffers.
12791  */
12792 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
12793
12794 /**
12795  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12796  */
12797 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
12798
12799 /**
12800  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12801  */
12802 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
12803
12804 /**
12805  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12806  */
12807 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
12808
12809 /**
12810  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12811  * but with all dynamically-allocated buffers duplicated in new buffers.
12812  */
12813 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
12814
12815 /**
12816  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12817  */
12818 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
12819
12820 /**
12821  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12822  */
12823 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
12824
12825 /**
12826  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12827  */
12828 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
12829
12830 /**
12831  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12832  * but with all dynamically-allocated buffers duplicated in new buffers.
12833  */
12834 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
12835
12836 /**
12837  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12838  */
12839 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
12840
12841 /**
12842  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12843  */
12844 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
12845
12846 /**
12847  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12848  */
12849 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
12850
12851 /**
12852  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12853  * but with all dynamically-allocated buffers duplicated in new buffers.
12854  */
12855 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
12856
12857 /**
12858  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12859  */
12860 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
12861
12862 /**
12863  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12864  */
12865 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12866
12867 /**
12868  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12869  */
12870 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
12871
12872 /**
12873  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12874  * but with all dynamically-allocated buffers duplicated in new buffers.
12875  */
12876 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
12877
12878 /**
12879  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12880  */
12881 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
12882
12883 /**
12884  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12885  */
12886 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12887
12888 /**
12889  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12890  */
12891 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
12892
12893 /**
12894  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12895  * but with all dynamically-allocated buffers duplicated in new buffers.
12896  */
12897 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
12898
12899 /**
12900  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12901  */
12902 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
12903
12904 /**
12905  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12906  */
12907 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
12908
12909 /**
12910  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12911  */
12912 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
12913
12914 /**
12915  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12916  * but with all dynamically-allocated buffers duplicated in new buffers.
12917  */
12918 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
12919
12920 /**
12921  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12922  */
12923 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
12924
12925 /**
12926  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12927  */
12928 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12929
12930 /**
12931  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12932  */
12933 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
12934
12935 /**
12936  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12937  * but with all dynamically-allocated buffers duplicated in new buffers.
12938  */
12939 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
12940
12941 /**
12942  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12943  */
12944 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
12945
12946 /**
12947  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12948  */
12949 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
12950
12951 /**
12952  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12953  */
12954 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
12955
12956 /**
12957  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12958  * but with all dynamically-allocated buffers duplicated in new buffers.
12959  */
12960 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
12961
12962 /**
12963  * Creates a new CResult_PingDecodeErrorZ in the success state.
12964  */
12965 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
12966
12967 /**
12968  * Creates a new CResult_PingDecodeErrorZ in the error state.
12969  */
12970 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
12971
12972 /**
12973  * Frees any resources used by the CResult_PingDecodeErrorZ.
12974  */
12975 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
12976
12977 /**
12978  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12979  * but with all dynamically-allocated buffers duplicated in new buffers.
12980  */
12981 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
12982
12983 /**
12984  * Creates a new CResult_PongDecodeErrorZ in the success state.
12985  */
12986 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
12987
12988 /**
12989  * Creates a new CResult_PongDecodeErrorZ in the error state.
12990  */
12991 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
12992
12993 /**
12994  * Frees any resources used by the CResult_PongDecodeErrorZ.
12995  */
12996 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
12997
12998 /**
12999  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13000  * but with all dynamically-allocated buffers duplicated in new buffers.
13001  */
13002 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
13003
13004 /**
13005  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13006  */
13007 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
13008
13009 /**
13010  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13011  */
13012 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13013
13014 /**
13015  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13016  */
13017 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
13018
13019 /**
13020  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13021  * but with all dynamically-allocated buffers duplicated in new buffers.
13022  */
13023 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13024
13025 /**
13026  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13027  */
13028 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
13029
13030 /**
13031  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13032  */
13033 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13034
13035 /**
13036  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13037  */
13038 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
13039
13040 /**
13041  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13042  * but with all dynamically-allocated buffers duplicated in new buffers.
13043  */
13044 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13045
13046 /**
13047  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13048  */
13049 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
13050
13051 /**
13052  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13053  */
13054 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13055
13056 /**
13057  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13058  */
13059 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
13060
13061 /**
13062  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13063  * but with all dynamically-allocated buffers duplicated in new buffers.
13064  */
13065 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13066
13067 /**
13068  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13069  */
13070 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
13071
13072 /**
13073  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13074  */
13075 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13076
13077 /**
13078  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13079  */
13080 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
13081
13082 /**
13083  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13084  * but with all dynamically-allocated buffers duplicated in new buffers.
13085  */
13086 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13087
13088 /**
13089  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13090  */
13091 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
13092
13093 /**
13094  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13095  */
13096 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
13097
13098 /**
13099  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13100  */
13101 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
13102
13103 /**
13104  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13105  * but with all dynamically-allocated buffers duplicated in new buffers.
13106  */
13107 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
13108
13109 /**
13110  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13111  */
13112 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
13113
13114 /**
13115  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13116  */
13117 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13118
13119 /**
13120  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13121  */
13122 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
13123
13124 /**
13125  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13126  * but with all dynamically-allocated buffers duplicated in new buffers.
13127  */
13128 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13129
13130 /**
13131  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13132  */
13133 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
13134
13135 /**
13136  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13137  */
13138 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13139
13140 /**
13141  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13142  */
13143 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
13144
13145 /**
13146  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13147  * but with all dynamically-allocated buffers duplicated in new buffers.
13148  */
13149 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13150
13151 /**
13152  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13153  */
13154 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
13155
13156 /**
13157  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13158  */
13159 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
13160
13161 /**
13162  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13163  */
13164 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
13165
13166 /**
13167  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13168  * but with all dynamically-allocated buffers duplicated in new buffers.
13169  */
13170 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
13171
13172 /**
13173  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13174  */
13175 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
13176
13177 /**
13178  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13179  */
13180 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
13181
13182 /**
13183  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13184  */
13185 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
13186
13187 /**
13188  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13189  * but with all dynamically-allocated buffers duplicated in new buffers.
13190  */
13191 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
13192
13193 /**
13194  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13195  */
13196 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
13197
13198 /**
13199  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13200  */
13201 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13202
13203 /**
13204  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13205  */
13206 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
13207
13208 /**
13209  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13210  * but with all dynamically-allocated buffers duplicated in new buffers.
13211  */
13212 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13213
13214 /**
13215  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13216  */
13217 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
13218
13219 /**
13220  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13221  */
13222 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13223
13224 /**
13225  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13226  */
13227 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
13228
13229 /**
13230  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13231  * but with all dynamically-allocated buffers duplicated in new buffers.
13232  */
13233 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13234
13235 /**
13236  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
13237  */
13238 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
13239
13240 /**
13241  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
13242  */
13243 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
13244
13245 /**
13246  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
13247  */
13248 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
13249
13250 /**
13251  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
13252  * but with all dynamically-allocated buffers duplicated in new buffers.
13253  */
13254 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
13255
13256 /**
13257  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
13258  */
13259 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
13260
13261 /**
13262  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
13263  */
13264 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
13265
13266 /**
13267  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
13268  */
13269 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
13270
13271 /**
13272  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
13273  * but with all dynamically-allocated buffers duplicated in new buffers.
13274  */
13275 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
13276
13277 /**
13278  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
13279  */
13280 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
13281
13282 /**
13283  * Constructs a new COption_FilterZ containing nothing
13284  */
13285 struct LDKCOption_FilterZ COption_FilterZ_none(void);
13286
13287 /**
13288  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
13289  */
13290 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
13291
13292 /**
13293  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
13294  */
13295 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
13296
13297 /**
13298  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
13299  */
13300 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
13301
13302 /**
13303  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
13304  */
13305 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
13306
13307 /**
13308  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13309  */
13310 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
13311
13312 /**
13313  * Frees any resources used by the PaymentPurpose
13314  */
13315 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
13316
13317 /**
13318  * Creates a copy of the PaymentPurpose
13319  */
13320 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
13321
13322 /**
13323  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
13324  */
13325 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
13326
13327 /**
13328  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
13329  */
13330 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
13331
13332 /**
13333  * Frees any resources used by the ClosureReason
13334  */
13335 void ClosureReason_free(struct LDKClosureReason this_ptr);
13336
13337 /**
13338  * Creates a copy of the ClosureReason
13339  */
13340 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
13341
13342 /**
13343  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
13344  */
13345 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
13346
13347 /**
13348  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
13349  */
13350 struct LDKClosureReason ClosureReason_holder_force_closed(void);
13351
13352 /**
13353  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
13354  */
13355 struct LDKClosureReason ClosureReason_cooperative_closure(void);
13356
13357 /**
13358  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
13359  */
13360 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
13361
13362 /**
13363  * Utility method to constructs a new ProcessingError-variant ClosureReason
13364  */
13365 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
13366
13367 /**
13368  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
13369  */
13370 struct LDKClosureReason ClosureReason_disconnected_peer(void);
13371
13372 /**
13373  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
13374  */
13375 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
13376
13377 /**
13378  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
13379  */
13380 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
13381
13382 /**
13383  * Frees any resources used by the Event
13384  */
13385 void Event_free(struct LDKEvent this_ptr);
13386
13387 /**
13388  * Creates a copy of the Event
13389  */
13390 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
13391
13392 /**
13393  * Utility method to constructs a new FundingGenerationReady-variant Event
13394  */
13395 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);
13396
13397 /**
13398  * Utility method to constructs a new PaymentReceived-variant Event
13399  */
13400 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
13401
13402 /**
13403  * Utility method to constructs a new PaymentSent-variant Event
13404  */
13405 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash);
13406
13407 /**
13408  * Utility method to constructs a new PaymentPathFailed-variant Event
13409  */
13410 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, struct LDKCOption_u64Z short_channel_id);
13411
13412 /**
13413  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
13414  */
13415 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
13416
13417 /**
13418  * Utility method to constructs a new SpendableOutputs-variant Event
13419  */
13420 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
13421
13422 /**
13423  * Utility method to constructs a new PaymentForwarded-variant Event
13424  */
13425 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
13426
13427 /**
13428  * Utility method to constructs a new ChannelClosed-variant Event
13429  */
13430 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
13431
13432 /**
13433  * Utility method to constructs a new DiscardFunding-variant Event
13434  */
13435 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
13436
13437 /**
13438  * Serialize the Event object into a byte array which can be read by Event_read
13439  */
13440 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
13441
13442 /**
13443  * Frees any resources used by the MessageSendEvent
13444  */
13445 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
13446
13447 /**
13448  * Creates a copy of the MessageSendEvent
13449  */
13450 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
13451
13452 /**
13453  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
13454  */
13455 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
13456
13457 /**
13458  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
13459  */
13460 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
13461
13462 /**
13463  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
13464  */
13465 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
13466
13467 /**
13468  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
13469  */
13470 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
13471
13472 /**
13473  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
13474  */
13475 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
13476
13477 /**
13478  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
13479  */
13480 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
13481
13482 /**
13483  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
13484  */
13485 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
13486
13487 /**
13488  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
13489  */
13490 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
13491
13492 /**
13493  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
13494  */
13495 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
13496
13497 /**
13498  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
13499  */
13500 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
13501
13502 /**
13503  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
13504  */
13505 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
13506
13507 /**
13508  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
13509  */
13510 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
13511
13512 /**
13513  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
13514  */
13515 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
13516
13517 /**
13518  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
13519  */
13520 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
13521
13522 /**
13523  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
13524  */
13525 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
13526
13527 /**
13528  * Utility method to constructs a new HandleError-variant MessageSendEvent
13529  */
13530 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
13531
13532 /**
13533  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
13534  */
13535 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
13536
13537 /**
13538  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
13539  */
13540 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
13541
13542 /**
13543  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
13544  */
13545 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
13546
13547 /**
13548  * Calls the free function if one is set
13549  */
13550 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
13551
13552 /**
13553  * Calls the free function if one is set
13554  */
13555 void EventsProvider_free(struct LDKEventsProvider this_ptr);
13556
13557 /**
13558  * Calls the free function if one is set
13559  */
13560 void EventHandler_free(struct LDKEventHandler this_ptr);
13561
13562 /**
13563  * Frees any resources used by the APIError
13564  */
13565 void APIError_free(struct LDKAPIError this_ptr);
13566
13567 /**
13568  * Creates a copy of the APIError
13569  */
13570 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
13571
13572 /**
13573  * Utility method to constructs a new APIMisuseError-variant APIError
13574  */
13575 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
13576
13577 /**
13578  * Utility method to constructs a new FeeRateTooHigh-variant APIError
13579  */
13580 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
13581
13582 /**
13583  * Utility method to constructs a new RouteError-variant APIError
13584  */
13585 struct LDKAPIError APIError_route_error(struct LDKStr err);
13586
13587 /**
13588  * Utility method to constructs a new ChannelUnavailable-variant APIError
13589  */
13590 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
13591
13592 /**
13593  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
13594  */
13595 struct LDKAPIError APIError_monitor_update_failed(void);
13596
13597 /**
13598  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
13599  */
13600 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
13601
13602 /**
13603  * Creates a digital signature of a message given a SecretKey, like the node's secret.
13604  * 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.
13605  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
13606  */
13607 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
13608
13609 /**
13610  * Recovers the PublicKey of the signer of the message given the message and the signature.
13611  */
13612 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
13613
13614 /**
13615  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
13616  * and the PublicKey.
13617  */
13618 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
13619
13620 /**
13621  * Creates a copy of the Level
13622  */
13623 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
13624
13625 /**
13626  * Utility method to constructs a new Trace-variant Level
13627  */
13628 enum LDKLevel Level_trace(void);
13629
13630 /**
13631  * Utility method to constructs a new Debug-variant Level
13632  */
13633 enum LDKLevel Level_debug(void);
13634
13635 /**
13636  * Utility method to constructs a new Info-variant Level
13637  */
13638 enum LDKLevel Level_info(void);
13639
13640 /**
13641  * Utility method to constructs a new Warn-variant Level
13642  */
13643 enum LDKLevel Level_warn(void);
13644
13645 /**
13646  * Utility method to constructs a new Error-variant Level
13647  */
13648 enum LDKLevel Level_error(void);
13649
13650 /**
13651  * Checks if two Levels contain equal inner contents.
13652  * This ignores pointers and is_owned flags and looks at the values in fields.
13653  */
13654 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
13655
13656 /**
13657  * Checks if two Levels contain equal inner contents.
13658  */
13659 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
13660
13661 /**
13662  * Returns the most verbose logging level.
13663  */
13664 MUST_USE_RES enum LDKLevel Level_max(void);
13665
13666 /**
13667  * Calls the free function if one is set
13668  */
13669 void Logger_free(struct LDKLogger this_ptr);
13670
13671 /**
13672  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
13673  */
13674 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
13675
13676 /**
13677  * Confirmations we will wait for before considering the channel locked in.
13678  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
13679  * equivalent limit applied to outbound channels).
13680  *
13681  * Default value: 6.
13682  */
13683 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13684
13685 /**
13686  * Confirmations we will wait for before considering the channel locked in.
13687  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
13688  * equivalent limit applied to outbound channels).
13689  *
13690  * Default value: 6.
13691  */
13692 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
13693
13694 /**
13695  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
13696  * the number of blocks we have to punish our counterparty if they broadcast a revoked
13697  * transaction).
13698  *
13699  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
13700  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
13701  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
13702  * possibly with time in between to RBF the spending transaction).
13703  *
13704  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
13705  * case of an honest unilateral channel close, which implicitly decrease the economic value of
13706  * our channel.
13707  *
13708  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
13709  * can tweak config to ask for more security, not less.
13710  */
13711 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13712
13713 /**
13714  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
13715  * the number of blocks we have to punish our counterparty if they broadcast a revoked
13716  * transaction).
13717  *
13718  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
13719  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
13720  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
13721  * possibly with time in between to RBF the spending transaction).
13722  *
13723  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
13724  * case of an honest unilateral channel close, which implicitly decrease the economic value of
13725  * our channel.
13726  *
13727  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
13728  * can tweak config to ask for more security, not less.
13729  */
13730 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
13731
13732 /**
13733  * Set to the smallest value HTLC we will accept to process.
13734  *
13735  * This value is sent to our counterparty on channel-open and we close the channel any time
13736  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
13737  *
13738  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
13739  * by the protocol.
13740  */
13741 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
13742
13743 /**
13744  * Set to the smallest value HTLC we will accept to process.
13745  *
13746  * This value is sent to our counterparty on channel-open and we close the channel any time
13747  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
13748  *
13749  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
13750  * by the protocol.
13751  */
13752 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
13753
13754 /**
13755  * Constructs a new ChannelHandshakeConfig given each field
13756  */
13757 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);
13758
13759 /**
13760  * Creates a copy of the ChannelHandshakeConfig
13761  */
13762 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
13763
13764 /**
13765  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
13766  */
13767 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
13768
13769 /**
13770  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
13771  */
13772 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
13773
13774 /**
13775  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
13776  * only applies to inbound channels.
13777  *
13778  * Default value: 0.
13779  */
13780 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13781
13782 /**
13783  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
13784  * only applies to inbound channels.
13785  *
13786  * Default value: 0.
13787  */
13788 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13789
13790 /**
13791  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
13792  * you to limit the maximum minimum-size they can require.
13793  *
13794  * Default value: u64::max_value.
13795  */
13796 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13797
13798 /**
13799  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
13800  * you to limit the maximum minimum-size they can require.
13801  *
13802  * Default value: u64::max_value.
13803  */
13804 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13805
13806 /**
13807  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
13808  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
13809  *
13810  * Default value: 0.
13811  */
13812 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13813
13814 /**
13815  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
13816  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
13817  *
13818  * Default value: 0.
13819  */
13820 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13821
13822 /**
13823  * The remote node will require we keep a certain amount in direct payment to ourselves at all
13824  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
13825  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
13826  *
13827  * Default value: u64::max_value.
13828  */
13829 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13830
13831 /**
13832  * The remote node will require we keep a certain amount in direct payment to ourselves at all
13833  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
13834  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
13835  *
13836  * Default value: u64::max_value.
13837  */
13838 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
13839
13840 /**
13841  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
13842  * time. This allows you to set a minimum such value.
13843  *
13844  * Default value: 0.
13845  */
13846 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13847
13848 /**
13849  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
13850  * time. This allows you to set a minimum such value.
13851  *
13852  * Default value: 0.
13853  */
13854 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
13855
13856 /**
13857  * Before a channel is usable the funding transaction will need to be confirmed by at least a
13858  * certain number of blocks, specified by the node which is not the funder (as the funder can
13859  * assume they aren't going to double-spend themselves).
13860  * This config allows you to set a limit on the maximum amount of time to wait.
13861  *
13862  * Default value: 144, or roughly one day and only applies to outbound channels.
13863  */
13864 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13865
13866 /**
13867  * Before a channel is usable the funding transaction will need to be confirmed by at least a
13868  * certain number of blocks, specified by the node which is not the funder (as the funder can
13869  * assume they aren't going to double-spend themselves).
13870  * This config allows you to set a limit on the maximum amount of time to wait.
13871  *
13872  * Default value: 144, or roughly one day and only applies to outbound channels.
13873  */
13874 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
13875
13876 /**
13877  * Set to force an incoming channel to match our announced channel preference in
13878  * [`ChannelConfig::announced_channel`].
13879  *
13880  * For a node which is not online reliably, this should be set to true and
13881  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
13882  * channels will ever be opened.
13883  *
13884  * Default value: true.
13885  */
13886 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13887
13888 /**
13889  * Set to force an incoming channel to match our announced channel preference in
13890  * [`ChannelConfig::announced_channel`].
13891  *
13892  * For a node which is not online reliably, this should be set to true and
13893  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
13894  * channels will ever be opened.
13895  *
13896  * Default value: true.
13897  */
13898 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
13899
13900 /**
13901  * Set to the amount of time we're willing to wait to claim money back to us.
13902  *
13903  * Not checking this value would be a security issue, as our peer would be able to set it to
13904  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
13905  *
13906  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
13907  * reduce the loss of having useless locked funds (if your peer accepts)
13908  */
13909 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
13910
13911 /**
13912  * Set to the amount of time we're willing to wait to claim money back to us.
13913  *
13914  * Not checking this value would be a security issue, as our peer would be able to set it to
13915  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
13916  *
13917  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
13918  * reduce the loss of having useless locked funds (if your peer accepts)
13919  */
13920 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
13921
13922 /**
13923  * Constructs a new ChannelHandshakeLimits given each field
13924  */
13925 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);
13926
13927 /**
13928  * Creates a copy of the ChannelHandshakeLimits
13929  */
13930 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
13931
13932 /**
13933  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
13934  */
13935 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
13936
13937 /**
13938  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
13939  */
13940 void ChannelConfig_free(struct LDKChannelConfig this_obj);
13941
13942 /**
13943  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
13944  * over the channel.
13945  * This may be allowed to change at runtime in a later update, however doing so must result in
13946  * update messages sent to notify all nodes of our updated relay fee.
13947  *
13948  * Default value: 0.
13949  */
13950 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13951
13952 /**
13953  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
13954  * over the channel.
13955  * This may be allowed to change at runtime in a later update, however doing so must result in
13956  * update messages sent to notify all nodes of our updated relay fee.
13957  *
13958  * Default value: 0.
13959  */
13960 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
13961
13962 /**
13963  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
13964  * excess of [`forwarding_fee_proportional_millionths`].
13965  * This may be allowed to change at runtime in a later update, however doing so must result in
13966  * update messages sent to notify all nodes of our updated relay fee.
13967  *
13968  * The default value of a single satoshi roughly matches the market rate on many routing nodes
13969  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
13970  * this node.
13971  *
13972  * Default value: 1000.
13973  *
13974  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
13975  */
13976 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
13977
13978 /**
13979  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
13980  * excess of [`forwarding_fee_proportional_millionths`].
13981  * This may be allowed to change at runtime in a later update, however doing so must result in
13982  * update messages sent to notify all nodes of our updated relay fee.
13983  *
13984  * The default value of a single satoshi roughly matches the market rate on many routing nodes
13985  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
13986  * this node.
13987  *
13988  * Default value: 1000.
13989  *
13990  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
13991  */
13992 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
13993
13994 /**
13995  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
13996  * the channel this config applies to.
13997  *
13998  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
13999  * HTLC balance when a channel appears on-chain whereas
14000  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14001  * (non-HTLC-encumbered) balance.
14002  *
14003  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14004  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14005  * commitment transaction at least once per this many blocks (minus some margin to allow us
14006  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14007  * the spending transaction).
14008  *
14009  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14010  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14011  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14012  *
14013  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14014  */
14015 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14016
14017 /**
14018  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
14019  * the channel this config applies to.
14020  *
14021  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
14022  * HTLC balance when a channel appears on-chain whereas
14023  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14024  * (non-HTLC-encumbered) balance.
14025  *
14026  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14027  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14028  * commitment transaction at least once per this many blocks (minus some margin to allow us
14029  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14030  * the spending transaction).
14031  *
14032  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14033  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14034  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14035  *
14036  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14037  */
14038 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
14039
14040 /**
14041  * Set to announce the channel publicly and notify all nodes that they can route via this
14042  * channel.
14043  *
14044  * This should only be set to true for nodes which expect to be online reliably.
14045  *
14046  * As the node which funds a channel picks this value this will only apply for new outbound
14047  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14048  *
14049  * This cannot be changed after the initial channel handshake.
14050  *
14051  * Default value: false.
14052  */
14053 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14054
14055 /**
14056  * Set to announce the channel publicly and notify all nodes that they can route via this
14057  * channel.
14058  *
14059  * This should only be set to true for nodes which expect to be online reliably.
14060  *
14061  * As the node which funds a channel picks this value this will only apply for new outbound
14062  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14063  *
14064  * This cannot be changed after the initial channel handshake.
14065  *
14066  * Default value: false.
14067  */
14068 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14069
14070 /**
14071  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14072  * supports it, they will then enforce the mutual-close output to us matches what we provided
14073  * at intialization, preventing us from closing to an alternate pubkey.
14074  *
14075  * This is set to true by default to provide a slight increase in security, though ultimately
14076  * any attacker who is able to take control of a channel can just as easily send the funds via
14077  * lightning payments, so we never require that our counterparties support this option.
14078  *
14079  * This cannot be changed after a channel has been initialized.
14080  *
14081  * Default value: true.
14082  */
14083 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14084
14085 /**
14086  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14087  * supports it, they will then enforce the mutual-close output to us matches what we provided
14088  * at intialization, preventing us from closing to an alternate pubkey.
14089  *
14090  * This is set to true by default to provide a slight increase in security, though ultimately
14091  * any attacker who is able to take control of a channel can just as easily send the funds via
14092  * lightning payments, so we never require that our counterparties support this option.
14093  *
14094  * This cannot be changed after a channel has been initialized.
14095  *
14096  * Default value: true.
14097  */
14098 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14099
14100 /**
14101  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14102  * small to claim on-chain.
14103  *
14104  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14105  * not be claimable on-chain, instead being turned into additional miner fees if either
14106  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14107  * to such payments may be sustantial if there are many dust HTLCs present when the
14108  * channel is force-closed.
14109  *
14110  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14111  * exposure across all three types per-channel. Setting this too low may prevent the
14112  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14113  * important to prevent stealing of dust HTLCs by miners.
14114  *
14115  * Default value: 5_000_000 msat.
14116  */
14117 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14118
14119 /**
14120  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14121  * small to claim on-chain.
14122  *
14123  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14124  * not be claimable on-chain, instead being turned into additional miner fees if either
14125  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14126  * to such payments may be sustantial if there are many dust HTLCs present when the
14127  * channel is force-closed.
14128  *
14129  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14130  * exposure across all three types per-channel. Setting this too low may prevent the
14131  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14132  * important to prevent stealing of dust HTLCs by miners.
14133  *
14134  * Default value: 5_000_000 msat.
14135  */
14136 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14137
14138 /**
14139  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14140  * `to_self_delay` to reclaim funds.
14141  *
14142  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14143  * closing transaction which both sides find acceptable, ultimately paid by the channel
14144  * funder/initiator.
14145  *
14146  * When we are the funder, because we have to pay the channel closing fee, we bound the
14147  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14148  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14149  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14150  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14151  * funds.
14152  *
14153  * When we are not the funder, we require the closing transaction fee pay at least our
14154  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14155  * Thus, this value is ignored when we are not the funder.
14156  *
14157  * Default value: 1000 satoshis.
14158  *
14159  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14160  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14161  */
14162 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14163
14164 /**
14165  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14166  * `to_self_delay` to reclaim funds.
14167  *
14168  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14169  * closing transaction which both sides find acceptable, ultimately paid by the channel
14170  * funder/initiator.
14171  *
14172  * When we are the funder, because we have to pay the channel closing fee, we bound the
14173  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14174  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14175  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14176  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14177  * funds.
14178  *
14179  * When we are not the funder, we require the closing transaction fee pay at least our
14180  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14181  * Thus, this value is ignored when we are not the funder.
14182  *
14183  * Default value: 1000 satoshis.
14184  *
14185  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14186  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14187  */
14188 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14189
14190 /**
14191  * Constructs a new ChannelConfig given each field
14192  */
14193 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);
14194
14195 /**
14196  * Creates a copy of the ChannelConfig
14197  */
14198 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
14199
14200 /**
14201  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
14202  */
14203 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
14204
14205 /**
14206  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
14207  */
14208 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
14209
14210 /**
14211  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
14212  */
14213 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
14214
14215 /**
14216  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
14217  */
14218 void UserConfig_free(struct LDKUserConfig this_obj);
14219
14220 /**
14221  * Channel config that we propose to our counterparty.
14222  */
14223 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14224
14225 /**
14226  * Channel config that we propose to our counterparty.
14227  */
14228 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
14229
14230 /**
14231  * Limits applied to our counterparty's proposed channel config settings.
14232  */
14233 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14234
14235 /**
14236  * Limits applied to our counterparty's proposed channel config settings.
14237  */
14238 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
14239
14240 /**
14241  * Channel config which affects behavior during channel lifetime.
14242  */
14243 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14244
14245 /**
14246  * Channel config which affects behavior during channel lifetime.
14247  */
14248 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
14249
14250 /**
14251  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14252  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14253  * node which is not online reliably.
14254  *
14255  * For nodes which are not online reliably, you should set all channels to *not* be announced
14256  * (using [`ChannelConfig::announced_channel`] and
14257  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14258  * ensure you are not exposed to any forwarding risk.
14259  *
14260  * Note that because you cannot change a channel's announced state after creation, there is no
14261  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14262  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14263  * all your channels and open new ones. For privacy, you should also change your node_id
14264  * (swapping all private and public key material for new ones) at that time.
14265  *
14266  * Default value: false.
14267  */
14268 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14269
14270 /**
14271  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14272  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14273  * node which is not online reliably.
14274  *
14275  * For nodes which are not online reliably, you should set all channels to *not* be announced
14276  * (using [`ChannelConfig::announced_channel`] and
14277  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14278  * ensure you are not exposed to any forwarding risk.
14279  *
14280  * Note that because you cannot change a channel's announced state after creation, there is no
14281  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14282  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14283  * all your channels and open new ones. For privacy, you should also change your node_id
14284  * (swapping all private and public key material for new ones) at that time.
14285  *
14286  * Default value: false.
14287  */
14288 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
14289
14290 /**
14291  * Constructs a new UserConfig given each field
14292  */
14293 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);
14294
14295 /**
14296  * Creates a copy of the UserConfig
14297  */
14298 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
14299
14300 /**
14301  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
14302  */
14303 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
14304
14305 /**
14306  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
14307  */
14308 void BestBlock_free(struct LDKBestBlock this_obj);
14309
14310 /**
14311  * Creates a copy of the BestBlock
14312  */
14313 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
14314
14315 /**
14316  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
14317  * network.
14318  */
14319 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
14320
14321 /**
14322  * Returns a `BestBlock` as identified by the given block hash and height.
14323  */
14324 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
14325
14326 /**
14327  * Returns the best block hash.
14328  */
14329 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
14330
14331 /**
14332  * Returns the best block height.
14333  */
14334 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
14335
14336 /**
14337  * Creates a copy of the AccessError
14338  */
14339 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
14340
14341 /**
14342  * Utility method to constructs a new UnknownChain-variant AccessError
14343  */
14344 enum LDKAccessError AccessError_unknown_chain(void);
14345
14346 /**
14347  * Utility method to constructs a new UnknownTx-variant AccessError
14348  */
14349 enum LDKAccessError AccessError_unknown_tx(void);
14350
14351 /**
14352  * Calls the free function if one is set
14353  */
14354 void Access_free(struct LDKAccess this_ptr);
14355
14356 /**
14357  * Calls the free function if one is set
14358  */
14359 void Listen_free(struct LDKListen this_ptr);
14360
14361 /**
14362  * Calls the free function if one is set
14363  */
14364 void Confirm_free(struct LDKConfirm this_ptr);
14365
14366 /**
14367  * Creates a copy of the ChannelMonitorUpdateErr
14368  */
14369 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
14370
14371 /**
14372  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
14373  */
14374 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
14375
14376 /**
14377  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
14378  */
14379 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
14380
14381 /**
14382  * Calls the free function if one is set
14383  */
14384 void Watch_free(struct LDKWatch this_ptr);
14385
14386 /**
14387  * Calls the free function if one is set
14388  */
14389 void Filter_free(struct LDKFilter this_ptr);
14390
14391 /**
14392  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
14393  */
14394 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
14395
14396 /**
14397  * First block where the transaction output may have been spent.
14398  *
14399  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14400  */
14401 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14402
14403 /**
14404  * First block where the transaction output may have been spent.
14405  *
14406  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
14407  */
14408 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14409
14410 /**
14411  * Outpoint identifying the transaction output.
14412  */
14413 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14414
14415 /**
14416  * Outpoint identifying the transaction output.
14417  */
14418 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14419
14420 /**
14421  * Spending condition of the transaction output.
14422  */
14423 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14424
14425 /**
14426  * Spending condition of the transaction output.
14427  */
14428 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14429
14430 /**
14431  * Constructs a new WatchedOutput given each field
14432  */
14433 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
14434
14435 /**
14436  * Creates a copy of the WatchedOutput
14437  */
14438 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
14439
14440 /**
14441  * Checks if two WatchedOutputs contain equal inner contents.
14442  */
14443 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
14444
14445 /**
14446  * Calls the free function if one is set
14447  */
14448 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
14449
14450 /**
14451  * Creates a copy of the ConfirmationTarget
14452  */
14453 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
14454
14455 /**
14456  * Utility method to constructs a new Background-variant ConfirmationTarget
14457  */
14458 enum LDKConfirmationTarget ConfirmationTarget_background(void);
14459
14460 /**
14461  * Utility method to constructs a new Normal-variant ConfirmationTarget
14462  */
14463 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
14464
14465 /**
14466  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
14467  */
14468 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
14469
14470 /**
14471  * Checks if two ConfirmationTargets contain equal inner contents.
14472  * This ignores pointers and is_owned flags and looks at the values in fields.
14473  */
14474 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
14475
14476 /**
14477  * Calls the free function if one is set
14478  */
14479 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
14480
14481 /**
14482  * Calls the free function if one is set
14483  */
14484 void Persist_free(struct LDKPersist this_ptr);
14485
14486 /**
14487  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
14488  */
14489 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
14490
14491 /**
14492  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
14493  */
14494 void ChainMonitor_free(struct LDKChainMonitor this_obj);
14495
14496 /**
14497  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
14498  *
14499  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
14500  * will call back to it indicating transactions and outputs of interest. This allows clients to
14501  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
14502  * always need to fetch full blocks absent another means for determining which blocks contain
14503  * transactions relevant to the watched channels.
14504  */
14505 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
14506
14507 /**
14508  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
14509  * claims which are awaiting confirmation.
14510  *
14511  * Includes the balances from each [`ChannelMonitor`] *except* those included in
14512  * `ignored_channels`, allowing you to filter out balances from channels which are still open
14513  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
14514  *
14515  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
14516  * inclusion in the return value.
14517  */
14518 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
14519
14520 /**
14521  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
14522  * such [`ChannelMonitor`] is currently being monitored for.
14523  *
14524  * Note that the result holds a mutex over our monitor set, and should not be held
14525  * indefinitely.
14526  */
14527 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
14528
14529 /**
14530  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
14531  *
14532  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
14533  * monitoring for on-chain state resolutions.
14534  */
14535 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
14536
14537 /**
14538  * Constructs a new Listen which calls the relevant methods on this_arg.
14539  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
14540  */
14541 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
14542
14543 /**
14544  * Constructs a new Confirm which calls the relevant methods on this_arg.
14545  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
14546  */
14547 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
14548
14549 /**
14550  * Constructs a new Watch which calls the relevant methods on this_arg.
14551  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
14552  */
14553 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
14554
14555 /**
14556  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
14557  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
14558  */
14559 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
14560
14561 /**
14562  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
14563  */
14564 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
14565
14566 /**
14567  * The sequence number of this update. Updates *must* be replayed in-order according to this
14568  * sequence number (and updates may panic if they are not). The update_id values are strictly
14569  * increasing and increase by one for each new update, with one exception specified below.
14570  *
14571  * This sequence number is also used to track up to which points updates which returned
14572  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
14573  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
14574  *
14575  * The only instance where update_id values are not strictly increasing is the case where we
14576  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
14577  * its docs for more details.
14578  */
14579 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
14580
14581 /**
14582  * The sequence number of this update. Updates *must* be replayed in-order according to this
14583  * sequence number (and updates may panic if they are not). The update_id values are strictly
14584  * increasing and increase by one for each new update, with one exception specified below.
14585  *
14586  * This sequence number is also used to track up to which points updates which returned
14587  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
14588  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
14589  *
14590  * The only instance where update_id values are not strictly increasing is the case where we
14591  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
14592  * its docs for more details.
14593  */
14594 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
14595
14596 /**
14597  * Creates a copy of the ChannelMonitorUpdate
14598  */
14599 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
14600
14601 /**
14602  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
14603  */
14604 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
14605
14606 /**
14607  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
14608  */
14609 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
14610
14611 /**
14612  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
14613  */
14614 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
14615
14616 /**
14617  * Creates a copy of the MonitorUpdateError
14618  */
14619 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
14620
14621 /**
14622  * Frees any resources used by the MonitorEvent
14623  */
14624 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
14625
14626 /**
14627  * Creates a copy of the MonitorEvent
14628  */
14629 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
14630
14631 /**
14632  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
14633  */
14634 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
14635
14636 /**
14637  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
14638  */
14639 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
14640
14641 /**
14642  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
14643  */
14644 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
14645
14646 /**
14647  * Creates a copy of the HTLCUpdate
14648  */
14649 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
14650
14651 /**
14652  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
14653  */
14654 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
14655
14656 /**
14657  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
14658  */
14659 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
14660
14661 /**
14662  * Frees any resources used by the Balance
14663  */
14664 void Balance_free(struct LDKBalance this_ptr);
14665
14666 /**
14667  * Creates a copy of the Balance
14668  */
14669 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
14670
14671 /**
14672  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
14673  */
14674 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
14675
14676 /**
14677  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
14678  */
14679 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
14680
14681 /**
14682  * Utility method to constructs a new ContentiousClaimable-variant Balance
14683  */
14684 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
14685
14686 /**
14687  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
14688  */
14689 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
14690
14691 /**
14692  * Checks if two Balances contain equal inner contents.
14693  * This ignores pointers and is_owned flags and looks at the values in fields.
14694  */
14695 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
14696
14697 /**
14698  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
14699  */
14700 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
14701
14702 /**
14703  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
14704  */
14705 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
14706
14707 /**
14708  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
14709  * itself.
14710  *
14711  * panics if the given update is not the next update by update_id.
14712  */
14713 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);
14714
14715 /**
14716  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
14717  * ChannelMonitor.
14718  */
14719 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14720
14721 /**
14722  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
14723  */
14724 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14725
14726 /**
14727  * Gets a list of txids, with their output scripts (in the order they appear in the
14728  * transaction), which we must learn about spends of via block_connected().
14729  */
14730 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14731
14732 /**
14733  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
14734  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
14735  * have been registered.
14736  */
14737 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
14738
14739 /**
14740  * Get the list of HTLCs who's status has been updated on chain. This should be called by
14741  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
14742  */
14743 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14744
14745 /**
14746  * Gets the list of pending events which were generated by previous actions, clearing the list
14747  * in the process.
14748  *
14749  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
14750  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
14751  * no internal locking in ChannelMonitors.
14752  */
14753 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14754
14755 /**
14756  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
14757  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
14758  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
14759  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
14760  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
14761  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
14762  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
14763  * out-of-band the other node operator to coordinate with him if option is available to you.
14764  * In any-case, choice is up to the user.
14765  */
14766 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);
14767
14768 /**
14769  * Processes transactions in a newly connected block, which may result in any of the following:
14770  * - update the monitor's state against resolved HTLCs
14771  * - punish the counterparty in the case of seeing a revoked commitment transaction
14772  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
14773  * - detect settled outputs for later spending
14774  * - schedule and bump any in-flight claims
14775  *
14776  * Returns any new outputs to watch from `txdata`; after called, these are also included in
14777  * [`get_outputs_to_watch`].
14778  *
14779  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
14780  */
14781 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);
14782
14783 /**
14784  * Determines if the disconnected block contained any transactions of interest and updates
14785  * appropriately.
14786  */
14787 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);
14788
14789 /**
14790  * Processes transactions confirmed in a block with the given header and height, returning new
14791  * outputs to watch. See [`block_connected`] for details.
14792  *
14793  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
14794  * blocks. See [`chain::Confirm`] for calling expectations.
14795  *
14796  * [`block_connected`]: Self::block_connected
14797  */
14798 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);
14799
14800 /**
14801  * Processes a transaction that was reorganized out of the chain.
14802  *
14803  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
14804  * than blocks. See [`chain::Confirm`] for calling expectations.
14805  *
14806  * [`block_disconnected`]: Self::block_disconnected
14807  */
14808 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);
14809
14810 /**
14811  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
14812  * [`block_connected`] for details.
14813  *
14814  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
14815  * blocks. See [`chain::Confirm`] for calling expectations.
14816  *
14817  * [`block_connected`]: Self::block_connected
14818  */
14819 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);
14820
14821 /**
14822  * Returns the set of txids that should be monitored for re-organization out of the chain.
14823  */
14824 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14825
14826 /**
14827  * Gets the latest best block which was connected either via the [`chain::Listen`] or
14828  * [`chain::Confirm`] interfaces.
14829  */
14830 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14831
14832 /**
14833  * Gets the balances in this channel which are either claimable by us if we were to
14834  * force-close the channel now or which are claimable on-chain (possibly awaiting
14835  * confirmation).
14836  *
14837  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
14838  * included here until an [`Event::SpendableOutputs`] event has been generated for the
14839  * balance, or until our counterparty has claimed the balance and accrued several
14840  * confirmations on the claim transaction.
14841  *
14842  * Note that the balances available when you or your counterparty have broadcasted revoked
14843  * state(s) may not be fully captured here.
14844  *
14845  * See [`Balance`] for additional details on the types of claimable balances which
14846  * may be returned here and their meanings.
14847  */
14848 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
14849
14850 /**
14851  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
14852  */
14853 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
14854
14855 /**
14856  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
14857  */
14858 void OutPoint_free(struct LDKOutPoint this_obj);
14859
14860 /**
14861  * The referenced transaction's txid.
14862  */
14863 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
14864
14865 /**
14866  * The referenced transaction's txid.
14867  */
14868 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14869
14870 /**
14871  * The index of the referenced output in its transaction's vout.
14872  */
14873 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
14874
14875 /**
14876  * The index of the referenced output in its transaction's vout.
14877  */
14878 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
14879
14880 /**
14881  * Constructs a new OutPoint given each field
14882  */
14883 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
14884
14885 /**
14886  * Creates a copy of the OutPoint
14887  */
14888 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
14889
14890 /**
14891  * Checks if two OutPoints contain equal inner contents.
14892  * This ignores pointers and is_owned flags and looks at the values in fields.
14893  * Two objects with NULL inner values will be considered "equal" here.
14894  */
14895 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
14896
14897 /**
14898  * Checks if two OutPoints contain equal inner contents.
14899  */
14900 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
14901
14902 /**
14903  * Convert an `OutPoint` to a lightning channel id.
14904  */
14905 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
14906
14907 /**
14908  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
14909  */
14910 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
14911
14912 /**
14913  * Read a OutPoint from a byte array, created by OutPoint_write
14914  */
14915 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
14916
14917 /**
14918  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
14919  */
14920 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
14921
14922 /**
14923  * The outpoint which is spendable
14924  */
14925 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14926
14927 /**
14928  * The outpoint which is spendable
14929  */
14930 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14931
14932 /**
14933  * Per commitment point to derive delayed_payment_key by key holder
14934  */
14935 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14936
14937 /**
14938  * Per commitment point to derive delayed_payment_key by key holder
14939  */
14940 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14941
14942 /**
14943  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
14944  * the witness_script.
14945  */
14946 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14947
14948 /**
14949  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
14950  * the witness_script.
14951  */
14952 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
14953
14954 /**
14955  * The output which is referenced by the given outpoint
14956  */
14957 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
14958
14959 /**
14960  * The revocation point specific to the commitment transaction which was broadcast. Used to
14961  * derive the witnessScript for this output.
14962  */
14963 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14964
14965 /**
14966  * The revocation point specific to the commitment transaction which was broadcast. Used to
14967  * derive the witnessScript for this output.
14968  */
14969 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14970
14971 /**
14972  * Arbitrary identification information returned by a call to
14973  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14974  * the channel to spend the output.
14975  */
14976 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
14977
14978 /**
14979  * Arbitrary identification information returned by a call to
14980  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
14981  * the channel to spend the output.
14982  */
14983 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14984
14985 /**
14986  * The value of the channel which this output originated from, possibly indirectly.
14987  */
14988 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
14989
14990 /**
14991  * The value of the channel which this output originated from, possibly indirectly.
14992  */
14993 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
14994
14995 /**
14996  * Constructs a new DelayedPaymentOutputDescriptor given each field
14997  */
14998 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);
14999
15000 /**
15001  * Creates a copy of the DelayedPaymentOutputDescriptor
15002  */
15003 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
15004
15005 /**
15006  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
15007  */
15008 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
15009
15010 /**
15011  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
15012  */
15013 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
15014
15015 /**
15016  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
15017  */
15018 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
15019
15020 /**
15021  * The outpoint which is spendable
15022  */
15023 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15024
15025 /**
15026  * The outpoint which is spendable
15027  */
15028 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15029
15030 /**
15031  * The output which is referenced by the given outpoint
15032  */
15033 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
15034
15035 /**
15036  * Arbitrary identification information returned by a call to
15037  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15038  * the channel to spend the output.
15039  */
15040 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
15041
15042 /**
15043  * Arbitrary identification information returned by a call to
15044  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15045  * the channel to spend the output.
15046  */
15047 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15048
15049 /**
15050  * The value of the channel which this transactions spends.
15051  */
15052 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15053
15054 /**
15055  * The value of the channel which this transactions spends.
15056  */
15057 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
15058
15059 /**
15060  * Constructs a new StaticPaymentOutputDescriptor given each field
15061  */
15062 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);
15063
15064 /**
15065  * Creates a copy of the StaticPaymentOutputDescriptor
15066  */
15067 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
15068
15069 /**
15070  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
15071  */
15072 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
15073
15074 /**
15075  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
15076  */
15077 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
15078
15079 /**
15080  * Frees any resources used by the SpendableOutputDescriptor
15081  */
15082 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
15083
15084 /**
15085  * Creates a copy of the SpendableOutputDescriptor
15086  */
15087 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
15088
15089 /**
15090  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
15091  */
15092 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
15093
15094 /**
15095  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
15096  */
15097 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
15098
15099 /**
15100  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
15101  */
15102 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
15103
15104 /**
15105  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
15106  */
15107 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
15108
15109 /**
15110  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
15111  */
15112 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
15113
15114 /**
15115  * Calls the free function if one is set
15116  */
15117 void BaseSign_free(struct LDKBaseSign this_ptr);
15118
15119 /**
15120  * Creates a copy of a Sign
15121  */
15122 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
15123
15124 /**
15125  * Calls the free function if one is set
15126  */
15127 void Sign_free(struct LDKSign this_ptr);
15128
15129 /**
15130  * Calls the free function if one is set
15131  */
15132 void KeysInterface_free(struct LDKKeysInterface this_ptr);
15133
15134 /**
15135  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
15136  */
15137 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
15138
15139 /**
15140  * Private key of anchor tx
15141  */
15142 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15143
15144 /**
15145  * Private key of anchor tx
15146  */
15147 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15148
15149 /**
15150  * Holder secret key for blinded revocation pubkey
15151  */
15152 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15153
15154 /**
15155  * Holder secret key for blinded revocation pubkey
15156  */
15157 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15158
15159 /**
15160  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15161  */
15162 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15163
15164 /**
15165  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15166  */
15167 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15168
15169 /**
15170  * Holder secret key used in HTLC tx
15171  */
15172 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15173
15174 /**
15175  * Holder secret key used in HTLC tx
15176  */
15177 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15178
15179 /**
15180  * Holder htlc secret key used in commitment tx htlc outputs
15181  */
15182 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15183
15184 /**
15185  * Holder htlc secret key used in commitment tx htlc outputs
15186  */
15187 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15188
15189 /**
15190  * Commitment seed
15191  */
15192 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15193
15194 /**
15195  * Commitment seed
15196  */
15197 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15198
15199 /**
15200  * Creates a copy of the InMemorySigner
15201  */
15202 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
15203
15204 /**
15205  * Create a new InMemorySigner
15206  */
15207 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);
15208
15209 /**
15210  * Counterparty pubkeys.
15211  * Will panic if ready_channel wasn't called.
15212  */
15213 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15214
15215 /**
15216  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
15217  * transactions, ie the amount of time that we have to wait to recover our funds if we
15218  * broadcast a transaction.
15219  * Will panic if ready_channel wasn't called.
15220  */
15221 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15222
15223 /**
15224  * The contest_delay value specified by us and applied on transactions broadcastable
15225  * by our counterparty, ie the amount of time that they have to wait to recover their funds
15226  * if they broadcast a transaction.
15227  * Will panic if ready_channel wasn't called.
15228  */
15229 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15230
15231 /**
15232  * Whether the holder is the initiator
15233  * Will panic if ready_channel wasn't called.
15234  */
15235 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15236
15237 /**
15238  * Funding outpoint
15239  * Will panic if ready_channel wasn't called.
15240  */
15241 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15242
15243 /**
15244  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
15245  * building transactions.
15246  *
15247  * Will panic if ready_channel wasn't called.
15248  */
15249 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15250
15251 /**
15252  * Sign the single input of spend_tx at index `input_idx` which spends the output
15253  * described by descriptor, returning the witness stack for the input.
15254  *
15255  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15256  * or is not spending the outpoint described by `descriptor.outpoint`.
15257  */
15258 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);
15259
15260 /**
15261  * Sign the single input of spend_tx at index `input_idx` which spends the output
15262  * described by descriptor, returning the witness stack for the input.
15263  *
15264  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15265  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
15266  * sequence set to `descriptor.to_self_delay`.
15267  */
15268 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);
15269
15270 /**
15271  * Constructs a new BaseSign which calls the relevant methods on this_arg.
15272  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
15273  */
15274 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15275
15276 /**
15277  * Constructs a new Sign which calls the relevant methods on this_arg.
15278  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
15279  */
15280 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15281
15282 /**
15283  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
15284  */
15285 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
15286
15287 /**
15288  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
15289  */
15290 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
15291
15292 /**
15293  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
15294  */
15295 void KeysManager_free(struct LDKKeysManager this_obj);
15296
15297 /**
15298  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
15299  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
15300  * starting_time isn't strictly required to actually be a time, but it must absolutely,
15301  * without a doubt, be unique to this instance. ie if you start multiple times with the same
15302  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
15303  * simply use the current time (with very high precision).
15304  *
15305  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
15306  * obviously, starting_time should be unique every time you reload the library - it is only
15307  * used to generate new ephemeral key data (which will be stored by the individual channel if
15308  * necessary).
15309  *
15310  * Note that the seed is required to recover certain on-chain funds independent of
15311  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
15312  * channel, and some on-chain during-closing funds.
15313  *
15314  * Note that until the 0.1 release there is no guarantee of backward compatibility between
15315  * versions. Once the library is more fully supported, the docs will be updated to include a
15316  * detailed description of the guarantee.
15317  */
15318 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
15319
15320 /**
15321  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
15322  *
15323  * Key derivation parameters are accessible through a per-channel secrets
15324  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
15325  * onchain output detection for which a corresponding delayed_payment_key must be derived.
15326  */
15327 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]);
15328
15329 /**
15330  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
15331  * output to the given change destination (if sufficient change value remains). The
15332  * transaction will have a feerate, at least, of the given value.
15333  *
15334  * Returns `Err(())` if the output value is greater than the input value minus required fee or
15335  * if a descriptor was duplicated.
15336  *
15337  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
15338  *
15339  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
15340  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
15341  */
15342 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);
15343
15344 /**
15345  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
15346  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
15347  */
15348 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
15349
15350 /**
15351  * Frees any resources used by the PaymentId, if is_owned is set and inner is non-NULL.
15352  */
15353 void PaymentId_free(struct LDKPaymentId this_obj);
15354
15355 /**
15356  * Checks if two PaymentIds contain equal inner contents.
15357  */
15358 uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o);
15359
15360 /**
15361  * Creates a copy of the PaymentId
15362  */
15363 struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig);
15364
15365 /**
15366  * Checks if two PaymentIds contain equal inner contents.
15367  * This ignores pointers and is_owned flags and looks at the values in fields.
15368  * Two objects with NULL inner values will be considered "equal" here.
15369  */
15370 bool PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b);
15371
15372 /**
15373  * Serialize the PaymentId object into a byte array which can be read by PaymentId_read
15374  */
15375 struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj);
15376
15377 /**
15378  * Read a PaymentId from a byte array, created by PaymentId_write
15379  */
15380 struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser);
15381
15382 /**
15383  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
15384  */
15385 void ChannelManager_free(struct LDKChannelManager this_obj);
15386
15387 /**
15388  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
15389  */
15390 void ChainParameters_free(struct LDKChainParameters this_obj);
15391
15392 /**
15393  * The network for determining the `chain_hash` in Lightning messages.
15394  */
15395 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
15396
15397 /**
15398  * The network for determining the `chain_hash` in Lightning messages.
15399  */
15400 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
15401
15402 /**
15403  * The hash and height of the latest block successfully connected.
15404  *
15405  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
15406  */
15407 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
15408
15409 /**
15410  * The hash and height of the latest block successfully connected.
15411  *
15412  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
15413  */
15414 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
15415
15416 /**
15417  * Constructs a new ChainParameters given each field
15418  */
15419 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
15420
15421 /**
15422  * Creates a copy of the ChainParameters
15423  */
15424 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
15425
15426 /**
15427  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
15428  */
15429 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
15430
15431 /**
15432  * Base routing fee in millisatoshis.
15433  */
15434 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
15435
15436 /**
15437  * Base routing fee in millisatoshis.
15438  */
15439 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
15440
15441 /**
15442  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
15443  */
15444 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
15445
15446 /**
15447  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
15448  */
15449 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
15450
15451 /**
15452  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
15453  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
15454  * `cltv_expiry_delta` for more details.
15455  */
15456 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
15457
15458 /**
15459  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
15460  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
15461  * `cltv_expiry_delta` for more details.
15462  */
15463 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
15464
15465 /**
15466  * Constructs a new CounterpartyForwardingInfo given each field
15467  */
15468 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);
15469
15470 /**
15471  * Creates a copy of the CounterpartyForwardingInfo
15472  */
15473 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
15474
15475 /**
15476  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
15477  */
15478 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
15479
15480 /**
15481  * The node_id of our counterparty
15482  */
15483 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
15484
15485 /**
15486  * The node_id of our counterparty
15487  */
15488 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15489
15490 /**
15491  * The Features the channel counterparty provided upon last connection.
15492  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
15493  * many routing-relevant features are present in the init context.
15494  */
15495 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
15496
15497 /**
15498  * The Features the channel counterparty provided upon last connection.
15499  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
15500  * many routing-relevant features are present in the init context.
15501  */
15502 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
15503
15504 /**
15505  * The value, in satoshis, that must always be held in the channel for our counterparty. This
15506  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
15507  * claiming at least this value on chain.
15508  *
15509  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
15510  *
15511  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
15512  */
15513 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
15514
15515 /**
15516  * The value, in satoshis, that must always be held in the channel for our counterparty. This
15517  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
15518  * claiming at least this value on chain.
15519  *
15520  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
15521  *
15522  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
15523  */
15524 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
15525
15526 /**
15527  * Information on the fees and requirements that the counterparty requires when forwarding
15528  * payments to us through this channel.
15529  *
15530  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
15531  */
15532 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
15533
15534 /**
15535  * Information on the fees and requirements that the counterparty requires when forwarding
15536  * payments to us through this channel.
15537  *
15538  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
15539  */
15540 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
15541
15542 /**
15543  * Constructs a new ChannelCounterparty given each field
15544  */
15545 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);
15546
15547 /**
15548  * Creates a copy of the ChannelCounterparty
15549  */
15550 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
15551
15552 /**
15553  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
15554  */
15555 void ChannelDetails_free(struct LDKChannelDetails this_obj);
15556
15557 /**
15558  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
15559  * thereafter this is the txid of the funding transaction xor the funding transaction output).
15560  * Note that this means this value is *not* persistent - it can change once during the
15561  * lifetime of the channel.
15562  */
15563 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
15564
15565 /**
15566  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
15567  * thereafter this is the txid of the funding transaction xor the funding transaction output).
15568  * Note that this means this value is *not* persistent - it can change once during the
15569  * lifetime of the channel.
15570  */
15571 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15572
15573 /**
15574  * Parameters which apply to our counterparty. See individual fields for more information.
15575  */
15576 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15577
15578 /**
15579  * Parameters which apply to our counterparty. See individual fields for more information.
15580  */
15581 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
15582
15583 /**
15584  * The Channel's funding transaction output, if we've negotiated the funding transaction with
15585  * our counterparty already.
15586  *
15587  * Note that, if this has been set, `channel_id` will be equivalent to
15588  * `funding_txo.unwrap().to_channel_id()`.
15589  *
15590  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
15591  */
15592 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15593
15594 /**
15595  * The Channel's funding transaction output, if we've negotiated the funding transaction with
15596  * our counterparty already.
15597  *
15598  * Note that, if this has been set, `channel_id` will be equivalent to
15599  * `funding_txo.unwrap().to_channel_id()`.
15600  *
15601  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
15602  */
15603 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15604
15605 /**
15606  * The position of the funding transaction in the chain. None if the funding transaction has
15607  * not yet been confirmed and the channel fully opened.
15608  */
15609 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15610
15611 /**
15612  * The position of the funding transaction in the chain. None if the funding transaction has
15613  * not yet been confirmed and the channel fully opened.
15614  */
15615 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15616
15617 /**
15618  * The value, in satoshis, of this channel as appears in the funding output
15619  */
15620 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15621
15622 /**
15623  * The value, in satoshis, of this channel as appears in the funding output
15624  */
15625 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15626
15627 /**
15628  * The value, in satoshis, that must always be held in the channel for us. This value ensures
15629  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
15630  * this value on chain.
15631  *
15632  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
15633  *
15634  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15635  *
15636  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
15637  */
15638 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15639
15640 /**
15641  * The value, in satoshis, that must always be held in the channel for us. This value ensures
15642  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
15643  * this value on chain.
15644  *
15645  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
15646  *
15647  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15648  *
15649  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
15650  */
15651 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15652
15653 /**
15654  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
15655  */
15656 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15657
15658 /**
15659  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
15660  */
15661 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15662
15663 /**
15664  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
15665  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15666  * available for inclusion in new outbound HTLCs). This further does not include any pending
15667  * outgoing HTLCs which are awaiting some other resolution to be sent.
15668  *
15669  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15670  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
15671  * should be able to spend nearly this amount.
15672  */
15673 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15674
15675 /**
15676  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
15677  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15678  * available for inclusion in new outbound HTLCs). This further does not include any pending
15679  * outgoing HTLCs which are awaiting some other resolution to be sent.
15680  *
15681  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15682  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
15683  * should be able to spend nearly this amount.
15684  */
15685 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15686
15687 /**
15688  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
15689  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15690  * available for inclusion in new inbound HTLCs).
15691  * Note that there are some corner cases not fully handled here, so the actual available
15692  * inbound capacity may be slightly higher than this.
15693  *
15694  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15695  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
15696  * However, our counterparty should be able to spend nearly this amount.
15697  */
15698 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15699
15700 /**
15701  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
15702  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
15703  * available for inclusion in new inbound HTLCs).
15704  * Note that there are some corner cases not fully handled here, so the actual available
15705  * inbound capacity may be slightly higher than this.
15706  *
15707  * This value is not exact. Due to various in-flight changes, feerate changes, and our
15708  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
15709  * However, our counterparty should be able to spend nearly this amount.
15710  */
15711 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
15712
15713 /**
15714  * The number of required confirmations on the funding transaction before the funding will be
15715  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
15716  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
15717  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
15718  * [`ChannelHandshakeLimits::max_minimum_depth`].
15719  *
15720  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15721  *
15722  * [`is_outbound`]: ChannelDetails::is_outbound
15723  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
15724  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
15725  */
15726 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15727
15728 /**
15729  * The number of required confirmations on the funding transaction before the funding will be
15730  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
15731  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
15732  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
15733  * [`ChannelHandshakeLimits::max_minimum_depth`].
15734  *
15735  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15736  *
15737  * [`is_outbound`]: ChannelDetails::is_outbound
15738  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
15739  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
15740  */
15741 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
15742
15743 /**
15744  * The number of blocks (after our commitment transaction confirms) that we will need to wait
15745  * until we can claim our funds after we force-close the channel. During this time our
15746  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
15747  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
15748  * time to claim our non-HTLC-encumbered funds.
15749  *
15750  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15751  */
15752 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15753
15754 /**
15755  * The number of blocks (after our commitment transaction confirms) that we will need to wait
15756  * until we can claim our funds after we force-close the channel. During this time our
15757  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
15758  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
15759  * time to claim our non-HTLC-encumbered funds.
15760  *
15761  * This value will be `None` for outbound channels until the counterparty accepts the channel.
15762  */
15763 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
15764
15765 /**
15766  * True if the channel was initiated (and thus funded) by us.
15767  */
15768 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15769
15770 /**
15771  * True if the channel was initiated (and thus funded) by us.
15772  */
15773 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15774
15775 /**
15776  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
15777  * channel is not currently being shut down. `funding_locked` message exchange implies the
15778  * required confirmation count has been reached (and we were connected to the peer at some
15779  * point after the funding transaction received enough confirmations). The required
15780  * confirmation count is provided in [`confirmations_required`].
15781  *
15782  * [`confirmations_required`]: ChannelDetails::confirmations_required
15783  */
15784 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15785
15786 /**
15787  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
15788  * channel is not currently being shut down. `funding_locked` message exchange implies the
15789  * required confirmation count has been reached (and we were connected to the peer at some
15790  * point after the funding transaction received enough confirmations). The required
15791  * confirmation count is provided in [`confirmations_required`].
15792  *
15793  * [`confirmations_required`]: ChannelDetails::confirmations_required
15794  */
15795 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15796
15797 /**
15798  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
15799  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
15800  *
15801  * This is a strict superset of `is_funding_locked`.
15802  */
15803 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15804
15805 /**
15806  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
15807  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
15808  *
15809  * This is a strict superset of `is_funding_locked`.
15810  */
15811 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15812
15813 /**
15814  * True if this channel is (or will be) publicly-announced.
15815  */
15816 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
15817
15818 /**
15819  * True if this channel is (or will be) publicly-announced.
15820  */
15821 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
15822
15823 /**
15824  * Constructs a new ChannelDetails given each field
15825  */
15826 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t 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);
15827
15828 /**
15829  * Creates a copy of the ChannelDetails
15830  */
15831 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
15832
15833 /**
15834  * Frees any resources used by the PaymentSendFailure
15835  */
15836 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
15837
15838 /**
15839  * Creates a copy of the PaymentSendFailure
15840  */
15841 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
15842
15843 /**
15844  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
15845  */
15846 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
15847
15848 /**
15849  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
15850  */
15851 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
15852
15853 /**
15854  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
15855  */
15856 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
15857
15858 /**
15859  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
15860  */
15861 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a);
15862
15863 /**
15864  * Constructs a new ChannelManager to hold several channels and route between them.
15865  *
15866  * This is the main \"logic hub\" for all channel-related actions, and implements
15867  * ChannelMessageHandler.
15868  *
15869  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
15870  *
15871  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
15872  *
15873  * Users need to notify the new ChannelManager when a new block is connected or
15874  * disconnected using its `block_connected` and `block_disconnected` methods, starting
15875  * from after `params.latest_hash`.
15876  */
15877 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);
15878
15879 /**
15880  * Gets the current configuration applied to all new channels,  as
15881  */
15882 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
15883
15884 /**
15885  * Creates a new outbound channel to the given remote node and with the given value.
15886  *
15887  * `user_channel_id` will be provided back as in
15888  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
15889  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
15890  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
15891  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
15892  * ignored.
15893  *
15894  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
15895  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
15896  *
15897  * Note that we do not check if you are currently connected to the given peer. If no
15898  * connection is available, the outbound `open_channel` message may fail to send, resulting in
15899  * the channel eventually being silently forgotten (dropped on reload).
15900  *
15901  * Returns the new Channel's temporary `channel_id`. This ID will appear as
15902  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
15903  * [`ChannelDetails::channel_id`] until after
15904  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
15905  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
15906  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
15907  *
15908  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
15909  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
15910  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
15911  *
15912  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
15913  */
15914 MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config);
15915
15916 /**
15917  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
15918  * more information.
15919  */
15920 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15921
15922 /**
15923  * Gets the list of usable channels, in random order. Useful as an argument to
15924  * get_route to ensure non-announced channels are used.
15925  *
15926  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
15927  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
15928  * are.
15929  */
15930 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15931
15932 /**
15933  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
15934  * will be accepted on the given channel, and after additional timeout/the closing of all
15935  * pending HTLCs, the channel will be closed on chain.
15936  *
15937  *  * If we are the channel initiator, we will pay between our [`Background`] and
15938  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
15939  *    estimate.
15940  *  * If our counterparty is the channel initiator, we will require a channel closing
15941  *    transaction feerate of at least our [`Background`] feerate or the feerate which
15942  *    would appear on a force-closure transaction, whichever is lower. We will allow our
15943  *    counterparty to pay as much fee as they'd like, however.
15944  *
15945  * May generate a SendShutdown message event on success, which should be relayed.
15946  *
15947  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
15948  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15949  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15950  */
15951 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
15952
15953 /**
15954  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
15955  * will be accepted on the given channel, and after additional timeout/the closing of all
15956  * pending HTLCs, the channel will be closed on chain.
15957  *
15958  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
15959  * the channel being closed or not:
15960  *  * If we are the channel initiator, we will pay at least this feerate on the closing
15961  *    transaction. The upper-bound is set by
15962  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
15963  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
15964  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
15965  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
15966  *    will appear on a force-closure transaction, whichever is lower).
15967  *
15968  * May generate a SendShutdown message event on success, which should be relayed.
15969  *
15970  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
15971  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15972  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15973  */
15974 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);
15975
15976 /**
15977  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
15978  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
15979  */
15980 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
15981
15982 /**
15983  * Force close all channels, immediately broadcasting the latest local commitment transaction
15984  * for each to the chain and rejecting new HTLCs on each.
15985  */
15986 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
15987
15988 /**
15989  * Sends a payment along a given route.
15990  *
15991  * Value parameters are provided via the last hop in route, see documentation for RouteHop
15992  * fields for more info.
15993  *
15994  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
15995  * payment), we don't do anything to stop you! We always try to ensure that if the provided
15996  * next hop knows the preimage to payment_hash they can claim an additional amount as
15997  * specified in the last hop in the route! Thus, you should probably do your own
15998  * payment_preimage tracking (which you should already be doing as they represent \"proof of
15999  * payment\") and prevent double-sends yourself.
16000  *
16001  * May generate SendHTLCs message(s) event on success, which should be relayed.
16002  *
16003  * Each path may have a different return value, and PaymentSendValue may return a Vec with
16004  * each entry matching the corresponding-index entry in the route paths, see
16005  * PaymentSendFailure for more info.
16006  *
16007  * In general, a path may raise:
16008  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
16009  *    node public key) is specified.
16010  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
16011  *    (including due to previous monitor update failure or new permanent monitor update
16012  *    failure).
16013  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
16014  *    relevant updates.
16015  *
16016  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
16017  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
16018  * different route unless you intend to pay twice!
16019  *
16020  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
16021  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
16022  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
16023  * must not contain multiple paths as multi-path payments require a recipient-provided
16024  * payment_secret.
16025  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
16026  * bit set (either as required or as available). If multiple paths are present in the Route,
16027  * we assume the invoice had the basic_mpp feature set.
16028  *
16029  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
16030  */
16031 MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
16032
16033 /**
16034  * Retries a payment along the given [`Route`].
16035  *
16036  * Errors returned are a superset of those returned from [`send_payment`], so see
16037  * [`send_payment`] documentation for more details on errors. This method will also error if the
16038  * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
16039  * for the given `payment_id` cannot be found (likely due to timeout or success).
16040  *
16041  * [`send_payment`]: [`ChannelManager::send_payment`]
16042  */
16043 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id);
16044
16045 /**
16046  * Send a spontaneous payment, which is a payment that does not require the recipient to have
16047  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
16048  * the preimage, it must be a cryptographically secure random value that no intermediate node
16049  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
16050  * never reach the recipient.
16051  *
16052  * See [`send_payment`] documentation for more details on the return value of this function.
16053  *
16054  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
16055  * [`send_payment`] for more information about the risks of duplicate preimage usage.
16056  *
16057  * Note that `route` must have exactly one path.
16058  *
16059  * [`send_payment`]: Self::send_payment
16060  *
16061  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
16062  */
16063 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
16064
16065 /**
16066  * Call this upon creation of a funding transaction for the given channel.
16067  *
16068  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
16069  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
16070  *
16071  * Panics if a funding transaction has already been provided for this channel.
16072  *
16073  * May panic if the output found in the funding transaction is duplicative with some other
16074  * channel (note that this should be trivially prevented by using unique funding transaction
16075  * keys per-channel).
16076  *
16077  * Do NOT broadcast the funding transaction yourself. When we have safely received our
16078  * counterparty's signature the funding transaction will automatically be broadcast via the
16079  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
16080  *
16081  * Note that this includes RBF or similar transaction replacement strategies - lightning does
16082  * not currently support replacing a funding transaction on an existing channel. Instead,
16083  * create a new channel with a conflicting funding transaction.
16084  *
16085  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
16086  */
16087 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);
16088
16089 /**
16090  * Regenerates channel_announcements and generates a signed node_announcement from the given
16091  * arguments, providing them in corresponding events via
16092  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
16093  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
16094  * announcement to ensure that the lightning P2P network is aware of the channels we have and
16095  * our network addresses.
16096  *
16097  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
16098  * node to humans. They carry no in-protocol meaning.
16099  *
16100  * `addresses` represent the set (possibly empty) of socket addresses on which this node
16101  * accepts incoming connections. These will be included in the node_announcement, publicly
16102  * tying these addresses together and to this node. If you wish to preserve user privacy,
16103  * addresses should likely contain only Tor Onion addresses.
16104  *
16105  * Panics if `addresses` is absurdly large (more than 500).
16106  *
16107  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
16108  */
16109 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
16110
16111 /**
16112  * Processes HTLCs which are pending waiting on random forward delay.
16113  *
16114  * Should only really ever be called in response to a PendingHTLCsForwardable event.
16115  * Will likely generate further events.
16116  */
16117 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
16118
16119 /**
16120  * Performs actions which should happen on startup and roughly once per minute thereafter.
16121  *
16122  * This currently includes:
16123  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
16124  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
16125  *    than a minute, informing the network that they should no longer attempt to route over
16126  *    the channel.
16127  *
16128  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
16129  * estimate fetches.
16130  */
16131 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
16132
16133 /**
16134  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
16135  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
16136  * along the path (including in our own channel on which we received it).
16137  * Returns false if no payment was found to fail backwards, true if the process of failing the
16138  * HTLC backwards has been started.
16139  */
16140 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
16141
16142 /**
16143  * Provides a payment preimage in response to a PaymentReceived event, returning true and
16144  * generating message events for the net layer to claim the payment, if possible. Thus, you
16145  * should probably kick the net layer to go send messages if this returns true!
16146  *
16147  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
16148  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
16149  * event matches your expectation. If you fail to do so and call this method, you may provide
16150  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
16151  *
16152  * May panic if called except in response to a PaymentReceived event.
16153  *
16154  * [`create_inbound_payment`]: Self::create_inbound_payment
16155  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16156  */
16157 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
16158
16159 /**
16160  * Gets the node_id held by this ChannelManager
16161  */
16162 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
16163
16164 /**
16165  * Restores a single, given channel to normal operation after a
16166  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
16167  * operation.
16168  *
16169  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
16170  * fully committed in every copy of the given channels' ChannelMonitors.
16171  *
16172  * Note that there is no effect to calling with a highest_applied_update_id other than the
16173  * current latest ChannelMonitorUpdate and one call to this function after multiple
16174  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
16175  * exists largely only to prevent races between this and concurrent update_monitor calls.
16176  *
16177  * Thus, the anticipated use is, at a high level:
16178  *  1) You register a chain::Watch with this ChannelManager,
16179  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
16180  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
16181  *     any time it cannot do so instantly,
16182  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
16183  *  4) once all remote copies are updated, you call this function with the update_id that
16184  *     completed, and once it is the latest the Channel will be re-enabled.
16185  */
16186 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);
16187
16188 /**
16189  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
16190  * to pay us.
16191  *
16192  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
16193  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
16194  *
16195  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
16196  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
16197  * passed directly to [`claim_funds`].
16198  *
16199  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
16200  *
16201  * [`claim_funds`]: Self::claim_funds
16202  * [`PaymentReceived`]: events::Event::PaymentReceived
16203  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
16204  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16205  */
16206 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);
16207
16208 /**
16209  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
16210  * stored external to LDK.
16211  *
16212  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
16213  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
16214  * the `min_value_msat` provided here, if one is provided.
16215  *
16216  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
16217  * method may return an Err if another payment with the same payment_hash is still pending.
16218  *
16219  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
16220  * allow tracking of which events correspond with which calls to this and
16221  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
16222  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
16223  * with invoice metadata stored elsewhere.
16224  *
16225  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
16226  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
16227  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
16228  * sender \"proof-of-payment\" unless they have paid the required amount.
16229  *
16230  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
16231  * in excess of the current time. This should roughly match the expiry time set in the invoice.
16232  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
16233  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
16234  * invoices when no timeout is set.
16235  *
16236  * Note that we use block header time to time-out pending inbound payments (with some margin
16237  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
16238  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
16239  * If you need exact expiry semantics, you should enforce them upon receipt of
16240  * [`PaymentReceived`].
16241  *
16242  * Pending inbound payments are stored in memory and in serialized versions of this
16243  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
16244  * space is limited, you may wish to rate-limit inbound payment creation.
16245  *
16246  * May panic if `invoice_expiry_delta_secs` is greater than one year.
16247  *
16248  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
16249  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
16250  *
16251  * [`create_inbound_payment`]: Self::create_inbound_payment
16252  * [`PaymentReceived`]: events::Event::PaymentReceived
16253  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
16254  */
16255 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);
16256
16257 /**
16258  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16259  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16260  */
16261 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16262
16263 /**
16264  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
16265  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
16266  */
16267 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16268
16269 /**
16270  * Constructs a new Listen which calls the relevant methods on this_arg.
16271  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
16272  */
16273 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
16274
16275 /**
16276  * Constructs a new Confirm which calls the relevant methods on this_arg.
16277  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
16278  */
16279 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
16280
16281 /**
16282  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
16283  * indicating whether persistence is necessary. Only one listener on
16284  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16285  * up.
16286  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
16287  */
16288 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
16289
16290 /**
16291  * Blocks until ChannelManager needs to be persisted. Only one listener on
16292  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16293  * up.
16294  */
16295 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
16296
16297 /**
16298  * Gets the latest best block which was connected either via the [`chain::Listen`] or
16299  * [`chain::Confirm`] interfaces.
16300  */
16301 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
16302
16303 /**
16304  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
16305  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
16306  */
16307 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
16308
16309 /**
16310  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
16311  */
16312 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
16313
16314 /**
16315  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
16316  */
16317 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
16318
16319 /**
16320  * The keys provider which will give us relevant keys. Some keys will be loaded during
16321  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16322  * signing data.
16323  */
16324 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16325
16326 /**
16327  * The keys provider which will give us relevant keys. Some keys will be loaded during
16328  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16329  * signing data.
16330  */
16331 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
16332
16333 /**
16334  * The fee_estimator for use in the ChannelManager in the future.
16335  *
16336  * No calls to the FeeEstimator will be made during deserialization.
16337  */
16338 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16339
16340 /**
16341  * The fee_estimator for use in the ChannelManager in the future.
16342  *
16343  * No calls to the FeeEstimator will be made during deserialization.
16344  */
16345 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
16346
16347 /**
16348  * The chain::Watch for use in the ChannelManager in the future.
16349  *
16350  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16351  * you have deserialized ChannelMonitors separately and will add them to your
16352  * chain::Watch after deserializing this ChannelManager.
16353  */
16354 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16355
16356 /**
16357  * The chain::Watch for use in the ChannelManager in the future.
16358  *
16359  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16360  * you have deserialized ChannelMonitors separately and will add them to your
16361  * chain::Watch after deserializing this ChannelManager.
16362  */
16363 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
16364
16365 /**
16366  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16367  * used to broadcast the latest local commitment transactions of channels which must be
16368  * force-closed during deserialization.
16369  */
16370 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16371
16372 /**
16373  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16374  * used to broadcast the latest local commitment transactions of channels which must be
16375  * force-closed during deserialization.
16376  */
16377 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
16378
16379 /**
16380  * The Logger for use in the ChannelManager and which may be used to log information during
16381  * deserialization.
16382  */
16383 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16384
16385 /**
16386  * The Logger for use in the ChannelManager and which may be used to log information during
16387  * deserialization.
16388  */
16389 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
16390
16391 /**
16392  * Default settings used for new channels. Any existing channels will continue to use the
16393  * runtime settings which were stored when the ChannelManager was serialized.
16394  */
16395 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16396
16397 /**
16398  * Default settings used for new channels. Any existing channels will continue to use the
16399  * runtime settings which were stored when the ChannelManager was serialized.
16400  */
16401 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
16402
16403 /**
16404  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
16405  * HashMap for you. This is primarily useful for C bindings where it is not practical to
16406  * populate a HashMap directly from C.
16407  */
16408 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);
16409
16410 /**
16411  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
16412  */
16413 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
16414
16415 /**
16416  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
16417  */
16418 void DecodeError_free(struct LDKDecodeError this_obj);
16419
16420 /**
16421  * Creates a copy of the DecodeError
16422  */
16423 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
16424
16425 /**
16426  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
16427  */
16428 void Init_free(struct LDKInit this_obj);
16429
16430 /**
16431  * The relevant features which the sender supports
16432  */
16433 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
16434
16435 /**
16436  * The relevant features which the sender supports
16437  */
16438 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
16439
16440 /**
16441  * Constructs a new Init given each field
16442  */
16443 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
16444
16445 /**
16446  * Creates a copy of the Init
16447  */
16448 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
16449
16450 /**
16451  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
16452  */
16453 void ErrorMessage_free(struct LDKErrorMessage this_obj);
16454
16455 /**
16456  * The channel ID involved in the error
16457  */
16458 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
16459
16460 /**
16461  * The channel ID involved in the error
16462  */
16463 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16464
16465 /**
16466  * A possibly human-readable error description.
16467  * The string should be sanitized before it is used (e.g. emitted to logs
16468  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
16469  * vulnerability in the terminal emulator or the logging subsystem.
16470  */
16471 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
16472
16473 /**
16474  * A possibly human-readable error description.
16475  * The string should be sanitized before it is used (e.g. emitted to logs
16476  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
16477  * vulnerability in the terminal emulator or the logging subsystem.
16478  */
16479 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
16480
16481 /**
16482  * Constructs a new ErrorMessage given each field
16483  */
16484 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
16485
16486 /**
16487  * Creates a copy of the ErrorMessage
16488  */
16489 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
16490
16491 /**
16492  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
16493  */
16494 void Ping_free(struct LDKPing this_obj);
16495
16496 /**
16497  * The desired response length
16498  */
16499 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
16500
16501 /**
16502  * The desired response length
16503  */
16504 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
16505
16506 /**
16507  * The ping packet size.
16508  * This field is not sent on the wire. byteslen zeros are sent.
16509  */
16510 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
16511
16512 /**
16513  * The ping packet size.
16514  * This field is not sent on the wire. byteslen zeros are sent.
16515  */
16516 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
16517
16518 /**
16519  * Constructs a new Ping given each field
16520  */
16521 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
16522
16523 /**
16524  * Creates a copy of the Ping
16525  */
16526 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
16527
16528 /**
16529  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
16530  */
16531 void Pong_free(struct LDKPong this_obj);
16532
16533 /**
16534  * The pong packet size.
16535  * This field is not sent on the wire. byteslen zeros are sent.
16536  */
16537 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
16538
16539 /**
16540  * The pong packet size.
16541  * This field is not sent on the wire. byteslen zeros are sent.
16542  */
16543 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
16544
16545 /**
16546  * Constructs a new Pong given each field
16547  */
16548 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
16549
16550 /**
16551  * Creates a copy of the Pong
16552  */
16553 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
16554
16555 /**
16556  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
16557  */
16558 void OpenChannel_free(struct LDKOpenChannel this_obj);
16559
16560 /**
16561  * The genesis hash of the blockchain where the channel is to be opened
16562  */
16563 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
16564
16565 /**
16566  * The genesis hash of the blockchain where the channel is to be opened
16567  */
16568 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16569
16570 /**
16571  * A temporary channel ID, until the funding outpoint is announced
16572  */
16573 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
16574
16575 /**
16576  * A temporary channel ID, until the funding outpoint is announced
16577  */
16578 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16579
16580 /**
16581  * The channel value
16582  */
16583 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16584
16585 /**
16586  * The channel value
16587  */
16588 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16589
16590 /**
16591  * The amount to push to the counterparty as part of the open, in milli-satoshi
16592  */
16593 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16594
16595 /**
16596  * The amount to push to the counterparty as part of the open, in milli-satoshi
16597  */
16598 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16599
16600 /**
16601  * The threshold below which outputs on transactions broadcast by sender will be omitted
16602  */
16603 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16604
16605 /**
16606  * The threshold below which outputs on transactions broadcast by sender will be omitted
16607  */
16608 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16609
16610 /**
16611  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16612  */
16613 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16614
16615 /**
16616  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16617  */
16618 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16619
16620 /**
16621  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16622  */
16623 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16624
16625 /**
16626  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16627  */
16628 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16629
16630 /**
16631  * The minimum HTLC size incoming to sender, in milli-satoshi
16632  */
16633 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16634
16635 /**
16636  * The minimum HTLC size incoming to sender, in milli-satoshi
16637  */
16638 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
16639
16640 /**
16641  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
16642  */
16643 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16644
16645 /**
16646  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
16647  */
16648 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
16649
16650 /**
16651  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16652  */
16653 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16654
16655 /**
16656  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16657  */
16658 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
16659
16660 /**
16661  * The maximum number of inbound HTLCs towards sender
16662  */
16663 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16664
16665 /**
16666  * The maximum number of inbound HTLCs towards sender
16667  */
16668 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
16669
16670 /**
16671  * The sender's key controlling the funding transaction
16672  */
16673 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16674
16675 /**
16676  * The sender's key controlling the funding transaction
16677  */
16678 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16679
16680 /**
16681  * Used to derive a revocation key for transactions broadcast by counterparty
16682  */
16683 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16684
16685 /**
16686  * Used to derive a revocation key for transactions broadcast by counterparty
16687  */
16688 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16689
16690 /**
16691  * A payment key to sender for transactions broadcast by counterparty
16692  */
16693 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16694
16695 /**
16696  * A payment key to sender for transactions broadcast by counterparty
16697  */
16698 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16699
16700 /**
16701  * Used to derive a payment key to sender for transactions broadcast by sender
16702  */
16703 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16704
16705 /**
16706  * Used to derive a payment key to sender for transactions broadcast by sender
16707  */
16708 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16709
16710 /**
16711  * Used to derive an HTLC payment key to sender
16712  */
16713 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16714
16715 /**
16716  * Used to derive an HTLC payment key to sender
16717  */
16718 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16719
16720 /**
16721  * The first to-be-broadcast-by-sender transaction's per commitment point
16722  */
16723 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16724
16725 /**
16726  * The first to-be-broadcast-by-sender transaction's per commitment point
16727  */
16728 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16729
16730 /**
16731  * Channel flags
16732  */
16733 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
16734
16735 /**
16736  * Channel flags
16737  */
16738 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
16739
16740 /**
16741  * Creates a copy of the OpenChannel
16742  */
16743 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
16744
16745 /**
16746  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
16747  */
16748 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
16749
16750 /**
16751  * A temporary channel ID, until the funding outpoint is announced
16752  */
16753 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
16754
16755 /**
16756  * A temporary channel ID, until the funding outpoint is announced
16757  */
16758 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16759
16760 /**
16761  * The threshold below which outputs on transactions broadcast by sender will be omitted
16762  */
16763 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16764
16765 /**
16766  * The threshold below which outputs on transactions broadcast by sender will be omitted
16767  */
16768 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16769
16770 /**
16771  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16772  */
16773 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16774
16775 /**
16776  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
16777  */
16778 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16779
16780 /**
16781  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16782  */
16783 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16784
16785 /**
16786  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
16787  */
16788 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16789
16790 /**
16791  * The minimum HTLC size incoming to sender, in milli-satoshi
16792  */
16793 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16794
16795 /**
16796  * The minimum HTLC size incoming to sender, in milli-satoshi
16797  */
16798 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
16799
16800 /**
16801  * Minimum depth of the funding transaction before the channel is considered open
16802  */
16803 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16804
16805 /**
16806  * Minimum depth of the funding transaction before the channel is considered open
16807  */
16808 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
16809
16810 /**
16811  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16812  */
16813 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16814
16815 /**
16816  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
16817  */
16818 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
16819
16820 /**
16821  * The maximum number of inbound HTLCs towards sender
16822  */
16823 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16824
16825 /**
16826  * The maximum number of inbound HTLCs towards sender
16827  */
16828 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
16829
16830 /**
16831  * The sender's key controlling the funding transaction
16832  */
16833 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16834
16835 /**
16836  * The sender's key controlling the funding transaction
16837  */
16838 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16839
16840 /**
16841  * Used to derive a revocation key for transactions broadcast by counterparty
16842  */
16843 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16844
16845 /**
16846  * Used to derive a revocation key for transactions broadcast by counterparty
16847  */
16848 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16849
16850 /**
16851  * A payment key to sender for transactions broadcast by counterparty
16852  */
16853 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16854
16855 /**
16856  * A payment key to sender for transactions broadcast by counterparty
16857  */
16858 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16859
16860 /**
16861  * Used to derive a payment key to sender for transactions broadcast by sender
16862  */
16863 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16864
16865 /**
16866  * Used to derive a payment key to sender for transactions broadcast by sender
16867  */
16868 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16869
16870 /**
16871  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
16872  */
16873 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16874
16875 /**
16876  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
16877  */
16878 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16879
16880 /**
16881  * The first to-be-broadcast-by-sender transaction's per commitment point
16882  */
16883 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
16884
16885 /**
16886  * The first to-be-broadcast-by-sender transaction's per commitment point
16887  */
16888 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16889
16890 /**
16891  * Creates a copy of the AcceptChannel
16892  */
16893 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
16894
16895 /**
16896  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
16897  */
16898 void FundingCreated_free(struct LDKFundingCreated this_obj);
16899
16900 /**
16901  * A temporary channel ID, until the funding is established
16902  */
16903 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
16904
16905 /**
16906  * A temporary channel ID, until the funding is established
16907  */
16908 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16909
16910 /**
16911  * The funding transaction ID
16912  */
16913 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
16914
16915 /**
16916  * The funding transaction ID
16917  */
16918 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16919
16920 /**
16921  * The specific output index funding this channel
16922  */
16923 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
16924
16925 /**
16926  * The specific output index funding this channel
16927  */
16928 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
16929
16930 /**
16931  * The signature of the channel initiator (funder) on the initial commitment transaction
16932  */
16933 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
16934
16935 /**
16936  * The signature of the channel initiator (funder) on the initial commitment transaction
16937  */
16938 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
16939
16940 /**
16941  * Constructs a new FundingCreated given each field
16942  */
16943 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);
16944
16945 /**
16946  * Creates a copy of the FundingCreated
16947  */
16948 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
16949
16950 /**
16951  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
16952  */
16953 void FundingSigned_free(struct LDKFundingSigned this_obj);
16954
16955 /**
16956  * The channel ID
16957  */
16958 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
16959
16960 /**
16961  * The channel ID
16962  */
16963 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16964
16965 /**
16966  * The signature of the channel acceptor (fundee) on the initial commitment transaction
16967  */
16968 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
16969
16970 /**
16971  * The signature of the channel acceptor (fundee) on the initial commitment transaction
16972  */
16973 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
16974
16975 /**
16976  * Constructs a new FundingSigned given each field
16977  */
16978 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
16979
16980 /**
16981  * Creates a copy of the FundingSigned
16982  */
16983 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
16984
16985 /**
16986  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
16987  */
16988 void FundingLocked_free(struct LDKFundingLocked this_obj);
16989
16990 /**
16991  * The channel ID
16992  */
16993 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
16994
16995 /**
16996  * The channel ID
16997  */
16998 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16999
17000 /**
17001  * The per-commitment point of the second commitment transaction
17002  */
17003 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
17004
17005 /**
17006  * The per-commitment point of the second commitment transaction
17007  */
17008 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17009
17010 /**
17011  * Constructs a new FundingLocked given each field
17012  */
17013 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
17014
17015 /**
17016  * Creates a copy of the FundingLocked
17017  */
17018 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
17019
17020 /**
17021  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
17022  */
17023 void Shutdown_free(struct LDKShutdown this_obj);
17024
17025 /**
17026  * The channel ID
17027  */
17028 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
17029
17030 /**
17031  * The channel ID
17032  */
17033 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17034
17035 /**
17036  * The destination of this peer's funds on closing.
17037  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17038  */
17039 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
17040
17041 /**
17042  * The destination of this peer's funds on closing.
17043  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17044  */
17045 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17046
17047 /**
17048  * Constructs a new Shutdown given each field
17049  */
17050 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
17051
17052 /**
17053  * Creates a copy of the Shutdown
17054  */
17055 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
17056
17057 /**
17058  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
17059  */
17060 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
17061
17062 /**
17063  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17064  * transaction.
17065  */
17066 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17067
17068 /**
17069  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17070  * transaction.
17071  */
17072 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17073
17074 /**
17075  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17076  * transaction.
17077  */
17078 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17079
17080 /**
17081  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17082  * transaction.
17083  */
17084 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17085
17086 /**
17087  * Constructs a new ClosingSignedFeeRange given each field
17088  */
17089 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
17090
17091 /**
17092  * Creates a copy of the ClosingSignedFeeRange
17093  */
17094 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
17095
17096 /**
17097  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
17098  */
17099 void ClosingSigned_free(struct LDKClosingSigned this_obj);
17100
17101 /**
17102  * The channel ID
17103  */
17104 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
17105
17106 /**
17107  * The channel ID
17108  */
17109 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17110
17111 /**
17112  * The proposed total fee for the closing transaction
17113  */
17114 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17115
17116 /**
17117  * The proposed total fee for the closing transaction
17118  */
17119 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
17120
17121 /**
17122  * A signature on the closing transaction
17123  */
17124 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17125
17126 /**
17127  * A signature on the closing transaction
17128  */
17129 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17130
17131 /**
17132  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17133  * nodes.
17134  *
17135  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17136  */
17137 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17138
17139 /**
17140  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17141  * nodes.
17142  *
17143  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17144  */
17145 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
17146
17147 /**
17148  * Constructs a new ClosingSigned given each field
17149  */
17150 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);
17151
17152 /**
17153  * Creates a copy of the ClosingSigned
17154  */
17155 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
17156
17157 /**
17158  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
17159  */
17160 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
17161
17162 /**
17163  * The channel ID
17164  */
17165 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17166
17167 /**
17168  * The channel ID
17169  */
17170 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17171
17172 /**
17173  * The HTLC ID
17174  */
17175 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17176
17177 /**
17178  * The HTLC ID
17179  */
17180 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17181
17182 /**
17183  * The HTLC value in milli-satoshi
17184  */
17185 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17186
17187 /**
17188  * The HTLC value in milli-satoshi
17189  */
17190 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17191
17192 /**
17193  * The payment hash, the pre-image of which controls HTLC redemption
17194  */
17195 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17196
17197 /**
17198  * The payment hash, the pre-image of which controls HTLC redemption
17199  */
17200 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17201
17202 /**
17203  * The expiry height of the HTLC
17204  */
17205 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17206
17207 /**
17208  * The expiry height of the HTLC
17209  */
17210 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
17211
17212 /**
17213  * Creates a copy of the UpdateAddHTLC
17214  */
17215 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
17216
17217 /**
17218  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
17219  */
17220 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
17221
17222 /**
17223  * The channel ID
17224  */
17225 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17226
17227 /**
17228  * The channel ID
17229  */
17230 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17231
17232 /**
17233  * The HTLC ID
17234  */
17235 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
17236
17237 /**
17238  * The HTLC ID
17239  */
17240 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
17241
17242 /**
17243  * The pre-image of the payment hash, allowing HTLC redemption
17244  */
17245 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17246
17247 /**
17248  * The pre-image of the payment hash, allowing HTLC redemption
17249  */
17250 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17251
17252 /**
17253  * Constructs a new UpdateFulfillHTLC given each field
17254  */
17255 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
17256
17257 /**
17258  * Creates a copy of the UpdateFulfillHTLC
17259  */
17260 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
17261
17262 /**
17263  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
17264  */
17265 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
17266
17267 /**
17268  * The channel ID
17269  */
17270 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
17271
17272 /**
17273  * The channel ID
17274  */
17275 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17276
17277 /**
17278  * The HTLC ID
17279  */
17280 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
17281
17282 /**
17283  * The HTLC ID
17284  */
17285 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
17286
17287 /**
17288  * Creates a copy of the UpdateFailHTLC
17289  */
17290 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
17291
17292 /**
17293  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
17294  */
17295 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
17296
17297 /**
17298  * The channel ID
17299  */
17300 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
17301
17302 /**
17303  * The channel ID
17304  */
17305 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17306
17307 /**
17308  * The HTLC ID
17309  */
17310 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17311
17312 /**
17313  * The HTLC ID
17314  */
17315 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
17316
17317 /**
17318  * The failure code
17319  */
17320 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17321
17322 /**
17323  * The failure code
17324  */
17325 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
17326
17327 /**
17328  * Creates a copy of the UpdateFailMalformedHTLC
17329  */
17330 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
17331
17332 /**
17333  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
17334  */
17335 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
17336
17337 /**
17338  * The channel ID
17339  */
17340 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
17341
17342 /**
17343  * The channel ID
17344  */
17345 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17346
17347 /**
17348  * A signature on the commitment transaction
17349  */
17350 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
17351
17352 /**
17353  * A signature on the commitment transaction
17354  */
17355 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17356
17357 /**
17358  * Signatures on the HTLC transactions
17359  */
17360 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
17361
17362 /**
17363  * Constructs a new CommitmentSigned given each field
17364  */
17365 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
17366
17367 /**
17368  * Creates a copy of the CommitmentSigned
17369  */
17370 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
17371
17372 /**
17373  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
17374  */
17375 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
17376
17377 /**
17378  * The channel ID
17379  */
17380 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
17381
17382 /**
17383  * The channel ID
17384  */
17385 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17386
17387 /**
17388  * The secret corresponding to the per-commitment point
17389  */
17390 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
17391
17392 /**
17393  * The secret corresponding to the per-commitment point
17394  */
17395 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17396
17397 /**
17398  * The next sender-broadcast commitment transaction's per-commitment point
17399  */
17400 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
17401
17402 /**
17403  * The next sender-broadcast commitment transaction's per-commitment point
17404  */
17405 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17406
17407 /**
17408  * Constructs a new RevokeAndACK given each field
17409  */
17410 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);
17411
17412 /**
17413  * Creates a copy of the RevokeAndACK
17414  */
17415 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
17416
17417 /**
17418  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
17419  */
17420 void UpdateFee_free(struct LDKUpdateFee this_obj);
17421
17422 /**
17423  * The channel ID
17424  */
17425 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
17426
17427 /**
17428  * The channel ID
17429  */
17430 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17431
17432 /**
17433  * Fee rate per 1000-weight of the transaction
17434  */
17435 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
17436
17437 /**
17438  * Fee rate per 1000-weight of the transaction
17439  */
17440 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
17441
17442 /**
17443  * Constructs a new UpdateFee given each field
17444  */
17445 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
17446
17447 /**
17448  * Creates a copy of the UpdateFee
17449  */
17450 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
17451
17452 /**
17453  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
17454  */
17455 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
17456
17457 /**
17458  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
17459  * belonging to the recipient
17460  */
17461 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
17462
17463 /**
17464  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
17465  * belonging to the recipient
17466  */
17467 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17468
17469 /**
17470  * The sender's per-commitment point for their current commitment transaction
17471  */
17472 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
17473
17474 /**
17475  * The sender's per-commitment point for their current commitment transaction
17476  */
17477 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17478
17479 /**
17480  * Constructs a new DataLossProtect given each field
17481  */
17482 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
17483
17484 /**
17485  * Creates a copy of the DataLossProtect
17486  */
17487 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
17488
17489 /**
17490  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
17491  */
17492 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
17493
17494 /**
17495  * The channel ID
17496  */
17497 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
17498
17499 /**
17500  * The channel ID
17501  */
17502 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17503
17504 /**
17505  * The next commitment number for the sender
17506  */
17507 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
17508
17509 /**
17510  * The next commitment number for the sender
17511  */
17512 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
17513
17514 /**
17515  * The next commitment number for the recipient
17516  */
17517 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
17518
17519 /**
17520  * The next commitment number for the recipient
17521  */
17522 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
17523
17524 /**
17525  * Creates a copy of the ChannelReestablish
17526  */
17527 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
17528
17529 /**
17530  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
17531  */
17532 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
17533
17534 /**
17535  * The channel ID
17536  */
17537 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
17538
17539 /**
17540  * The channel ID
17541  */
17542 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17543
17544 /**
17545  * The short channel ID
17546  */
17547 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
17548
17549 /**
17550  * The short channel ID
17551  */
17552 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
17553
17554 /**
17555  * A signature by the node key
17556  */
17557 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
17558
17559 /**
17560  * A signature by the node key
17561  */
17562 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
17563
17564 /**
17565  * A signature by the funding key
17566  */
17567 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
17568
17569 /**
17570  * A signature by the funding key
17571  */
17572 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
17573
17574 /**
17575  * Constructs a new AnnouncementSignatures given each field
17576  */
17577 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);
17578
17579 /**
17580  * Creates a copy of the AnnouncementSignatures
17581  */
17582 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
17583
17584 /**
17585  * Frees any resources used by the NetAddress
17586  */
17587 void NetAddress_free(struct LDKNetAddress this_ptr);
17588
17589 /**
17590  * Creates a copy of the NetAddress
17591  */
17592 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
17593
17594 /**
17595  * Utility method to constructs a new IPv4-variant NetAddress
17596  */
17597 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
17598
17599 /**
17600  * Utility method to constructs a new IPv6-variant NetAddress
17601  */
17602 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
17603
17604 /**
17605  * Utility method to constructs a new OnionV2-variant NetAddress
17606  */
17607 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
17608
17609 /**
17610  * Utility method to constructs a new OnionV3-variant NetAddress
17611  */
17612 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
17613
17614 /**
17615  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
17616  */
17617 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
17618
17619 /**
17620  * Read a Result from a byte array, created by Result_write
17621  */
17622 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
17623
17624 /**
17625  * Read a NetAddress from a byte array, created by NetAddress_write
17626  */
17627 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
17628
17629 /**
17630  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
17631  */
17632 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
17633
17634 /**
17635  * The advertised features
17636  */
17637 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17638
17639 /**
17640  * The advertised features
17641  */
17642 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17643
17644 /**
17645  * A strictly monotonic announcement counter, with gaps allowed
17646  */
17647 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17648
17649 /**
17650  * A strictly monotonic announcement counter, with gaps allowed
17651  */
17652 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
17653
17654 /**
17655  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
17656  * to this node).
17657  */
17658 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
17659
17660 /**
17661  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
17662  * to this node).
17663  */
17664 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17665
17666 /**
17667  * An RGB color for UI purposes
17668  */
17669 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
17670
17671 /**
17672  * An RGB color for UI purposes
17673  */
17674 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17675
17676 /**
17677  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
17678  * of uniqueness.
17679  */
17680 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
17681
17682 /**
17683  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
17684  * of uniqueness.
17685  */
17686 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17687
17688 /**
17689  * List of addresses on which this node is reachable
17690  */
17691 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17692
17693 /**
17694  * Creates a copy of the UnsignedNodeAnnouncement
17695  */
17696 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
17697
17698 /**
17699  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
17700  */
17701 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
17702
17703 /**
17704  * The signature by the node key
17705  */
17706 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
17707
17708 /**
17709  * The signature by the node key
17710  */
17711 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17712
17713 /**
17714  * The actual content of the announcement
17715  */
17716 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
17717
17718 /**
17719  * The actual content of the announcement
17720  */
17721 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
17722
17723 /**
17724  * Constructs a new NodeAnnouncement given each field
17725  */
17726 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
17727
17728 /**
17729  * Creates a copy of the NodeAnnouncement
17730  */
17731 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
17732
17733 /**
17734  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
17735  */
17736 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
17737
17738 /**
17739  * The advertised channel features
17740  */
17741 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17742
17743 /**
17744  * The advertised channel features
17745  */
17746 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17747
17748 /**
17749  * The genesis hash of the blockchain where the channel is to be opened
17750  */
17751 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
17752
17753 /**
17754  * The genesis hash of the blockchain where the channel is to be opened
17755  */
17756 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17757
17758 /**
17759  * The short channel ID
17760  */
17761 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17762
17763 /**
17764  * The short channel ID
17765  */
17766 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
17767
17768 /**
17769  * One of the two node_ids which are endpoints of this channel
17770  */
17771 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17772
17773 /**
17774  * One of the two node_ids which are endpoints of this channel
17775  */
17776 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17777
17778 /**
17779  * The other of the two node_ids which are endpoints of this channel
17780  */
17781 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17782
17783 /**
17784  * The other of the two node_ids which are endpoints of this channel
17785  */
17786 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17787
17788 /**
17789  * The funding key for the first node
17790  */
17791 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17792
17793 /**
17794  * The funding key for the first node
17795  */
17796 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17797
17798 /**
17799  * The funding key for the second node
17800  */
17801 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
17802
17803 /**
17804  * The funding key for the second node
17805  */
17806 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17807
17808 /**
17809  * Creates a copy of the UnsignedChannelAnnouncement
17810  */
17811 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
17812
17813 /**
17814  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
17815  */
17816 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
17817
17818 /**
17819  * Authentication of the announcement by the first public node
17820  */
17821 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17822
17823 /**
17824  * Authentication of the announcement by the first public node
17825  */
17826 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17827
17828 /**
17829  * Authentication of the announcement by the second public node
17830  */
17831 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17832
17833 /**
17834  * Authentication of the announcement by the second public node
17835  */
17836 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17837
17838 /**
17839  * Proof of funding UTXO ownership by the first public node
17840  */
17841 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17842
17843 /**
17844  * Proof of funding UTXO ownership by the first public node
17845  */
17846 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17847
17848 /**
17849  * Proof of funding UTXO ownership by the second public node
17850  */
17851 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17852
17853 /**
17854  * Proof of funding UTXO ownership by the second public node
17855  */
17856 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
17857
17858 /**
17859  * The actual announcement
17860  */
17861 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
17862
17863 /**
17864  * The actual announcement
17865  */
17866 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
17867
17868 /**
17869  * Constructs a new ChannelAnnouncement given each field
17870  */
17871 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);
17872
17873 /**
17874  * Creates a copy of the ChannelAnnouncement
17875  */
17876 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
17877
17878 /**
17879  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
17880  */
17881 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
17882
17883 /**
17884  * The genesis hash of the blockchain where the channel is to be opened
17885  */
17886 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
17887
17888 /**
17889  * The genesis hash of the blockchain where the channel is to be opened
17890  */
17891 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17892
17893 /**
17894  * The short channel ID
17895  */
17896 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17897
17898 /**
17899  * The short channel ID
17900  */
17901 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
17902
17903 /**
17904  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
17905  */
17906 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17907
17908 /**
17909  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
17910  */
17911 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17912
17913 /**
17914  * Channel flags
17915  */
17916 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17917
17918 /**
17919  * Channel flags
17920  */
17921 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
17922
17923 /**
17924  * The number of blocks such that if:
17925  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
17926  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
17927  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
17928  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
17929  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
17930  * forwarding. Note that the HTLC sender is the one who originally sets this value when
17931  * constructing the route.
17932  */
17933 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17934
17935 /**
17936  * The number of blocks such that if:
17937  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
17938  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
17939  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
17940  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
17941  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
17942  * forwarding. Note that the HTLC sender is the one who originally sets this value when
17943  * constructing the route.
17944  */
17945 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
17946
17947 /**
17948  * The minimum HTLC size incoming to sender, in milli-satoshi
17949  */
17950 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17951
17952 /**
17953  * The minimum HTLC size incoming to sender, in milli-satoshi
17954  */
17955 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
17956
17957 /**
17958  * The base HTLC fee charged by sender, in milli-satoshi
17959  */
17960 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17961
17962 /**
17963  * The base HTLC fee charged by sender, in milli-satoshi
17964  */
17965 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17966
17967 /**
17968  * The amount to fee multiplier, in micro-satoshi
17969  */
17970 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
17971
17972 /**
17973  * The amount to fee multiplier, in micro-satoshi
17974  */
17975 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
17976
17977 /**
17978  * Creates a copy of the UnsignedChannelUpdate
17979  */
17980 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
17981
17982 /**
17983  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
17984  */
17985 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
17986
17987 /**
17988  * A signature of the channel update
17989  */
17990 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
17991
17992 /**
17993  * A signature of the channel update
17994  */
17995 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
17996
17997 /**
17998  * The actual channel update
17999  */
18000 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
18001
18002 /**
18003  * The actual channel update
18004  */
18005 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
18006
18007 /**
18008  * Constructs a new ChannelUpdate given each field
18009  */
18010 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
18011
18012 /**
18013  * Creates a copy of the ChannelUpdate
18014  */
18015 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
18016
18017 /**
18018  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
18019  */
18020 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
18021
18022 /**
18023  * The genesis hash of the blockchain being queried
18024  */
18025 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
18026
18027 /**
18028  * The genesis hash of the blockchain being queried
18029  */
18030 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18031
18032 /**
18033  * The height of the first block for the channel UTXOs being queried
18034  */
18035 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18036
18037 /**
18038  * The height of the first block for the channel UTXOs being queried
18039  */
18040 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18041
18042 /**
18043  * The number of blocks to include in the query results
18044  */
18045 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18046
18047 /**
18048  * The number of blocks to include in the query results
18049  */
18050 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18051
18052 /**
18053  * Constructs a new QueryChannelRange given each field
18054  */
18055 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
18056
18057 /**
18058  * Creates a copy of the QueryChannelRange
18059  */
18060 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
18061
18062 /**
18063  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
18064  */
18065 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
18066
18067 /**
18068  * The genesis hash of the blockchain being queried
18069  */
18070 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
18071
18072 /**
18073  * The genesis hash of the blockchain being queried
18074  */
18075 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18076
18077 /**
18078  * The height of the first block in the range of the reply
18079  */
18080 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18081
18082 /**
18083  * The height of the first block in the range of the reply
18084  */
18085 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18086
18087 /**
18088  * The number of blocks included in the range of the reply
18089  */
18090 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18091
18092 /**
18093  * The number of blocks included in the range of the reply
18094  */
18095 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18096
18097 /**
18098  * True when this is the final reply for a query
18099  */
18100 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18101
18102 /**
18103  * True when this is the final reply for a query
18104  */
18105 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
18106
18107 /**
18108  * The short_channel_ids in the channel range
18109  */
18110 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18111
18112 /**
18113  * Constructs a new ReplyChannelRange given each field
18114  */
18115 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);
18116
18117 /**
18118  * Creates a copy of the ReplyChannelRange
18119  */
18120 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
18121
18122 /**
18123  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
18124  */
18125 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
18126
18127 /**
18128  * The genesis hash of the blockchain being queried
18129  */
18130 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
18131
18132 /**
18133  * The genesis hash of the blockchain being queried
18134  */
18135 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18136
18137 /**
18138  * The short_channel_ids that are being queried
18139  */
18140 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18141
18142 /**
18143  * Constructs a new QueryShortChannelIds given each field
18144  */
18145 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
18146
18147 /**
18148  * Creates a copy of the QueryShortChannelIds
18149  */
18150 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
18151
18152 /**
18153  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
18154  */
18155 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
18156
18157 /**
18158  * The genesis hash of the blockchain that was queried
18159  */
18160 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
18161
18162 /**
18163  * The genesis hash of the blockchain that was queried
18164  */
18165 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18166
18167 /**
18168  * Indicates if the query recipient maintains up-to-date channel
18169  * information for the chain_hash
18170  */
18171 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
18172
18173 /**
18174  * Indicates if the query recipient maintains up-to-date channel
18175  * information for the chain_hash
18176  */
18177 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
18178
18179 /**
18180  * Constructs a new ReplyShortChannelIdsEnd given each field
18181  */
18182 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
18183
18184 /**
18185  * Creates a copy of the ReplyShortChannelIdsEnd
18186  */
18187 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
18188
18189 /**
18190  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
18191  */
18192 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
18193
18194 /**
18195  * The genesis hash of the blockchain for channel and node information
18196  */
18197 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
18198
18199 /**
18200  * The genesis hash of the blockchain for channel and node information
18201  */
18202 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18203
18204 /**
18205  * The starting unix timestamp
18206  */
18207 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18208
18209 /**
18210  * The starting unix timestamp
18211  */
18212 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18213
18214 /**
18215  * The range of information in seconds
18216  */
18217 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18218
18219 /**
18220  * The range of information in seconds
18221  */
18222 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18223
18224 /**
18225  * Constructs a new GossipTimestampFilter given each field
18226  */
18227 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
18228
18229 /**
18230  * Creates a copy of the GossipTimestampFilter
18231  */
18232 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
18233
18234 /**
18235  * Frees any resources used by the ErrorAction
18236  */
18237 void ErrorAction_free(struct LDKErrorAction this_ptr);
18238
18239 /**
18240  * Creates a copy of the ErrorAction
18241  */
18242 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
18243
18244 /**
18245  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
18246  */
18247 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
18248
18249 /**
18250  * Utility method to constructs a new IgnoreError-variant ErrorAction
18251  */
18252 struct LDKErrorAction ErrorAction_ignore_error(void);
18253
18254 /**
18255  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
18256  */
18257 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
18258
18259 /**
18260  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
18261  */
18262 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
18263
18264 /**
18265  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
18266  */
18267 void LightningError_free(struct LDKLightningError this_obj);
18268
18269 /**
18270  * A human-readable message describing the error
18271  */
18272 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
18273
18274 /**
18275  * A human-readable message describing the error
18276  */
18277 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
18278
18279 /**
18280  * The action which should be taken against the offending peer.
18281  */
18282 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
18283
18284 /**
18285  * The action which should be taken against the offending peer.
18286  */
18287 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
18288
18289 /**
18290  * Constructs a new LightningError given each field
18291  */
18292 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
18293
18294 /**
18295  * Creates a copy of the LightningError
18296  */
18297 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
18298
18299 /**
18300  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
18301  */
18302 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
18303
18304 /**
18305  * update_add_htlc messages which should be sent
18306  */
18307 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18308
18309 /**
18310  * update_add_htlc messages which should be sent
18311  */
18312 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
18313
18314 /**
18315  * update_fulfill_htlc messages which should be sent
18316  */
18317 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18318
18319 /**
18320  * update_fulfill_htlc messages which should be sent
18321  */
18322 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
18323
18324 /**
18325  * update_fail_htlc messages which should be sent
18326  */
18327 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18328
18329 /**
18330  * update_fail_htlc messages which should be sent
18331  */
18332 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
18333
18334 /**
18335  * update_fail_malformed_htlc messages which should be sent
18336  */
18337 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18338
18339 /**
18340  * update_fail_malformed_htlc messages which should be sent
18341  */
18342 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
18343
18344 /**
18345  * An update_fee message which should be sent
18346  *
18347  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18348  */
18349 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18350
18351 /**
18352  * An update_fee message which should be sent
18353  *
18354  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18355  */
18356 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
18357
18358 /**
18359  * Finally, the commitment_signed message which should be sent
18360  */
18361 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18362
18363 /**
18364  * Finally, the commitment_signed message which should be sent
18365  */
18366 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
18367
18368 /**
18369  * Constructs a new CommitmentUpdate given each field
18370  */
18371 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);
18372
18373 /**
18374  * Creates a copy of the CommitmentUpdate
18375  */
18376 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
18377
18378 /**
18379  * Calls the free function if one is set
18380  */
18381 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
18382
18383 /**
18384  * Calls the free function if one is set
18385  */
18386 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
18387
18388 /**
18389  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
18390  */
18391 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
18392
18393 /**
18394  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
18395  */
18396 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
18397
18398 /**
18399  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
18400  */
18401 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
18402
18403 /**
18404  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
18405  */
18406 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
18407
18408 /**
18409  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
18410  */
18411 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
18412
18413 /**
18414  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
18415  */
18416 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
18417
18418 /**
18419  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
18420  */
18421 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
18422
18423 /**
18424  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
18425  */
18426 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
18427
18428 /**
18429  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
18430  */
18431 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
18432
18433 /**
18434  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
18435  */
18436 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
18437
18438 /**
18439  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
18440  */
18441 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
18442
18443 /**
18444  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
18445  */
18446 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
18447
18448 /**
18449  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
18450  */
18451 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
18452
18453 /**
18454  * Read a FundingCreated from a byte array, created by FundingCreated_write
18455  */
18456 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
18457
18458 /**
18459  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
18460  */
18461 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
18462
18463 /**
18464  * Read a FundingSigned from a byte array, created by FundingSigned_write
18465  */
18466 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
18467
18468 /**
18469  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
18470  */
18471 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
18472
18473 /**
18474  * Read a FundingLocked from a byte array, created by FundingLocked_write
18475  */
18476 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
18477
18478 /**
18479  * Serialize the Init object into a byte array which can be read by Init_read
18480  */
18481 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
18482
18483 /**
18484  * Read a Init from a byte array, created by Init_write
18485  */
18486 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
18487
18488 /**
18489  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
18490  */
18491 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
18492
18493 /**
18494  * Read a OpenChannel from a byte array, created by OpenChannel_write
18495  */
18496 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
18497
18498 /**
18499  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
18500  */
18501 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
18502
18503 /**
18504  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
18505  */
18506 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
18507
18508 /**
18509  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
18510  */
18511 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
18512
18513 /**
18514  * Read a Shutdown from a byte array, created by Shutdown_write
18515  */
18516 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
18517
18518 /**
18519  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
18520  */
18521 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
18522
18523 /**
18524  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
18525  */
18526 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
18527
18528 /**
18529  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
18530  */
18531 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
18532
18533 /**
18534  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
18535  */
18536 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
18537
18538 /**
18539  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
18540  */
18541 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
18542
18543 /**
18544  * Read a UpdateFee from a byte array, created by UpdateFee_write
18545  */
18546 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
18547
18548 /**
18549  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
18550  */
18551 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
18552
18553 /**
18554  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
18555  */
18556 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
18557
18558 /**
18559  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
18560  */
18561 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
18562
18563 /**
18564  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
18565  */
18566 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
18567
18568 /**
18569  * Serialize the Ping object into a byte array which can be read by Ping_read
18570  */
18571 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
18572
18573 /**
18574  * Read a Ping from a byte array, created by Ping_write
18575  */
18576 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
18577
18578 /**
18579  * Serialize the Pong object into a byte array which can be read by Pong_read
18580  */
18581 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
18582
18583 /**
18584  * Read a Pong from a byte array, created by Pong_write
18585  */
18586 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
18587
18588 /**
18589  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
18590  */
18591 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
18592
18593 /**
18594  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
18595  */
18596 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
18597
18598 /**
18599  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
18600  */
18601 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
18602
18603 /**
18604  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
18605  */
18606 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
18607
18608 /**
18609  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
18610  */
18611 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
18612
18613 /**
18614  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
18615  */
18616 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
18617
18618 /**
18619  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
18620  */
18621 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
18622
18623 /**
18624  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
18625  */
18626 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
18627
18628 /**
18629  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
18630  */
18631 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
18632
18633 /**
18634  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
18635  */
18636 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
18637
18638 /**
18639  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
18640  */
18641 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
18642
18643 /**
18644  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
18645  */
18646 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
18647
18648 /**
18649  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
18650  */
18651 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
18652
18653 /**
18654  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
18655  */
18656 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
18657
18658 /**
18659  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
18660  */
18661 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
18662
18663 /**
18664  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
18665  */
18666 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
18667
18668 /**
18669  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
18670  */
18671 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
18672
18673 /**
18674  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
18675  */
18676 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
18677
18678 /**
18679  *\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
18680  */
18681 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
18682
18683 /**
18684  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
18685  */
18686 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
18687
18688 /**
18689  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
18690  */
18691 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
18692
18693 /**
18694  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
18695  */
18696 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
18697
18698 /**
18699  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
18700  */
18701 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
18702
18703 /**
18704  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
18705  */
18706 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
18707
18708 /**
18709  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
18710  */
18711 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
18712
18713 /**
18714  * Calls the free function if one is set
18715  */
18716 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
18717
18718 /**
18719  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
18720  */
18721 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
18722
18723 /**
18724  * Constructs a new IgnoringMessageHandler given each field
18725  */
18726 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
18727
18728 /**
18729  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18730  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18731  */
18732 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18733
18734 /**
18735  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
18736  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
18737  */
18738 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18739
18740 /**
18741  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
18742  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
18743  */
18744 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18745
18746 /**
18747  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
18748  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
18749  */
18750 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
18751
18752 /**
18753  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
18754  */
18755 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
18756
18757 /**
18758  * Constructs a new ErroringMessageHandler
18759  */
18760 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
18761
18762 /**
18763  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18764  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18765  */
18766 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
18767
18768 /**
18769  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
18770  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
18771  */
18772 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
18773
18774 /**
18775  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
18776  */
18777 void MessageHandler_free(struct LDKMessageHandler this_obj);
18778
18779 /**
18780  * A message handler which handles messages specific to channels. Usually this is just a
18781  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
18782  *
18783  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18784  */
18785 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
18786
18787 /**
18788  * A message handler which handles messages specific to channels. Usually this is just a
18789  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
18790  *
18791  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18792  */
18793 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
18794
18795 /**
18796  * A message handler which handles messages updating our knowledge of the network channel
18797  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
18798  * [`IgnoringMessageHandler`].
18799  *
18800  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
18801  */
18802 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
18803
18804 /**
18805  * A message handler which handles messages updating our knowledge of the network channel
18806  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
18807  * [`IgnoringMessageHandler`].
18808  *
18809  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
18810  */
18811 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
18812
18813 /**
18814  * Constructs a new MessageHandler given each field
18815  */
18816 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
18817
18818 /**
18819  * Creates a copy of a SocketDescriptor
18820  */
18821 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
18822
18823 /**
18824  * Calls the free function if one is set
18825  */
18826 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
18827
18828 /**
18829  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
18830  */
18831 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
18832
18833 /**
18834  * Used to indicate that we probably can't make any future connections to this peer, implying
18835  * we should go ahead and force-close any channels we have with it.
18836  */
18837 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
18838
18839 /**
18840  * Used to indicate that we probably can't make any future connections to this peer, implying
18841  * we should go ahead and force-close any channels we have with it.
18842  */
18843 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
18844
18845 /**
18846  * Constructs a new PeerHandleError given each field
18847  */
18848 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
18849
18850 /**
18851  * Creates a copy of the PeerHandleError
18852  */
18853 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
18854
18855 /**
18856  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
18857  */
18858 void PeerManager_free(struct LDKPeerManager this_obj);
18859
18860 /**
18861  * Constructs a new PeerManager with the given message handlers and node_id secret key
18862  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
18863  * cryptographically secure random bytes.
18864  */
18865 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);
18866
18867 /**
18868  * Get the list of node ids for peers which have completed the initial handshake.
18869  *
18870  * For outbound connections, this will be the same as the their_node_id parameter passed in to
18871  * new_outbound_connection, however entries will only appear once the initial handshake has
18872  * completed and we are sure the remote peer has the private key for the given node_id.
18873  */
18874 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
18875
18876 /**
18877  * Indicates a new outbound connection has been established to a node with the given node_id.
18878  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
18879  * descriptor but must disconnect the connection immediately.
18880  *
18881  * Returns a small number of bytes to send to the remote node (currently always 50).
18882  *
18883  * Panics if descriptor is duplicative with some other descriptor which has not yet been
18884  * [`socket_disconnected()`].
18885  *
18886  * [`socket_disconnected()`]: PeerManager::socket_disconnected
18887  */
18888 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);
18889
18890 /**
18891  * Indicates a new inbound connection has been established.
18892  *
18893  * May refuse the connection by returning an Err, but will never write bytes to the remote end
18894  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
18895  * call socket_disconnected for the new descriptor but must disconnect the connection
18896  * immediately.
18897  *
18898  * Panics if descriptor is duplicative with some other descriptor which has not yet been
18899  * [`socket_disconnected()`].
18900  *
18901  * [`socket_disconnected()`]: PeerManager::socket_disconnected
18902  */
18903 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
18904
18905 /**
18906  * Indicates that there is room to write data to the given socket descriptor.
18907  *
18908  * May return an Err to indicate that the connection should be closed.
18909  *
18910  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
18911  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
18912  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
18913  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
18914  * sufficient!
18915  *
18916  * [`send_data`]: SocketDescriptor::send_data
18917  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
18918  */
18919 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
18920
18921 /**
18922  * Indicates that data was read from the given socket descriptor.
18923  *
18924  * May return an Err to indicate that the connection should be closed.
18925  *
18926  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
18927  * Thus, however, you should call [`process_events`] after any `read_event` to generate
18928  * [`send_data`] calls to handle responses.
18929  *
18930  * If `Ok(true)` is returned, further read_events should not be triggered until a
18931  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
18932  * send buffer).
18933  *
18934  * [`send_data`]: SocketDescriptor::send_data
18935  * [`process_events`]: PeerManager::process_events
18936  */
18937 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);
18938
18939 /**
18940  * Checks for any events generated by our handlers and processes them. Includes sending most
18941  * response messages as well as messages generated by calls to handler functions directly (eg
18942  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
18943  *
18944  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
18945  * issues!
18946  *
18947  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
18948  * or one of the other clients provided in our language bindings.
18949  *
18950  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18951  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
18952  * [`send_data`]: SocketDescriptor::send_data
18953  */
18954 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
18955
18956 /**
18957  * Indicates that the given socket descriptor's connection is now closed.
18958  */
18959 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
18960
18961 /**
18962  * Disconnect a peer given its node id.
18963  *
18964  * Set `no_connection_possible` to true to prevent any further connection with this peer,
18965  * force-closing any channels we have with it.
18966  *
18967  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
18968  * peer. Thus, be very careful about reentrancy issues.
18969  *
18970  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
18971  */
18972 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
18973
18974 /**
18975  * Send pings to each peer and disconnect those which did not respond to the last round of
18976  * pings.
18977  *
18978  * This may be called on any timescale you want, however, roughly once every five to ten
18979  * seconds is preferred. The call rate determines both how often we send a ping to our peers
18980  * and how much time they have to respond before we disconnect them.
18981  *
18982  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
18983  * issues!
18984  *
18985  * [`send_data`]: SocketDescriptor::send_data
18986  */
18987 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
18988
18989 /**
18990  * Build the commitment secret from the seed and the commitment number
18991  */
18992 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
18993
18994 /**
18995  * Build a closing transaction
18996  */
18997 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);
18998
18999 /**
19000  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
19001  * from the base secret and the per_commitment_point.
19002  *
19003  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19004  * generated (ie our own).
19005  */
19006 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
19007
19008 /**
19009  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
19010  * from the base point and the per_commitment_key. This is the public equivalent of
19011  * derive_private_key - using only public keys to derive a public key instead of private keys.
19012  *
19013  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19014  * generated (ie our own).
19015  */
19016 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
19017
19018 /**
19019  * Derives a per-commitment-transaction revocation key from its constituent parts.
19020  *
19021  * Only the cheating participant owns a valid witness to propagate a revoked
19022  * commitment transaction, thus per_commitment_secret always come from cheater
19023  * and revocation_base_secret always come from punisher, which is the broadcaster
19024  * of the transaction spending with this key knowledge.
19025  *
19026  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19027  * generated (ie our own).
19028  */
19029 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
19030
19031 /**
19032  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
19033  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
19034  * public key instead of private keys.
19035  *
19036  * Only the cheating participant owns a valid witness to propagate a revoked
19037  * commitment transaction, thus per_commitment_point always come from cheater
19038  * and revocation_base_point always come from punisher, which is the broadcaster
19039  * of the transaction spending with this key knowledge.
19040  *
19041  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19042  * generated (ie our own).
19043  */
19044 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
19045
19046 /**
19047  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
19048  */
19049 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
19050
19051 /**
19052  * The broadcaster's per-commitment public key which was used to derive the other keys.
19053  */
19054 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19055
19056 /**
19057  * The broadcaster's per-commitment public key which was used to derive the other keys.
19058  */
19059 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19060
19061 /**
19062  * The revocation key which is used to allow the broadcaster of the commitment
19063  * transaction to provide their counterparty the ability to punish them if they broadcast
19064  * an old state.
19065  */
19066 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19067
19068 /**
19069  * The revocation key which is used to allow the broadcaster of the commitment
19070  * transaction to provide their counterparty the ability to punish them if they broadcast
19071  * an old state.
19072  */
19073 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19074
19075 /**
19076  * Broadcaster's HTLC Key
19077  */
19078 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19079
19080 /**
19081  * Broadcaster's HTLC Key
19082  */
19083 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19084
19085 /**
19086  * Countersignatory's HTLC Key
19087  */
19088 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19089
19090 /**
19091  * Countersignatory's HTLC Key
19092  */
19093 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19094
19095 /**
19096  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19097  */
19098 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19099
19100 /**
19101  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19102  */
19103 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19104
19105 /**
19106  * Constructs a new TxCreationKeys given each field
19107  */
19108 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);
19109
19110 /**
19111  * Creates a copy of the TxCreationKeys
19112  */
19113 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
19114
19115 /**
19116  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
19117  */
19118 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
19119
19120 /**
19121  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
19122  */
19123 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
19124
19125 /**
19126  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
19127  */
19128 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
19129
19130 /**
19131  * The public key which is used to sign all commitment transactions, as it appears in the
19132  * on-chain channel lock-in 2-of-2 multisig output.
19133  */
19134 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19135
19136 /**
19137  * The public key which is used to sign all commitment transactions, as it appears in the
19138  * on-chain channel lock-in 2-of-2 multisig output.
19139  */
19140 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19141
19142 /**
19143  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19144  * revocation keys. This is combined with the per-commitment-secret generated by the
19145  * counterparty to create a secret which the counterparty can reveal to revoke previous
19146  * states.
19147  */
19148 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19149
19150 /**
19151  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19152  * revocation keys. This is combined with the per-commitment-secret generated by the
19153  * counterparty to create a secret which the counterparty can reveal to revoke previous
19154  * states.
19155  */
19156 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19157
19158 /**
19159  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19160  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19161  * static across every commitment transaction.
19162  */
19163 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19164
19165 /**
19166  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19167  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19168  * static across every commitment transaction.
19169  */
19170 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19171
19172 /**
19173  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19174  * public key which receives non-HTLC-encumbered funds which are only available for spending
19175  * after some delay (or can be claimed via the revocation path).
19176  */
19177 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19178
19179 /**
19180  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19181  * public key which receives non-HTLC-encumbered funds which are only available for spending
19182  * after some delay (or can be claimed via the revocation path).
19183  */
19184 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19185
19186 /**
19187  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19188  * which is used to encumber HTLC-in-flight outputs.
19189  */
19190 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19191
19192 /**
19193  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19194  * which is used to encumber HTLC-in-flight outputs.
19195  */
19196 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19197
19198 /**
19199  * Constructs a new ChannelPublicKeys given each field
19200  */
19201 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);
19202
19203 /**
19204  * Creates a copy of the ChannelPublicKeys
19205  */
19206 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
19207
19208 /**
19209  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
19210  */
19211 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
19212
19213 /**
19214  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
19215  */
19216 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
19217
19218 /**
19219  * Create per-state keys from channel base points and the per-commitment point.
19220  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19221  */
19222 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);
19223
19224 /**
19225  * Generate per-state keys from channel static keys.
19226  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19227  */
19228 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);
19229
19230 /**
19231  * A script either spendable by the revocation
19232  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
19233  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
19234  */
19235 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
19236
19237 /**
19238  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
19239  */
19240 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
19241
19242 /**
19243  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19244  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19245  * need to compare this value to whether the commitment transaction in question is that of
19246  * the counterparty or our own.
19247  */
19248 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19249
19250 /**
19251  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19252  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19253  * need to compare this value to whether the commitment transaction in question is that of
19254  * the counterparty or our own.
19255  */
19256 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
19257
19258 /**
19259  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19260  * this divided by 1000.
19261  */
19262 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19263
19264 /**
19265  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19266  * this divided by 1000.
19267  */
19268 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
19269
19270 /**
19271  * The CLTV lock-time at which this HTLC expires.
19272  */
19273 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19274
19275 /**
19276  * The CLTV lock-time at which this HTLC expires.
19277  */
19278 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
19279
19280 /**
19281  * The hash of the preimage which unlocks this HTLC.
19282  */
19283 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
19284
19285 /**
19286  * The hash of the preimage which unlocks this HTLC.
19287  */
19288 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19289
19290 /**
19291  * The position within the commitment transactions' outputs. This may be None if the value is
19292  * below the dust limit (in which case no output appears in the commitment transaction and the
19293  * value is spent to additional transaction fees).
19294  */
19295 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19296
19297 /**
19298  * The position within the commitment transactions' outputs. This may be None if the value is
19299  * below the dust limit (in which case no output appears in the commitment transaction and the
19300  * value is spent to additional transaction fees).
19301  */
19302 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19303
19304 /**
19305  * Constructs a new HTLCOutputInCommitment given each field
19306  */
19307 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);
19308
19309 /**
19310  * Creates a copy of the HTLCOutputInCommitment
19311  */
19312 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
19313
19314 /**
19315  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
19316  */
19317 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
19318
19319 /**
19320  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
19321  */
19322 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
19323
19324 /**
19325  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
19326  * does not need to have its previous_output_index filled.
19327  */
19328 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
19329
19330 /**
19331  * Gets the redeemscript for a funding output from the two funding public keys.
19332  * Note that the order of funding public keys does not matter.
19333  */
19334 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
19335
19336 /**
19337  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
19338  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
19339  * transaction which needs signing, and can be used to construct an HTLC transaction which is
19340  * broadcastable given a counterparty HTLC signature.
19341  *
19342  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
19343  * commitment transaction).
19344  */
19345 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);
19346
19347 /**
19348  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19349  */
19350 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
19351
19352 /**
19353  * Holder public keys
19354  */
19355 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19356
19357 /**
19358  * Holder public keys
19359  */
19360 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
19361
19362 /**
19363  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19364  */
19365 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19366
19367 /**
19368  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19369  */
19370 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
19371
19372 /**
19373  * Whether the holder is the initiator of this channel.
19374  * This is an input to the commitment number obscure factor computation.
19375  */
19376 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19377
19378 /**
19379  * Whether the holder is the initiator of this channel.
19380  * This is an input to the commitment number obscure factor computation.
19381  */
19382 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
19383
19384 /**
19385  * The late-bound counterparty channel transaction parameters.
19386  * These parameters are populated at the point in the protocol where the counterparty provides them.
19387  *
19388  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19389  */
19390 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19391
19392 /**
19393  * The late-bound counterparty channel transaction parameters.
19394  * These parameters are populated at the point in the protocol where the counterparty provides them.
19395  *
19396  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19397  */
19398 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
19399
19400 /**
19401  * The late-bound funding outpoint
19402  *
19403  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19404  */
19405 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19406
19407 /**
19408  * The late-bound funding outpoint
19409  *
19410  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19411  */
19412 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19413
19414 /**
19415  * Constructs a new ChannelTransactionParameters given each field
19416  */
19417 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);
19418
19419 /**
19420  * Creates a copy of the ChannelTransactionParameters
19421  */
19422 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
19423
19424 /**
19425  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19426  */
19427 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
19428
19429 /**
19430  * Counter-party public keys
19431  */
19432 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
19433
19434 /**
19435  * Counter-party public keys
19436  */
19437 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
19438
19439 /**
19440  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
19441  */
19442 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
19443
19444 /**
19445  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
19446  */
19447 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
19448
19449 /**
19450  * Constructs a new CounterpartyChannelTransactionParameters given each field
19451  */
19452 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
19453
19454 /**
19455  * Creates a copy of the CounterpartyChannelTransactionParameters
19456  */
19457 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
19458
19459 /**
19460  * Whether the late bound parameters are populated.
19461  */
19462 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
19463
19464 /**
19465  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
19466  * given that the holder is the broadcaster.
19467  *
19468  * self.is_populated() must be true before calling this function.
19469  */
19470 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
19471
19472 /**
19473  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
19474  * given that the counterparty is the broadcaster.
19475  *
19476  * self.is_populated() must be true before calling this function.
19477  */
19478 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
19479
19480 /**
19481  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
19482  */
19483 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
19484
19485 /**
19486  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
19487  */
19488 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
19489
19490 /**
19491  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
19492  */
19493 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
19494
19495 /**
19496  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
19497  */
19498 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
19499
19500 /**
19501  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19502  */
19503 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
19504
19505 /**
19506  * Get the channel pubkeys for the broadcaster
19507  */
19508 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
19509
19510 /**
19511  * Get the channel pubkeys for the countersignatory
19512  */
19513 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
19514
19515 /**
19516  * Get the contest delay applicable to the transactions.
19517  * Note that the contest delay was selected by the countersignatory.
19518  */
19519 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
19520
19521 /**
19522  * Whether the channel is outbound from the broadcaster.
19523  *
19524  * The boolean representing the side that initiated the channel is
19525  * an input to the commitment number obscure factor computation.
19526  */
19527 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
19528
19529 /**
19530  * The funding outpoint
19531  */
19532 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
19533
19534 /**
19535  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
19536  */
19537 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
19538
19539 /**
19540  * Our counterparty's signature for the transaction
19541  */
19542 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
19543
19544 /**
19545  * Our counterparty's signature for the transaction
19546  */
19547 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
19548
19549 /**
19550  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
19551  */
19552 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
19553
19554 /**
19555  * Creates a copy of the HolderCommitmentTransaction
19556  */
19557 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
19558
19559 /**
19560  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
19561  */
19562 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
19563
19564 /**
19565  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
19566  */
19567 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
19568
19569 /**
19570  * Create a new holder transaction with the given counterparty signatures.
19571  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
19572  */
19573 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);
19574
19575 /**
19576  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
19577  */
19578 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
19579
19580 /**
19581  * The commitment transaction
19582  */
19583 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
19584
19585 /**
19586  * The commitment transaction
19587  */
19588 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
19589
19590 /**
19591  * The txid for the commitment transaction.
19592  *
19593  * This is provided as a performance optimization, instead of calling transaction.txid()
19594  * multiple times.
19595  */
19596 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
19597
19598 /**
19599  * The txid for the commitment transaction.
19600  *
19601  * This is provided as a performance optimization, instead of calling transaction.txid()
19602  * multiple times.
19603  */
19604 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19605
19606 /**
19607  * Constructs a new BuiltCommitmentTransaction given each field
19608  */
19609 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
19610
19611 /**
19612  * Creates a copy of the BuiltCommitmentTransaction
19613  */
19614 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
19615
19616 /**
19617  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
19618  */
19619 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
19620
19621 /**
19622  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
19623  */
19624 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
19625
19626 /**
19627  * Get the SIGHASH_ALL sighash value of the transaction.
19628  *
19629  * This can be used to verify a signature.
19630  */
19631 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);
19632
19633 /**
19634  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
19635  * because we are about to broadcast a holder transaction.
19636  */
19637 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);
19638
19639 /**
19640  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
19641  */
19642 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
19643
19644 /**
19645  * Construct an object of the class
19646  */
19647 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);
19648
19649 /**
19650  * Trust our pre-built transaction.
19651  *
19652  * Applies a wrapper which allows access to the transaction.
19653  *
19654  * This should only be used if you fully trust the builder of this object. It should not
19655  * be used by an external signer - instead use the verify function.
19656  */
19657 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19658
19659 /**
19660  * Verify our pre-built transaction.
19661  *
19662  * Applies a wrapper which allows access to the transaction.
19663  *
19664  * An external validating signer must call this method before signing
19665  * or using the built transaction.
19666  */
19667 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
19668
19669 /**
19670  * The value to be sent to the holder, or zero if the output will be omitted
19671  */
19672 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19673
19674 /**
19675  * The value to be sent to the counterparty, or zero if the output will be omitted
19676  */
19677 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19678
19679 /**
19680  * The destination of the holder's output
19681  */
19682 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19683
19684 /**
19685  * The destination of the counterparty's output
19686  */
19687 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
19688
19689 /**
19690  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
19691  */
19692 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
19693
19694 /**
19695  * The pre-built Bitcoin commitment transaction
19696  */
19697 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
19698
19699 /**
19700  * Get the SIGHASH_ALL sighash value of the transaction.
19701  *
19702  * This can be used to verify a signature.
19703  */
19704 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);
19705
19706 /**
19707  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
19708  * because we are about to broadcast a holder transaction.
19709  */
19710 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);
19711
19712 /**
19713  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
19714  */
19715 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
19716
19717 /**
19718  * Creates a copy of the CommitmentTransaction
19719  */
19720 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
19721
19722 /**
19723  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
19724  */
19725 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
19726
19727 /**
19728  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
19729  */
19730 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
19731
19732 /**
19733  * The backwards-counting commitment number
19734  */
19735 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19736
19737 /**
19738  * The value to be sent to the broadcaster
19739  */
19740 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19741
19742 /**
19743  * The value to be sent to the counterparty
19744  */
19745 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19746
19747 /**
19748  * The feerate paid per 1000-weight-unit in this commitment transaction.
19749  */
19750 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19751
19752 /**
19753  * Trust our pre-built transaction and derived transaction creation public keys.
19754  *
19755  * Applies a wrapper which allows access to these fields.
19756  *
19757  * This should only be used if you fully trust the builder of this object.  It should not
19758  * be used by an external signer - instead use the verify function.
19759  */
19760 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
19761
19762 /**
19763  * Verify our pre-built transaction and derived transaction creation public keys.
19764  *
19765  * Applies a wrapper which allows access to these fields.
19766  *
19767  * An external validating signer must call this method before signing
19768  * or using the built transaction.
19769  */
19770 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);
19771
19772 /**
19773  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
19774  */
19775 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
19776
19777 /**
19778  * The transaction ID of the built Bitcoin transaction
19779  */
19780 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19781
19782 /**
19783  * The pre-built Bitcoin commitment transaction
19784  */
19785 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19786
19787 /**
19788  * The pre-calculated transaction creation public keys.
19789  */
19790 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
19791
19792 /**
19793  * Get a signature for each HTLC which was included in the commitment transaction (ie for
19794  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
19795  *
19796  * The returned Vec has one entry for each HTLC, and in the same order.
19797  */
19798 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);
19799
19800 /**
19801  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
19802  * shared secret first. This prevents on-chain observers from discovering how many commitment
19803  * transactions occurred in a channel before it was closed.
19804  *
19805  * This function gets the shared secret from relevant channel public keys and can be used to
19806  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
19807  */
19808 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
19809
19810 /**
19811  * Checks if two InitFeaturess contain equal inner contents.
19812  * This ignores pointers and is_owned flags and looks at the values in fields.
19813  * Two objects with NULL inner values will be considered "equal" here.
19814  */
19815 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
19816
19817 /**
19818  * Checks if two NodeFeaturess contain equal inner contents.
19819  * This ignores pointers and is_owned flags and looks at the values in fields.
19820  * Two objects with NULL inner values will be considered "equal" here.
19821  */
19822 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
19823
19824 /**
19825  * Checks if two ChannelFeaturess contain equal inner contents.
19826  * This ignores pointers and is_owned flags and looks at the values in fields.
19827  * Two objects with NULL inner values will be considered "equal" here.
19828  */
19829 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
19830
19831 /**
19832  * Checks if two InvoiceFeaturess contain equal inner contents.
19833  * This ignores pointers and is_owned flags and looks at the values in fields.
19834  * Two objects with NULL inner values will be considered "equal" here.
19835  */
19836 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
19837
19838 /**
19839  * Creates a copy of the InitFeatures
19840  */
19841 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
19842
19843 /**
19844  * Creates a copy of the NodeFeatures
19845  */
19846 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
19847
19848 /**
19849  * Creates a copy of the ChannelFeatures
19850  */
19851 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
19852
19853 /**
19854  * Creates a copy of the InvoiceFeatures
19855  */
19856 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
19857
19858 /**
19859  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
19860  */
19861 void InitFeatures_free(struct LDKInitFeatures this_obj);
19862
19863 /**
19864  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
19865  */
19866 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
19867
19868 /**
19869  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
19870  */
19871 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
19872
19873 /**
19874  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
19875  */
19876 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
19877
19878 /**
19879  * Create a blank Features with no features set
19880  */
19881 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
19882
19883 /**
19884  * Creates a Features with the bits set which are known by the implementation
19885  */
19886 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
19887
19888 /**
19889  * Returns true if this `Features` object contains unknown feature flags which are set as
19890  * \"required\".
19891  */
19892 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
19893
19894 /**
19895  * Create a blank Features with no features set
19896  */
19897 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
19898
19899 /**
19900  * Creates a Features with the bits set which are known by the implementation
19901  */
19902 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
19903
19904 /**
19905  * Returns true if this `Features` object contains unknown feature flags which are set as
19906  * \"required\".
19907  */
19908 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
19909
19910 /**
19911  * Create a blank Features with no features set
19912  */
19913 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
19914
19915 /**
19916  * Creates a Features with the bits set which are known by the implementation
19917  */
19918 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
19919
19920 /**
19921  * Returns true if this `Features` object contains unknown feature flags which are set as
19922  * \"required\".
19923  */
19924 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
19925
19926 /**
19927  * Create a blank Features with no features set
19928  */
19929 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
19930
19931 /**
19932  * Creates a Features with the bits set which are known by the implementation
19933  */
19934 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
19935
19936 /**
19937  * Returns true if this `Features` object contains unknown feature flags which are set as
19938  * \"required\".
19939  */
19940 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
19941
19942 /**
19943  * Returns whether the `payment_secret` feature is supported.
19944  */
19945 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
19946
19947 /**
19948  * Returns whether the `payment_secret` feature is supported.
19949  */
19950 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
19951
19952 /**
19953  * Returns whether the `payment_secret` feature is supported.
19954  */
19955 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
19956
19957 /**
19958  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
19959  */
19960 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
19961
19962 /**
19963  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
19964  */
19965 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
19966
19967 /**
19968  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
19969  */
19970 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
19971
19972 /**
19973  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
19974  */
19975 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
19976
19977 /**
19978  * Read a InitFeatures from a byte array, created by InitFeatures_write
19979  */
19980 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
19981
19982 /**
19983  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
19984  */
19985 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
19986
19987 /**
19988  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
19989  */
19990 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
19991
19992 /**
19993  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
19994  */
19995 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
19996
19997 /**
19998  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
19999  */
20000 void ShutdownScript_free(struct LDKShutdownScript this_obj);
20001
20002 /**
20003  * Creates a copy of the ShutdownScript
20004  */
20005 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
20006
20007 /**
20008  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
20009  */
20010 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
20011
20012 /**
20013  * The script that did not meet the requirements from [BOLT #2].
20014  *
20015  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20016  */
20017 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
20018
20019 /**
20020  * The script that did not meet the requirements from [BOLT #2].
20021  *
20022  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20023  */
20024 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20025
20026 /**
20027  * Constructs a new InvalidShutdownScript given each field
20028  */
20029 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
20030
20031 /**
20032  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
20033  */
20034 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
20035
20036 /**
20037  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
20038  */
20039 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
20040
20041 /**
20042  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
20043  */
20044 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
20045
20046 /**
20047  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
20048  */
20049 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
20050
20051 /**
20052  * Generates a witness script pubkey from the given segwit version and program.
20053  *
20054  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
20055  * [`ShutdownScript::new_p2wsh`] instead.
20056  *
20057  * # Errors
20058  *
20059  * This function may return an error if `program` is invalid for the segwit `version`.
20060  */
20061 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
20062
20063 /**
20064  * Converts the shutdown script into the underlying [`Script`].
20065  */
20066 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
20067
20068 /**
20069  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
20070  *
20071  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20072  */
20073 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
20074
20075 /**
20076  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
20077  *
20078  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
20079  */
20080 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
20081
20082 /**
20083  * Calls the free function if one is set
20084  */
20085 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
20086
20087 /**
20088  * Calls the free function if one is set
20089  */
20090 void Type_free(struct LDKType this_ptr);
20091
20092 /**
20093  * Calls the free function if one is set
20094  */
20095 void Score_free(struct LDKScore this_ptr);
20096
20097 /**
20098  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
20099  */
20100 void NodeId_free(struct LDKNodeId this_obj);
20101
20102 /**
20103  * Creates a copy of the NodeId
20104  */
20105 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
20106
20107 /**
20108  * Create a new NodeId from a public key
20109  */
20110 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
20111
20112 /**
20113  * Get the public key slice from this NodeId
20114  */
20115 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
20116
20117 /**
20118  * Checks if two NodeIds contain equal inner contents.
20119  */
20120 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
20121
20122 /**
20123  * Serialize the NodeId object into a byte array which can be read by NodeId_read
20124  */
20125 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
20126
20127 /**
20128  * Read a NodeId from a byte array, created by NodeId_write
20129  */
20130 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
20131
20132 /**
20133  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
20134  */
20135 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
20136
20137 /**
20138  * Creates a copy of the NetworkGraph
20139  */
20140 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
20141
20142 /**
20143  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
20144  */
20145 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
20146
20147 /**
20148  * Frees any resources used by the NetworkUpdate
20149  */
20150 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
20151
20152 /**
20153  * Creates a copy of the NetworkUpdate
20154  */
20155 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
20156
20157 /**
20158  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
20159  */
20160 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
20161
20162 /**
20163  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
20164  */
20165 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
20166
20167 /**
20168  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
20169  */
20170 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
20171
20172 /**
20173  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
20174  */
20175 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
20176
20177 /**
20178  * Constructs a new EventHandler which calls the relevant methods on this_arg.
20179  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
20180  */
20181 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20182
20183 /**
20184  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
20185  */
20186 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
20187
20188 /**
20189  * Representation of the payment channel network
20190  */
20191 struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
20192
20193 /**
20194  * Representation of the payment channel network
20195  */
20196 void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
20197
20198 /**
20199  * Creates a new tracker of the actual state of the network of channels and nodes,
20200  * assuming an existing Network Graph.
20201  * Chain monitor is used to make sure announced channels exist on-chain,
20202  * channel data is correct, and that the announcement is signed with
20203  * channel owners' keys.
20204  */
20205 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
20206
20207 /**
20208  * Adds a provider used to check new announcements. Does not affect
20209  * existing announcements unless they are updated.
20210  * Add, update or remove the provider would replace the current one.
20211  */
20212 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
20213
20214 /**
20215  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
20216  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
20217  */
20218 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20219
20220 /**
20221  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20222  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20223  */
20224 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20225
20226 /**
20227  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
20228  */
20229 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
20230
20231 /**
20232  * When the last update to the channel direction was issued.
20233  * Value is opaque, as set in the announcement.
20234  */
20235 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20236
20237 /**
20238  * When the last update to the channel direction was issued.
20239  * Value is opaque, as set in the announcement.
20240  */
20241 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
20242
20243 /**
20244  * Whether the channel can be currently used for payments (in this one direction).
20245  */
20246 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20247
20248 /**
20249  * Whether the channel can be currently used for payments (in this one direction).
20250  */
20251 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
20252
20253 /**
20254  * The difference in CLTV values that you must have when routing through this channel.
20255  */
20256 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20257
20258 /**
20259  * The difference in CLTV values that you must have when routing through this channel.
20260  */
20261 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
20262
20263 /**
20264  * The minimum value, which must be relayed to the next hop via the channel
20265  */
20266 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20267
20268 /**
20269  * The minimum value, which must be relayed to the next hop via the channel
20270  */
20271 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
20272
20273 /**
20274  * The maximum value which may be relayed to the next hop via the channel.
20275  */
20276 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20277
20278 /**
20279  * The maximum value which may be relayed to the next hop via the channel.
20280  */
20281 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20282
20283 /**
20284  * Fees charged when the channel is used for routing
20285  */
20286 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20287
20288 /**
20289  * Fees charged when the channel is used for routing
20290  */
20291 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20292
20293 /**
20294  * Most recent update for the channel received from the network
20295  * Mostly redundant with the data we store in fields explicitly.
20296  * Everything else is useful only for sending out for initial routing sync.
20297  * Not stored if contains excess data to prevent DoS.
20298  *
20299  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20300  */
20301 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20302
20303 /**
20304  * Most recent update for the channel received from the network
20305  * Mostly redundant with the data we store in fields explicitly.
20306  * Everything else is useful only for sending out for initial routing sync.
20307  * Not stored if contains excess data to prevent DoS.
20308  *
20309  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20310  */
20311 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
20312
20313 /**
20314  * Constructs a new DirectionalChannelInfo given each field
20315  */
20316 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);
20317
20318 /**
20319  * Creates a copy of the DirectionalChannelInfo
20320  */
20321 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
20322
20323 /**
20324  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
20325  */
20326 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
20327
20328 /**
20329  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
20330  */
20331 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
20332
20333 /**
20334  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
20335  */
20336 void ChannelInfo_free(struct LDKChannelInfo this_obj);
20337
20338 /**
20339  * Protocol features of a channel communicated during its announcement
20340  */
20341 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20342
20343 /**
20344  * Protocol features of a channel communicated during its announcement
20345  */
20346 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
20347
20348 /**
20349  * Source node of the first direction of a channel
20350  */
20351 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20352
20353 /**
20354  * Source node of the first direction of a channel
20355  */
20356 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
20357
20358 /**
20359  * Details about the first direction of a channel
20360  *
20361  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20362  */
20363 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20364
20365 /**
20366  * Details about the first direction of a channel
20367  *
20368  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20369  */
20370 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20371
20372 /**
20373  * Source node of the second direction of a channel
20374  */
20375 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20376
20377 /**
20378  * Source node of the second direction of a channel
20379  */
20380 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
20381
20382 /**
20383  * Details about the second direction of a channel
20384  *
20385  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20386  */
20387 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20388
20389 /**
20390  * Details about the second direction of a channel
20391  *
20392  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20393  */
20394 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20395
20396 /**
20397  * The channel capacity as seen on-chain, if chain lookup is available.
20398  */
20399 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20400
20401 /**
20402  * The channel capacity as seen on-chain, if chain lookup is available.
20403  */
20404 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20405
20406 /**
20407  * An initial announcement of the channel
20408  * Mostly redundant with the data we store in fields explicitly.
20409  * Everything else is useful only for sending out for initial routing sync.
20410  * Not stored if contains excess data to prevent DoS.
20411  *
20412  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20413  */
20414 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20415
20416 /**
20417  * An initial announcement of the channel
20418  * Mostly redundant with the data we store in fields explicitly.
20419  * Everything else is useful only for sending out for initial routing sync.
20420  * Not stored if contains excess data to prevent DoS.
20421  *
20422  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20423  */
20424 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
20425
20426 /**
20427  * Constructs a new ChannelInfo given each field
20428  */
20429 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
20430
20431 /**
20432  * Creates a copy of the ChannelInfo
20433  */
20434 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
20435
20436 /**
20437  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
20438  */
20439 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
20440
20441 /**
20442  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
20443  */
20444 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
20445
20446 /**
20447  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
20448  */
20449 void RoutingFees_free(struct LDKRoutingFees this_obj);
20450
20451 /**
20452  * Flat routing fee in satoshis
20453  */
20454 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20455
20456 /**
20457  * Flat routing fee in satoshis
20458  */
20459 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20460
20461 /**
20462  * Liquidity-based routing fee in millionths of a routed amount.
20463  * In other words, 10000 is 1%.
20464  */
20465 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20466
20467 /**
20468  * Liquidity-based routing fee in millionths of a routed amount.
20469  * In other words, 10000 is 1%.
20470  */
20471 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20472
20473 /**
20474  * Constructs a new RoutingFees given each field
20475  */
20476 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
20477
20478 /**
20479  * Checks if two RoutingFeess contain equal inner contents.
20480  * This ignores pointers and is_owned flags and looks at the values in fields.
20481  * Two objects with NULL inner values will be considered "equal" here.
20482  */
20483 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
20484
20485 /**
20486  * Creates a copy of the RoutingFees
20487  */
20488 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
20489
20490 /**
20491  * Checks if two RoutingFeess contain equal inner contents.
20492  */
20493 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
20494
20495 /**
20496  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
20497  */
20498 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
20499
20500 /**
20501  * Read a RoutingFees from a byte array, created by RoutingFees_write
20502  */
20503 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
20504
20505 /**
20506  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
20507  */
20508 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
20509
20510 /**
20511  * Protocol features the node announced support for
20512  */
20513 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20514
20515 /**
20516  * Protocol features the node announced support for
20517  */
20518 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
20519
20520 /**
20521  * When the last known update to the node state was issued.
20522  * Value is opaque, as set in the announcement.
20523  */
20524 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20525
20526 /**
20527  * When the last known update to the node state was issued.
20528  * Value is opaque, as set in the announcement.
20529  */
20530 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
20531
20532 /**
20533  * Color assigned to the node
20534  */
20535 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
20536
20537 /**
20538  * Color assigned to the node
20539  */
20540 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
20541
20542 /**
20543  * Moniker assigned to the node.
20544  * May be invalid or malicious (eg control chars),
20545  * should not be exposed to the user.
20546  */
20547 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
20548
20549 /**
20550  * Moniker assigned to the node.
20551  * May be invalid or malicious (eg control chars),
20552  * should not be exposed to the user.
20553  */
20554 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20555
20556 /**
20557  * Internet-level addresses via which one can connect to the node
20558  */
20559 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
20560
20561 /**
20562  * An initial announcement of the node
20563  * Mostly redundant with the data we store in fields explicitly.
20564  * Everything else is useful only for sending out for initial routing sync.
20565  * Not stored if contains excess data to prevent DoS.
20566  *
20567  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20568  */
20569 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
20570
20571 /**
20572  * An initial announcement of the node
20573  * Mostly redundant with the data we store in fields explicitly.
20574  * Everything else is useful only for sending out for initial routing sync.
20575  * Not stored if contains excess data to prevent DoS.
20576  *
20577  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20578  */
20579 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
20580
20581 /**
20582  * Constructs a new NodeAnnouncementInfo given each field
20583  */
20584 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);
20585
20586 /**
20587  * Creates a copy of the NodeAnnouncementInfo
20588  */
20589 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
20590
20591 /**
20592  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
20593  */
20594 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
20595
20596 /**
20597  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
20598  */
20599 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
20600
20601 /**
20602  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
20603  */
20604 void NodeInfo_free(struct LDKNodeInfo this_obj);
20605
20606 /**
20607  * All valid channels a node has announced
20608  */
20609 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
20610
20611 /**
20612  * Lowest fees enabling routing via any of the enabled, known channels to a node.
20613  * The two fields (flat and proportional fee) are independent,
20614  * meaning they don't have to refer to the same channel.
20615  *
20616  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20617  */
20618 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
20619
20620 /**
20621  * Lowest fees enabling routing via any of the enabled, known channels to a node.
20622  * The two fields (flat and proportional fee) are independent,
20623  * meaning they don't have to refer to the same channel.
20624  *
20625  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20626  */
20627 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20628
20629 /**
20630  * More information about a node from node_announcement.
20631  * Optional because we store a Node entry after learning about it from
20632  * a channel announcement, but before receiving a node announcement.
20633  *
20634  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20635  */
20636 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
20637
20638 /**
20639  * More information about a node from node_announcement.
20640  * Optional because we store a Node entry after learning about it from
20641  * a channel announcement, but before receiving a node announcement.
20642  *
20643  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20644  */
20645 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
20646
20647 /**
20648  * Constructs a new NodeInfo given each field
20649  */
20650 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
20651
20652 /**
20653  * Creates a copy of the NodeInfo
20654  */
20655 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
20656
20657 /**
20658  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
20659  */
20660 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
20661
20662 /**
20663  * Read a NodeInfo from a byte array, created by NodeInfo_write
20664  */
20665 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
20666
20667 /**
20668  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
20669  */
20670 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
20671
20672 /**
20673  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
20674  */
20675 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
20676
20677 /**
20678  * Creates a new, empty, network graph.
20679  */
20680 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
20681
20682 /**
20683  * Returns a read-only view of the network graph.
20684  */
20685 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
20686
20687 /**
20688  * For an already known node (from channel announcements), update its stored properties from a
20689  * given node announcement.
20690  *
20691  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20692  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20693  * routing messages from a source using a protocol other than the lightning P2P protocol.
20694  */
20695 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
20696
20697 /**
20698  * For an already known node (from channel announcements), update its stored properties from a
20699  * given node announcement without verifying the associated signatures. Because we aren't
20700  * given the associated signatures here we cannot relay the node announcement to any of our
20701  * peers.
20702  */
20703 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);
20704
20705 /**
20706  * Store or update channel info from a channel announcement.
20707  *
20708  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20709  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20710  * routing messages from a source using a protocol other than the lightning P2P protocol.
20711  *
20712  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
20713  * the corresponding UTXO exists on chain and is correctly-formatted.
20714  */
20715 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);
20716
20717 /**
20718  * Store or update channel info from a channel announcement without verifying the associated
20719  * signatures. Because we aren't given the associated signatures here we cannot relay the
20720  * channel announcement to any of our peers.
20721  *
20722  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
20723  * the corresponding UTXO exists on chain and is correctly-formatted.
20724  */
20725 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);
20726
20727 /**
20728  * Close a channel if a corresponding HTLC fail was sent.
20729  * If permanent, removes a channel from the local storage.
20730  * May cause the removal of nodes too, if this was their last channel.
20731  * If not permanent, makes channels unavailable for routing.
20732  */
20733 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
20734
20735 /**
20736  * Marks a node in the graph as failed.
20737  */
20738 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
20739
20740 /**
20741  * For an already known (from announcement) channel, update info about one of the directions
20742  * of the channel.
20743  *
20744  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
20745  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
20746  * routing messages from a source using a protocol other than the lightning P2P protocol.
20747  */
20748 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
20749
20750 /**
20751  * For an already known (from announcement) channel, update info about one of the directions
20752  * of the channel without verifying the associated signatures. Because we aren't given the
20753  * associated signatures here we cannot relay the channel update to any of our peers.
20754  */
20755 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
20756
20757 /**
20758  * Get network addresses by node id.
20759  * Returns None if the requested node is completely unknown,
20760  * or if node announcement for the node was never received.
20761  */
20762 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
20763
20764 /**
20765  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
20766  */
20767 void RouteHop_free(struct LDKRouteHop this_obj);
20768
20769 /**
20770  * The node_id of the node at this hop.
20771  */
20772 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20773
20774 /**
20775  * The node_id of the node at this hop.
20776  */
20777 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20778
20779 /**
20780  * The node_announcement features of the node at this hop. For the last hop, these may be
20781  * amended to match the features present in the invoice this node generated.
20782  */
20783 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20784
20785 /**
20786  * The node_announcement features of the node at this hop. For the last hop, these may be
20787  * amended to match the features present in the invoice this node generated.
20788  */
20789 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
20790
20791 /**
20792  * The channel that should be used from the previous hop to reach this node.
20793  */
20794 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20795
20796 /**
20797  * The channel that should be used from the previous hop to reach this node.
20798  */
20799 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
20800
20801 /**
20802  * The channel_announcement features of the channel that should be used from the previous hop
20803  * to reach this node.
20804  */
20805 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20806
20807 /**
20808  * The channel_announcement features of the channel that should be used from the previous hop
20809  * to reach this node.
20810  */
20811 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
20812
20813 /**
20814  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
20815  * For the last hop, this should be the full value of the payment (might be more than
20816  * requested if we had to match htlc_minimum_msat).
20817  */
20818 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20819
20820 /**
20821  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
20822  * For the last hop, this should be the full value of the payment (might be more than
20823  * requested if we had to match htlc_minimum_msat).
20824  */
20825 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
20826
20827 /**
20828  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
20829  * expected at the destination, in excess of the current block height.
20830  */
20831 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
20832
20833 /**
20834  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
20835  * expected at the destination, in excess of the current block height.
20836  */
20837 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
20838
20839 /**
20840  * Constructs a new RouteHop given each field
20841  */
20842 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);
20843
20844 /**
20845  * Creates a copy of the RouteHop
20846  */
20847 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
20848
20849 /**
20850  * Checks if two RouteHops contain equal inner contents.
20851  */
20852 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
20853
20854 /**
20855  * Checks if two RouteHops contain equal inner contents.
20856  * This ignores pointers and is_owned flags and looks at the values in fields.
20857  * Two objects with NULL inner values will be considered "equal" here.
20858  */
20859 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
20860
20861 /**
20862  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
20863  */
20864 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
20865
20866 /**
20867  * Read a RouteHop from a byte array, created by RouteHop_write
20868  */
20869 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
20870
20871 /**
20872  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
20873  */
20874 void Route_free(struct LDKRoute this_obj);
20875
20876 /**
20877  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
20878  * last RouteHop in each path must be the same.
20879  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
20880  * destination. Thus, this must always be at least length one. While the maximum length of any
20881  * given path is variable, keeping the length of any path to less than 20 should currently
20882  * ensure it is viable.
20883  */
20884 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
20885
20886 /**
20887  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
20888  * last RouteHop in each path must be the same.
20889  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
20890  * destination. Thus, this must always be at least length one. While the maximum length of any
20891  * given path is variable, keeping the length of any path to less than 20 should currently
20892  * ensure it is viable.
20893  */
20894 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
20895
20896 /**
20897  * Constructs a new Route given each field
20898  */
20899 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
20900
20901 /**
20902  * Creates a copy of the Route
20903  */
20904 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
20905
20906 /**
20907  * Checks if two Routes contain equal inner contents.
20908  */
20909 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
20910
20911 /**
20912  * Checks if two Routes contain equal inner contents.
20913  * This ignores pointers and is_owned flags and looks at the values in fields.
20914  * Two objects with NULL inner values will be considered "equal" here.
20915  */
20916 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
20917
20918 /**
20919  * Returns the total amount of fees paid on this [`Route`].
20920  *
20921  * This doesn't include any extra payment made to the recipient, which can happen in excess of
20922  * the amount passed to [`get_route`]'s `final_value_msat`.
20923  */
20924 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
20925
20926 /**
20927  * Returns the total amount paid on this [`Route`], excluding the fees.
20928  */
20929 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
20930
20931 /**
20932  * Serialize the Route object into a byte array which can be read by Route_read
20933  */
20934 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
20935
20936 /**
20937  * Read a Route from a byte array, created by Route_write
20938  */
20939 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
20940
20941 /**
20942  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
20943  */
20944 void RouteHint_free(struct LDKRouteHint this_obj);
20945
20946 /**
20947  * Creates a copy of the RouteHint
20948  */
20949 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
20950
20951 /**
20952  * Checks if two RouteHints contain equal inner contents.
20953  */
20954 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
20955
20956 /**
20957  * Checks if two RouteHints contain equal inner contents.
20958  * This ignores pointers and is_owned flags and looks at the values in fields.
20959  * Two objects with NULL inner values will be considered "equal" here.
20960  */
20961 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
20962
20963 /**
20964  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
20965  */
20966 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
20967
20968 /**
20969  * The node_id of the non-target end of the route
20970  */
20971 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
20972
20973 /**
20974  * The node_id of the non-target end of the route
20975  */
20976 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20977
20978 /**
20979  * The short_channel_id of this channel
20980  */
20981 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
20982
20983 /**
20984  * The short_channel_id of this channel
20985  */
20986 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
20987
20988 /**
20989  * The fees which must be paid to use this channel
20990  */
20991 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
20992
20993 /**
20994  * The fees which must be paid to use this channel
20995  */
20996 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20997
20998 /**
20999  * The difference in CLTV values between this node and the next node.
21000  */
21001 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21002
21003 /**
21004  * The difference in CLTV values between this node and the next node.
21005  */
21006 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
21007
21008 /**
21009  * The minimum value, in msat, which must be relayed to the next hop.
21010  */
21011 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21012
21013 /**
21014  * The minimum value, in msat, which must be relayed to the next hop.
21015  */
21016 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21017
21018 /**
21019  * The maximum value in msat available for routing with a single HTLC.
21020  */
21021 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21022
21023 /**
21024  * The maximum value in msat available for routing with a single HTLC.
21025  */
21026 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21027
21028 /**
21029  * Constructs a new RouteHintHop given each field
21030  */
21031 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);
21032
21033 /**
21034  * Creates a copy of the RouteHintHop
21035  */
21036 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
21037
21038 /**
21039  * Checks if two RouteHintHops contain equal inner contents.
21040  */
21041 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
21042
21043 /**
21044  * Checks if two RouteHintHops contain equal inner contents.
21045  * This ignores pointers and is_owned flags and looks at the values in fields.
21046  * Two objects with NULL inner values will be considered "equal" here.
21047  */
21048 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
21049
21050 /**
21051  * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
21052  * keysend payments do not have an invoice from which to pull the payee's supported features, which
21053  * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
21054  *
21055  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
21056  */
21057 struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, 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, const struct LDKScore *NONNULL_PTR scorer);
21058
21059 /**
21060  * Gets a route from us (payer) to the given target node (payee).
21061  *
21062  * If the payee provided features in their invoice, they should be provided via payee_features.
21063  * Without this, MPP will only be used if the payee's features are available in the network graph.
21064  *
21065  * Private routing paths between a public node and the target may be included in `last_hops`.
21066  * Currently, only the last hop in each path is considered.
21067  *
21068  * If some channels aren't announced, it may be useful to fill in a first_hops with the
21069  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
21070  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
21071  * in first_hops will be used.
21072  *
21073  * Panics if first_hops contains channels without short_channel_ids
21074  * (ChannelManager::list_usable_channels will never include such channels).
21075  *
21076  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
21077  * equal), however the enabled/disabled bit on such channels as well as the
21078  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
21079  *
21080  * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
21081  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
21082  */
21083 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, 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, const struct LDKScore *NONNULL_PTR scorer);
21084
21085 /**
21086  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
21087  */
21088 void Scorer_free(struct LDKScorer this_obj);
21089
21090 /**
21091  * Creates a new scorer using `base_penalty_msat` as the channel penalty.
21092  */
21093 MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat);
21094
21095 /**
21096  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
21097  */
21098 MUST_USE_RES struct LDKScorer Scorer_default(void);
21099
21100 /**
21101  * Constructs a new Score which calls the relevant methods on this_arg.
21102  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
21103  */
21104 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
21105
21106 /**
21107  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
21108  */
21109 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
21110
21111 /**
21112  * Initialize a new FilesystemPersister and set the path to the individual channels'
21113  * files.
21114  */
21115 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
21116
21117 /**
21118  * Get the directory which was provided when this persister was initialized.
21119  */
21120 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
21121
21122 /**
21123  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
21124  * initialization, within a file called \"manager\".
21125  */
21126 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
21127
21128 /**
21129  * Read `ChannelMonitor`s from disk.
21130  */
21131 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
21132
21133 /**
21134  * Constructs a new Persist which calls the relevant methods on this_arg.
21135  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
21136  */
21137 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
21138
21139 /**
21140  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
21141  */
21142 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
21143
21144 /**
21145  * Calls the free function if one is set
21146  */
21147 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
21148
21149 /**
21150  * Start a background thread that takes care of responsibilities enumerated in the [top-level
21151  * documentation].
21152  *
21153  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
21154  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
21155  * either [`join`] or [`stop`].
21156  *
21157  * # Data Persistence
21158  *
21159  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
21160  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
21161  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
21162  * provided implementation.
21163  *
21164  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
21165  * error or call [`join`] and handle any error that may arise. For the latter case,
21166  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
21167  *
21168  * # Event Handling
21169  *
21170  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
21171  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
21172  * functionality implemented by other handlers.
21173  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
21174  *
21175  * [top-level documentation]: Self
21176  * [`join`]: Self::join
21177  * [`stop`]: Self::stop
21178  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21179  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
21180  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
21181  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
21182  *
21183  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
21184  */
21185 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);
21186
21187 /**
21188  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
21189  * [`ChannelManager`].
21190  *
21191  * # Panics
21192  *
21193  * This function panics if the background thread has panicked such as while persisting or
21194  * handling events.
21195  *
21196  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21197  */
21198 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
21199
21200 /**
21201  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
21202  * [`ChannelManager`].
21203  *
21204  * # Panics
21205  *
21206  * This function panics if the background thread has panicked such as while persisting or
21207  * handling events.
21208  *
21209  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21210  */
21211 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
21212
21213 /**
21214  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
21215  *
21216  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
21217  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
21218  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
21219  * since this check is fast we recommend to do it anyway.
21220  *
21221  * If this function fails this is considered a bug. Please open an issue describing your
21222  * platform and stating your current system time.
21223  *
21224  * # Panics
21225  * If the check fails this function panics. By calling this function on startup you ensure that
21226  * this wont happen at an arbitrary later point in time.
21227  */
21228 void check_platform(void);
21229
21230 /**
21231  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
21232  */
21233 void Invoice_free(struct LDKInvoice this_obj);
21234
21235 /**
21236  * Checks if two Invoices contain equal inner contents.
21237  * This ignores pointers and is_owned flags and looks at the values in fields.
21238  * Two objects with NULL inner values will be considered "equal" here.
21239  */
21240 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
21241
21242 /**
21243  * Creates a copy of the Invoice
21244  */
21245 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
21246
21247 /**
21248  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
21249  */
21250 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
21251
21252 /**
21253  * Checks if two SignedRawInvoices contain equal inner contents.
21254  * This ignores pointers and is_owned flags and looks at the values in fields.
21255  * Two objects with NULL inner values will be considered "equal" here.
21256  */
21257 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
21258
21259 /**
21260  * Creates a copy of the SignedRawInvoice
21261  */
21262 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
21263
21264 /**
21265  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
21266  */
21267 void RawInvoice_free(struct LDKRawInvoice this_obj);
21268
21269 /**
21270  * data part
21271  */
21272 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
21273
21274 /**
21275  * data part
21276  */
21277 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
21278
21279 /**
21280  * Checks if two RawInvoices contain equal inner contents.
21281  * This ignores pointers and is_owned flags and looks at the values in fields.
21282  * Two objects with NULL inner values will be considered "equal" here.
21283  */
21284 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
21285
21286 /**
21287  * Creates a copy of the RawInvoice
21288  */
21289 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
21290
21291 /**
21292  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
21293  */
21294 void RawDataPart_free(struct LDKRawDataPart this_obj);
21295
21296 /**
21297  * generation time of the invoice
21298  */
21299 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
21300
21301 /**
21302  * generation time of the invoice
21303  */
21304 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
21305
21306 /**
21307  * Checks if two RawDataParts contain equal inner contents.
21308  * This ignores pointers and is_owned flags and looks at the values in fields.
21309  * Two objects with NULL inner values will be considered "equal" here.
21310  */
21311 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
21312
21313 /**
21314  * Creates a copy of the RawDataPart
21315  */
21316 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
21317
21318 /**
21319  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
21320  */
21321 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
21322
21323 /**
21324  * Checks if two PositiveTimestamps contain equal inner contents.
21325  * This ignores pointers and is_owned flags and looks at the values in fields.
21326  * Two objects with NULL inner values will be considered "equal" here.
21327  */
21328 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
21329
21330 /**
21331  * Creates a copy of the PositiveTimestamp
21332  */
21333 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
21334
21335 /**
21336  * Creates a copy of the SiPrefix
21337  */
21338 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
21339
21340 /**
21341  * Utility method to constructs a new Milli-variant SiPrefix
21342  */
21343 enum LDKSiPrefix SiPrefix_milli(void);
21344
21345 /**
21346  * Utility method to constructs a new Micro-variant SiPrefix
21347  */
21348 enum LDKSiPrefix SiPrefix_micro(void);
21349
21350 /**
21351  * Utility method to constructs a new Nano-variant SiPrefix
21352  */
21353 enum LDKSiPrefix SiPrefix_nano(void);
21354
21355 /**
21356  * Utility method to constructs a new Pico-variant SiPrefix
21357  */
21358 enum LDKSiPrefix SiPrefix_pico(void);
21359
21360 /**
21361  * Checks if two SiPrefixs contain equal inner contents.
21362  * This ignores pointers and is_owned flags and looks at the values in fields.
21363  */
21364 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
21365
21366 /**
21367  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
21368  * This is effectively 10^12 * the prefix multiplier
21369  */
21370 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
21371
21372 /**
21373  * Creates a copy of the Currency
21374  */
21375 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
21376
21377 /**
21378  * Utility method to constructs a new Bitcoin-variant Currency
21379  */
21380 enum LDKCurrency Currency_bitcoin(void);
21381
21382 /**
21383  * Utility method to constructs a new BitcoinTestnet-variant Currency
21384  */
21385 enum LDKCurrency Currency_bitcoin_testnet(void);
21386
21387 /**
21388  * Utility method to constructs a new Regtest-variant Currency
21389  */
21390 enum LDKCurrency Currency_regtest(void);
21391
21392 /**
21393  * Utility method to constructs a new Simnet-variant Currency
21394  */
21395 enum LDKCurrency Currency_simnet(void);
21396
21397 /**
21398  * Utility method to constructs a new Signet-variant Currency
21399  */
21400 enum LDKCurrency Currency_signet(void);
21401
21402 /**
21403  * Checks if two Currencys contain equal inner contents.
21404  */
21405 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
21406
21407 /**
21408  * Checks if two Currencys contain equal inner contents.
21409  * This ignores pointers and is_owned flags and looks at the values in fields.
21410  */
21411 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
21412
21413 /**
21414  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
21415  */
21416 void Sha256_free(struct LDKSha256 this_obj);
21417
21418 /**
21419  * Creates a copy of the Sha256
21420  */
21421 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
21422
21423 /**
21424  * Checks if two Sha256s contain equal inner contents.
21425  */
21426 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
21427
21428 /**
21429  * Checks if two Sha256s contain equal inner contents.
21430  * This ignores pointers and is_owned flags and looks at the values in fields.
21431  * Two objects with NULL inner values will be considered "equal" here.
21432  */
21433 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
21434
21435 /**
21436  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
21437  */
21438 void Description_free(struct LDKDescription this_obj);
21439
21440 /**
21441  * Creates a copy of the Description
21442  */
21443 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
21444
21445 /**
21446  * Checks if two Descriptions contain equal inner contents.
21447  */
21448 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
21449
21450 /**
21451  * Checks if two Descriptions contain equal inner contents.
21452  * This ignores pointers and is_owned flags and looks at the values in fields.
21453  * Two objects with NULL inner values will be considered "equal" here.
21454  */
21455 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
21456
21457 /**
21458  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
21459  */
21460 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
21461
21462 /**
21463  * Creates a copy of the PayeePubKey
21464  */
21465 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
21466
21467 /**
21468  * Checks if two PayeePubKeys contain equal inner contents.
21469  */
21470 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
21471
21472 /**
21473  * Checks if two PayeePubKeys contain equal inner contents.
21474  * This ignores pointers and is_owned flags and looks at the values in fields.
21475  * Two objects with NULL inner values will be considered "equal" here.
21476  */
21477 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
21478
21479 /**
21480  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
21481  */
21482 void ExpiryTime_free(struct LDKExpiryTime this_obj);
21483
21484 /**
21485  * Creates a copy of the ExpiryTime
21486  */
21487 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
21488
21489 /**
21490  * Checks if two ExpiryTimes contain equal inner contents.
21491  */
21492 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
21493
21494 /**
21495  * Checks if two ExpiryTimes contain equal inner contents.
21496  * This ignores pointers and is_owned flags and looks at the values in fields.
21497  * Two objects with NULL inner values will be considered "equal" here.
21498  */
21499 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
21500
21501 /**
21502  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
21503  */
21504 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
21505
21506 /**
21507  * Creates a copy of the MinFinalCltvExpiry
21508  */
21509 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
21510
21511 /**
21512  * Checks if two MinFinalCltvExpirys contain equal inner contents.
21513  */
21514 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
21515
21516 /**
21517  * Checks if two MinFinalCltvExpirys contain equal inner contents.
21518  * This ignores pointers and is_owned flags and looks at the values in fields.
21519  * Two objects with NULL inner values will be considered "equal" here.
21520  */
21521 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
21522
21523 /**
21524  * Frees any resources used by the Fallback
21525  */
21526 void Fallback_free(struct LDKFallback this_ptr);
21527
21528 /**
21529  * Creates a copy of the Fallback
21530  */
21531 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
21532
21533 /**
21534  * Utility method to constructs a new SegWitProgram-variant Fallback
21535  */
21536 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
21537
21538 /**
21539  * Utility method to constructs a new PubKeyHash-variant Fallback
21540  */
21541 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
21542
21543 /**
21544  * Utility method to constructs a new ScriptHash-variant Fallback
21545  */
21546 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
21547
21548 /**
21549  * Checks if two Fallbacks contain equal inner contents.
21550  */
21551 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
21552
21553 /**
21554  * Checks if two Fallbacks contain equal inner contents.
21555  * This ignores pointers and is_owned flags and looks at the values in fields.
21556  */
21557 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
21558
21559 /**
21560  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
21561  */
21562 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
21563
21564 /**
21565  * Creates a copy of the InvoiceSignature
21566  */
21567 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
21568
21569 /**
21570  * Checks if two InvoiceSignatures contain equal inner contents.
21571  * This ignores pointers and is_owned flags and looks at the values in fields.
21572  * Two objects with NULL inner values will be considered "equal" here.
21573  */
21574 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
21575
21576 /**
21577  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
21578  */
21579 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
21580
21581 /**
21582  * Creates a copy of the PrivateRoute
21583  */
21584 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
21585
21586 /**
21587  * Checks if two PrivateRoutes contain equal inner contents.
21588  */
21589 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
21590
21591 /**
21592  * Checks if two PrivateRoutes contain equal inner contents.
21593  * This ignores pointers and is_owned flags and looks at the values in fields.
21594  * Two objects with NULL inner values will be considered "equal" here.
21595  */
21596 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
21597
21598 /**
21599  * Disassembles the `SignedRawInvoice` into its three parts:
21600  *  1. raw invoice
21601  *  2. hash of the raw invoice
21602  *  3. signature
21603  */
21604 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
21605
21606 /**
21607  * The `RawInvoice` which was signed.
21608  */
21609 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
21610
21611 /**
21612  * The hash of the `RawInvoice` that was signed.
21613  */
21614 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
21615
21616 /**
21617  * InvoiceSignature for the invoice.
21618  */
21619 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
21620
21621 /**
21622  * Recovers the public key used for signing the invoice from the recoverable signature.
21623  */
21624 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
21625
21626 /**
21627  * Checks if the signature is valid for the included payee public key or if none exists if it's
21628  * valid for the recovered signature (which should always be true?).
21629  */
21630 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
21631
21632 /**
21633  * Calculate the hash of the encoded `RawInvoice`
21634  */
21635 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21636
21637 /**
21638  *
21639  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21640  */
21641 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21642
21643 /**
21644  *
21645  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21646  */
21647 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21648
21649 /**
21650  *
21651  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21652  */
21653 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21654
21655 /**
21656  *
21657  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21658  */
21659 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21660
21661 /**
21662  *
21663  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21664  */
21665 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21666
21667 /**
21668  *
21669  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21670  */
21671 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21672
21673 /**
21674  *
21675  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21676  */
21677 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21678
21679 /**
21680  *
21681  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21682  */
21683 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21684
21685 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21686
21687 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21688
21689 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
21690
21691 /**
21692  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
21693  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
21694  * `CreationError::TimestampOutOfBounds`.
21695  */
21696 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
21697
21698 /**
21699  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
21700  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
21701  * `CreationError::TimestampOutOfBounds`.
21702  */
21703 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
21704
21705 /**
21706  * Returns the UNIX timestamp representing the stored time
21707  */
21708 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
21709
21710 /**
21711  * Returns a reference to the internal `SystemTime` time representation
21712  */
21713 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
21714
21715 /**
21716  * Transform the `Invoice` into it's unchecked version
21717  */
21718 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
21719
21720 /**
21721  * Check that the invoice is signed correctly and that key recovery works
21722  */
21723 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
21724
21725 /**
21726  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
21727  * ```
21728  * use lightning_invoice::*;
21729  *
21730  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
21731  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
21732  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
21733  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
21734  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
21735  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
21736  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
21737  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
21738  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
21739  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
21740  * j5r6drg6k6zcqj0fcwg\";
21741  *
21742  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
21743  *
21744  * assert!(Invoice::from_signed(signed).is_ok());
21745  * ```
21746  */
21747 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
21748
21749 /**
21750  * Returns the `Invoice`'s timestamp (should equal it's creation time)
21751  */
21752 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
21753
21754 /**
21755  * Returns the hash to which we will receive the preimage on completion of the payment
21756  */
21757 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
21758
21759 /**
21760  * Get the payee's public key if one was included in the invoice
21761  *
21762  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21763  */
21764 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
21765
21766 /**
21767  * Get the payment secret if one was included in the invoice
21768  */
21769 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
21770
21771 /**
21772  * Get the invoice features if they were included in the invoice
21773  *
21774  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21775  */
21776 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
21777
21778 /**
21779  * Recover the payee's public key (only to be used if none was included in the invoice)
21780  */
21781 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
21782
21783 /**
21784  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
21785  */
21786 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
21787
21788 /**
21789  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
21790  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
21791  */
21792 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
21793
21794 /**
21795  * Returns a list of all routes included in the invoice
21796  */
21797 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
21798
21799 /**
21800  * Returns a list of all routes included in the invoice as the underlying hints
21801  */
21802 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
21803
21804 /**
21805  * Returns the currency for which the invoice was issued
21806  */
21807 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
21808
21809 /**
21810  * Returns the amount if specified in the invoice as pico <currency>.
21811  */
21812 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
21813
21814 /**
21815  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
21816  * returns `CreationError::DescriptionTooLong` otherwise
21817  *
21818  * Please note that single characters may use more than one byte due to UTF8 encoding.
21819  */
21820 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
21821
21822 /**
21823  * Returns the underlying description `String`
21824  */
21825 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
21826
21827 /**
21828  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
21829  * overflow on adding the `EpiryTime` to it then this function will return a
21830  * `CreationError::ExpiryTimeOutOfBounds`.
21831  */
21832 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
21833
21834 /**
21835  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
21836  * would overflow on adding the `EpiryTime` to it then this function will return a
21837  * `CreationError::ExpiryTimeOutOfBounds`.
21838  */
21839 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
21840
21841 /**
21842  * Returns the expiry time in seconds
21843  */
21844 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
21845
21846 /**
21847  * Returns a reference to the underlying `Duration` (=expiry time)
21848  */
21849 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
21850
21851 /**
21852  * Creates a new (partial) route from a list of hops
21853  */
21854 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
21855
21856 /**
21857  * Returns the underlying list of hops
21858  */
21859 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
21860
21861 /**
21862  * Creates a copy of the CreationError
21863  */
21864 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
21865
21866 /**
21867  * Utility method to constructs a new DescriptionTooLong-variant CreationError
21868  */
21869 enum LDKCreationError CreationError_description_too_long(void);
21870
21871 /**
21872  * Utility method to constructs a new RouteTooLong-variant CreationError
21873  */
21874 enum LDKCreationError CreationError_route_too_long(void);
21875
21876 /**
21877  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
21878  */
21879 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
21880
21881 /**
21882  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
21883  */
21884 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
21885
21886 /**
21887  * Checks if two CreationErrors contain equal inner contents.
21888  * This ignores pointers and is_owned flags and looks at the values in fields.
21889  */
21890 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
21891
21892 /**
21893  * Get the string representation of a CreationError object
21894  */
21895 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
21896
21897 /**
21898  * Creates a copy of the SemanticError
21899  */
21900 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
21901
21902 /**
21903  * Utility method to constructs a new NoPaymentHash-variant SemanticError
21904  */
21905 enum LDKSemanticError SemanticError_no_payment_hash(void);
21906
21907 /**
21908  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
21909  */
21910 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
21911
21912 /**
21913  * Utility method to constructs a new NoDescription-variant SemanticError
21914  */
21915 enum LDKSemanticError SemanticError_no_description(void);
21916
21917 /**
21918  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
21919  */
21920 enum LDKSemanticError SemanticError_multiple_descriptions(void);
21921
21922 /**
21923  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
21924  */
21925 enum LDKSemanticError SemanticError_no_payment_secret(void);
21926
21927 /**
21928  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
21929  */
21930 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
21931
21932 /**
21933  * Utility method to constructs a new InvalidFeatures-variant SemanticError
21934  */
21935 enum LDKSemanticError SemanticError_invalid_features(void);
21936
21937 /**
21938  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
21939  */
21940 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
21941
21942 /**
21943  * Utility method to constructs a new InvalidSignature-variant SemanticError
21944  */
21945 enum LDKSemanticError SemanticError_invalid_signature(void);
21946
21947 /**
21948  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
21949  */
21950 enum LDKSemanticError SemanticError_imprecise_amount(void);
21951
21952 /**
21953  * Checks if two SemanticErrors contain equal inner contents.
21954  * This ignores pointers and is_owned flags and looks at the values in fields.
21955  */
21956 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
21957
21958 /**
21959  * Get the string representation of a SemanticError object
21960  */
21961 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
21962
21963 /**
21964  * Frees any resources used by the SignOrCreationError
21965  */
21966 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
21967
21968 /**
21969  * Creates a copy of the SignOrCreationError
21970  */
21971 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
21972
21973 /**
21974  * Utility method to constructs a new SignError-variant SignOrCreationError
21975  */
21976 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
21977
21978 /**
21979  * Utility method to constructs a new CreationError-variant SignOrCreationError
21980  */
21981 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
21982
21983 /**
21984  * Checks if two SignOrCreationErrors contain equal inner contents.
21985  * This ignores pointers and is_owned flags and looks at the values in fields.
21986  */
21987 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
21988
21989 /**
21990  * Get the string representation of a SignOrCreationError object
21991  */
21992 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
21993
21994 /**
21995  * Utility to construct an invoice. Generally, unless you want to do something like a custom
21996  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
21997  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
21998  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
21999  * that the payment secret is valid when the invoice is paid.
22000  */
22001 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);
22002
22003 /**
22004  * Read a SiPrefix object from a string
22005  */
22006 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
22007
22008 /**
22009  * Read a Invoice object from a string
22010  */
22011 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
22012
22013 /**
22014  * Read a SignedRawInvoice object from a string
22015  */
22016 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
22017
22018 /**
22019  * Get the string representation of a Invoice object
22020  */
22021 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
22022
22023 /**
22024  * Get the string representation of a SignedRawInvoice object
22025  */
22026 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
22027
22028 /**
22029  * Get the string representation of a Currency object
22030  */
22031 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
22032
22033 /**
22034  * Get the string representation of a SiPrefix object
22035  */
22036 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
22037
22038 #endif /* LDK_C_BINDINGS_H */
22039
22040 #include "ldk_ver.h"