455cae8ade37eefbfab884db34be513f1954a7f6
[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/signet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Must be last for serialization purposes
172     */
173    LDKCurrency_Sentinel,
174 } LDKCurrency;
175
176 /**
177  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
178  */
179 typedef enum LDKIOError {
180    LDKIOError_NotFound,
181    LDKIOError_PermissionDenied,
182    LDKIOError_ConnectionRefused,
183    LDKIOError_ConnectionReset,
184    LDKIOError_ConnectionAborted,
185    LDKIOError_NotConnected,
186    LDKIOError_AddrInUse,
187    LDKIOError_AddrNotAvailable,
188    LDKIOError_BrokenPipe,
189    LDKIOError_AlreadyExists,
190    LDKIOError_WouldBlock,
191    LDKIOError_InvalidInput,
192    LDKIOError_InvalidData,
193    LDKIOError_TimedOut,
194    LDKIOError_WriteZero,
195    LDKIOError_Interrupted,
196    LDKIOError_Other,
197    LDKIOError_UnexpectedEof,
198    /**
199     * Must be last for serialization purposes
200     */
201    LDKIOError_Sentinel,
202 } LDKIOError;
203
204 /**
205  * An enum representing the available verbosity levels of the logger.
206  */
207 typedef enum LDKLevel {
208    /**
209     *Designates logger being silent
210     */
211    LDKLevel_Off,
212    /**
213     * Designates very serious errors
214     */
215    LDKLevel_Error,
216    /**
217     * Designates hazardous situations
218     */
219    LDKLevel_Warn,
220    /**
221     * Designates useful information
222     */
223    LDKLevel_Info,
224    /**
225     * Designates lower priority information
226     */
227    LDKLevel_Debug,
228    /**
229     * Designates very low priority, often extremely verbose, information
230     */
231    LDKLevel_Trace,
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 contains multiple payment secrets
333     */
334    LDKSemanticError_MultiplePaymentSecrets,
335    /**
336     * The invoice's features are invalid
337     */
338    LDKSemanticError_InvalidFeatures,
339    /**
340     * The recovery id doesn't fit the signature/pub key
341     */
342    LDKSemanticError_InvalidRecoveryId,
343    /**
344     * The invoice's signature is invalid
345     */
346    LDKSemanticError_InvalidSignature,
347    /**
348     * Must be last for serialization purposes
349     */
350    LDKSemanticError_Sentinel,
351 } LDKSemanticError;
352
353 /**
354  * SI prefixes for the human readable part
355  */
356 typedef enum LDKSiPrefix {
357    /**
358     * 10^-3
359     */
360    LDKSiPrefix_Milli,
361    /**
362     * 10^-6
363     */
364    LDKSiPrefix_Micro,
365    /**
366     * 10^-9
367     */
368    LDKSiPrefix_Nano,
369    /**
370     * 10^-12
371     */
372    LDKSiPrefix_Pico,
373    /**
374     * Must be last for serialization purposes
375     */
376    LDKSiPrefix_Sentinel,
377 } LDKSiPrefix;
378
379 /**
380  * A Rust str object, ie a reference to a UTF8-valid string.
381  * This is *not* null-terminated so cannot be used directly as a C string!
382  */
383 typedef struct LDKStr {
384    /**
385     * A pointer to the string's bytes, in UTF8 encoding
386     */
387    const uint8_t *chars;
388    /**
389     * The number of bytes (not characters!) pointed to by `chars`
390     */
391    uintptr_t len;
392    /**
393     * Whether the data pointed to by `chars` should be freed or not.
394     */
395    bool chars_is_owned;
396 } LDKStr;
397
398 /**
399  * A serialized transaction, in (pointer, length) form.
400  *
401  * This type optionally owns its own memory, and thus the semantics around access change based on
402  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
403  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
404  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
405  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
406  * you would be invalid.
407  *
408  * Note that, while it may change in the future, because transactions on the Rust side are stored
409  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
410  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
411  * `data_is_owned` either set or unset at your discretion.
412  */
413 typedef struct LDKTransaction {
414    /**
415     * The serialized transaction data.
416     *
417     * This is non-const for your convenience, an object passed to Rust is never written to.
418     */
419    uint8_t *data;
420    /**
421     * The length of the serialized transaction
422     */
423    uintptr_t datalen;
424    /**
425     * Whether the data pointed to by `data` should be freed or not.
426     */
427    bool data_is_owned;
428 } LDKTransaction;
429
430 /**
431  * A dynamically-allocated array of u8s of arbitrary size.
432  * This corresponds to std::vector in C++
433  */
434 typedef struct LDKCVec_u8Z {
435    /**
436     * The elements in the array.
437     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
438     */
439    uint8_t *data;
440    /**
441     * The number of elements pointed to by `data`.
442     */
443    uintptr_t datalen;
444 } LDKCVec_u8Z;
445
446 /**
447  * A transaction output including a scriptPubKey and value.
448  * This type *does* own its own memory, so must be free'd appropriately.
449  */
450 typedef struct LDKTxOut {
451    /**
452     * The script_pubkey in this output
453     */
454    struct LDKCVec_u8Z script_pubkey;
455    /**
456     * The value, in satoshis, of this output
457     */
458    uint64_t value;
459 } LDKTxOut;
460
461
462
463 /**
464  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
465  * with our counterparty.
466  */
467 typedef struct MUST_USE_STRUCT LDKChannelConfig {
468    /**
469     * A pointer to the opaque Rust object.
470     * Nearly everywhere, inner must be non-null, however in places where
471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
472     */
473    LDKnativeChannelConfig *inner;
474    /**
475     * Indicates that this is the only struct which contains the same pointer.
476     * Rust functions which take ownership of an object provided via an argument require
477     * this to be true and invalidate the object pointed to by inner.
478     */
479    bool is_owned;
480 } LDKChannelConfig;
481
482
483
484 /**
485  * An error in decoding a message or struct.
486  */
487 typedef struct MUST_USE_STRUCT LDKDecodeError {
488    /**
489     * A pointer to the opaque Rust object.
490     * Nearly everywhere, inner must be non-null, however in places where
491     * the Rust equivalent takes an Option, it may be set to null to indicate None.
492     */
493    LDKnativeDecodeError *inner;
494    /**
495     * Indicates that this is the only struct which contains the same pointer.
496     * Rust functions which take ownership of an object provided via an argument require
497     * this to be true and invalidate the object pointed to by inner.
498     */
499    bool is_owned;
500 } LDKDecodeError;
501
502 /**
503  * The contents of CResult_ChannelConfigDecodeErrorZ
504  */
505 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
506    /**
507     * A pointer to the contents in the success state.
508     * Reading from this pointer when `result_ok` is not set is undefined.
509     */
510    struct LDKChannelConfig *result;
511    /**
512     * A pointer to the contents in the error state.
513     * Reading from this pointer when `result_ok` is set is undefined.
514     */
515    struct LDKDecodeError *err;
516 } LDKCResult_ChannelConfigDecodeErrorZPtr;
517
518 /**
519  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
520  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
521  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
522  */
523 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
524    /**
525     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
526     * `err` or `result` depending on the state of `result_ok`.
527     */
528    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
529    /**
530     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
531     */
532    bool result_ok;
533 } LDKCResult_ChannelConfigDecodeErrorZ;
534
535
536
537 /**
538  * A reference to a transaction output.
539  *
540  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
541  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
542  */
543 typedef struct MUST_USE_STRUCT LDKOutPoint {
544    /**
545     * A pointer to the opaque Rust object.
546     * Nearly everywhere, inner must be non-null, however in places where
547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
548     */
549    LDKnativeOutPoint *inner;
550    /**
551     * Indicates that this is the only struct which contains the same pointer.
552     * Rust functions which take ownership of an object provided via an argument require
553     * this to be true and invalidate the object pointed to by inner.
554     */
555    bool is_owned;
556 } LDKOutPoint;
557
558 /**
559  * The contents of CResult_OutPointDecodeErrorZ
560  */
561 typedef union LDKCResult_OutPointDecodeErrorZPtr {
562    /**
563     * A pointer to the contents in the success state.
564     * Reading from this pointer when `result_ok` is not set is undefined.
565     */
566    struct LDKOutPoint *result;
567    /**
568     * A pointer to the contents in the error state.
569     * Reading from this pointer when `result_ok` is set is undefined.
570     */
571    struct LDKDecodeError *err;
572 } LDKCResult_OutPointDecodeErrorZPtr;
573
574 /**
575  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
576  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
577  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
578  */
579 typedef struct LDKCResult_OutPointDecodeErrorZ {
580    /**
581     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
582     * `err` or `result` depending on the state of `result_ok`.
583     */
584    union LDKCResult_OutPointDecodeErrorZPtr contents;
585    /**
586     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
587     */
588    bool result_ok;
589 } LDKCResult_OutPointDecodeErrorZ;
590
591 /**
592  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
593  */
594 typedef struct LDKSecretKey {
595    /**
596     * The bytes of the secret key
597     */
598    uint8_t bytes[32];
599 } LDKSecretKey;
600
601 /**
602  * The contents of CResult_SecretKeyErrorZ
603  */
604 typedef union LDKCResult_SecretKeyErrorZPtr {
605    /**
606     * A pointer to the contents in the success state.
607     * Reading from this pointer when `result_ok` is not set is undefined.
608     */
609    struct LDKSecretKey *result;
610    /**
611     * A pointer to the contents in the error state.
612     * Reading from this pointer when `result_ok` is set is undefined.
613     */
614    enum LDKSecp256k1Error *err;
615 } LDKCResult_SecretKeyErrorZPtr;
616
617 /**
618  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
619  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
620  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
621  */
622 typedef struct LDKCResult_SecretKeyErrorZ {
623    /**
624     * The contents of this CResult_SecretKeyErrorZ, accessible via either
625     * `err` or `result` depending on the state of `result_ok`.
626     */
627    union LDKCResult_SecretKeyErrorZPtr contents;
628    /**
629     * Whether this CResult_SecretKeyErrorZ represents a success state.
630     */
631    bool result_ok;
632 } LDKCResult_SecretKeyErrorZ;
633
634 /**
635  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
636  */
637 typedef struct LDKPublicKey {
638    /**
639     * The bytes of the public key
640     */
641    uint8_t compressed_form[33];
642 } LDKPublicKey;
643
644 /**
645  * The contents of CResult_PublicKeyErrorZ
646  */
647 typedef union LDKCResult_PublicKeyErrorZPtr {
648    /**
649     * A pointer to the contents in the success state.
650     * Reading from this pointer when `result_ok` is not set is undefined.
651     */
652    struct LDKPublicKey *result;
653    /**
654     * A pointer to the contents in the error state.
655     * Reading from this pointer when `result_ok` is set is undefined.
656     */
657    enum LDKSecp256k1Error *err;
658 } LDKCResult_PublicKeyErrorZPtr;
659
660 /**
661  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
662  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
664  */
665 typedef struct LDKCResult_PublicKeyErrorZ {
666    /**
667     * The contents of this CResult_PublicKeyErrorZ, accessible via either
668     * `err` or `result` depending on the state of `result_ok`.
669     */
670    union LDKCResult_PublicKeyErrorZPtr contents;
671    /**
672     * Whether this CResult_PublicKeyErrorZ represents a success state.
673     */
674    bool result_ok;
675 } LDKCResult_PublicKeyErrorZ;
676
677
678
679 /**
680  * The set of public keys which are used in the creation of one commitment transaction.
681  * These are derived from the channel base keys and per-commitment data.
682  *
683  * A broadcaster key is provided from potential broadcaster of the computed transaction.
684  * A countersignatory key is coming from a protocol participant unable to broadcast the
685  * transaction.
686  *
687  * These keys are assumed to be good, either because the code derived them from
688  * channel basepoints via the new function, or they were obtained via
689  * CommitmentTransaction.trust().keys() because we trusted the source of the
690  * pre-calculated keys.
691  */
692 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
693    /**
694     * A pointer to the opaque Rust object.
695     * Nearly everywhere, inner must be non-null, however in places where
696     * the Rust equivalent takes an Option, it may be set to null to indicate None.
697     */
698    LDKnativeTxCreationKeys *inner;
699    /**
700     * Indicates that this is the only struct which contains the same pointer.
701     * Rust functions which take ownership of an object provided via an argument require
702     * this to be true and invalidate the object pointed to by inner.
703     */
704    bool is_owned;
705 } LDKTxCreationKeys;
706
707 /**
708  * The contents of CResult_TxCreationKeysDecodeErrorZ
709  */
710 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
711    /**
712     * A pointer to the contents in the success state.
713     * Reading from this pointer when `result_ok` is not set is undefined.
714     */
715    struct LDKTxCreationKeys *result;
716    /**
717     * A pointer to the contents in the error state.
718     * Reading from this pointer when `result_ok` is set is undefined.
719     */
720    struct LDKDecodeError *err;
721 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
722
723 /**
724  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
725  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
726  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
727  */
728 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
729    /**
730     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
731     * `err` or `result` depending on the state of `result_ok`.
732     */
733    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
734    /**
735     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
736     */
737    bool result_ok;
738 } LDKCResult_TxCreationKeysDecodeErrorZ;
739
740
741
742 /**
743  * One counterparty's public keys which do not change over the life of a channel.
744  */
745 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
746    /**
747     * A pointer to the opaque Rust object.
748     * Nearly everywhere, inner must be non-null, however in places where
749     * the Rust equivalent takes an Option, it may be set to null to indicate None.
750     */
751    LDKnativeChannelPublicKeys *inner;
752    /**
753     * Indicates that this is the only struct which contains the same pointer.
754     * Rust functions which take ownership of an object provided via an argument require
755     * this to be true and invalidate the object pointed to by inner.
756     */
757    bool is_owned;
758 } LDKChannelPublicKeys;
759
760 /**
761  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
762  */
763 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
764    /**
765     * A pointer to the contents in the success state.
766     * Reading from this pointer when `result_ok` is not set is undefined.
767     */
768    struct LDKChannelPublicKeys *result;
769    /**
770     * A pointer to the contents in the error state.
771     * Reading from this pointer when `result_ok` is set is undefined.
772     */
773    struct LDKDecodeError *err;
774 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
775
776 /**
777  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
778  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
779  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
780  */
781 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
782    /**
783     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
784     * `err` or `result` depending on the state of `result_ok`.
785     */
786    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
787    /**
788     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
789     */
790    bool result_ok;
791 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
792
793 /**
794  * The contents of CResult_TxCreationKeysErrorZ
795  */
796 typedef union LDKCResult_TxCreationKeysErrorZPtr {
797    /**
798     * A pointer to the contents in the success state.
799     * Reading from this pointer when `result_ok` is not set is undefined.
800     */
801    struct LDKTxCreationKeys *result;
802    /**
803     * A pointer to the contents in the error state.
804     * Reading from this pointer when `result_ok` is set is undefined.
805     */
806    enum LDKSecp256k1Error *err;
807 } LDKCResult_TxCreationKeysErrorZPtr;
808
809 /**
810  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
811  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
813  */
814 typedef struct LDKCResult_TxCreationKeysErrorZ {
815    /**
816     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
817     * `err` or `result` depending on the state of `result_ok`.
818     */
819    union LDKCResult_TxCreationKeysErrorZPtr contents;
820    /**
821     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
822     */
823    bool result_ok;
824 } LDKCResult_TxCreationKeysErrorZ;
825
826 /**
827  * An enum which can either contain a u32 or not
828  */
829 typedef enum LDKCOption_u32Z_Tag {
830    /**
831     * When we're in this state, this COption_u32Z contains a u32
832     */
833    LDKCOption_u32Z_Some,
834    /**
835     * When we're in this state, this COption_u32Z contains nothing
836     */
837    LDKCOption_u32Z_None,
838    /**
839     * Must be last for serialization purposes
840     */
841    LDKCOption_u32Z_Sentinel,
842 } LDKCOption_u32Z_Tag;
843
844 typedef struct LDKCOption_u32Z {
845    LDKCOption_u32Z_Tag tag;
846    union {
847       struct {
848          uint32_t some;
849       };
850    };
851 } LDKCOption_u32Z;
852
853
854
855 /**
856  * Information about an HTLC as it appears in a commitment transaction
857  */
858 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
859    /**
860     * A pointer to the opaque Rust object.
861     * Nearly everywhere, inner must be non-null, however in places where
862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
863     */
864    LDKnativeHTLCOutputInCommitment *inner;
865    /**
866     * Indicates that this is the only struct which contains the same pointer.
867     * Rust functions which take ownership of an object provided via an argument require
868     * this to be true and invalidate the object pointed to by inner.
869     */
870    bool is_owned;
871 } LDKHTLCOutputInCommitment;
872
873 /**
874  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
875  */
876 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
877    /**
878     * A pointer to the contents in the success state.
879     * Reading from this pointer when `result_ok` is not set is undefined.
880     */
881    struct LDKHTLCOutputInCommitment *result;
882    /**
883     * A pointer to the contents in the error state.
884     * Reading from this pointer when `result_ok` is set is undefined.
885     */
886    struct LDKDecodeError *err;
887 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
888
889 /**
890  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
891  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
892  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
893  */
894 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
895    /**
896     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
897     * `err` or `result` depending on the state of `result_ok`.
898     */
899    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
900    /**
901     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
902     */
903    bool result_ok;
904 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
905
906
907
908 /**
909  * Late-bound per-channel counterparty data used to build transactions.
910  */
911 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
912    /**
913     * A pointer to the opaque Rust object.
914     * Nearly everywhere, inner must be non-null, however in places where
915     * the Rust equivalent takes an Option, it may be set to null to indicate None.
916     */
917    LDKnativeCounterpartyChannelTransactionParameters *inner;
918    /**
919     * Indicates that this is the only struct which contains the same pointer.
920     * Rust functions which take ownership of an object provided via an argument require
921     * this to be true and invalidate the object pointed to by inner.
922     */
923    bool is_owned;
924 } LDKCounterpartyChannelTransactionParameters;
925
926 /**
927  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
928  */
929 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
930    /**
931     * A pointer to the contents in the success state.
932     * Reading from this pointer when `result_ok` is not set is undefined.
933     */
934    struct LDKCounterpartyChannelTransactionParameters *result;
935    /**
936     * A pointer to the contents in the error state.
937     * Reading from this pointer when `result_ok` is set is undefined.
938     */
939    struct LDKDecodeError *err;
940 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
941
942 /**
943  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
946  */
947 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
948    /**
949     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
950     * `err` or `result` depending on the state of `result_ok`.
951     */
952    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
953    /**
954     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
955     */
956    bool result_ok;
957 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
958
959
960
961 /**
962  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
963  * The fields are organized by holder/counterparty.
964  *
965  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
966  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
967  */
968 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
969    /**
970     * A pointer to the opaque Rust object.
971     * Nearly everywhere, inner must be non-null, however in places where
972     * the Rust equivalent takes an Option, it may be set to null to indicate None.
973     */
974    LDKnativeChannelTransactionParameters *inner;
975    /**
976     * Indicates that this is the only struct which contains the same pointer.
977     * Rust functions which take ownership of an object provided via an argument require
978     * this to be true and invalidate the object pointed to by inner.
979     */
980    bool is_owned;
981 } LDKChannelTransactionParameters;
982
983 /**
984  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
985  */
986 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
987    /**
988     * A pointer to the contents in the success state.
989     * Reading from this pointer when `result_ok` is not set is undefined.
990     */
991    struct LDKChannelTransactionParameters *result;
992    /**
993     * A pointer to the contents in the error state.
994     * Reading from this pointer when `result_ok` is set is undefined.
995     */
996    struct LDKDecodeError *err;
997 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
998
999 /**
1000  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1001  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1002  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1003  */
1004 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1005    /**
1006     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1007     * `err` or `result` depending on the state of `result_ok`.
1008     */
1009    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1010    /**
1011     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1012     */
1013    bool result_ok;
1014 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1015
1016 /**
1017  * Represents a secp256k1 signature serialized as two 32-byte numbers
1018  */
1019 typedef struct LDKSignature {
1020    /**
1021     * The bytes of the signature in "compact" form
1022     */
1023    uint8_t compact_form[64];
1024 } LDKSignature;
1025
1026 /**
1027  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1028  * This corresponds to std::vector in C++
1029  */
1030 typedef struct LDKCVec_SignatureZ {
1031    /**
1032     * The elements in the array.
1033     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034     */
1035    struct LDKSignature *data;
1036    /**
1037     * The number of elements pointed to by `data`.
1038     */
1039    uintptr_t datalen;
1040 } LDKCVec_SignatureZ;
1041
1042
1043
1044 /**
1045  * Information needed to build and sign a holder's commitment transaction.
1046  *
1047  * The transaction is only signed once we are ready to broadcast.
1048  */
1049 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1050    /**
1051     * A pointer to the opaque Rust object.
1052     * Nearly everywhere, inner must be non-null, however in places where
1053     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1054     */
1055    LDKnativeHolderCommitmentTransaction *inner;
1056    /**
1057     * Indicates that this is the only struct which contains the same pointer.
1058     * Rust functions which take ownership of an object provided via an argument require
1059     * this to be true and invalidate the object pointed to by inner.
1060     */
1061    bool is_owned;
1062 } LDKHolderCommitmentTransaction;
1063
1064 /**
1065  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1066  */
1067 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1068    /**
1069     * A pointer to the contents in the success state.
1070     * Reading from this pointer when `result_ok` is not set is undefined.
1071     */
1072    struct LDKHolderCommitmentTransaction *result;
1073    /**
1074     * A pointer to the contents in the error state.
1075     * Reading from this pointer when `result_ok` is set is undefined.
1076     */
1077    struct LDKDecodeError *err;
1078 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1079
1080 /**
1081  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1082  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1083  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1084  */
1085 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1086    /**
1087     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1088     * `err` or `result` depending on the state of `result_ok`.
1089     */
1090    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1091    /**
1092     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093     */
1094    bool result_ok;
1095 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1096
1097
1098
1099 /**
1100  * A pre-built Bitcoin commitment transaction and its txid.
1101  */
1102 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1103    /**
1104     * A pointer to the opaque Rust object.
1105     * Nearly everywhere, inner must be non-null, however in places where
1106     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1107     */
1108    LDKnativeBuiltCommitmentTransaction *inner;
1109    /**
1110     * Indicates that this is the only struct which contains the same pointer.
1111     * Rust functions which take ownership of an object provided via an argument require
1112     * this to be true and invalidate the object pointed to by inner.
1113     */
1114    bool is_owned;
1115 } LDKBuiltCommitmentTransaction;
1116
1117 /**
1118  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1119  */
1120 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1121    /**
1122     * A pointer to the contents in the success state.
1123     * Reading from this pointer when `result_ok` is not set is undefined.
1124     */
1125    struct LDKBuiltCommitmentTransaction *result;
1126    /**
1127     * A pointer to the contents in the error state.
1128     * Reading from this pointer when `result_ok` is set is undefined.
1129     */
1130    struct LDKDecodeError *err;
1131 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1132
1133 /**
1134  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1135  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1136  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1137  */
1138 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1139    /**
1140     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1141     * `err` or `result` depending on the state of `result_ok`.
1142     */
1143    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1144    /**
1145     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1146     */
1147    bool result_ok;
1148 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1149
1150
1151
1152 /**
1153  * This class tracks the per-transaction information needed to build a commitment transaction and to
1154  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1155  * and for transactions we sign for the counterparty.
1156  *
1157  * This class can be used inside a signer implementation to generate a signature given the relevant
1158  * secret key.
1159  */
1160 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1161    /**
1162     * A pointer to the opaque Rust object.
1163     * Nearly everywhere, inner must be non-null, however in places where
1164     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1165     */
1166    LDKnativeCommitmentTransaction *inner;
1167    /**
1168     * Indicates that this is the only struct which contains the same pointer.
1169     * Rust functions which take ownership of an object provided via an argument require
1170     * this to be true and invalidate the object pointed to by inner.
1171     */
1172    bool is_owned;
1173 } LDKCommitmentTransaction;
1174
1175 /**
1176  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1177  */
1178 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1179    /**
1180     * A pointer to the contents in the success state.
1181     * Reading from this pointer when `result_ok` is not set is undefined.
1182     */
1183    struct LDKCommitmentTransaction *result;
1184    /**
1185     * A pointer to the contents in the error state.
1186     * Reading from this pointer when `result_ok` is set is undefined.
1187     */
1188    struct LDKDecodeError *err;
1189 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1190
1191 /**
1192  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1193  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1194  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1195  */
1196 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1197    /**
1198     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1199     * `err` or `result` depending on the state of `result_ok`.
1200     */
1201    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1202    /**
1203     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1204     */
1205    bool result_ok;
1206 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1207
1208
1209
1210 /**
1211  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1212  * transaction and the transaction creation keys) are trusted.
1213  *
1214  * See trust() and verify() functions on CommitmentTransaction.
1215  *
1216  * This structure implements Deref.
1217  */
1218 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1219    /**
1220     * A pointer to the opaque Rust object.
1221     * Nearly everywhere, inner must be non-null, however in places where
1222     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1223     */
1224    LDKnativeTrustedCommitmentTransaction *inner;
1225    /**
1226     * Indicates that this is the only struct which contains the same pointer.
1227     * Rust functions which take ownership of an object provided via an argument require
1228     * this to be true and invalidate the object pointed to by inner.
1229     */
1230    bool is_owned;
1231 } LDKTrustedCommitmentTransaction;
1232
1233 /**
1234  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1235  */
1236 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1237    /**
1238     * A pointer to the contents in the success state.
1239     * Reading from this pointer when `result_ok` is not set is undefined.
1240     */
1241    struct LDKTrustedCommitmentTransaction *result;
1242    /**
1243     * Note that this value is always NULL, as there are no contents in the Err variant
1244     */
1245    void *err;
1246 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1247
1248 /**
1249  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1250  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1251  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1252  */
1253 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1254    /**
1255     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1256     * `err` or `result` depending on the state of `result_ok`.
1257     */
1258    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1259    /**
1260     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1261     */
1262    bool result_ok;
1263 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1264
1265 /**
1266  * The contents of CResult_CVec_SignatureZNoneZ
1267  */
1268 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1269    /**
1270     * A pointer to the contents in the success state.
1271     * Reading from this pointer when `result_ok` is not set is undefined.
1272     */
1273    struct LDKCVec_SignatureZ *result;
1274    /**
1275     * Note that this value is always NULL, as there are no contents in the Err variant
1276     */
1277    void *err;
1278 } LDKCResult_CVec_SignatureZNoneZPtr;
1279
1280 /**
1281  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1282  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1283  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1284  */
1285 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1286    /**
1287     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1288     * `err` or `result` depending on the state of `result_ok`.
1289     */
1290    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1291    /**
1292     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1293     */
1294    bool result_ok;
1295 } LDKCResult_CVec_SignatureZNoneZ;
1296
1297 /**
1298  * The contents of CResult_SiPrefixNoneZ
1299  */
1300 typedef union LDKCResult_SiPrefixNoneZPtr {
1301    /**
1302     * A pointer to the contents in the success state.
1303     * Reading from this pointer when `result_ok` is not set is undefined.
1304     */
1305    enum LDKSiPrefix *result;
1306    /**
1307     * Note that this value is always NULL, as there are no contents in the Err variant
1308     */
1309    void *err;
1310 } LDKCResult_SiPrefixNoneZPtr;
1311
1312 /**
1313  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
1314  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
1315  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1316  */
1317 typedef struct LDKCResult_SiPrefixNoneZ {
1318    /**
1319     * The contents of this CResult_SiPrefixNoneZ, accessible via either
1320     * `err` or `result` depending on the state of `result_ok`.
1321     */
1322    union LDKCResult_SiPrefixNoneZPtr contents;
1323    /**
1324     * Whether this CResult_SiPrefixNoneZ represents a success state.
1325     */
1326    bool result_ok;
1327 } LDKCResult_SiPrefixNoneZ;
1328
1329
1330
1331 /**
1332  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
1333  *
1334  * There are three ways to construct an `Invoice`:
1335  *  1. using `InvoiceBuilder`
1336  *  2. using `Invoice::from_signed(SignedRawInvoice)`
1337  *  3. using `str::parse::<Invoice>(&str)`
1338  */
1339 typedef struct MUST_USE_STRUCT LDKInvoice {
1340    /**
1341     * A pointer to the opaque Rust object.
1342     * Nearly everywhere, inner must be non-null, however in places where
1343     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1344     */
1345    LDKnativeInvoice *inner;
1346    /**
1347     * Indicates that this is the only struct which contains the same pointer.
1348     * Rust functions which take ownership of an object provided via an argument require
1349     * this to be true and invalidate the object pointed to by inner.
1350     */
1351    bool is_owned;
1352 } LDKInvoice;
1353
1354 /**
1355  * The contents of CResult_InvoiceNoneZ
1356  */
1357 typedef union LDKCResult_InvoiceNoneZPtr {
1358    /**
1359     * A pointer to the contents in the success state.
1360     * Reading from this pointer when `result_ok` is not set is undefined.
1361     */
1362    struct LDKInvoice *result;
1363    /**
1364     * Note that this value is always NULL, as there are no contents in the Err variant
1365     */
1366    void *err;
1367 } LDKCResult_InvoiceNoneZPtr;
1368
1369 /**
1370  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
1371  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
1372  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1373  */
1374 typedef struct LDKCResult_InvoiceNoneZ {
1375    /**
1376     * The contents of this CResult_InvoiceNoneZ, accessible via either
1377     * `err` or `result` depending on the state of `result_ok`.
1378     */
1379    union LDKCResult_InvoiceNoneZPtr contents;
1380    /**
1381     * Whether this CResult_InvoiceNoneZ represents a success state.
1382     */
1383    bool result_ok;
1384 } LDKCResult_InvoiceNoneZ;
1385
1386
1387
1388 /**
1389  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
1390  * invalid.
1391  *
1392  * # Invariants
1393  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
1394  */
1395 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
1396    /**
1397     * A pointer to the opaque Rust object.
1398     * Nearly everywhere, inner must be non-null, however in places where
1399     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1400     */
1401    LDKnativeSignedRawInvoice *inner;
1402    /**
1403     * Indicates that this is the only struct which contains the same pointer.
1404     * Rust functions which take ownership of an object provided via an argument require
1405     * this to be true and invalidate the object pointed to by inner.
1406     */
1407    bool is_owned;
1408 } LDKSignedRawInvoice;
1409
1410 /**
1411  * The contents of CResult_SignedRawInvoiceNoneZ
1412  */
1413 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
1414    /**
1415     * A pointer to the contents in the success state.
1416     * Reading from this pointer when `result_ok` is not set is undefined.
1417     */
1418    struct LDKSignedRawInvoice *result;
1419    /**
1420     * Note that this value is always NULL, as there are no contents in the Err variant
1421     */
1422    void *err;
1423 } LDKCResult_SignedRawInvoiceNoneZPtr;
1424
1425 /**
1426  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
1427  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
1428  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1429  */
1430 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
1431    /**
1432     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
1433     * `err` or `result` depending on the state of `result_ok`.
1434     */
1435    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
1436    /**
1437     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
1438     */
1439    bool result_ok;
1440 } LDKCResult_SignedRawInvoiceNoneZ;
1441
1442
1443
1444 /**
1445  * Represents an syntactically correct Invoice for a payment on the lightning network,
1446  * but without the signature information.
1447  * De- and encoding should not lead to information loss but may lead to different hashes.
1448  *
1449  * For methods without docs see the corresponding methods in `Invoice`.
1450  */
1451 typedef struct MUST_USE_STRUCT LDKRawInvoice {
1452    /**
1453     * A pointer to the opaque Rust object.
1454     * Nearly everywhere, inner must be non-null, however in places where
1455     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1456     */
1457    LDKnativeRawInvoice *inner;
1458    /**
1459     * Indicates that this is the only struct which contains the same pointer.
1460     * Rust functions which take ownership of an object provided via an argument require
1461     * this to be true and invalidate the object pointed to by inner.
1462     */
1463    bool is_owned;
1464 } LDKRawInvoice;
1465
1466 /**
1467  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1468  * look up the corresponding function in rust-lightning's docs.
1469  */
1470 typedef struct LDKThirtyTwoBytes {
1471    /**
1472     * The thirty-two bytes
1473     */
1474    uint8_t data[32];
1475 } LDKThirtyTwoBytes;
1476
1477
1478
1479 /**
1480  * Recoverable signature
1481  */
1482 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
1483    /**
1484     * A pointer to the opaque Rust object.
1485     * Nearly everywhere, inner must be non-null, however in places where
1486     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1487     */
1488    LDKnativeInvoiceSignature *inner;
1489    /**
1490     * Indicates that this is the only struct which contains the same pointer.
1491     * Rust functions which take ownership of an object provided via an argument require
1492     * this to be true and invalidate the object pointed to by inner.
1493     */
1494    bool is_owned;
1495 } LDKInvoiceSignature;
1496
1497 /**
1498  * A tuple of 3 elements. See the individual fields for the types contained.
1499  */
1500 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
1501    /**
1502     * The element at position 0
1503     */
1504    struct LDKRawInvoice a;
1505    /**
1506     * The element at position 1
1507     */
1508    struct LDKThirtyTwoBytes b;
1509    /**
1510     * The element at position 2
1511     */
1512    struct LDKInvoiceSignature c;
1513 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
1514
1515
1516
1517 /**
1518  * Payee public key
1519  */
1520 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
1521    /**
1522     * A pointer to the opaque Rust object.
1523     * Nearly everywhere, inner must be non-null, however in places where
1524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1525     */
1526    LDKnativePayeePubKey *inner;
1527    /**
1528     * Indicates that this is the only struct which contains the same pointer.
1529     * Rust functions which take ownership of an object provided via an argument require
1530     * this to be true and invalidate the object pointed to by inner.
1531     */
1532    bool is_owned;
1533 } LDKPayeePubKey;
1534
1535 /**
1536  * The contents of CResult_PayeePubKeyErrorZ
1537  */
1538 typedef union LDKCResult_PayeePubKeyErrorZPtr {
1539    /**
1540     * A pointer to the contents in the success state.
1541     * Reading from this pointer when `result_ok` is not set is undefined.
1542     */
1543    struct LDKPayeePubKey *result;
1544    /**
1545     * A pointer to the contents in the error state.
1546     * Reading from this pointer when `result_ok` is set is undefined.
1547     */
1548    enum LDKSecp256k1Error *err;
1549 } LDKCResult_PayeePubKeyErrorZPtr;
1550
1551 /**
1552  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1553  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1555  */
1556 typedef struct LDKCResult_PayeePubKeyErrorZ {
1557    /**
1558     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1559     * `err` or `result` depending on the state of `result_ok`.
1560     */
1561    union LDKCResult_PayeePubKeyErrorZPtr contents;
1562    /**
1563     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
1564     */
1565    bool result_ok;
1566 } LDKCResult_PayeePubKeyErrorZ;
1567
1568
1569
1570 /**
1571  * Private routing information
1572  *
1573  * # Invariants
1574  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
1575  *
1576  */
1577 typedef struct MUST_USE_STRUCT LDKRouteHint {
1578    /**
1579     * A pointer to the opaque Rust object.
1580     * Nearly everywhere, inner must be non-null, however in places where
1581     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1582     */
1583    LDKnativeRouteHint *inner;
1584    /**
1585     * Indicates that this is the only struct which contains the same pointer.
1586     * Rust functions which take ownership of an object provided via an argument require
1587     * this to be true and invalidate the object pointed to by inner.
1588     */
1589    bool is_owned;
1590 } LDKRouteHint;
1591
1592 /**
1593  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1594  * This corresponds to std::vector in C++
1595  */
1596 typedef struct LDKCVec_RouteHintZ {
1597    /**
1598     * The elements in the array.
1599     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1600     */
1601    struct LDKRouteHint *data;
1602    /**
1603     * The number of elements pointed to by `data`.
1604     */
1605    uintptr_t datalen;
1606 } LDKCVec_RouteHintZ;
1607
1608 /**
1609  * An enum which can either contain a u64 or not
1610  */
1611 typedef enum LDKCOption_u64Z_Tag {
1612    /**
1613     * When we're in this state, this COption_u64Z contains a u64
1614     */
1615    LDKCOption_u64Z_Some,
1616    /**
1617     * When we're in this state, this COption_u64Z contains nothing
1618     */
1619    LDKCOption_u64Z_None,
1620    /**
1621     * Must be last for serialization purposes
1622     */
1623    LDKCOption_u64Z_Sentinel,
1624 } LDKCOption_u64Z_Tag;
1625
1626 typedef struct LDKCOption_u64Z {
1627    LDKCOption_u64Z_Tag tag;
1628    union {
1629       struct {
1630          uint64_t some;
1631       };
1632    };
1633 } LDKCOption_u64Z;
1634
1635
1636
1637 /**
1638  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
1639  * timestamp is positive.
1640  *
1641  * # Invariants
1642  * The UNIX timestamp representing the stored time has to be positive and small enough so that
1643  * a `EpiryTime` can be added to it without an overflow.
1644  */
1645 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
1646    /**
1647     * A pointer to the opaque Rust object.
1648     * Nearly everywhere, inner must be non-null, however in places where
1649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1650     */
1651    LDKnativePositiveTimestamp *inner;
1652    /**
1653     * Indicates that this is the only struct which contains the same pointer.
1654     * Rust functions which take ownership of an object provided via an argument require
1655     * this to be true and invalidate the object pointed to by inner.
1656     */
1657    bool is_owned;
1658 } LDKPositiveTimestamp;
1659
1660 /**
1661  * The contents of CResult_PositiveTimestampCreationErrorZ
1662  */
1663 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
1664    /**
1665     * A pointer to the contents in the success state.
1666     * Reading from this pointer when `result_ok` is not set is undefined.
1667     */
1668    struct LDKPositiveTimestamp *result;
1669    /**
1670     * A pointer to the contents in the error state.
1671     * Reading from this pointer when `result_ok` is set is undefined.
1672     */
1673    enum LDKCreationError *err;
1674 } LDKCResult_PositiveTimestampCreationErrorZPtr;
1675
1676 /**
1677  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1678  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1680  */
1681 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
1682    /**
1683     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1684     * `err` or `result` depending on the state of `result_ok`.
1685     */
1686    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
1687    /**
1688     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1689     */
1690    bool result_ok;
1691 } LDKCResult_PositiveTimestampCreationErrorZ;
1692
1693 /**
1694  * The contents of CResult_NoneSemanticErrorZ
1695  */
1696 typedef union LDKCResult_NoneSemanticErrorZPtr {
1697    /**
1698     * Note that this value is always NULL, as there are no contents in the OK variant
1699     */
1700    void *result;
1701    /**
1702     * A pointer to the contents in the error state.
1703     * Reading from this pointer when `result_ok` is set is undefined.
1704     */
1705    enum LDKSemanticError *err;
1706 } LDKCResult_NoneSemanticErrorZPtr;
1707
1708 /**
1709  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1710  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1712  */
1713 typedef struct LDKCResult_NoneSemanticErrorZ {
1714    /**
1715     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
1716     * `err` or `result` depending on the state of `result_ok`.
1717     */
1718    union LDKCResult_NoneSemanticErrorZPtr contents;
1719    /**
1720     * Whether this CResult_NoneSemanticErrorZ represents a success state.
1721     */
1722    bool result_ok;
1723 } LDKCResult_NoneSemanticErrorZ;
1724
1725 /**
1726  * The contents of CResult_InvoiceSemanticErrorZ
1727  */
1728 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
1729    /**
1730     * A pointer to the contents in the success state.
1731     * Reading from this pointer when `result_ok` is not set is undefined.
1732     */
1733    struct LDKInvoice *result;
1734    /**
1735     * A pointer to the contents in the error state.
1736     * Reading from this pointer when `result_ok` is set is undefined.
1737     */
1738    enum LDKSemanticError *err;
1739 } LDKCResult_InvoiceSemanticErrorZPtr;
1740
1741 /**
1742  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1743  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1745  */
1746 typedef struct LDKCResult_InvoiceSemanticErrorZ {
1747    /**
1748     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1749     * `err` or `result` depending on the state of `result_ok`.
1750     */
1751    union LDKCResult_InvoiceSemanticErrorZPtr contents;
1752    /**
1753     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1754     */
1755    bool result_ok;
1756 } LDKCResult_InvoiceSemanticErrorZ;
1757
1758
1759
1760 /**
1761  * Description string
1762  *
1763  * # Invariants
1764  * The description can be at most 639 __bytes__ long
1765  */
1766 typedef struct MUST_USE_STRUCT LDKDescription {
1767    /**
1768     * A pointer to the opaque Rust object.
1769     * Nearly everywhere, inner must be non-null, however in places where
1770     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1771     */
1772    LDKnativeDescription *inner;
1773    /**
1774     * Indicates that this is the only struct which contains the same pointer.
1775     * Rust functions which take ownership of an object provided via an argument require
1776     * this to be true and invalidate the object pointed to by inner.
1777     */
1778    bool is_owned;
1779 } LDKDescription;
1780
1781 /**
1782  * The contents of CResult_DescriptionCreationErrorZ
1783  */
1784 typedef union LDKCResult_DescriptionCreationErrorZPtr {
1785    /**
1786     * A pointer to the contents in the success state.
1787     * Reading from this pointer when `result_ok` is not set is undefined.
1788     */
1789    struct LDKDescription *result;
1790    /**
1791     * A pointer to the contents in the error state.
1792     * Reading from this pointer when `result_ok` is set is undefined.
1793     */
1794    enum LDKCreationError *err;
1795 } LDKCResult_DescriptionCreationErrorZPtr;
1796
1797 /**
1798  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1799  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1800  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1801  */
1802 typedef struct LDKCResult_DescriptionCreationErrorZ {
1803    /**
1804     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1805     * `err` or `result` depending on the state of `result_ok`.
1806     */
1807    union LDKCResult_DescriptionCreationErrorZPtr contents;
1808    /**
1809     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
1810     */
1811    bool result_ok;
1812 } LDKCResult_DescriptionCreationErrorZ;
1813
1814
1815
1816 /**
1817  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
1818  * expires
1819  *
1820  * # Invariants
1821  * The number of seconds this expiry time represents has to be in the range
1822  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
1823  * timestamp
1824  */
1825 typedef struct MUST_USE_STRUCT LDKExpiryTime {
1826    /**
1827     * A pointer to the opaque Rust object.
1828     * Nearly everywhere, inner must be non-null, however in places where
1829     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1830     */
1831    LDKnativeExpiryTime *inner;
1832    /**
1833     * Indicates that this is the only struct which contains the same pointer.
1834     * Rust functions which take ownership of an object provided via an argument require
1835     * this to be true and invalidate the object pointed to by inner.
1836     */
1837    bool is_owned;
1838 } LDKExpiryTime;
1839
1840 /**
1841  * The contents of CResult_ExpiryTimeCreationErrorZ
1842  */
1843 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
1844    /**
1845     * A pointer to the contents in the success state.
1846     * Reading from this pointer when `result_ok` is not set is undefined.
1847     */
1848    struct LDKExpiryTime *result;
1849    /**
1850     * A pointer to the contents in the error state.
1851     * Reading from this pointer when `result_ok` is set is undefined.
1852     */
1853    enum LDKCreationError *err;
1854 } LDKCResult_ExpiryTimeCreationErrorZPtr;
1855
1856 /**
1857  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
1858  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
1859  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1860  */
1861 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
1862    /**
1863     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
1864     * `err` or `result` depending on the state of `result_ok`.
1865     */
1866    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
1867    /**
1868     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
1869     */
1870    bool result_ok;
1871 } LDKCResult_ExpiryTimeCreationErrorZ;
1872
1873
1874
1875 /**
1876  * A channel descriptor which provides a last-hop route to get_route
1877  */
1878 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1879    /**
1880     * A pointer to the opaque Rust object.
1881     * Nearly everywhere, inner must be non-null, however in places where
1882     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1883     */
1884    LDKnativeRouteHintHop *inner;
1885    /**
1886     * Indicates that this is the only struct which contains the same pointer.
1887     * Rust functions which take ownership of an object provided via an argument require
1888     * this to be true and invalidate the object pointed to by inner.
1889     */
1890    bool is_owned;
1891 } LDKRouteHintHop;
1892
1893 /**
1894  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1895  * This corresponds to std::vector in C++
1896  */
1897 typedef struct LDKCVec_RouteHintHopZ {
1898    /**
1899     * The elements in the array.
1900     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1901     */
1902    struct LDKRouteHintHop *data;
1903    /**
1904     * The number of elements pointed to by `data`.
1905     */
1906    uintptr_t datalen;
1907 } LDKCVec_RouteHintHopZ;
1908
1909 /**
1910  * The contents of CResult_RouteHintCreationErrorZ
1911  */
1912 typedef union LDKCResult_RouteHintCreationErrorZPtr {
1913    /**
1914     * A pointer to the contents in the success state.
1915     * Reading from this pointer when `result_ok` is not set is undefined.
1916     */
1917    struct LDKRouteHint *result;
1918    /**
1919     * A pointer to the contents in the error state.
1920     * Reading from this pointer when `result_ok` is set is undefined.
1921     */
1922    enum LDKCreationError *err;
1923 } LDKCResult_RouteHintCreationErrorZPtr;
1924
1925 /**
1926  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
1927  * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
1928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1929  */
1930 typedef struct LDKCResult_RouteHintCreationErrorZ {
1931    /**
1932     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
1933     * `err` or `result` depending on the state of `result_ok`.
1934     */
1935    union LDKCResult_RouteHintCreationErrorZPtr contents;
1936    /**
1937     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
1938     */
1939    bool result_ok;
1940 } LDKCResult_RouteHintCreationErrorZ;
1941
1942 /**
1943  * The contents of CResult_StringErrorZ
1944  */
1945 typedef union LDKCResult_StringErrorZPtr {
1946    /**
1947     * A pointer to the contents in the success state.
1948     * Reading from this pointer when `result_ok` is not set is undefined.
1949     */
1950    struct LDKStr *result;
1951    /**
1952     * A pointer to the contents in the error state.
1953     * Reading from this pointer when `result_ok` is set is undefined.
1954     */
1955    enum LDKSecp256k1Error *err;
1956 } LDKCResult_StringErrorZPtr;
1957
1958 /**
1959  * A CResult_StringErrorZ represents the result of a fallible operation,
1960  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
1961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1962  */
1963 typedef struct LDKCResult_StringErrorZ {
1964    /**
1965     * The contents of this CResult_StringErrorZ, accessible via either
1966     * `err` or `result` depending on the state of `result_ok`.
1967     */
1968    union LDKCResult_StringErrorZPtr contents;
1969    /**
1970     * Whether this CResult_StringErrorZ represents a success state.
1971     */
1972    bool result_ok;
1973 } LDKCResult_StringErrorZ;
1974
1975
1976
1977 /**
1978  * An update generated by the underlying Channel itself which contains some new information the
1979  * ChannelMonitor should be made aware of.
1980  */
1981 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1982    /**
1983     * A pointer to the opaque Rust object.
1984     * Nearly everywhere, inner must be non-null, however in places where
1985     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1986     */
1987    LDKnativeChannelMonitorUpdate *inner;
1988    /**
1989     * Indicates that this is the only struct which contains the same pointer.
1990     * Rust functions which take ownership of an object provided via an argument require
1991     * this to be true and invalidate the object pointed to by inner.
1992     */
1993    bool is_owned;
1994 } LDKChannelMonitorUpdate;
1995
1996 /**
1997  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1998  */
1999 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
2000    /**
2001     * A pointer to the contents in the success state.
2002     * Reading from this pointer when `result_ok` is not set is undefined.
2003     */
2004    struct LDKChannelMonitorUpdate *result;
2005    /**
2006     * A pointer to the contents in the error state.
2007     * Reading from this pointer when `result_ok` is set is undefined.
2008     */
2009    struct LDKDecodeError *err;
2010 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
2011
2012 /**
2013  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2014  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2015  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2016  */
2017 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
2018    /**
2019     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2020     * `err` or `result` depending on the state of `result_ok`.
2021     */
2022    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
2023    /**
2024     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2025     */
2026    bool result_ok;
2027 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2028
2029
2030
2031 /**
2032  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2033  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2034  * preimage claim backward will lead to loss of funds.
2035  */
2036 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2037    /**
2038     * A pointer to the opaque Rust object.
2039     * Nearly everywhere, inner must be non-null, however in places where
2040     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2041     */
2042    LDKnativeHTLCUpdate *inner;
2043    /**
2044     * Indicates that this is the only struct which contains the same pointer.
2045     * Rust functions which take ownership of an object provided via an argument require
2046     * this to be true and invalidate the object pointed to by inner.
2047     */
2048    bool is_owned;
2049 } LDKHTLCUpdate;
2050
2051 /**
2052  * The contents of CResult_HTLCUpdateDecodeErrorZ
2053  */
2054 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
2055    /**
2056     * A pointer to the contents in the success state.
2057     * Reading from this pointer when `result_ok` is not set is undefined.
2058     */
2059    struct LDKHTLCUpdate *result;
2060    /**
2061     * A pointer to the contents in the error state.
2062     * Reading from this pointer when `result_ok` is set is undefined.
2063     */
2064    struct LDKDecodeError *err;
2065 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
2066
2067 /**
2068  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2069  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2070  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2071  */
2072 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
2073    /**
2074     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2075     * `err` or `result` depending on the state of `result_ok`.
2076     */
2077    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
2078    /**
2079     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2080     */
2081    bool result_ok;
2082 } LDKCResult_HTLCUpdateDecodeErrorZ;
2083
2084
2085
2086 /**
2087  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
2088  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
2089  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
2090  * corrupted.
2091  * Contains a developer-readable error message.
2092  */
2093 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
2094    /**
2095     * A pointer to the opaque Rust object.
2096     * Nearly everywhere, inner must be non-null, however in places where
2097     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2098     */
2099    LDKnativeMonitorUpdateError *inner;
2100    /**
2101     * Indicates that this is the only struct which contains the same pointer.
2102     * Rust functions which take ownership of an object provided via an argument require
2103     * this to be true and invalidate the object pointed to by inner.
2104     */
2105    bool is_owned;
2106 } LDKMonitorUpdateError;
2107
2108 /**
2109  * The contents of CResult_NoneMonitorUpdateErrorZ
2110  */
2111 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
2112    /**
2113     * Note that this value is always NULL, as there are no contents in the OK variant
2114     */
2115    void *result;
2116    /**
2117     * A pointer to the contents in the error state.
2118     * Reading from this pointer when `result_ok` is set is undefined.
2119     */
2120    struct LDKMonitorUpdateError *err;
2121 } LDKCResult_NoneMonitorUpdateErrorZPtr;
2122
2123 /**
2124  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2125  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2126  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2127  */
2128 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
2129    /**
2130     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2131     * `err` or `result` depending on the state of `result_ok`.
2132     */
2133    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
2134    /**
2135     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2136     */
2137    bool result_ok;
2138 } LDKCResult_NoneMonitorUpdateErrorZ;
2139
2140 /**
2141  * A tuple of 2 elements. See the individual fields for the types contained.
2142  */
2143 typedef struct LDKC2Tuple_OutPointScriptZ {
2144    /**
2145     * The element at position 0
2146     */
2147    struct LDKOutPoint a;
2148    /**
2149     * The element at position 1
2150     */
2151    struct LDKCVec_u8Z b;
2152 } LDKC2Tuple_OutPointScriptZ;
2153
2154 /**
2155  * A tuple of 2 elements. See the individual fields for the types contained.
2156  */
2157 typedef struct LDKC2Tuple_u32ScriptZ {
2158    /**
2159     * The element at position 0
2160     */
2161    uint32_t a;
2162    /**
2163     * The element at position 1
2164     */
2165    struct LDKCVec_u8Z b;
2166 } LDKC2Tuple_u32ScriptZ;
2167
2168 /**
2169  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2170  * This corresponds to std::vector in C++
2171  */
2172 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
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 LDKC2Tuple_u32ScriptZ *data;
2178    /**
2179     * The number of elements pointed to by `data`.
2180     */
2181    uintptr_t datalen;
2182 } LDKCVec_C2Tuple_u32ScriptZZ;
2183
2184 /**
2185  * A tuple of 2 elements. See the individual fields for the types contained.
2186  */
2187 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2188    /**
2189     * The element at position 0
2190     */
2191    struct LDKThirtyTwoBytes a;
2192    /**
2193     * The element at position 1
2194     */
2195    struct LDKCVec_C2Tuple_u32ScriptZZ b;
2196 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
2197
2198 /**
2199  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2200  * This corresponds to std::vector in C++
2201  */
2202 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2203    /**
2204     * The elements in the array.
2205     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2206     */
2207    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
2208    /**
2209     * The number of elements pointed to by `data`.
2210     */
2211    uintptr_t datalen;
2212 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
2213
2214 /**
2215  * An event to be processed by the ChannelManager.
2216  */
2217 typedef enum LDKMonitorEvent_Tag {
2218    /**
2219     * A monitor event containing an HTLCUpdate.
2220     */
2221    LDKMonitorEvent_HTLCEvent,
2222    /**
2223     * A monitor event that the Channel's commitment transaction was broadcasted.
2224     */
2225    LDKMonitorEvent_CommitmentTxBroadcasted,
2226    /**
2227     * Must be last for serialization purposes
2228     */
2229    LDKMonitorEvent_Sentinel,
2230 } LDKMonitorEvent_Tag;
2231
2232 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2233    LDKMonitorEvent_Tag tag;
2234    union {
2235       struct {
2236          struct LDKHTLCUpdate htlc_event;
2237       };
2238       struct {
2239          struct LDKOutPoint commitment_tx_broadcasted;
2240       };
2241    };
2242 } LDKMonitorEvent;
2243
2244 /**
2245  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2246  * This corresponds to std::vector in C++
2247  */
2248 typedef struct LDKCVec_MonitorEventZ {
2249    /**
2250     * The elements in the array.
2251     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2252     */
2253    struct LDKMonitorEvent *data;
2254    /**
2255     * The number of elements pointed to by `data`.
2256     */
2257    uintptr_t datalen;
2258 } LDKCVec_MonitorEventZ;
2259
2260
2261
2262 /**
2263  * Information about a spendable output to a P2WSH script. See
2264  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2265  */
2266 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2267    /**
2268     * A pointer to the opaque Rust object.
2269     * Nearly everywhere, inner must be non-null, however in places where
2270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2271     */
2272    LDKnativeDelayedPaymentOutputDescriptor *inner;
2273    /**
2274     * Indicates that this is the only struct which contains the same pointer.
2275     * Rust functions which take ownership of an object provided via an argument require
2276     * this to be true and invalidate the object pointed to by inner.
2277     */
2278    bool is_owned;
2279 } LDKDelayedPaymentOutputDescriptor;
2280
2281
2282
2283 /**
2284  * Information about a spendable output to our \"payment key\". See
2285  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2286  */
2287 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2288    /**
2289     * A pointer to the opaque Rust object.
2290     * Nearly everywhere, inner must be non-null, however in places where
2291     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2292     */
2293    LDKnativeStaticPaymentOutputDescriptor *inner;
2294    /**
2295     * Indicates that this is the only struct which contains the same pointer.
2296     * Rust functions which take ownership of an object provided via an argument require
2297     * this to be true and invalidate the object pointed to by inner.
2298     */
2299    bool is_owned;
2300 } LDKStaticPaymentOutputDescriptor;
2301
2302 /**
2303  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2304  * claim at any point in the future) an event is generated which you must track and be able to
2305  * spend on-chain. The information needed to do this is provided in this enum, including the
2306  * outpoint describing which txid and output index is available, the full output which exists at
2307  * that txid/index, and any keys or other information required to sign.
2308  */
2309 typedef enum LDKSpendableOutputDescriptor_Tag {
2310    /**
2311     * An output to a script which was provided via KeysInterface directly, either from
2312     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
2313     * spend it. No secret keys are provided as rust-lightning was never given any key.
2314     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2315     * on-chain using the payment preimage or after it has timed out.
2316     */
2317    LDKSpendableOutputDescriptor_StaticOutput,
2318    /**
2319     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2320     *
2321     * The witness in the spending input should be:
2322     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2323     *
2324     * Note that the nSequence field in the spending input must be set to to_self_delay
2325     * (which means the transaction is not broadcastable until at least to_self_delay
2326     * blocks after the outpoint confirms).
2327     *
2328     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2329     * it is an output from an old state which we broadcast (which should never happen).
2330     *
2331     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2332     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2333     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2334     * chan_utils::derive_private_key. The public key can be generated without the secret key
2335     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2336     * Sign::pubkeys().
2337     *
2338     * To derive the revocation_pubkey provided here (which is used in the witness
2339     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2340     * call to Sign::ready_channel) and the provided per_commitment point
2341     * to chan_utils::derive_public_revocation_key.
2342     *
2343     * The witness script which is hashed and included in the output script_pubkey may be
2344     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2345     * (derived as above), and the to_self_delay contained here to
2346     * chan_utils::get_revokeable_redeemscript.
2347     */
2348    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2349    /**
2350     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2351     * corresponds to the public key in Sign::pubkeys().payment_point).
2352     * The witness in the spending input, is, thus, simply:
2353     * <BIP 143 signature> <payment key>
2354     *
2355     * These are generally the result of our counterparty having broadcast the current state,
2356     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2357     */
2358    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2359    /**
2360     * Must be last for serialization purposes
2361     */
2362    LDKSpendableOutputDescriptor_Sentinel,
2363 } LDKSpendableOutputDescriptor_Tag;
2364
2365 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2366    /**
2367     * The outpoint which is spendable
2368     */
2369    struct LDKOutPoint outpoint;
2370    /**
2371     * The output which is referenced by the given outpoint.
2372     */
2373    struct LDKTxOut output;
2374 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2375
2376 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2377    LDKSpendableOutputDescriptor_Tag tag;
2378    union {
2379       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2380       struct {
2381          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2382       };
2383       struct {
2384          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2385       };
2386    };
2387 } LDKSpendableOutputDescriptor;
2388
2389 /**
2390  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2391  * This corresponds to std::vector in C++
2392  */
2393 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2394    /**
2395     * The elements in the array.
2396     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2397     */
2398    struct LDKSpendableOutputDescriptor *data;
2399    /**
2400     * The number of elements pointed to by `data`.
2401     */
2402    uintptr_t datalen;
2403 } LDKCVec_SpendableOutputDescriptorZ;
2404
2405 /**
2406  * An Event which you should probably take some action in response to.
2407  *
2408  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2409  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2410  * written as it makes no sense to respond to it after reconnecting to peers).
2411  */
2412 typedef enum LDKEvent_Tag {
2413    /**
2414     * Used to indicate that the client should generate a funding transaction with the given
2415     * parameters and then call ChannelManager::funding_transaction_generated.
2416     * Generated in ChannelManager message handling.
2417     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2418     * counterparty can steal your funds!
2419     */
2420    LDKEvent_FundingGenerationReady,
2421    /**
2422     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2423     * ChannelManager::claim_funds to get it....
2424     * Note that if the preimage is not known or the amount paid is incorrect, you should call
2425     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2426     * network congestion.
2427     * The amount paid should be considered 'incorrect' when it is less than or more than twice
2428     * the amount expected.
2429     * If you fail to call either ChannelManager::claim_funds or
2430     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2431     * automatically failed.
2432     */
2433    LDKEvent_PaymentReceived,
2434    /**
2435     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2436     * and we got back the payment preimage for it).
2437     */
2438    LDKEvent_PaymentSent,
2439    /**
2440     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2441     * something. You may wish to retry with a different route.
2442     */
2443    LDKEvent_PaymentFailed,
2444    /**
2445     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2446     * time in the future.
2447     */
2448    LDKEvent_PendingHTLCsForwardable,
2449    /**
2450     * Used to indicate that an output was generated on-chain which you should know how to spend.
2451     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2452     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2453     * somewhere and spend them when you create on-chain transactions.
2454     */
2455    LDKEvent_SpendableOutputs,
2456    /**
2457     * Must be last for serialization purposes
2458     */
2459    LDKEvent_Sentinel,
2460 } LDKEvent_Tag;
2461
2462 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2463    /**
2464     * The random channel_id we picked which you'll need to pass into
2465     * ChannelManager::funding_transaction_generated.
2466     */
2467    struct LDKThirtyTwoBytes temporary_channel_id;
2468    /**
2469     * The value, in satoshis, that the output should have.
2470     */
2471    uint64_t channel_value_satoshis;
2472    /**
2473     * The script which should be used in the transaction output.
2474     */
2475    struct LDKCVec_u8Z output_script;
2476    /**
2477     * The value passed in to ChannelManager::create_channel
2478     */
2479    uint64_t user_channel_id;
2480 } LDKEvent_LDKFundingGenerationReady_Body;
2481
2482 typedef struct LDKEvent_LDKPaymentReceived_Body {
2483    /**
2484     * The hash for which the preimage should be handed to the ChannelManager.
2485     */
2486    struct LDKThirtyTwoBytes payment_hash;
2487    /**
2488     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2489     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2490     * [`ChannelManager::claim_funds`].
2491     *
2492     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2493     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2494     */
2495    struct LDKThirtyTwoBytes payment_preimage;
2496    /**
2497     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2498     * number of deanonymization attacks during the routing process.
2499     * It is provided here for your reference, however its accuracy is enforced directly by
2500     * [`ChannelManager`] using the values you previously provided to
2501     * [`ChannelManager::create_inbound_payment`] or
2502     * [`ChannelManager::create_inbound_payment_for_hash`].
2503     *
2504     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2505     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2506     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2507     */
2508    struct LDKThirtyTwoBytes payment_secret;
2509    /**
2510     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
2511     * compare this to the expected value before accepting the payment (as otherwise you are
2512     * providing proof-of-payment for less than the value you expected!).
2513     */
2514    uint64_t amt;
2515    /**
2516     * This is the `user_payment_id` which was provided to
2517     * [`ChannelManager::create_inbound_payment_for_hash`] or
2518     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
2519     * simply copied here. It may be used to correlate PaymentReceived events with invoice
2520     * metadata stored elsewhere.
2521     *
2522     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2523     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2524     */
2525    uint64_t user_payment_id;
2526 } LDKEvent_LDKPaymentReceived_Body;
2527
2528 typedef struct LDKEvent_LDKPaymentSent_Body {
2529    /**
2530     * The preimage to the hash given to ChannelManager::send_payment.
2531     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2532     * store it somehow!
2533     */
2534    struct LDKThirtyTwoBytes payment_preimage;
2535 } LDKEvent_LDKPaymentSent_Body;
2536
2537 typedef struct LDKEvent_LDKPaymentFailed_Body {
2538    /**
2539     * The hash which was given to ChannelManager::send_payment.
2540     */
2541    struct LDKThirtyTwoBytes payment_hash;
2542    /**
2543     * Indicates the payment was rejected for some reason by the recipient. This implies that
2544     * the payment has failed, not just the route in question. If this is not set, you may
2545     * retry the payment via a different route.
2546     */
2547    bool rejected_by_dest;
2548 } LDKEvent_LDKPaymentFailed_Body;
2549
2550 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2551    /**
2552     * The minimum amount of time that should be waited prior to calling
2553     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2554     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2555     * now + 5*time_forwardable).
2556     */
2557    uint64_t time_forwardable;
2558 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2559
2560 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2561    /**
2562     * The outputs which you should store as spendable by you.
2563     */
2564    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2565 } LDKEvent_LDKSpendableOutputs_Body;
2566
2567 typedef struct MUST_USE_STRUCT LDKEvent {
2568    LDKEvent_Tag tag;
2569    union {
2570       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2571       LDKEvent_LDKPaymentReceived_Body payment_received;
2572       LDKEvent_LDKPaymentSent_Body payment_sent;
2573       LDKEvent_LDKPaymentFailed_Body payment_failed;
2574       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2575       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2576    };
2577 } LDKEvent;
2578
2579 /**
2580  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2581  * This corresponds to std::vector in C++
2582  */
2583 typedef struct LDKCVec_EventZ {
2584    /**
2585     * The elements in the array.
2586     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2587     */
2588    struct LDKEvent *data;
2589    /**
2590     * The number of elements pointed to by `data`.
2591     */
2592    uintptr_t datalen;
2593 } LDKCVec_EventZ;
2594
2595 /**
2596  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2597  * This corresponds to std::vector in C++
2598  */
2599 typedef struct LDKCVec_TransactionZ {
2600    /**
2601     * The elements in the array.
2602     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2603     */
2604    struct LDKTransaction *data;
2605    /**
2606     * The number of elements pointed to by `data`.
2607     */
2608    uintptr_t datalen;
2609 } LDKCVec_TransactionZ;
2610
2611 /**
2612  * A tuple of 2 elements. See the individual fields for the types contained.
2613  */
2614 typedef struct LDKC2Tuple_usizeTransactionZ {
2615    /**
2616     * The element at position 0
2617     */
2618    uintptr_t a;
2619    /**
2620     * The element at position 1
2621     */
2622    struct LDKTransaction b;
2623 } LDKC2Tuple_usizeTransactionZ;
2624
2625 /**
2626  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2627  * This corresponds to std::vector in C++
2628  */
2629 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2630    /**
2631     * The elements in the array.
2632     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2633     */
2634    struct LDKC2Tuple_usizeTransactionZ *data;
2635    /**
2636     * The number of elements pointed to by `data`.
2637     */
2638    uintptr_t datalen;
2639 } LDKCVec_C2Tuple_usizeTransactionZZ;
2640
2641 /**
2642  * A tuple of 2 elements. See the individual fields for the types contained.
2643  */
2644 typedef struct LDKC2Tuple_u32TxOutZ {
2645    /**
2646     * The element at position 0
2647     */
2648    uint32_t a;
2649    /**
2650     * The element at position 1
2651     */
2652    struct LDKTxOut b;
2653 } LDKC2Tuple_u32TxOutZ;
2654
2655 /**
2656  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2657  * This corresponds to std::vector in C++
2658  */
2659 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
2660    /**
2661     * The elements in the array.
2662     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2663     */
2664    struct LDKC2Tuple_u32TxOutZ *data;
2665    /**
2666     * The number of elements pointed to by `data`.
2667     */
2668    uintptr_t datalen;
2669 } LDKCVec_C2Tuple_u32TxOutZZ;
2670
2671 /**
2672  * A tuple of 2 elements. See the individual fields for the types contained.
2673  */
2674 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2675    /**
2676     * The element at position 0
2677     */
2678    struct LDKThirtyTwoBytes a;
2679    /**
2680     * The element at position 1
2681     */
2682    struct LDKCVec_C2Tuple_u32TxOutZZ b;
2683 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
2684
2685 /**
2686  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2687  * This corresponds to std::vector in C++
2688  */
2689 typedef struct LDKCVec_TransactionOutputsZ {
2690    /**
2691     * The elements in the array.
2692     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2693     */
2694    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
2695    /**
2696     * The number of elements pointed to by `data`.
2697     */
2698    uintptr_t datalen;
2699 } LDKCVec_TransactionOutputsZ;
2700
2701 /**
2702  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2703  * This corresponds to std::vector in C++
2704  */
2705 typedef struct LDKCVec_TxidZ {
2706    /**
2707     * The elements in the array.
2708     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2709     */
2710    struct LDKThirtyTwoBytes *data;
2711    /**
2712     * The number of elements pointed to by `data`.
2713     */
2714    uintptr_t datalen;
2715 } LDKCVec_TxidZ;
2716
2717 /**
2718  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2719  */
2720 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2721    /**
2722     * Note that this value is always NULL, as there are no contents in the OK variant
2723     */
2724    void *result;
2725    /**
2726     * A pointer to the contents in the error state.
2727     * Reading from this pointer when `result_ok` is set is undefined.
2728     */
2729    enum LDKChannelMonitorUpdateErr *err;
2730 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2731
2732 /**
2733  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2734  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2736  */
2737 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2738    /**
2739     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2740     * `err` or `result` depending on the state of `result_ok`.
2741     */
2742    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2743    /**
2744     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2745     */
2746    bool result_ok;
2747 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2748
2749 /**
2750  * A tuple of 2 elements. See the individual fields for the types contained.
2751  */
2752 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2753    /**
2754     * The element at position 0
2755     */
2756    struct LDKSignature a;
2757    /**
2758     * The element at position 1
2759     */
2760    struct LDKCVec_SignatureZ b;
2761 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2762
2763 /**
2764  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2765  */
2766 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2767    /**
2768     * A pointer to the contents in the success state.
2769     * Reading from this pointer when `result_ok` is not set is undefined.
2770     */
2771    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2772    /**
2773     * Note that this value is always NULL, as there are no contents in the Err variant
2774     */
2775    void *err;
2776 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2777
2778 /**
2779  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2780  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2781  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2782  */
2783 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2784    /**
2785     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2786     * `err` or `result` depending on the state of `result_ok`.
2787     */
2788    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2789    /**
2790     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2791     */
2792    bool result_ok;
2793 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2794
2795 /**
2796  * The contents of CResult_SignatureNoneZ
2797  */
2798 typedef union LDKCResult_SignatureNoneZPtr {
2799    /**
2800     * A pointer to the contents in the success state.
2801     * Reading from this pointer when `result_ok` is not set is undefined.
2802     */
2803    struct LDKSignature *result;
2804    /**
2805     * Note that this value is always NULL, as there are no contents in the Err variant
2806     */
2807    void *err;
2808 } LDKCResult_SignatureNoneZPtr;
2809
2810 /**
2811  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2812  * containing a crate::c_types::Signature on success and a () on failure.
2813  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2814  */
2815 typedef struct LDKCResult_SignatureNoneZ {
2816    /**
2817     * The contents of this CResult_SignatureNoneZ, accessible via either
2818     * `err` or `result` depending on the state of `result_ok`.
2819     */
2820    union LDKCResult_SignatureNoneZPtr contents;
2821    /**
2822     * Whether this CResult_SignatureNoneZ represents a success state.
2823     */
2824    bool result_ok;
2825 } LDKCResult_SignatureNoneZ;
2826
2827
2828
2829 /**
2830  * The unsigned part of a channel_announcement
2831  */
2832 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2833    /**
2834     * A pointer to the opaque Rust object.
2835     * Nearly everywhere, inner must be non-null, however in places where
2836     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2837     */
2838    LDKnativeUnsignedChannelAnnouncement *inner;
2839    /**
2840     * Indicates that this is the only struct which contains the same pointer.
2841     * Rust functions which take ownership of an object provided via an argument require
2842     * this to be true and invalidate the object pointed to by inner.
2843     */
2844    bool is_owned;
2845 } LDKUnsignedChannelAnnouncement;
2846
2847 /**
2848  * A trait to sign lightning channel transactions as described in BOLT 3.
2849  *
2850  * Signing services could be implemented on a hardware wallet. In this case,
2851  * the current Sign would be a front-end on top of a communication
2852  * channel connected to your secure device and lightning key material wouldn't
2853  * reside on a hot server. Nevertheless, a this deployment would still need
2854  * to trust the ChannelManager to avoid loss of funds as this latest component
2855  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2856  *
2857  * A more secure iteration would be to use hashlock (or payment points) to pair
2858  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2859  * at the price of more state and computation on the hardware wallet side. In the future,
2860  * we are looking forward to design such interface.
2861  *
2862  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2863  * to act, as liveness and breach reply correctness are always going to be hard requirements
2864  * of LN security model, orthogonal of key management issues.
2865  */
2866 typedef struct LDKBaseSign {
2867    /**
2868     * An opaque pointer which is passed to your function implementations as an argument.
2869     * This has no meaning in the LDK, and can be NULL or any other value.
2870     */
2871    void *this_arg;
2872    /**
2873     * Gets the per-commitment point for a specific commitment number
2874     *
2875     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2876     */
2877    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2878    /**
2879     * Gets the commitment secret for a specific commitment number as part of the revocation process
2880     *
2881     * An external signer implementation should error here if the commitment was already signed
2882     * and should refuse to sign it in the future.
2883     *
2884     * May be called more than once for the same index.
2885     *
2886     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2887     */
2888    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2889    /**
2890     * Gets the holder's channel public keys and basepoints
2891     */
2892    struct LDKChannelPublicKeys pubkeys;
2893    /**
2894     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2895     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2896     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2897     */
2898    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2899    /**
2900     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2901     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2902     * Sign object uniquely and lookup or re-derive its keys.
2903     */
2904    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2905    /**
2906     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2907     *
2908     * Note that if signing fails or is rejected, the channel will be force-closed.
2909     */
2910    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2911    /**
2912     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2913     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2914     * latest commitment_tx when we initiate a force-close.
2915     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2916     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2917     * the latest.
2918     * This may be called multiple times for the same transaction.
2919     *
2920     * An external signer implementation should check that the commitment has not been revoked.
2921     *
2922     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2923     */
2924    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2925    /**
2926     * Create a signature for the given input in a transaction spending an HTLC transaction output
2927     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
2928     *
2929     * A justice transaction may claim multiple outputs at the same time if timelocks are
2930     * similar, but only a signature for the input at index `input` should be signed for here.
2931     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
2932     * to an upcoming timelock expiration.
2933     *
2934     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2935     *
2936     * per_commitment_key is revocation secret which was provided by our counterparty when they
2937     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2938     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2939     * so).
2940     */
2941    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]);
2942    /**
2943     * Create a signature for the given input in a transaction spending a commitment transaction
2944     * HTLC output when our counterparty broadcasts an old state.
2945     *
2946     * A justice transaction may claim multiple outputs at the same time if timelocks are
2947     * similar, but only a signature for the input at index `input` should be signed for here.
2948     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
2949     * to an upcoming timelock expiration.
2950     *
2951     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2952     *
2953     * per_commitment_key is revocation secret which was provided by our counterparty when they
2954     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2955     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2956     * so).
2957     *
2958     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
2959     * (which is committed to in the BIP 143 signatures).
2960     */
2961    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);
2962    /**
2963     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2964     * transaction, either offered or received.
2965     *
2966     * Such a transaction may claim multiples offered outputs at same time if we know the
2967     * preimage for each when we create it, but only the input at index `input` should be
2968     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2969     * needed with regards to an upcoming timelock expiration.
2970     *
2971     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2972     * outputs.
2973     *
2974     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2975     *
2976     * Per_commitment_point is the dynamic point corresponding to the channel state
2977     * detected onchain. It has been generated by our counterparty and is used to derive
2978     * channel state keys, which are then included in the witness script and committed to in the
2979     * BIP 143 signature.
2980     */
2981    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);
2982    /**
2983     * Create a signature for a (proposed) closing transaction.
2984     *
2985     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2986     * chosen to forgo their output as dust.
2987     */
2988    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2989    /**
2990     * Signs a channel announcement message with our funding key, proving it comes from one
2991     * of the channel participants.
2992     *
2993     * Note that if this fails or is rejected, the channel will not be publicly announced and
2994     * our counterparty may (though likely will not) close the channel on us for violating the
2995     * protocol.
2996     */
2997    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2998    /**
2999     * Set the counterparty static channel data, including basepoints,
3000     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3001     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3002     * they MUST NOT be allowed to change to different values once set.
3003     *
3004     * channel_parameters.is_populated() MUST be true.
3005     *
3006     * We bind holder_selected_contest_delay late here for API convenience.
3007     *
3008     * Will be called before any signatures are applied.
3009     */
3010    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3011    /**
3012     * Frees any resources associated with this object given its this_arg pointer.
3013     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3014     */
3015    void (*free)(void *this_arg);
3016 } LDKBaseSign;
3017
3018 /**
3019  * A cloneable signer.
3020  *
3021  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3022  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3023  * which implies Sized, into this derived trait.
3024  */
3025 typedef struct LDKSign {
3026    /**
3027     * An opaque pointer which is passed to your function implementations as an argument.
3028     * This has no meaning in the LDK, and can be NULL or any other value.
3029     */
3030    void *this_arg;
3031    /**
3032     * Implementation of BaseSign for this object.
3033     */
3034    struct LDKBaseSign BaseSign;
3035    /**
3036     * Creates a copy of the BaseSign, for a copy of this Sign.
3037     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3038     */
3039    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3040    /**
3041     * Serialize the object into a byte array
3042     */
3043    struct LDKCVec_u8Z (*write)(const void *this_arg);
3044    /**
3045     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3046     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3047     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3048     */
3049    void *(*clone)(const void *this_arg);
3050    /**
3051     * Frees any resources associated with this object given its this_arg pointer.
3052     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3053     */
3054    void (*free)(void *this_arg);
3055 } LDKSign;
3056
3057
3058
3059 /**
3060  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3061  * on-chain transactions to ensure no loss of funds occurs.
3062  *
3063  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3064  * information and are actively monitoring the chain.
3065  *
3066  * Pending Events or updated HTLCs which have not yet been read out by
3067  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3068  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3069  * gotten are fully handled before re-serializing the new state.
3070  *
3071  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3072  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3073  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3074  * returned block hash and the the current chain and then reconnecting blocks to get to the
3075  * best chain) upon deserializing the object!
3076  */
3077 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3078    /**
3079     * A pointer to the opaque Rust object.
3080     * Nearly everywhere, inner must be non-null, however in places where
3081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3082     */
3083    LDKnativeChannelMonitor *inner;
3084    /**
3085     * Indicates that this is the only struct which contains the same pointer.
3086     * Rust functions which take ownership of an object provided via an argument require
3087     * this to be true and invalidate the object pointed to by inner.
3088     */
3089    bool is_owned;
3090 } LDKChannelMonitor;
3091
3092 /**
3093  * A tuple of 2 elements. See the individual fields for the types contained.
3094  */
3095 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3096    /**
3097     * The element at position 0
3098     */
3099    struct LDKThirtyTwoBytes a;
3100    /**
3101     * The element at position 1
3102     */
3103    struct LDKChannelMonitor b;
3104 } LDKC2Tuple_BlockHashChannelMonitorZ;
3105
3106 /**
3107  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3108  */
3109 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3110    /**
3111     * A pointer to the contents in the success state.
3112     * Reading from this pointer when `result_ok` is not set is undefined.
3113     */
3114    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
3115    /**
3116     * A pointer to the contents in the error state.
3117     * Reading from this pointer when `result_ok` is set is undefined.
3118     */
3119    struct LDKDecodeError *err;
3120 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
3121
3122 /**
3123  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3124  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3126  */
3127 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3128    /**
3129     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3130     * `err` or `result` depending on the state of `result_ok`.
3131     */
3132    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
3133    /**
3134     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3135     */
3136    bool result_ok;
3137 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
3138
3139
3140
3141 /**
3142  * A hop in a route
3143  */
3144 typedef struct MUST_USE_STRUCT LDKRouteHop {
3145    /**
3146     * A pointer to the opaque Rust object.
3147     * Nearly everywhere, inner must be non-null, however in places where
3148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3149     */
3150    LDKnativeRouteHop *inner;
3151    /**
3152     * Indicates that this is the only struct which contains the same pointer.
3153     * Rust functions which take ownership of an object provided via an argument require
3154     * this to be true and invalidate the object pointed to by inner.
3155     */
3156    bool is_owned;
3157 } LDKRouteHop;
3158
3159 /**
3160  * The contents of CResult_RouteHopDecodeErrorZ
3161  */
3162 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
3163    /**
3164     * A pointer to the contents in the success state.
3165     * Reading from this pointer when `result_ok` is not set is undefined.
3166     */
3167    struct LDKRouteHop *result;
3168    /**
3169     * A pointer to the contents in the error state.
3170     * Reading from this pointer when `result_ok` is set is undefined.
3171     */
3172    struct LDKDecodeError *err;
3173 } LDKCResult_RouteHopDecodeErrorZPtr;
3174
3175 /**
3176  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3177  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3179  */
3180 typedef struct LDKCResult_RouteHopDecodeErrorZ {
3181    /**
3182     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3183     * `err` or `result` depending on the state of `result_ok`.
3184     */
3185    union LDKCResult_RouteHopDecodeErrorZPtr contents;
3186    /**
3187     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3188     */
3189    bool result_ok;
3190 } LDKCResult_RouteHopDecodeErrorZ;
3191
3192 /**
3193  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3194  * This corresponds to std::vector in C++
3195  */
3196 typedef struct LDKCVec_RouteHopZ {
3197    /**
3198     * The elements in the array.
3199     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3200     */
3201    struct LDKRouteHop *data;
3202    /**
3203     * The number of elements pointed to by `data`.
3204     */
3205    uintptr_t datalen;
3206 } LDKCVec_RouteHopZ;
3207
3208 /**
3209  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3210  * This corresponds to std::vector in C++
3211  */
3212 typedef struct LDKCVec_CVec_RouteHopZZ {
3213    /**
3214     * The elements in the array.
3215     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3216     */
3217    struct LDKCVec_RouteHopZ *data;
3218    /**
3219     * The number of elements pointed to by `data`.
3220     */
3221    uintptr_t datalen;
3222 } LDKCVec_CVec_RouteHopZZ;
3223
3224
3225
3226 /**
3227  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3228  * it can take multiple paths. Each path is composed of one or more hops through the network.
3229  */
3230 typedef struct MUST_USE_STRUCT LDKRoute {
3231    /**
3232     * A pointer to the opaque Rust object.
3233     * Nearly everywhere, inner must be non-null, however in places where
3234     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3235     */
3236    LDKnativeRoute *inner;
3237    /**
3238     * Indicates that this is the only struct which contains the same pointer.
3239     * Rust functions which take ownership of an object provided via an argument require
3240     * this to be true and invalidate the object pointed to by inner.
3241     */
3242    bool is_owned;
3243 } LDKRoute;
3244
3245 /**
3246  * The contents of CResult_RouteDecodeErrorZ
3247  */
3248 typedef union LDKCResult_RouteDecodeErrorZPtr {
3249    /**
3250     * A pointer to the contents in the success state.
3251     * Reading from this pointer when `result_ok` is not set is undefined.
3252     */
3253    struct LDKRoute *result;
3254    /**
3255     * A pointer to the contents in the error state.
3256     * Reading from this pointer when `result_ok` is set is undefined.
3257     */
3258    struct LDKDecodeError *err;
3259 } LDKCResult_RouteDecodeErrorZPtr;
3260
3261 /**
3262  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3263  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3264  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3265  */
3266 typedef struct LDKCResult_RouteDecodeErrorZ {
3267    /**
3268     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3269     * `err` or `result` depending on the state of `result_ok`.
3270     */
3271    union LDKCResult_RouteDecodeErrorZPtr contents;
3272    /**
3273     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3274     */
3275    bool result_ok;
3276 } LDKCResult_RouteDecodeErrorZ;
3277
3278
3279
3280 /**
3281  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
3282  */
3283 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3284    /**
3285     * A pointer to the opaque Rust object.
3286     * Nearly everywhere, inner must be non-null, however in places where
3287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3288     */
3289    LDKnativeChannelDetails *inner;
3290    /**
3291     * Indicates that this is the only struct which contains the same pointer.
3292     * Rust functions which take ownership of an object provided via an argument require
3293     * this to be true and invalidate the object pointed to by inner.
3294     */
3295    bool is_owned;
3296 } LDKChannelDetails;
3297
3298 /**
3299  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3300  * This corresponds to std::vector in C++
3301  */
3302 typedef struct LDKCVec_ChannelDetailsZ {
3303    /**
3304     * The elements in the array.
3305     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3306     */
3307    struct LDKChannelDetails *data;
3308    /**
3309     * The number of elements pointed to by `data`.
3310     */
3311    uintptr_t datalen;
3312 } LDKCVec_ChannelDetailsZ;
3313
3314
3315
3316 /**
3317  * An Err type for failure to process messages.
3318  */
3319 typedef struct MUST_USE_STRUCT LDKLightningError {
3320    /**
3321     * A pointer to the opaque Rust object.
3322     * Nearly everywhere, inner must be non-null, however in places where
3323     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3324     */
3325    LDKnativeLightningError *inner;
3326    /**
3327     * Indicates that this is the only struct which contains the same pointer.
3328     * Rust functions which take ownership of an object provided via an argument require
3329     * this to be true and invalidate the object pointed to by inner.
3330     */
3331    bool is_owned;
3332 } LDKLightningError;
3333
3334 /**
3335  * The contents of CResult_RouteLightningErrorZ
3336  */
3337 typedef union LDKCResult_RouteLightningErrorZPtr {
3338    /**
3339     * A pointer to the contents in the success state.
3340     * Reading from this pointer when `result_ok` is not set is undefined.
3341     */
3342    struct LDKRoute *result;
3343    /**
3344     * A pointer to the contents in the error state.
3345     * Reading from this pointer when `result_ok` is set is undefined.
3346     */
3347    struct LDKLightningError *err;
3348 } LDKCResult_RouteLightningErrorZPtr;
3349
3350 /**
3351  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3352  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3353  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3354  */
3355 typedef struct LDKCResult_RouteLightningErrorZ {
3356    /**
3357     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3358     * `err` or `result` depending on the state of `result_ok`.
3359     */
3360    union LDKCResult_RouteLightningErrorZPtr contents;
3361    /**
3362     * Whether this CResult_RouteLightningErrorZ represents a success state.
3363     */
3364    bool result_ok;
3365 } LDKCResult_RouteLightningErrorZ;
3366
3367
3368
3369 /**
3370  * An accept_channel message to be sent or received from a peer
3371  */
3372 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3373    /**
3374     * A pointer to the opaque Rust object.
3375     * Nearly everywhere, inner must be non-null, however in places where
3376     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3377     */
3378    LDKnativeAcceptChannel *inner;
3379    /**
3380     * Indicates that this is the only struct which contains the same pointer.
3381     * Rust functions which take ownership of an object provided via an argument require
3382     * this to be true and invalidate the object pointed to by inner.
3383     */
3384    bool is_owned;
3385 } LDKAcceptChannel;
3386
3387
3388
3389 /**
3390  * An open_channel message to be sent or received from a peer
3391  */
3392 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3393    /**
3394     * A pointer to the opaque Rust object.
3395     * Nearly everywhere, inner must be non-null, however in places where
3396     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3397     */
3398    LDKnativeOpenChannel *inner;
3399    /**
3400     * Indicates that this is the only struct which contains the same pointer.
3401     * Rust functions which take ownership of an object provided via an argument require
3402     * this to be true and invalidate the object pointed to by inner.
3403     */
3404    bool is_owned;
3405 } LDKOpenChannel;
3406
3407
3408
3409 /**
3410  * A funding_created message to be sent or received from a peer
3411  */
3412 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3413    /**
3414     * A pointer to the opaque Rust object.
3415     * Nearly everywhere, inner must be non-null, however in places where
3416     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3417     */
3418    LDKnativeFundingCreated *inner;
3419    /**
3420     * Indicates that this is the only struct which contains the same pointer.
3421     * Rust functions which take ownership of an object provided via an argument require
3422     * this to be true and invalidate the object pointed to by inner.
3423     */
3424    bool is_owned;
3425 } LDKFundingCreated;
3426
3427
3428
3429 /**
3430  * A funding_signed message to be sent or received from a peer
3431  */
3432 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3433    /**
3434     * A pointer to the opaque Rust object.
3435     * Nearly everywhere, inner must be non-null, however in places where
3436     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3437     */
3438    LDKnativeFundingSigned *inner;
3439    /**
3440     * Indicates that this is the only struct which contains the same pointer.
3441     * Rust functions which take ownership of an object provided via an argument require
3442     * this to be true and invalidate the object pointed to by inner.
3443     */
3444    bool is_owned;
3445 } LDKFundingSigned;
3446
3447
3448
3449 /**
3450  * A funding_locked message to be sent or received from a peer
3451  */
3452 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3453    /**
3454     * A pointer to the opaque Rust object.
3455     * Nearly everywhere, inner must be non-null, however in places where
3456     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3457     */
3458    LDKnativeFundingLocked *inner;
3459    /**
3460     * Indicates that this is the only struct which contains the same pointer.
3461     * Rust functions which take ownership of an object provided via an argument require
3462     * this to be true and invalidate the object pointed to by inner.
3463     */
3464    bool is_owned;
3465 } LDKFundingLocked;
3466
3467
3468
3469 /**
3470  * An announcement_signatures message to be sent or received from a peer
3471  */
3472 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3473    /**
3474     * A pointer to the opaque Rust object.
3475     * Nearly everywhere, inner must be non-null, however in places where
3476     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3477     */
3478    LDKnativeAnnouncementSignatures *inner;
3479    /**
3480     * Indicates that this is the only struct which contains the same pointer.
3481     * Rust functions which take ownership of an object provided via an argument require
3482     * this to be true and invalidate the object pointed to by inner.
3483     */
3484    bool is_owned;
3485 } LDKAnnouncementSignatures;
3486
3487
3488
3489 /**
3490  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3491  * transaction updates if they were pending.
3492  */
3493 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3494    /**
3495     * A pointer to the opaque Rust object.
3496     * Nearly everywhere, inner must be non-null, however in places where
3497     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3498     */
3499    LDKnativeCommitmentUpdate *inner;
3500    /**
3501     * Indicates that this is the only struct which contains the same pointer.
3502     * Rust functions which take ownership of an object provided via an argument require
3503     * this to be true and invalidate the object pointed to by inner.
3504     */
3505    bool is_owned;
3506 } LDKCommitmentUpdate;
3507
3508
3509
3510 /**
3511  * A revoke_and_ack message to be sent or received from a peer
3512  */
3513 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3514    /**
3515     * A pointer to the opaque Rust object.
3516     * Nearly everywhere, inner must be non-null, however in places where
3517     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3518     */
3519    LDKnativeRevokeAndACK *inner;
3520    /**
3521     * Indicates that this is the only struct which contains the same pointer.
3522     * Rust functions which take ownership of an object provided via an argument require
3523     * this to be true and invalidate the object pointed to by inner.
3524     */
3525    bool is_owned;
3526 } LDKRevokeAndACK;
3527
3528
3529
3530 /**
3531  * A closing_signed message to be sent or received from a peer
3532  */
3533 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3534    /**
3535     * A pointer to the opaque Rust object.
3536     * Nearly everywhere, inner must be non-null, however in places where
3537     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3538     */
3539    LDKnativeClosingSigned *inner;
3540    /**
3541     * Indicates that this is the only struct which contains the same pointer.
3542     * Rust functions which take ownership of an object provided via an argument require
3543     * this to be true and invalidate the object pointed to by inner.
3544     */
3545    bool is_owned;
3546 } LDKClosingSigned;
3547
3548
3549
3550 /**
3551  * A shutdown message to be sent or received from a peer
3552  */
3553 typedef struct MUST_USE_STRUCT LDKShutdown {
3554    /**
3555     * A pointer to the opaque Rust object.
3556     * Nearly everywhere, inner must be non-null, however in places where
3557     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3558     */
3559    LDKnativeShutdown *inner;
3560    /**
3561     * Indicates that this is the only struct which contains the same pointer.
3562     * Rust functions which take ownership of an object provided via an argument require
3563     * this to be true and invalidate the object pointed to by inner.
3564     */
3565    bool is_owned;
3566 } LDKShutdown;
3567
3568
3569
3570 /**
3571  * A channel_reestablish message to be sent or received from a peer
3572  */
3573 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3574    /**
3575     * A pointer to the opaque Rust object.
3576     * Nearly everywhere, inner must be non-null, however in places where
3577     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3578     */
3579    LDKnativeChannelReestablish *inner;
3580    /**
3581     * Indicates that this is the only struct which contains the same pointer.
3582     * Rust functions which take ownership of an object provided via an argument require
3583     * this to be true and invalidate the object pointed to by inner.
3584     */
3585    bool is_owned;
3586 } LDKChannelReestablish;
3587
3588
3589
3590 /**
3591  * A channel_announcement message to be sent or received from a peer
3592  */
3593 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3594    /**
3595     * A pointer to the opaque Rust object.
3596     * Nearly everywhere, inner must be non-null, however in places where
3597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3598     */
3599    LDKnativeChannelAnnouncement *inner;
3600    /**
3601     * Indicates that this is the only struct which contains the same pointer.
3602     * Rust functions which take ownership of an object provided via an argument require
3603     * this to be true and invalidate the object pointed to by inner.
3604     */
3605    bool is_owned;
3606 } LDKChannelAnnouncement;
3607
3608
3609
3610 /**
3611  * A channel_update message to be sent or received from a peer
3612  */
3613 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
3614    /**
3615     * A pointer to the opaque Rust object.
3616     * Nearly everywhere, inner must be non-null, however in places where
3617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3618     */
3619    LDKnativeChannelUpdate *inner;
3620    /**
3621     * Indicates that this is the only struct which contains the same pointer.
3622     * Rust functions which take ownership of an object provided via an argument require
3623     * this to be true and invalidate the object pointed to by inner.
3624     */
3625    bool is_owned;
3626 } LDKChannelUpdate;
3627
3628
3629
3630 /**
3631  * A node_announcement message to be sent or received from a peer
3632  */
3633 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3634    /**
3635     * A pointer to the opaque Rust object.
3636     * Nearly everywhere, inner must be non-null, however in places where
3637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3638     */
3639    LDKnativeNodeAnnouncement *inner;
3640    /**
3641     * Indicates that this is the only struct which contains the same pointer.
3642     * Rust functions which take ownership of an object provided via an argument require
3643     * this to be true and invalidate the object pointed to by inner.
3644     */
3645    bool is_owned;
3646 } LDKNodeAnnouncement;
3647
3648
3649
3650 /**
3651  * An error message to be sent or received from a peer
3652  */
3653 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3654    /**
3655     * A pointer to the opaque Rust object.
3656     * Nearly everywhere, inner must be non-null, however in places where
3657     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3658     */
3659    LDKnativeErrorMessage *inner;
3660    /**
3661     * Indicates that this is the only struct which contains the same pointer.
3662     * Rust functions which take ownership of an object provided via an argument require
3663     * this to be true and invalidate the object pointed to by inner.
3664     */
3665    bool is_owned;
3666 } LDKErrorMessage;
3667
3668 /**
3669  * Used to put an error message in a LightningError
3670  */
3671 typedef enum LDKErrorAction_Tag {
3672    /**
3673     * The peer took some action which made us think they were useless. Disconnect them.
3674     */
3675    LDKErrorAction_DisconnectPeer,
3676    /**
3677     * The peer did something harmless that we weren't able to process, just log and ignore
3678     */
3679    LDKErrorAction_IgnoreError,
3680    /**
3681     * The peer did something incorrect. Tell them.
3682     */
3683    LDKErrorAction_SendErrorMessage,
3684    /**
3685     * Must be last for serialization purposes
3686     */
3687    LDKErrorAction_Sentinel,
3688 } LDKErrorAction_Tag;
3689
3690 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3691    /**
3692     * An error message which we should make an effort to send before we disconnect.
3693     */
3694    struct LDKErrorMessage msg;
3695 } LDKErrorAction_LDKDisconnectPeer_Body;
3696
3697 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3698    /**
3699     * The message to send.
3700     */
3701    struct LDKErrorMessage msg;
3702 } LDKErrorAction_LDKSendErrorMessage_Body;
3703
3704 typedef struct MUST_USE_STRUCT LDKErrorAction {
3705    LDKErrorAction_Tag tag;
3706    union {
3707       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3708       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3709    };
3710 } LDKErrorAction;
3711
3712 /**
3713  * The information we received from a peer along the route of a payment we originated. This is
3714  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3715  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3716  */
3717 typedef enum LDKHTLCFailChannelUpdate_Tag {
3718    /**
3719     * We received an error which included a full ChannelUpdate message.
3720     */
3721    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
3722    /**
3723     * We received an error which indicated only that a channel has been closed
3724     */
3725    LDKHTLCFailChannelUpdate_ChannelClosed,
3726    /**
3727     * We received an error which indicated only that a node has failed
3728     */
3729    LDKHTLCFailChannelUpdate_NodeFailure,
3730    /**
3731     * Must be last for serialization purposes
3732     */
3733    LDKHTLCFailChannelUpdate_Sentinel,
3734 } LDKHTLCFailChannelUpdate_Tag;
3735
3736 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
3737    /**
3738     * The unwrapped message we received
3739     */
3740    struct LDKChannelUpdate msg;
3741 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
3742
3743 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
3744    /**
3745     * The short_channel_id which has now closed.
3746     */
3747    uint64_t short_channel_id;
3748    /**
3749     * when this true, this channel should be permanently removed from the
3750     * consideration. Otherwise, this channel can be restored as new channel_update is received
3751     */
3752    bool is_permanent;
3753 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
3754
3755 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
3756    /**
3757     * The node_id that has failed.
3758     */
3759    struct LDKPublicKey node_id;
3760    /**
3761     * when this true, node should be permanently removed from the
3762     * consideration. Otherwise, the channels connected to this node can be
3763     * restored as new channel_update is received
3764     */
3765    bool is_permanent;
3766 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
3767
3768 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
3769    LDKHTLCFailChannelUpdate_Tag tag;
3770    union {
3771       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3772       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
3773       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
3774    };
3775 } LDKHTLCFailChannelUpdate;
3776
3777
3778
3779 /**
3780  * A query_channel_range message is used to query a peer for channel
3781  * UTXOs in a range of blocks. The recipient of a query makes a best
3782  * effort to reply to the query using one or more reply_channel_range
3783  * messages.
3784  */
3785 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3786    /**
3787     * A pointer to the opaque Rust object.
3788     * Nearly everywhere, inner must be non-null, however in places where
3789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3790     */
3791    LDKnativeQueryChannelRange *inner;
3792    /**
3793     * Indicates that this is the only struct which contains the same pointer.
3794     * Rust functions which take ownership of an object provided via an argument require
3795     * this to be true and invalidate the object pointed to by inner.
3796     */
3797    bool is_owned;
3798 } LDKQueryChannelRange;
3799
3800
3801
3802 /**
3803  * A query_short_channel_ids message is used to query a peer for
3804  * routing gossip messages related to one or more short_channel_ids.
3805  * The query recipient will reply with the latest, if available,
3806  * channel_announcement, channel_update and node_announcement messages
3807  * it maintains for the requested short_channel_ids followed by a
3808  * reply_short_channel_ids_end message. The short_channel_ids sent in
3809  * this query are encoded. We only support encoding_type=0 uncompressed
3810  * serialization and do not support encoding_type=1 zlib serialization.
3811  */
3812 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3813    /**
3814     * A pointer to the opaque Rust object.
3815     * Nearly everywhere, inner must be non-null, however in places where
3816     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3817     */
3818    LDKnativeQueryShortChannelIds *inner;
3819    /**
3820     * Indicates that this is the only struct which contains the same pointer.
3821     * Rust functions which take ownership of an object provided via an argument require
3822     * this to be true and invalidate the object pointed to by inner.
3823     */
3824    bool is_owned;
3825 } LDKQueryShortChannelIds;
3826
3827
3828
3829 /**
3830  * A reply_channel_range message is a reply to a query_channel_range
3831  * message. Multiple reply_channel_range messages can be sent in reply
3832  * to a single query_channel_range message. The query recipient makes a
3833  * best effort to respond based on their local network view which may
3834  * not be a perfect view of the network. The short_channel_ids in the
3835  * reply are encoded. We only support encoding_type=0 uncompressed
3836  * serialization and do not support encoding_type=1 zlib serialization.
3837  */
3838 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3839    /**
3840     * A pointer to the opaque Rust object.
3841     * Nearly everywhere, inner must be non-null, however in places where
3842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3843     */
3844    LDKnativeReplyChannelRange *inner;
3845    /**
3846     * Indicates that this is the only struct which contains the same pointer.
3847     * Rust functions which take ownership of an object provided via an argument require
3848     * this to be true and invalidate the object pointed to by inner.
3849     */
3850    bool is_owned;
3851 } LDKReplyChannelRange;
3852
3853 /**
3854  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3855  * broadcast to most peers).
3856  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3857  */
3858 typedef enum LDKMessageSendEvent_Tag {
3859    /**
3860     * Used to indicate that we've accepted a channel open and should send the accept_channel
3861     * message provided to the given peer.
3862     */
3863    LDKMessageSendEvent_SendAcceptChannel,
3864    /**
3865     * Used to indicate that we've initiated a channel open and should send the open_channel
3866     * message provided to the given peer.
3867     */
3868    LDKMessageSendEvent_SendOpenChannel,
3869    /**
3870     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3871     */
3872    LDKMessageSendEvent_SendFundingCreated,
3873    /**
3874     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3875     */
3876    LDKMessageSendEvent_SendFundingSigned,
3877    /**
3878     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3879     */
3880    LDKMessageSendEvent_SendFundingLocked,
3881    /**
3882     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3883     */
3884    LDKMessageSendEvent_SendAnnouncementSignatures,
3885    /**
3886     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3887     * message should be sent to the peer with the given node_id.
3888     */
3889    LDKMessageSendEvent_UpdateHTLCs,
3890    /**
3891     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3892     */
3893    LDKMessageSendEvent_SendRevokeAndACK,
3894    /**
3895     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3896     */
3897    LDKMessageSendEvent_SendClosingSigned,
3898    /**
3899     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3900     */
3901    LDKMessageSendEvent_SendShutdown,
3902    /**
3903     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3904     */
3905    LDKMessageSendEvent_SendChannelReestablish,
3906    /**
3907     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3908     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3909     *
3910     * Note that after doing so, you very likely (unless you did so very recently) want to call
3911     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3912     * This ensures that any nodes which see our channel_announcement also have a relevant
3913     * node_announcement, including relevant feature flags which may be important for routing
3914     * through or to us.
3915     */
3916    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3917    /**
3918     * Used to indicate that a node_announcement should be broadcast to all peers.
3919     */
3920    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3921    /**
3922     * Used to indicate that a channel_update should be broadcast to all peers.
3923     */
3924    LDKMessageSendEvent_BroadcastChannelUpdate,
3925    /**
3926     * Broadcast an error downstream to be handled
3927     */
3928    LDKMessageSendEvent_HandleError,
3929    /**
3930     * When a payment fails we may receive updates back from the hop where it failed. In such
3931     * cases this event is generated so that we can inform the network graph of this information.
3932     */
3933    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3934    /**
3935     * Query a peer for channels with funding transaction UTXOs in a block range.
3936     */
3937    LDKMessageSendEvent_SendChannelRangeQuery,
3938    /**
3939     * Request routing gossip messages from a peer for a list of channels identified by
3940     * their short_channel_ids.
3941     */
3942    LDKMessageSendEvent_SendShortIdsQuery,
3943    /**
3944     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3945     * emitted during processing of the query.
3946     */
3947    LDKMessageSendEvent_SendReplyChannelRange,
3948    /**
3949     * Must be last for serialization purposes
3950     */
3951    LDKMessageSendEvent_Sentinel,
3952 } LDKMessageSendEvent_Tag;
3953
3954 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3955    /**
3956     * The node_id of the node which should receive this message
3957     */
3958    struct LDKPublicKey node_id;
3959    /**
3960     * The message which should be sent.
3961     */
3962    struct LDKAcceptChannel msg;
3963 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3964
3965 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3966    /**
3967     * The node_id of the node which should receive this message
3968     */
3969    struct LDKPublicKey node_id;
3970    /**
3971     * The message which should be sent.
3972     */
3973    struct LDKOpenChannel msg;
3974 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3975
3976 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3977    /**
3978     * The node_id of the node which should receive this message
3979     */
3980    struct LDKPublicKey node_id;
3981    /**
3982     * The message which should be sent.
3983     */
3984    struct LDKFundingCreated msg;
3985 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3986
3987 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3988    /**
3989     * The node_id of the node which should receive this message
3990     */
3991    struct LDKPublicKey node_id;
3992    /**
3993     * The message which should be sent.
3994     */
3995    struct LDKFundingSigned msg;
3996 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3997
3998 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3999    /**
4000     * The node_id of the node which should receive these message(s)
4001     */
4002    struct LDKPublicKey node_id;
4003    /**
4004     * The funding_locked message which should be sent.
4005     */
4006    struct LDKFundingLocked msg;
4007 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
4008
4009 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4010    /**
4011     * The node_id of the node which should receive these message(s)
4012     */
4013    struct LDKPublicKey node_id;
4014    /**
4015     * The announcement_signatures message which should be sent.
4016     */
4017    struct LDKAnnouncementSignatures msg;
4018 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4019
4020 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4021    /**
4022     * The node_id of the node which should receive these message(s)
4023     */
4024    struct LDKPublicKey node_id;
4025    /**
4026     * The update messages which should be sent. ALL messages in the struct should be sent!
4027     */
4028    struct LDKCommitmentUpdate updates;
4029 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4030
4031 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4032    /**
4033     * The node_id of the node which should receive this message
4034     */
4035    struct LDKPublicKey node_id;
4036    /**
4037     * The message which should be sent.
4038     */
4039    struct LDKRevokeAndACK msg;
4040 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4041
4042 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4043    /**
4044     * The node_id of the node which should receive this message
4045     */
4046    struct LDKPublicKey node_id;
4047    /**
4048     * The message which should be sent.
4049     */
4050    struct LDKClosingSigned msg;
4051 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4052
4053 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4054    /**
4055     * The node_id of the node which should receive this message
4056     */
4057    struct LDKPublicKey node_id;
4058    /**
4059     * The message which should be sent.
4060     */
4061    struct LDKShutdown msg;
4062 } LDKMessageSendEvent_LDKSendShutdown_Body;
4063
4064 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4065    /**
4066     * The node_id of the node which should receive this message
4067     */
4068    struct LDKPublicKey node_id;
4069    /**
4070     * The message which should be sent.
4071     */
4072    struct LDKChannelReestablish msg;
4073 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4074
4075 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4076    /**
4077     * The channel_announcement which should be sent.
4078     */
4079    struct LDKChannelAnnouncement msg;
4080    /**
4081     * The followup channel_update which should be sent.
4082     */
4083    struct LDKChannelUpdate update_msg;
4084 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4085
4086 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4087    /**
4088     * The node_announcement which should be sent.
4089     */
4090    struct LDKNodeAnnouncement msg;
4091 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4092
4093 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4094    /**
4095     * The channel_update which should be sent.
4096     */
4097    struct LDKChannelUpdate msg;
4098 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4099
4100 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4101    /**
4102     * The node_id of the node which should receive this message
4103     */
4104    struct LDKPublicKey node_id;
4105    /**
4106     * The action which should be taken.
4107     */
4108    struct LDKErrorAction action;
4109 } LDKMessageSendEvent_LDKHandleError_Body;
4110
4111 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
4112    /**
4113     * The channel/node update which should be sent to NetGraphMsgHandler
4114     */
4115    struct LDKHTLCFailChannelUpdate update;
4116 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
4117
4118 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4119    /**
4120     * The node_id of this message recipient
4121     */
4122    struct LDKPublicKey node_id;
4123    /**
4124     * The query_channel_range which should be sent.
4125     */
4126    struct LDKQueryChannelRange msg;
4127 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4128
4129 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4130    /**
4131     * The node_id of this message recipient
4132     */
4133    struct LDKPublicKey node_id;
4134    /**
4135     * The query_short_channel_ids which should be sent.
4136     */
4137    struct LDKQueryShortChannelIds msg;
4138 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4139
4140 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4141    /**
4142     * The node_id of this message recipient
4143     */
4144    struct LDKPublicKey node_id;
4145    /**
4146     * The reply_channel_range which should be sent.
4147     */
4148    struct LDKReplyChannelRange msg;
4149 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4150
4151 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4152    LDKMessageSendEvent_Tag tag;
4153    union {
4154       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4155       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4156       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4157       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4158       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4159       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4160       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4161       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4162       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4163       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4164       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4165       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4166       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4167       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4168       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4169       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
4170       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4171       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4172       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4173    };
4174 } LDKMessageSendEvent;
4175
4176 /**
4177  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4178  * This corresponds to std::vector in C++
4179  */
4180 typedef struct LDKCVec_MessageSendEventZ {
4181    /**
4182     * The elements in the array.
4183     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4184     */
4185    struct LDKMessageSendEvent *data;
4186    /**
4187     * The number of elements pointed to by `data`.
4188     */
4189    uintptr_t datalen;
4190 } LDKCVec_MessageSendEventZ;
4191
4192 /**
4193  * The contents of CResult_boolLightningErrorZ
4194  */
4195 typedef union LDKCResult_boolLightningErrorZPtr {
4196    /**
4197     * A pointer to the contents in the success state.
4198     * Reading from this pointer when `result_ok` is not set is undefined.
4199     */
4200    bool *result;
4201    /**
4202     * A pointer to the contents in the error state.
4203     * Reading from this pointer when `result_ok` is set is undefined.
4204     */
4205    struct LDKLightningError *err;
4206 } LDKCResult_boolLightningErrorZPtr;
4207
4208 /**
4209  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4210  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4212  */
4213 typedef struct LDKCResult_boolLightningErrorZ {
4214    /**
4215     * The contents of this CResult_boolLightningErrorZ, accessible via either
4216     * `err` or `result` depending on the state of `result_ok`.
4217     */
4218    union LDKCResult_boolLightningErrorZPtr contents;
4219    /**
4220     * Whether this CResult_boolLightningErrorZ represents a success state.
4221     */
4222    bool result_ok;
4223 } LDKCResult_boolLightningErrorZ;
4224
4225 /**
4226  * A tuple of 3 elements. See the individual fields for the types contained.
4227  */
4228 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4229    /**
4230     * The element at position 0
4231     */
4232    struct LDKChannelAnnouncement a;
4233    /**
4234     * The element at position 1
4235     */
4236    struct LDKChannelUpdate b;
4237    /**
4238     * The element at position 2
4239     */
4240    struct LDKChannelUpdate c;
4241 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4242
4243 /**
4244  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4245  * This corresponds to std::vector in C++
4246  */
4247 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4248    /**
4249     * The elements in the array.
4250     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4251     */
4252    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4253    /**
4254     * The number of elements pointed to by `data`.
4255     */
4256    uintptr_t datalen;
4257 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
4258
4259 /**
4260  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4261  * This corresponds to std::vector in C++
4262  */
4263 typedef struct LDKCVec_NodeAnnouncementZ {
4264    /**
4265     * The elements in the array.
4266     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4267     */
4268    struct LDKNodeAnnouncement *data;
4269    /**
4270     * The number of elements pointed to by `data`.
4271     */
4272    uintptr_t datalen;
4273 } LDKCVec_NodeAnnouncementZ;
4274
4275 /**
4276  * The contents of CResult_NoneLightningErrorZ
4277  */
4278 typedef union LDKCResult_NoneLightningErrorZPtr {
4279    /**
4280     * Note that this value is always NULL, as there are no contents in the OK variant
4281     */
4282    void *result;
4283    /**
4284     * A pointer to the contents in the error state.
4285     * Reading from this pointer when `result_ok` is set is undefined.
4286     */
4287    struct LDKLightningError *err;
4288 } LDKCResult_NoneLightningErrorZPtr;
4289
4290 /**
4291  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4292  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4294  */
4295 typedef struct LDKCResult_NoneLightningErrorZ {
4296    /**
4297     * The contents of this CResult_NoneLightningErrorZ, accessible via either
4298     * `err` or `result` depending on the state of `result_ok`.
4299     */
4300    union LDKCResult_NoneLightningErrorZPtr contents;
4301    /**
4302     * Whether this CResult_NoneLightningErrorZ represents a success state.
4303     */
4304    bool result_ok;
4305 } LDKCResult_NoneLightningErrorZ;
4306
4307 /**
4308  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4309  * This corresponds to std::vector in C++
4310  */
4311 typedef struct LDKCVec_PublicKeyZ {
4312    /**
4313     * The elements in the array.
4314     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4315     */
4316    struct LDKPublicKey *data;
4317    /**
4318     * The number of elements pointed to by `data`.
4319     */
4320    uintptr_t datalen;
4321 } LDKCVec_PublicKeyZ;
4322
4323
4324
4325 /**
4326  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
4327  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
4328  * descriptor.
4329  */
4330 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
4331    /**
4332     * A pointer to the opaque Rust object.
4333     * Nearly everywhere, inner must be non-null, however in places where
4334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4335     */
4336    LDKnativePeerHandleError *inner;
4337    /**
4338     * Indicates that this is the only struct which contains the same pointer.
4339     * Rust functions which take ownership of an object provided via an argument require
4340     * this to be true and invalidate the object pointed to by inner.
4341     */
4342    bool is_owned;
4343 } LDKPeerHandleError;
4344
4345 /**
4346  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
4347  */
4348 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
4349    /**
4350     * A pointer to the contents in the success state.
4351     * Reading from this pointer when `result_ok` is not set is undefined.
4352     */
4353    struct LDKCVec_u8Z *result;
4354    /**
4355     * A pointer to the contents in the error state.
4356     * Reading from this pointer when `result_ok` is set is undefined.
4357     */
4358    struct LDKPeerHandleError *err;
4359 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
4360
4361 /**
4362  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4363  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4365  */
4366 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
4367    /**
4368     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4369     * `err` or `result` depending on the state of `result_ok`.
4370     */
4371    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
4372    /**
4373     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4374     */
4375    bool result_ok;
4376 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
4377
4378 /**
4379  * The contents of CResult_NonePeerHandleErrorZ
4380  */
4381 typedef union LDKCResult_NonePeerHandleErrorZPtr {
4382    /**
4383     * Note that this value is always NULL, as there are no contents in the OK variant
4384     */
4385    void *result;
4386    /**
4387     * A pointer to the contents in the error state.
4388     * Reading from this pointer when `result_ok` is set is undefined.
4389     */
4390    struct LDKPeerHandleError *err;
4391 } LDKCResult_NonePeerHandleErrorZPtr;
4392
4393 /**
4394  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4395  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4397  */
4398 typedef struct LDKCResult_NonePeerHandleErrorZ {
4399    /**
4400     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4401     * `err` or `result` depending on the state of `result_ok`.
4402     */
4403    union LDKCResult_NonePeerHandleErrorZPtr contents;
4404    /**
4405     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
4406     */
4407    bool result_ok;
4408 } LDKCResult_NonePeerHandleErrorZ;
4409
4410 /**
4411  * The contents of CResult_boolPeerHandleErrorZ
4412  */
4413 typedef union LDKCResult_boolPeerHandleErrorZPtr {
4414    /**
4415     * A pointer to the contents in the success state.
4416     * Reading from this pointer when `result_ok` is not set is undefined.
4417     */
4418    bool *result;
4419    /**
4420     * A pointer to the contents in the error state.
4421     * Reading from this pointer when `result_ok` is set is undefined.
4422     */
4423    struct LDKPeerHandleError *err;
4424 } LDKCResult_boolPeerHandleErrorZPtr;
4425
4426 /**
4427  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4428  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4429  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4430  */
4431 typedef struct LDKCResult_boolPeerHandleErrorZ {
4432    /**
4433     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4434     * `err` or `result` depending on the state of `result_ok`.
4435     */
4436    union LDKCResult_boolPeerHandleErrorZPtr contents;
4437    /**
4438     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
4439     */
4440    bool result_ok;
4441 } LDKCResult_boolPeerHandleErrorZ;
4442
4443 /**
4444  * The contents of CResult_TxOutAccessErrorZ
4445  */
4446 typedef union LDKCResult_TxOutAccessErrorZPtr {
4447    /**
4448     * A pointer to the contents in the success state.
4449     * Reading from this pointer when `result_ok` is not set is undefined.
4450     */
4451    struct LDKTxOut *result;
4452    /**
4453     * A pointer to the contents in the error state.
4454     * Reading from this pointer when `result_ok` is set is undefined.
4455     */
4456    enum LDKAccessError *err;
4457 } LDKCResult_TxOutAccessErrorZPtr;
4458
4459 /**
4460  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4461  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4462  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4463  */
4464 typedef struct LDKCResult_TxOutAccessErrorZ {
4465    /**
4466     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4467     * `err` or `result` depending on the state of `result_ok`.
4468     */
4469    union LDKCResult_TxOutAccessErrorZPtr contents;
4470    /**
4471     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4472     */
4473    bool result_ok;
4474 } LDKCResult_TxOutAccessErrorZ;
4475
4476 /**
4477  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4478  */
4479 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4480    /**
4481     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4482     */
4483    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4484    /**
4485     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4486     */
4487    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4488    /**
4489     * Must be last for serialization purposes
4490     */
4491    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4492 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4493
4494 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4495    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4496    union {
4497       struct {
4498          struct LDKC2Tuple_usizeTransactionZ some;
4499       };
4500    };
4501 } LDKCOption_C2Tuple_usizeTransactionZZ;
4502
4503
4504
4505 /**
4506  * Details about one direction of a channel. Received
4507  * within a channel update.
4508  */
4509 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
4510    /**
4511     * A pointer to the opaque Rust object.
4512     * Nearly everywhere, inner must be non-null, however in places where
4513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4514     */
4515    LDKnativeDirectionalChannelInfo *inner;
4516    /**
4517     * Indicates that this is the only struct which contains the same pointer.
4518     * Rust functions which take ownership of an object provided via an argument require
4519     * this to be true and invalidate the object pointed to by inner.
4520     */
4521    bool is_owned;
4522 } LDKDirectionalChannelInfo;
4523
4524 /**
4525  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4526  */
4527 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
4528    /**
4529     * A pointer to the contents in the success state.
4530     * Reading from this pointer when `result_ok` is not set is undefined.
4531     */
4532    struct LDKDirectionalChannelInfo *result;
4533    /**
4534     * A pointer to the contents in the error state.
4535     * Reading from this pointer when `result_ok` is set is undefined.
4536     */
4537    struct LDKDecodeError *err;
4538 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
4539
4540 /**
4541  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4542  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4543  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4544  */
4545 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
4546    /**
4547     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4548     * `err` or `result` depending on the state of `result_ok`.
4549     */
4550    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
4551    /**
4552     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4553     */
4554    bool result_ok;
4555 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
4556
4557
4558
4559 /**
4560  * Details about a channel (both directions).
4561  * Received within a channel announcement.
4562  */
4563 typedef struct MUST_USE_STRUCT LDKChannelInfo {
4564    /**
4565     * A pointer to the opaque Rust object.
4566     * Nearly everywhere, inner must be non-null, however in places where
4567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4568     */
4569    LDKnativeChannelInfo *inner;
4570    /**
4571     * Indicates that this is the only struct which contains the same pointer.
4572     * Rust functions which take ownership of an object provided via an argument require
4573     * this to be true and invalidate the object pointed to by inner.
4574     */
4575    bool is_owned;
4576 } LDKChannelInfo;
4577
4578 /**
4579  * The contents of CResult_ChannelInfoDecodeErrorZ
4580  */
4581 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
4582    /**
4583     * A pointer to the contents in the success state.
4584     * Reading from this pointer when `result_ok` is not set is undefined.
4585     */
4586    struct LDKChannelInfo *result;
4587    /**
4588     * A pointer to the contents in the error state.
4589     * Reading from this pointer when `result_ok` is set is undefined.
4590     */
4591    struct LDKDecodeError *err;
4592 } LDKCResult_ChannelInfoDecodeErrorZPtr;
4593
4594 /**
4595  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4596  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4598  */
4599 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
4600    /**
4601     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4602     * `err` or `result` depending on the state of `result_ok`.
4603     */
4604    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
4605    /**
4606     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4607     */
4608    bool result_ok;
4609 } LDKCResult_ChannelInfoDecodeErrorZ;
4610
4611
4612
4613 /**
4614  * Fees for routing via a given channel or a node
4615  */
4616 typedef struct MUST_USE_STRUCT LDKRoutingFees {
4617    /**
4618     * A pointer to the opaque Rust object.
4619     * Nearly everywhere, inner must be non-null, however in places where
4620     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4621     */
4622    LDKnativeRoutingFees *inner;
4623    /**
4624     * Indicates that this is the only struct which contains the same pointer.
4625     * Rust functions which take ownership of an object provided via an argument require
4626     * this to be true and invalidate the object pointed to by inner.
4627     */
4628    bool is_owned;
4629 } LDKRoutingFees;
4630
4631 /**
4632  * The contents of CResult_RoutingFeesDecodeErrorZ
4633  */
4634 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
4635    /**
4636     * A pointer to the contents in the success state.
4637     * Reading from this pointer when `result_ok` is not set is undefined.
4638     */
4639    struct LDKRoutingFees *result;
4640    /**
4641     * A pointer to the contents in the error state.
4642     * Reading from this pointer when `result_ok` is set is undefined.
4643     */
4644    struct LDKDecodeError *err;
4645 } LDKCResult_RoutingFeesDecodeErrorZPtr;
4646
4647 /**
4648  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4649  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4650  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4651  */
4652 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
4653    /**
4654     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4655     * `err` or `result` depending on the state of `result_ok`.
4656     */
4657    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
4658    /**
4659     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4660     */
4661    bool result_ok;
4662 } LDKCResult_RoutingFeesDecodeErrorZ;
4663
4664 /**
4665  * A 4-byte byte array.
4666  */
4667 typedef struct LDKFourBytes {
4668    /**
4669     * The four bytes
4670     */
4671    uint8_t data[4];
4672 } LDKFourBytes;
4673
4674 /**
4675  * A 16-byte byte array.
4676  */
4677 typedef struct LDKSixteenBytes {
4678    /**
4679     * The sixteen bytes
4680     */
4681    uint8_t data[16];
4682 } LDKSixteenBytes;
4683
4684 /**
4685  * A 10-byte byte array.
4686  */
4687 typedef struct LDKTenBytes {
4688    /**
4689     * The ten bytes
4690     */
4691    uint8_t data[10];
4692 } LDKTenBytes;
4693
4694 /**
4695  * An address which can be used to connect to a remote peer
4696  */
4697 typedef enum LDKNetAddress_Tag {
4698    /**
4699     * An IPv4 address/port on which the peer is listening.
4700     */
4701    LDKNetAddress_IPv4,
4702    /**
4703     * An IPv6 address/port on which the peer is listening.
4704     */
4705    LDKNetAddress_IPv6,
4706    /**
4707     * An old-style Tor onion address/port on which the peer is listening.
4708     */
4709    LDKNetAddress_OnionV2,
4710    /**
4711     * A new-style Tor onion address/port on which the peer is listening.
4712     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4713     * wrap as base32 and append \".onion\".
4714     */
4715    LDKNetAddress_OnionV3,
4716    /**
4717     * Must be last for serialization purposes
4718     */
4719    LDKNetAddress_Sentinel,
4720 } LDKNetAddress_Tag;
4721
4722 typedef struct LDKNetAddress_LDKIPv4_Body {
4723    /**
4724     * The 4-byte IPv4 address
4725     */
4726    struct LDKFourBytes addr;
4727    /**
4728     * The port on which the node is listening
4729     */
4730    uint16_t port;
4731 } LDKNetAddress_LDKIPv4_Body;
4732
4733 typedef struct LDKNetAddress_LDKIPv6_Body {
4734    /**
4735     * The 16-byte IPv6 address
4736     */
4737    struct LDKSixteenBytes addr;
4738    /**
4739     * The port on which the node is listening
4740     */
4741    uint16_t port;
4742 } LDKNetAddress_LDKIPv6_Body;
4743
4744 typedef struct LDKNetAddress_LDKOnionV2_Body {
4745    /**
4746     * The bytes (usually encoded in base32 with \".onion\" appended)
4747     */
4748    struct LDKTenBytes addr;
4749    /**
4750     * The port on which the node is listening
4751     */
4752    uint16_t port;
4753 } LDKNetAddress_LDKOnionV2_Body;
4754
4755 typedef struct LDKNetAddress_LDKOnionV3_Body {
4756    /**
4757     * The ed25519 long-term public key of the peer
4758     */
4759    struct LDKThirtyTwoBytes ed25519_pubkey;
4760    /**
4761     * The checksum of the pubkey and version, as included in the onion address
4762     */
4763    uint16_t checksum;
4764    /**
4765     * The version byte, as defined by the Tor Onion v3 spec.
4766     */
4767    uint8_t version;
4768    /**
4769     * The port on which the node is listening
4770     */
4771    uint16_t port;
4772 } LDKNetAddress_LDKOnionV3_Body;
4773
4774 typedef struct MUST_USE_STRUCT LDKNetAddress {
4775    LDKNetAddress_Tag tag;
4776    union {
4777       LDKNetAddress_LDKIPv4_Body i_pv4;
4778       LDKNetAddress_LDKIPv6_Body i_pv6;
4779       LDKNetAddress_LDKOnionV2_Body onion_v2;
4780       LDKNetAddress_LDKOnionV3_Body onion_v3;
4781    };
4782 } LDKNetAddress;
4783
4784 /**
4785  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4786  * This corresponds to std::vector in C++
4787  */
4788 typedef struct LDKCVec_NetAddressZ {
4789    /**
4790     * The elements in the array.
4791     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4792     */
4793    struct LDKNetAddress *data;
4794    /**
4795     * The number of elements pointed to by `data`.
4796     */
4797    uintptr_t datalen;
4798 } LDKCVec_NetAddressZ;
4799
4800
4801
4802 /**
4803  * Information received in the latest node_announcement from this node.
4804  */
4805 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4806    /**
4807     * A pointer to the opaque Rust object.
4808     * Nearly everywhere, inner must be non-null, however in places where
4809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4810     */
4811    LDKnativeNodeAnnouncementInfo *inner;
4812    /**
4813     * Indicates that this is the only struct which contains the same pointer.
4814     * Rust functions which take ownership of an object provided via an argument require
4815     * this to be true and invalidate the object pointed to by inner.
4816     */
4817    bool is_owned;
4818 } LDKNodeAnnouncementInfo;
4819
4820 /**
4821  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4822  */
4823 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4824    /**
4825     * A pointer to the contents in the success state.
4826     * Reading from this pointer when `result_ok` is not set is undefined.
4827     */
4828    struct LDKNodeAnnouncementInfo *result;
4829    /**
4830     * A pointer to the contents in the error state.
4831     * Reading from this pointer when `result_ok` is set is undefined.
4832     */
4833    struct LDKDecodeError *err;
4834 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4835
4836 /**
4837  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4838  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4840  */
4841 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4842    /**
4843     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4844     * `err` or `result` depending on the state of `result_ok`.
4845     */
4846    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4847    /**
4848     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4849     */
4850    bool result_ok;
4851 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4852
4853 /**
4854  * A dynamically-allocated array of u64s of arbitrary size.
4855  * This corresponds to std::vector in C++
4856  */
4857 typedef struct LDKCVec_u64Z {
4858    /**
4859     * The elements in the array.
4860     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4861     */
4862    uint64_t *data;
4863    /**
4864     * The number of elements pointed to by `data`.
4865     */
4866    uintptr_t datalen;
4867 } LDKCVec_u64Z;
4868
4869
4870
4871 /**
4872  * Details about a node in the network, known from the network announcement.
4873  */
4874 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4875    /**
4876     * A pointer to the opaque Rust object.
4877     * Nearly everywhere, inner must be non-null, however in places where
4878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4879     */
4880    LDKnativeNodeInfo *inner;
4881    /**
4882     * Indicates that this is the only struct which contains the same pointer.
4883     * Rust functions which take ownership of an object provided via an argument require
4884     * this to be true and invalidate the object pointed to by inner.
4885     */
4886    bool is_owned;
4887 } LDKNodeInfo;
4888
4889 /**
4890  * The contents of CResult_NodeInfoDecodeErrorZ
4891  */
4892 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4893    /**
4894     * A pointer to the contents in the success state.
4895     * Reading from this pointer when `result_ok` is not set is undefined.
4896     */
4897    struct LDKNodeInfo *result;
4898    /**
4899     * A pointer to the contents in the error state.
4900     * Reading from this pointer when `result_ok` is set is undefined.
4901     */
4902    struct LDKDecodeError *err;
4903 } LDKCResult_NodeInfoDecodeErrorZPtr;
4904
4905 /**
4906  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4907  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4909  */
4910 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4911    /**
4912     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4913     * `err` or `result` depending on the state of `result_ok`.
4914     */
4915    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4916    /**
4917     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4918     */
4919    bool result_ok;
4920 } LDKCResult_NodeInfoDecodeErrorZ;
4921
4922
4923
4924 /**
4925  * Represents the network as nodes and channels between them
4926  */
4927 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4928    /**
4929     * A pointer to the opaque Rust object.
4930     * Nearly everywhere, inner must be non-null, however in places where
4931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4932     */
4933    LDKnativeNetworkGraph *inner;
4934    /**
4935     * Indicates that this is the only struct which contains the same pointer.
4936     * Rust functions which take ownership of an object provided via an argument require
4937     * this to be true and invalidate the object pointed to by inner.
4938     */
4939    bool is_owned;
4940 } LDKNetworkGraph;
4941
4942 /**
4943  * The contents of CResult_NetworkGraphDecodeErrorZ
4944  */
4945 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4946    /**
4947     * A pointer to the contents in the success state.
4948     * Reading from this pointer when `result_ok` is not set is undefined.
4949     */
4950    struct LDKNetworkGraph *result;
4951    /**
4952     * A pointer to the contents in the error state.
4953     * Reading from this pointer when `result_ok` is set is undefined.
4954     */
4955    struct LDKDecodeError *err;
4956 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4957
4958 /**
4959  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4960  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4962  */
4963 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4964    /**
4965     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4966     * `err` or `result` depending on the state of `result_ok`.
4967     */
4968    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4969    /**
4970     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4971     */
4972    bool result_ok;
4973 } LDKCResult_NetworkGraphDecodeErrorZ;
4974
4975
4976
4977 /**
4978  * Features used within an `init` message.
4979  */
4980 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4981    /**
4982     * A pointer to the opaque Rust object.
4983     * Nearly everywhere, inner must be non-null, however in places where
4984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4985     */
4986    LDKnativeInitFeatures *inner;
4987    /**
4988     * Indicates that this is the only struct which contains the same pointer.
4989     * Rust functions which take ownership of an object provided via an argument require
4990     * this to be true and invalidate the object pointed to by inner.
4991     */
4992    bool is_owned;
4993 } LDKInitFeatures;
4994
4995 /**
4996  * The contents of CResult_InitFeaturesDecodeErrorZ
4997  */
4998 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4999    /**
5000     * A pointer to the contents in the success state.
5001     * Reading from this pointer when `result_ok` is not set is undefined.
5002     */
5003    struct LDKInitFeatures *result;
5004    /**
5005     * A pointer to the contents in the error state.
5006     * Reading from this pointer when `result_ok` is set is undefined.
5007     */
5008    struct LDKDecodeError *err;
5009 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5010
5011 /**
5012  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5013  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5014  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5015  */
5016 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5017    /**
5018     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5019     * `err` or `result` depending on the state of `result_ok`.
5020     */
5021    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5022    /**
5023     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5024     */
5025    bool result_ok;
5026 } LDKCResult_InitFeaturesDecodeErrorZ;
5027
5028
5029
5030 /**
5031  * Features used within a `node_announcement` message.
5032  */
5033 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5034    /**
5035     * A pointer to the opaque Rust object.
5036     * Nearly everywhere, inner must be non-null, however in places where
5037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5038     */
5039    LDKnativeNodeFeatures *inner;
5040    /**
5041     * Indicates that this is the only struct which contains the same pointer.
5042     * Rust functions which take ownership of an object provided via an argument require
5043     * this to be true and invalidate the object pointed to by inner.
5044     */
5045    bool is_owned;
5046 } LDKNodeFeatures;
5047
5048 /**
5049  * The contents of CResult_NodeFeaturesDecodeErrorZ
5050  */
5051 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5052    /**
5053     * A pointer to the contents in the success state.
5054     * Reading from this pointer when `result_ok` is not set is undefined.
5055     */
5056    struct LDKNodeFeatures *result;
5057    /**
5058     * A pointer to the contents in the error state.
5059     * Reading from this pointer when `result_ok` is set is undefined.
5060     */
5061    struct LDKDecodeError *err;
5062 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5063
5064 /**
5065  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5066  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5068  */
5069 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5070    /**
5071     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5072     * `err` or `result` depending on the state of `result_ok`.
5073     */
5074    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5075    /**
5076     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5077     */
5078    bool result_ok;
5079 } LDKCResult_NodeFeaturesDecodeErrorZ;
5080
5081
5082
5083 /**
5084  * Features used within a `channel_announcement` message.
5085  */
5086 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5087    /**
5088     * A pointer to the opaque Rust object.
5089     * Nearly everywhere, inner must be non-null, however in places where
5090     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5091     */
5092    LDKnativeChannelFeatures *inner;
5093    /**
5094     * Indicates that this is the only struct which contains the same pointer.
5095     * Rust functions which take ownership of an object provided via an argument require
5096     * this to be true and invalidate the object pointed to by inner.
5097     */
5098    bool is_owned;
5099 } LDKChannelFeatures;
5100
5101 /**
5102  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5103  */
5104 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5105    /**
5106     * A pointer to the contents in the success state.
5107     * Reading from this pointer when `result_ok` is not set is undefined.
5108     */
5109    struct LDKChannelFeatures *result;
5110    /**
5111     * A pointer to the contents in the error state.
5112     * Reading from this pointer when `result_ok` is set is undefined.
5113     */
5114    struct LDKDecodeError *err;
5115 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5116
5117 /**
5118  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5119  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121  */
5122 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5123    /**
5124     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5125     * `err` or `result` depending on the state of `result_ok`.
5126     */
5127    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5128    /**
5129     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5130     */
5131    bool result_ok;
5132 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5133
5134
5135
5136 /**
5137  * Features used within an invoice.
5138  */
5139 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5140    /**
5141     * A pointer to the opaque Rust object.
5142     * Nearly everywhere, inner must be non-null, however in places where
5143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5144     */
5145    LDKnativeInvoiceFeatures *inner;
5146    /**
5147     * Indicates that this is the only struct which contains the same pointer.
5148     * Rust functions which take ownership of an object provided via an argument require
5149     * this to be true and invalidate the object pointed to by inner.
5150     */
5151    bool is_owned;
5152 } LDKInvoiceFeatures;
5153
5154 /**
5155  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5156  */
5157 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5158    /**
5159     * A pointer to the contents in the success state.
5160     * Reading from this pointer when `result_ok` is not set is undefined.
5161     */
5162    struct LDKInvoiceFeatures *result;
5163    /**
5164     * A pointer to the contents in the error state.
5165     * Reading from this pointer when `result_ok` is set is undefined.
5166     */
5167    struct LDKDecodeError *err;
5168 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5169
5170 /**
5171  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5172  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5174  */
5175 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5176    /**
5177     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5178     * `err` or `result` depending on the state of `result_ok`.
5179     */
5180    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5181    /**
5182     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5183     */
5184    bool result_ok;
5185 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5186
5187 /**
5188  * The contents of CResult_NetAddressu8Z
5189  */
5190 typedef union LDKCResult_NetAddressu8ZPtr {
5191    /**
5192     * A pointer to the contents in the success state.
5193     * Reading from this pointer when `result_ok` is not set is undefined.
5194     */
5195    struct LDKNetAddress *result;
5196    /**
5197     * A pointer to the contents in the error state.
5198     * Reading from this pointer when `result_ok` is set is undefined.
5199     */
5200    uint8_t *err;
5201 } LDKCResult_NetAddressu8ZPtr;
5202
5203 /**
5204  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5205  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5207  */
5208 typedef struct LDKCResult_NetAddressu8Z {
5209    /**
5210     * The contents of this CResult_NetAddressu8Z, accessible via either
5211     * `err` or `result` depending on the state of `result_ok`.
5212     */
5213    union LDKCResult_NetAddressu8ZPtr contents;
5214    /**
5215     * Whether this CResult_NetAddressu8Z represents a success state.
5216     */
5217    bool result_ok;
5218 } LDKCResult_NetAddressu8Z;
5219
5220 /**
5221  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5222  */
5223 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5224    /**
5225     * A pointer to the contents in the success state.
5226     * Reading from this pointer when `result_ok` is not set is undefined.
5227     */
5228    struct LDKCResult_NetAddressu8Z *result;
5229    /**
5230     * A pointer to the contents in the error state.
5231     * Reading from this pointer when `result_ok` is set is undefined.
5232     */
5233    struct LDKDecodeError *err;
5234 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5235
5236 /**
5237  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5238  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5239  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5240  */
5241 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5242    /**
5243     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5244     * `err` or `result` depending on the state of `result_ok`.
5245     */
5246    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5247    /**
5248     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5249     */
5250    bool result_ok;
5251 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5252
5253 /**
5254  * The contents of CResult_NetAddressDecodeErrorZ
5255  */
5256 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
5257    /**
5258     * A pointer to the contents in the success state.
5259     * Reading from this pointer when `result_ok` is not set is undefined.
5260     */
5261    struct LDKNetAddress *result;
5262    /**
5263     * A pointer to the contents in the error state.
5264     * Reading from this pointer when `result_ok` is set is undefined.
5265     */
5266    struct LDKDecodeError *err;
5267 } LDKCResult_NetAddressDecodeErrorZPtr;
5268
5269 /**
5270  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
5271  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
5272  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5273  */
5274 typedef struct LDKCResult_NetAddressDecodeErrorZ {
5275    /**
5276     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
5277     * `err` or `result` depending on the state of `result_ok`.
5278     */
5279    union LDKCResult_NetAddressDecodeErrorZPtr contents;
5280    /**
5281     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
5282     */
5283    bool result_ok;
5284 } LDKCResult_NetAddressDecodeErrorZ;
5285
5286
5287
5288 /**
5289  * An update_add_htlc message to be sent or received from a peer
5290  */
5291 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
5292    /**
5293     * A pointer to the opaque Rust object.
5294     * Nearly everywhere, inner must be non-null, however in places where
5295     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5296     */
5297    LDKnativeUpdateAddHTLC *inner;
5298    /**
5299     * Indicates that this is the only struct which contains the same pointer.
5300     * Rust functions which take ownership of an object provided via an argument require
5301     * this to be true and invalidate the object pointed to by inner.
5302     */
5303    bool is_owned;
5304 } LDKUpdateAddHTLC;
5305
5306 /**
5307  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5308  * This corresponds to std::vector in C++
5309  */
5310 typedef struct LDKCVec_UpdateAddHTLCZ {
5311    /**
5312     * The elements in the array.
5313     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5314     */
5315    struct LDKUpdateAddHTLC *data;
5316    /**
5317     * The number of elements pointed to by `data`.
5318     */
5319    uintptr_t datalen;
5320 } LDKCVec_UpdateAddHTLCZ;
5321
5322
5323
5324 /**
5325  * An update_fulfill_htlc message to be sent or received from a peer
5326  */
5327 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5328    /**
5329     * A pointer to the opaque Rust object.
5330     * Nearly everywhere, inner must be non-null, however in places where
5331     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5332     */
5333    LDKnativeUpdateFulfillHTLC *inner;
5334    /**
5335     * Indicates that this is the only struct which contains the same pointer.
5336     * Rust functions which take ownership of an object provided via an argument require
5337     * this to be true and invalidate the object pointed to by inner.
5338     */
5339    bool is_owned;
5340 } LDKUpdateFulfillHTLC;
5341
5342 /**
5343  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5344  * This corresponds to std::vector in C++
5345  */
5346 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5347    /**
5348     * The elements in the array.
5349     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5350     */
5351    struct LDKUpdateFulfillHTLC *data;
5352    /**
5353     * The number of elements pointed to by `data`.
5354     */
5355    uintptr_t datalen;
5356 } LDKCVec_UpdateFulfillHTLCZ;
5357
5358
5359
5360 /**
5361  * An update_fail_htlc message to be sent or received from a peer
5362  */
5363 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5364    /**
5365     * A pointer to the opaque Rust object.
5366     * Nearly everywhere, inner must be non-null, however in places where
5367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5368     */
5369    LDKnativeUpdateFailHTLC *inner;
5370    /**
5371     * Indicates that this is the only struct which contains the same pointer.
5372     * Rust functions which take ownership of an object provided via an argument require
5373     * this to be true and invalidate the object pointed to by inner.
5374     */
5375    bool is_owned;
5376 } LDKUpdateFailHTLC;
5377
5378 /**
5379  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5380  * This corresponds to std::vector in C++
5381  */
5382 typedef struct LDKCVec_UpdateFailHTLCZ {
5383    /**
5384     * The elements in the array.
5385     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5386     */
5387    struct LDKUpdateFailHTLC *data;
5388    /**
5389     * The number of elements pointed to by `data`.
5390     */
5391    uintptr_t datalen;
5392 } LDKCVec_UpdateFailHTLCZ;
5393
5394
5395
5396 /**
5397  * An update_fail_malformed_htlc message to be sent or received from a peer
5398  */
5399 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5400    /**
5401     * A pointer to the opaque Rust object.
5402     * Nearly everywhere, inner must be non-null, however in places where
5403     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5404     */
5405    LDKnativeUpdateFailMalformedHTLC *inner;
5406    /**
5407     * Indicates that this is the only struct which contains the same pointer.
5408     * Rust functions which take ownership of an object provided via an argument require
5409     * this to be true and invalidate the object pointed to by inner.
5410     */
5411    bool is_owned;
5412 } LDKUpdateFailMalformedHTLC;
5413
5414 /**
5415  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5416  * This corresponds to std::vector in C++
5417  */
5418 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5419    /**
5420     * The elements in the array.
5421     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5422     */
5423    struct LDKUpdateFailMalformedHTLC *data;
5424    /**
5425     * The number of elements pointed to by `data`.
5426     */
5427    uintptr_t datalen;
5428 } LDKCVec_UpdateFailMalformedHTLCZ;
5429
5430 /**
5431  * The contents of CResult_AcceptChannelDecodeErrorZ
5432  */
5433 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5434    /**
5435     * A pointer to the contents in the success state.
5436     * Reading from this pointer when `result_ok` is not set is undefined.
5437     */
5438    struct LDKAcceptChannel *result;
5439    /**
5440     * A pointer to the contents in the error state.
5441     * Reading from this pointer when `result_ok` is set is undefined.
5442     */
5443    struct LDKDecodeError *err;
5444 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5445
5446 /**
5447  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5448  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5449  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5450  */
5451 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5452    /**
5453     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5454     * `err` or `result` depending on the state of `result_ok`.
5455     */
5456    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5457    /**
5458     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5459     */
5460    bool result_ok;
5461 } LDKCResult_AcceptChannelDecodeErrorZ;
5462
5463 /**
5464  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5465  */
5466 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
5467    /**
5468     * A pointer to the contents in the success state.
5469     * Reading from this pointer when `result_ok` is not set is undefined.
5470     */
5471    struct LDKAnnouncementSignatures *result;
5472    /**
5473     * A pointer to the contents in the error state.
5474     * Reading from this pointer when `result_ok` is set is undefined.
5475     */
5476    struct LDKDecodeError *err;
5477 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
5478
5479 /**
5480  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5481  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5482  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5483  */
5484 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
5485    /**
5486     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5487     * `err` or `result` depending on the state of `result_ok`.
5488     */
5489    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5490    /**
5491     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5492     */
5493    bool result_ok;
5494 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5495
5496 /**
5497  * The contents of CResult_ChannelReestablishDecodeErrorZ
5498  */
5499 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
5500    /**
5501     * A pointer to the contents in the success state.
5502     * Reading from this pointer when `result_ok` is not set is undefined.
5503     */
5504    struct LDKChannelReestablish *result;
5505    /**
5506     * A pointer to the contents in the error state.
5507     * Reading from this pointer when `result_ok` is set is undefined.
5508     */
5509    struct LDKDecodeError *err;
5510 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
5511
5512 /**
5513  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5514  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5515  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5516  */
5517 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
5518    /**
5519     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5520     * `err` or `result` depending on the state of `result_ok`.
5521     */
5522    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5523    /**
5524     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5525     */
5526    bool result_ok;
5527 } LDKCResult_ChannelReestablishDecodeErrorZ;
5528
5529 /**
5530  * The contents of CResult_ClosingSignedDecodeErrorZ
5531  */
5532 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
5533    /**
5534     * A pointer to the contents in the success state.
5535     * Reading from this pointer when `result_ok` is not set is undefined.
5536     */
5537    struct LDKClosingSigned *result;
5538    /**
5539     * A pointer to the contents in the error state.
5540     * Reading from this pointer when `result_ok` is set is undefined.
5541     */
5542    struct LDKDecodeError *err;
5543 } LDKCResult_ClosingSignedDecodeErrorZPtr;
5544
5545 /**
5546  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5547  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5549  */
5550 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
5551    /**
5552     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5553     * `err` or `result` depending on the state of `result_ok`.
5554     */
5555    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5556    /**
5557     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5558     */
5559    bool result_ok;
5560 } LDKCResult_ClosingSignedDecodeErrorZ;
5561
5562
5563
5564 /**
5565  * A commitment_signed message to be sent or received from a peer
5566  */
5567 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5568    /**
5569     * A pointer to the opaque Rust object.
5570     * Nearly everywhere, inner must be non-null, however in places where
5571     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5572     */
5573    LDKnativeCommitmentSigned *inner;
5574    /**
5575     * Indicates that this is the only struct which contains the same pointer.
5576     * Rust functions which take ownership of an object provided via an argument require
5577     * this to be true and invalidate the object pointed to by inner.
5578     */
5579    bool is_owned;
5580 } LDKCommitmentSigned;
5581
5582 /**
5583  * The contents of CResult_CommitmentSignedDecodeErrorZ
5584  */
5585 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
5586    /**
5587     * A pointer to the contents in the success state.
5588     * Reading from this pointer when `result_ok` is not set is undefined.
5589     */
5590    struct LDKCommitmentSigned *result;
5591    /**
5592     * A pointer to the contents in the error state.
5593     * Reading from this pointer when `result_ok` is set is undefined.
5594     */
5595    struct LDKDecodeError *err;
5596 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
5597
5598 /**
5599  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5600  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5601  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5602  */
5603 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
5604    /**
5605     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5606     * `err` or `result` depending on the state of `result_ok`.
5607     */
5608    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5609    /**
5610     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5611     */
5612    bool result_ok;
5613 } LDKCResult_CommitmentSignedDecodeErrorZ;
5614
5615 /**
5616  * The contents of CResult_FundingCreatedDecodeErrorZ
5617  */
5618 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
5619    /**
5620     * A pointer to the contents in the success state.
5621     * Reading from this pointer when `result_ok` is not set is undefined.
5622     */
5623    struct LDKFundingCreated *result;
5624    /**
5625     * A pointer to the contents in the error state.
5626     * Reading from this pointer when `result_ok` is set is undefined.
5627     */
5628    struct LDKDecodeError *err;
5629 } LDKCResult_FundingCreatedDecodeErrorZPtr;
5630
5631 /**
5632  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5633  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5634  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5635  */
5636 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
5637    /**
5638     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5639     * `err` or `result` depending on the state of `result_ok`.
5640     */
5641    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5642    /**
5643     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5644     */
5645    bool result_ok;
5646 } LDKCResult_FundingCreatedDecodeErrorZ;
5647
5648 /**
5649  * The contents of CResult_FundingSignedDecodeErrorZ
5650  */
5651 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
5652    /**
5653     * A pointer to the contents in the success state.
5654     * Reading from this pointer when `result_ok` is not set is undefined.
5655     */
5656    struct LDKFundingSigned *result;
5657    /**
5658     * A pointer to the contents in the error state.
5659     * Reading from this pointer when `result_ok` is set is undefined.
5660     */
5661    struct LDKDecodeError *err;
5662 } LDKCResult_FundingSignedDecodeErrorZPtr;
5663
5664 /**
5665  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5666  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5667  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5668  */
5669 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
5670    /**
5671     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5672     * `err` or `result` depending on the state of `result_ok`.
5673     */
5674    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5675    /**
5676     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5677     */
5678    bool result_ok;
5679 } LDKCResult_FundingSignedDecodeErrorZ;
5680
5681 /**
5682  * The contents of CResult_FundingLockedDecodeErrorZ
5683  */
5684 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
5685    /**
5686     * A pointer to the contents in the success state.
5687     * Reading from this pointer when `result_ok` is not set is undefined.
5688     */
5689    struct LDKFundingLocked *result;
5690    /**
5691     * A pointer to the contents in the error state.
5692     * Reading from this pointer when `result_ok` is set is undefined.
5693     */
5694    struct LDKDecodeError *err;
5695 } LDKCResult_FundingLockedDecodeErrorZPtr;
5696
5697 /**
5698  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5699  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5700  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5701  */
5702 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
5703    /**
5704     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5705     * `err` or `result` depending on the state of `result_ok`.
5706     */
5707    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5708    /**
5709     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5710     */
5711    bool result_ok;
5712 } LDKCResult_FundingLockedDecodeErrorZ;
5713
5714
5715
5716 /**
5717  * An init message to be sent or received from a peer
5718  */
5719 typedef struct MUST_USE_STRUCT LDKInit {
5720    /**
5721     * A pointer to the opaque Rust object.
5722     * Nearly everywhere, inner must be non-null, however in places where
5723     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5724     */
5725    LDKnativeInit *inner;
5726    /**
5727     * Indicates that this is the only struct which contains the same pointer.
5728     * Rust functions which take ownership of an object provided via an argument require
5729     * this to be true and invalidate the object pointed to by inner.
5730     */
5731    bool is_owned;
5732 } LDKInit;
5733
5734 /**
5735  * The contents of CResult_InitDecodeErrorZ
5736  */
5737 typedef union LDKCResult_InitDecodeErrorZPtr {
5738    /**
5739     * A pointer to the contents in the success state.
5740     * Reading from this pointer when `result_ok` is not set is undefined.
5741     */
5742    struct LDKInit *result;
5743    /**
5744     * A pointer to the contents in the error state.
5745     * Reading from this pointer when `result_ok` is set is undefined.
5746     */
5747    struct LDKDecodeError *err;
5748 } LDKCResult_InitDecodeErrorZPtr;
5749
5750 /**
5751  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5752  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5753  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5754  */
5755 typedef struct LDKCResult_InitDecodeErrorZ {
5756    /**
5757     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5758     * `err` or `result` depending on the state of `result_ok`.
5759     */
5760    union LDKCResult_InitDecodeErrorZPtr contents;
5761    /**
5762     * Whether this CResult_InitDecodeErrorZ represents a success state.
5763     */
5764    bool result_ok;
5765 } LDKCResult_InitDecodeErrorZ;
5766
5767 /**
5768  * The contents of CResult_OpenChannelDecodeErrorZ
5769  */
5770 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
5771    /**
5772     * A pointer to the contents in the success state.
5773     * Reading from this pointer when `result_ok` is not set is undefined.
5774     */
5775    struct LDKOpenChannel *result;
5776    /**
5777     * A pointer to the contents in the error state.
5778     * Reading from this pointer when `result_ok` is set is undefined.
5779     */
5780    struct LDKDecodeError *err;
5781 } LDKCResult_OpenChannelDecodeErrorZPtr;
5782
5783 /**
5784  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5785  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5787  */
5788 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
5789    /**
5790     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5791     * `err` or `result` depending on the state of `result_ok`.
5792     */
5793    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5794    /**
5795     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5796     */
5797    bool result_ok;
5798 } LDKCResult_OpenChannelDecodeErrorZ;
5799
5800 /**
5801  * The contents of CResult_RevokeAndACKDecodeErrorZ
5802  */
5803 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
5804    /**
5805     * A pointer to the contents in the success state.
5806     * Reading from this pointer when `result_ok` is not set is undefined.
5807     */
5808    struct LDKRevokeAndACK *result;
5809    /**
5810     * A pointer to the contents in the error state.
5811     * Reading from this pointer when `result_ok` is set is undefined.
5812     */
5813    struct LDKDecodeError *err;
5814 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5815
5816 /**
5817  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5818  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5819  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5820  */
5821 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5822    /**
5823     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5824     * `err` or `result` depending on the state of `result_ok`.
5825     */
5826    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5827    /**
5828     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5829     */
5830    bool result_ok;
5831 } LDKCResult_RevokeAndACKDecodeErrorZ;
5832
5833 /**
5834  * The contents of CResult_ShutdownDecodeErrorZ
5835  */
5836 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5837    /**
5838     * A pointer to the contents in the success state.
5839     * Reading from this pointer when `result_ok` is not set is undefined.
5840     */
5841    struct LDKShutdown *result;
5842    /**
5843     * A pointer to the contents in the error state.
5844     * Reading from this pointer when `result_ok` is set is undefined.
5845     */
5846    struct LDKDecodeError *err;
5847 } LDKCResult_ShutdownDecodeErrorZPtr;
5848
5849 /**
5850  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5851  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5852  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5853  */
5854 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5855    /**
5856     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5857     * `err` or `result` depending on the state of `result_ok`.
5858     */
5859    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5860    /**
5861     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5862     */
5863    bool result_ok;
5864 } LDKCResult_ShutdownDecodeErrorZ;
5865
5866 /**
5867  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5868  */
5869 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5870    /**
5871     * A pointer to the contents in the success state.
5872     * Reading from this pointer when `result_ok` is not set is undefined.
5873     */
5874    struct LDKUpdateFailHTLC *result;
5875    /**
5876     * A pointer to the contents in the error state.
5877     * Reading from this pointer when `result_ok` is set is undefined.
5878     */
5879    struct LDKDecodeError *err;
5880 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5881
5882 /**
5883  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5884  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886  */
5887 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5888    /**
5889     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5890     * `err` or `result` depending on the state of `result_ok`.
5891     */
5892    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5893    /**
5894     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5895     */
5896    bool result_ok;
5897 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5898
5899 /**
5900  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5901  */
5902 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5903    /**
5904     * A pointer to the contents in the success state.
5905     * Reading from this pointer when `result_ok` is not set is undefined.
5906     */
5907    struct LDKUpdateFailMalformedHTLC *result;
5908    /**
5909     * A pointer to the contents in the error state.
5910     * Reading from this pointer when `result_ok` is set is undefined.
5911     */
5912    struct LDKDecodeError *err;
5913 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5914
5915 /**
5916  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5917  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5919  */
5920 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5921    /**
5922     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5923     * `err` or `result` depending on the state of `result_ok`.
5924     */
5925    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5926    /**
5927     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5928     */
5929    bool result_ok;
5930 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5931
5932
5933
5934 /**
5935  * An update_fee message to be sent or received from a peer
5936  */
5937 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5938    /**
5939     * A pointer to the opaque Rust object.
5940     * Nearly everywhere, inner must be non-null, however in places where
5941     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5942     */
5943    LDKnativeUpdateFee *inner;
5944    /**
5945     * Indicates that this is the only struct which contains the same pointer.
5946     * Rust functions which take ownership of an object provided via an argument require
5947     * this to be true and invalidate the object pointed to by inner.
5948     */
5949    bool is_owned;
5950 } LDKUpdateFee;
5951
5952 /**
5953  * The contents of CResult_UpdateFeeDecodeErrorZ
5954  */
5955 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5956    /**
5957     * A pointer to the contents in the success state.
5958     * Reading from this pointer when `result_ok` is not set is undefined.
5959     */
5960    struct LDKUpdateFee *result;
5961    /**
5962     * A pointer to the contents in the error state.
5963     * Reading from this pointer when `result_ok` is set is undefined.
5964     */
5965    struct LDKDecodeError *err;
5966 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5967
5968 /**
5969  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5970  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5972  */
5973 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5974    /**
5975     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5976     * `err` or `result` depending on the state of `result_ok`.
5977     */
5978    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5979    /**
5980     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5981     */
5982    bool result_ok;
5983 } LDKCResult_UpdateFeeDecodeErrorZ;
5984
5985 /**
5986  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5987  */
5988 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5989    /**
5990     * A pointer to the contents in the success state.
5991     * Reading from this pointer when `result_ok` is not set is undefined.
5992     */
5993    struct LDKUpdateFulfillHTLC *result;
5994    /**
5995     * A pointer to the contents in the error state.
5996     * Reading from this pointer when `result_ok` is set is undefined.
5997     */
5998    struct LDKDecodeError *err;
5999 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
6000
6001 /**
6002  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
6003  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6004  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6005  */
6006 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
6007    /**
6008     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
6009     * `err` or `result` depending on the state of `result_ok`.
6010     */
6011    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
6012    /**
6013     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
6014     */
6015    bool result_ok;
6016 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
6017
6018 /**
6019  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
6020  */
6021 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
6022    /**
6023     * A pointer to the contents in the success state.
6024     * Reading from this pointer when `result_ok` is not set is undefined.
6025     */
6026    struct LDKUpdateAddHTLC *result;
6027    /**
6028     * A pointer to the contents in the error state.
6029     * Reading from this pointer when `result_ok` is set is undefined.
6030     */
6031    struct LDKDecodeError *err;
6032 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
6033
6034 /**
6035  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6036  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6038  */
6039 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
6040    /**
6041     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6042     * `err` or `result` depending on the state of `result_ok`.
6043     */
6044    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
6045    /**
6046     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6047     */
6048    bool result_ok;
6049 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
6050
6051
6052
6053 /**
6054  * A ping message to be sent or received from a peer
6055  */
6056 typedef struct MUST_USE_STRUCT LDKPing {
6057    /**
6058     * A pointer to the opaque Rust object.
6059     * Nearly everywhere, inner must be non-null, however in places where
6060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6061     */
6062    LDKnativePing *inner;
6063    /**
6064     * Indicates that this is the only struct which contains the same pointer.
6065     * Rust functions which take ownership of an object provided via an argument require
6066     * this to be true and invalidate the object pointed to by inner.
6067     */
6068    bool is_owned;
6069 } LDKPing;
6070
6071 /**
6072  * The contents of CResult_PingDecodeErrorZ
6073  */
6074 typedef union LDKCResult_PingDecodeErrorZPtr {
6075    /**
6076     * A pointer to the contents in the success state.
6077     * Reading from this pointer when `result_ok` is not set is undefined.
6078     */
6079    struct LDKPing *result;
6080    /**
6081     * A pointer to the contents in the error state.
6082     * Reading from this pointer when `result_ok` is set is undefined.
6083     */
6084    struct LDKDecodeError *err;
6085 } LDKCResult_PingDecodeErrorZPtr;
6086
6087 /**
6088  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6089  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6091  */
6092 typedef struct LDKCResult_PingDecodeErrorZ {
6093    /**
6094     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6095     * `err` or `result` depending on the state of `result_ok`.
6096     */
6097    union LDKCResult_PingDecodeErrorZPtr contents;
6098    /**
6099     * Whether this CResult_PingDecodeErrorZ represents a success state.
6100     */
6101    bool result_ok;
6102 } LDKCResult_PingDecodeErrorZ;
6103
6104
6105
6106 /**
6107  * A pong message to be sent or received from a peer
6108  */
6109 typedef struct MUST_USE_STRUCT LDKPong {
6110    /**
6111     * A pointer to the opaque Rust object.
6112     * Nearly everywhere, inner must be non-null, however in places where
6113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6114     */
6115    LDKnativePong *inner;
6116    /**
6117     * Indicates that this is the only struct which contains the same pointer.
6118     * Rust functions which take ownership of an object provided via an argument require
6119     * this to be true and invalidate the object pointed to by inner.
6120     */
6121    bool is_owned;
6122 } LDKPong;
6123
6124 /**
6125  * The contents of CResult_PongDecodeErrorZ
6126  */
6127 typedef union LDKCResult_PongDecodeErrorZPtr {
6128    /**
6129     * A pointer to the contents in the success state.
6130     * Reading from this pointer when `result_ok` is not set is undefined.
6131     */
6132    struct LDKPong *result;
6133    /**
6134     * A pointer to the contents in the error state.
6135     * Reading from this pointer when `result_ok` is set is undefined.
6136     */
6137    struct LDKDecodeError *err;
6138 } LDKCResult_PongDecodeErrorZPtr;
6139
6140 /**
6141  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6142  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6143  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6144  */
6145 typedef struct LDKCResult_PongDecodeErrorZ {
6146    /**
6147     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6148     * `err` or `result` depending on the state of `result_ok`.
6149     */
6150    union LDKCResult_PongDecodeErrorZPtr contents;
6151    /**
6152     * Whether this CResult_PongDecodeErrorZ represents a success state.
6153     */
6154    bool result_ok;
6155 } LDKCResult_PongDecodeErrorZ;
6156
6157 /**
6158  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6159  */
6160 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6161    /**
6162     * A pointer to the contents in the success state.
6163     * Reading from this pointer when `result_ok` is not set is undefined.
6164     */
6165    struct LDKUnsignedChannelAnnouncement *result;
6166    /**
6167     * A pointer to the contents in the error state.
6168     * Reading from this pointer when `result_ok` is set is undefined.
6169     */
6170    struct LDKDecodeError *err;
6171 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
6172
6173 /**
6174  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6175  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6176  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6177  */
6178 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
6179    /**
6180     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6181     * `err` or `result` depending on the state of `result_ok`.
6182     */
6183    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6184    /**
6185     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6186     */
6187    bool result_ok;
6188 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6189
6190 /**
6191  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6192  */
6193 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
6194    /**
6195     * A pointer to the contents in the success state.
6196     * Reading from this pointer when `result_ok` is not set is undefined.
6197     */
6198    struct LDKChannelAnnouncement *result;
6199    /**
6200     * A pointer to the contents in the error state.
6201     * Reading from this pointer when `result_ok` is set is undefined.
6202     */
6203    struct LDKDecodeError *err;
6204 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
6205
6206 /**
6207  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6208  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6210  */
6211 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
6212    /**
6213     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6214     * `err` or `result` depending on the state of `result_ok`.
6215     */
6216    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6217    /**
6218     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6219     */
6220    bool result_ok;
6221 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6222
6223
6224
6225 /**
6226  * The unsigned part of a channel_update
6227  */
6228 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6229    /**
6230     * A pointer to the opaque Rust object.
6231     * Nearly everywhere, inner must be non-null, however in places where
6232     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6233     */
6234    LDKnativeUnsignedChannelUpdate *inner;
6235    /**
6236     * Indicates that this is the only struct which contains the same pointer.
6237     * Rust functions which take ownership of an object provided via an argument require
6238     * this to be true and invalidate the object pointed to by inner.
6239     */
6240    bool is_owned;
6241 } LDKUnsignedChannelUpdate;
6242
6243 /**
6244  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6245  */
6246 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
6247    /**
6248     * A pointer to the contents in the success state.
6249     * Reading from this pointer when `result_ok` is not set is undefined.
6250     */
6251    struct LDKUnsignedChannelUpdate *result;
6252    /**
6253     * A pointer to the contents in the error state.
6254     * Reading from this pointer when `result_ok` is set is undefined.
6255     */
6256    struct LDKDecodeError *err;
6257 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
6258
6259 /**
6260  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6261  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6263  */
6264 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
6265    /**
6266     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6267     * `err` or `result` depending on the state of `result_ok`.
6268     */
6269    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6270    /**
6271     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6272     */
6273    bool result_ok;
6274 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6275
6276 /**
6277  * The contents of CResult_ChannelUpdateDecodeErrorZ
6278  */
6279 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
6280    /**
6281     * A pointer to the contents in the success state.
6282     * Reading from this pointer when `result_ok` is not set is undefined.
6283     */
6284    struct LDKChannelUpdate *result;
6285    /**
6286     * A pointer to the contents in the error state.
6287     * Reading from this pointer when `result_ok` is set is undefined.
6288     */
6289    struct LDKDecodeError *err;
6290 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
6291
6292 /**
6293  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6294  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6295  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6296  */
6297 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
6298    /**
6299     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6300     * `err` or `result` depending on the state of `result_ok`.
6301     */
6302    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6303    /**
6304     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6305     */
6306    bool result_ok;
6307 } LDKCResult_ChannelUpdateDecodeErrorZ;
6308
6309 /**
6310  * The contents of CResult_ErrorMessageDecodeErrorZ
6311  */
6312 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
6313    /**
6314     * A pointer to the contents in the success state.
6315     * Reading from this pointer when `result_ok` is not set is undefined.
6316     */
6317    struct LDKErrorMessage *result;
6318    /**
6319     * A pointer to the contents in the error state.
6320     * Reading from this pointer when `result_ok` is set is undefined.
6321     */
6322    struct LDKDecodeError *err;
6323 } LDKCResult_ErrorMessageDecodeErrorZPtr;
6324
6325 /**
6326  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6327  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
6328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6329  */
6330 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
6331    /**
6332     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6333     * `err` or `result` depending on the state of `result_ok`.
6334     */
6335    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6336    /**
6337     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6338     */
6339    bool result_ok;
6340 } LDKCResult_ErrorMessageDecodeErrorZ;
6341
6342
6343
6344 /**
6345  * The unsigned part of a node_announcement
6346  */
6347 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6348    /**
6349     * A pointer to the opaque Rust object.
6350     * Nearly everywhere, inner must be non-null, however in places where
6351     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6352     */
6353    LDKnativeUnsignedNodeAnnouncement *inner;
6354    /**
6355     * Indicates that this is the only struct which contains the same pointer.
6356     * Rust functions which take ownership of an object provided via an argument require
6357     * this to be true and invalidate the object pointed to by inner.
6358     */
6359    bool is_owned;
6360 } LDKUnsignedNodeAnnouncement;
6361
6362 /**
6363  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6364  */
6365 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6366    /**
6367     * A pointer to the contents in the success state.
6368     * Reading from this pointer when `result_ok` is not set is undefined.
6369     */
6370    struct LDKUnsignedNodeAnnouncement *result;
6371    /**
6372     * A pointer to the contents in the error state.
6373     * Reading from this pointer when `result_ok` is set is undefined.
6374     */
6375    struct LDKDecodeError *err;
6376 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
6377
6378 /**
6379  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6380  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6381  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6382  */
6383 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
6384    /**
6385     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6386     * `err` or `result` depending on the state of `result_ok`.
6387     */
6388    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6389    /**
6390     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6391     */
6392    bool result_ok;
6393 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6394
6395 /**
6396  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6397  */
6398 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
6399    /**
6400     * A pointer to the contents in the success state.
6401     * Reading from this pointer when `result_ok` is not set is undefined.
6402     */
6403    struct LDKNodeAnnouncement *result;
6404    /**
6405     * A pointer to the contents in the error state.
6406     * Reading from this pointer when `result_ok` is set is undefined.
6407     */
6408    struct LDKDecodeError *err;
6409 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
6410
6411 /**
6412  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6413  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6414  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6415  */
6416 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
6417    /**
6418     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6419     * `err` or `result` depending on the state of `result_ok`.
6420     */
6421    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6422    /**
6423     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6424     */
6425    bool result_ok;
6426 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6427
6428 /**
6429  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6430  */
6431 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
6432    /**
6433     * A pointer to the contents in the success state.
6434     * Reading from this pointer when `result_ok` is not set is undefined.
6435     */
6436    struct LDKQueryShortChannelIds *result;
6437    /**
6438     * A pointer to the contents in the error state.
6439     * Reading from this pointer when `result_ok` is set is undefined.
6440     */
6441    struct LDKDecodeError *err;
6442 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
6443
6444 /**
6445  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6446  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
6447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6448  */
6449 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
6450    /**
6451     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6452     * `err` or `result` depending on the state of `result_ok`.
6453     */
6454    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6455    /**
6456     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6457     */
6458    bool result_ok;
6459 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6460
6461
6462
6463 /**
6464  * A reply_short_channel_ids_end message is sent as a reply to a
6465  * query_short_channel_ids message. The query recipient makes a best
6466  * effort to respond based on their local network view which may not be
6467  * a perfect view of the network.
6468  */
6469 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6470    /**
6471     * A pointer to the opaque Rust object.
6472     * Nearly everywhere, inner must be non-null, however in places where
6473     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6474     */
6475    LDKnativeReplyShortChannelIdsEnd *inner;
6476    /**
6477     * Indicates that this is the only struct which contains the same pointer.
6478     * Rust functions which take ownership of an object provided via an argument require
6479     * this to be true and invalidate the object pointed to by inner.
6480     */
6481    bool is_owned;
6482 } LDKReplyShortChannelIdsEnd;
6483
6484 /**
6485  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6486  */
6487 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6488    /**
6489     * A pointer to the contents in the success state.
6490     * Reading from this pointer when `result_ok` is not set is undefined.
6491     */
6492    struct LDKReplyShortChannelIdsEnd *result;
6493    /**
6494     * A pointer to the contents in the error state.
6495     * Reading from this pointer when `result_ok` is set is undefined.
6496     */
6497    struct LDKDecodeError *err;
6498 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6499
6500 /**
6501  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6502  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
6503  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6504  */
6505 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6506    /**
6507     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6508     * `err` or `result` depending on the state of `result_ok`.
6509     */
6510    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6511    /**
6512     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6513     */
6514    bool result_ok;
6515 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6516
6517 /**
6518  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6519  */
6520 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
6521    /**
6522     * A pointer to the contents in the success state.
6523     * Reading from this pointer when `result_ok` is not set is undefined.
6524     */
6525    struct LDKQueryChannelRange *result;
6526    /**
6527     * A pointer to the contents in the error state.
6528     * Reading from this pointer when `result_ok` is set is undefined.
6529     */
6530    struct LDKDecodeError *err;
6531 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
6532
6533 /**
6534  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6535  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6536  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6537  */
6538 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
6539    /**
6540     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6541     * `err` or `result` depending on the state of `result_ok`.
6542     */
6543    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6544    /**
6545     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6546     */
6547    bool result_ok;
6548 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6549
6550 /**
6551  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6552  */
6553 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
6554    /**
6555     * A pointer to the contents in the success state.
6556     * Reading from this pointer when `result_ok` is not set is undefined.
6557     */
6558    struct LDKReplyChannelRange *result;
6559    /**
6560     * A pointer to the contents in the error state.
6561     * Reading from this pointer when `result_ok` is set is undefined.
6562     */
6563    struct LDKDecodeError *err;
6564 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
6565
6566 /**
6567  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6568  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6570  */
6571 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
6572    /**
6573     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6574     * `err` or `result` depending on the state of `result_ok`.
6575     */
6576    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6577    /**
6578     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6579     */
6580    bool result_ok;
6581 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6582
6583
6584
6585 /**
6586  * A gossip_timestamp_filter message is used by a node to request
6587  * gossip relay for messages in the requested time range when the
6588  * gossip_queries feature has been negotiated.
6589  */
6590 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6591    /**
6592     * A pointer to the opaque Rust object.
6593     * Nearly everywhere, inner must be non-null, however in places where
6594     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6595     */
6596    LDKnativeGossipTimestampFilter *inner;
6597    /**
6598     * Indicates that this is the only struct which contains the same pointer.
6599     * Rust functions which take ownership of an object provided via an argument require
6600     * this to be true and invalidate the object pointed to by inner.
6601     */
6602    bool is_owned;
6603 } LDKGossipTimestampFilter;
6604
6605 /**
6606  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6607  */
6608 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6609    /**
6610     * A pointer to the contents in the success state.
6611     * Reading from this pointer when `result_ok` is not set is undefined.
6612     */
6613    struct LDKGossipTimestampFilter *result;
6614    /**
6615     * A pointer to the contents in the error state.
6616     * Reading from this pointer when `result_ok` is set is undefined.
6617     */
6618    struct LDKDecodeError *err;
6619 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6620
6621 /**
6622  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6623  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
6624  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6625  */
6626 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6627    /**
6628     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6629     * `err` or `result` depending on the state of `result_ok`.
6630     */
6631    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6632    /**
6633     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6634     */
6635    bool result_ok;
6636 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6637
6638 /**
6639  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
6640  * may occur.
6641  */
6642 typedef enum LDKSignOrCreationError_Tag {
6643    /**
6644     * An error occurred during signing
6645     */
6646    LDKSignOrCreationError_SignError,
6647    /**
6648     * An error occurred while building the transaction
6649     */
6650    LDKSignOrCreationError_CreationError,
6651    /**
6652     * Must be last for serialization purposes
6653     */
6654    LDKSignOrCreationError_Sentinel,
6655 } LDKSignOrCreationError_Tag;
6656
6657 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
6658    LDKSignOrCreationError_Tag tag;
6659    union {
6660       struct {
6661          enum LDKCreationError creation_error;
6662       };
6663    };
6664 } LDKSignOrCreationError;
6665
6666 /**
6667  * The contents of CResult_InvoiceSignOrCreationErrorZ
6668  */
6669 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
6670    /**
6671     * A pointer to the contents in the success state.
6672     * Reading from this pointer when `result_ok` is not set is undefined.
6673     */
6674    struct LDKInvoice *result;
6675    /**
6676     * A pointer to the contents in the error state.
6677     * Reading from this pointer when `result_ok` is set is undefined.
6678     */
6679    struct LDKSignOrCreationError *err;
6680 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
6681
6682 /**
6683  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
6684  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
6685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6686  */
6687 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
6688    /**
6689     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
6690     * `err` or `result` depending on the state of `result_ok`.
6691     */
6692    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
6693    /**
6694     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
6695     */
6696    bool result_ok;
6697 } LDKCResult_InvoiceSignOrCreationErrorZ;
6698
6699 /**
6700  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6701  */
6702 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6703    /**
6704     * A pointer to the contents in the success state.
6705     * Reading from this pointer when `result_ok` is not set is undefined.
6706     */
6707    struct LDKDelayedPaymentOutputDescriptor *result;
6708    /**
6709     * A pointer to the contents in the error state.
6710     * Reading from this pointer when `result_ok` is set is undefined.
6711     */
6712    struct LDKDecodeError *err;
6713 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
6714
6715 /**
6716  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6717  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6719  */
6720 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6721    /**
6722     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6723     * `err` or `result` depending on the state of `result_ok`.
6724     */
6725    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
6726    /**
6727     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6728     */
6729    bool result_ok;
6730 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
6731
6732 /**
6733  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6734  */
6735 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6736    /**
6737     * A pointer to the contents in the success state.
6738     * Reading from this pointer when `result_ok` is not set is undefined.
6739     */
6740    struct LDKStaticPaymentOutputDescriptor *result;
6741    /**
6742     * A pointer to the contents in the error state.
6743     * Reading from this pointer when `result_ok` is set is undefined.
6744     */
6745    struct LDKDecodeError *err;
6746 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
6747
6748 /**
6749  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6750  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6752  */
6753 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6754    /**
6755     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6756     * `err` or `result` depending on the state of `result_ok`.
6757     */
6758    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
6759    /**
6760     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6761     */
6762    bool result_ok;
6763 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
6764
6765 /**
6766  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6767  */
6768 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6769    /**
6770     * A pointer to the contents in the success state.
6771     * Reading from this pointer when `result_ok` is not set is undefined.
6772     */
6773    struct LDKSpendableOutputDescriptor *result;
6774    /**
6775     * A pointer to the contents in the error state.
6776     * Reading from this pointer when `result_ok` is set is undefined.
6777     */
6778    struct LDKDecodeError *err;
6779 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6780
6781 /**
6782  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6783  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6784  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6785  */
6786 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6787    /**
6788     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6789     * `err` or `result` depending on the state of `result_ok`.
6790     */
6791    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6792    /**
6793     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6794     */
6795    bool result_ok;
6796 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6797
6798 /**
6799  * The contents of CResult_SignDecodeErrorZ
6800  */
6801 typedef union LDKCResult_SignDecodeErrorZPtr {
6802    /**
6803     * A pointer to the contents in the success state.
6804     * Reading from this pointer when `result_ok` is not set is undefined.
6805     */
6806    struct LDKSign *result;
6807    /**
6808     * A pointer to the contents in the error state.
6809     * Reading from this pointer when `result_ok` is set is undefined.
6810     */
6811    struct LDKDecodeError *err;
6812 } LDKCResult_SignDecodeErrorZPtr;
6813
6814 /**
6815  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6816  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6817  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6818  */
6819 typedef struct LDKCResult_SignDecodeErrorZ {
6820    /**
6821     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6822     * `err` or `result` depending on the state of `result_ok`.
6823     */
6824    union LDKCResult_SignDecodeErrorZPtr contents;
6825    /**
6826     * Whether this CResult_SignDecodeErrorZ represents a success state.
6827     */
6828    bool result_ok;
6829 } LDKCResult_SignDecodeErrorZ;
6830
6831 /**
6832  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6833  * allows recovering the exact public key which created the signature given the message.
6834  */
6835 typedef struct LDKRecoverableSignature {
6836    /**
6837     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6838     * recovery.
6839     */
6840    uint8_t serialized_form[68];
6841 } LDKRecoverableSignature;
6842
6843 /**
6844  * The contents of CResult_RecoverableSignatureNoneZ
6845  */
6846 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6847    /**
6848     * A pointer to the contents in the success state.
6849     * Reading from this pointer when `result_ok` is not set is undefined.
6850     */
6851    struct LDKRecoverableSignature *result;
6852    /**
6853     * Note that this value is always NULL, as there are no contents in the Err variant
6854     */
6855    void *err;
6856 } LDKCResult_RecoverableSignatureNoneZPtr;
6857
6858 /**
6859  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6860  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6862  */
6863 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6864    /**
6865     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6866     * `err` or `result` depending on the state of `result_ok`.
6867     */
6868    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6869    /**
6870     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6871     */
6872    bool result_ok;
6873 } LDKCResult_RecoverableSignatureNoneZ;
6874
6875 /**
6876  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6877  * This corresponds to std::vector in C++
6878  */
6879 typedef struct LDKCVec_CVec_u8ZZ {
6880    /**
6881     * The elements in the array.
6882     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6883     */
6884    struct LDKCVec_u8Z *data;
6885    /**
6886     * The number of elements pointed to by `data`.
6887     */
6888    uintptr_t datalen;
6889 } LDKCVec_CVec_u8ZZ;
6890
6891 /**
6892  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6893  */
6894 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6895    /**
6896     * A pointer to the contents in the success state.
6897     * Reading from this pointer when `result_ok` is not set is undefined.
6898     */
6899    struct LDKCVec_CVec_u8ZZ *result;
6900    /**
6901     * Note that this value is always NULL, as there are no contents in the Err variant
6902     */
6903    void *err;
6904 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6905
6906 /**
6907  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6908  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6910  */
6911 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6912    /**
6913     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6914     * `err` or `result` depending on the state of `result_ok`.
6915     */
6916    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6917    /**
6918     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6919     */
6920    bool result_ok;
6921 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6922
6923
6924
6925 /**
6926  * A simple implementation of Sign that just keeps the private keys in memory.
6927  *
6928  * This implementation performs no policy checks and is insufficient by itself as
6929  * a secure external signer.
6930  */
6931 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6932    /**
6933     * A pointer to the opaque Rust object.
6934     * Nearly everywhere, inner must be non-null, however in places where
6935     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6936     */
6937    LDKnativeInMemorySigner *inner;
6938    /**
6939     * Indicates that this is the only struct which contains the same pointer.
6940     * Rust functions which take ownership of an object provided via an argument require
6941     * this to be true and invalidate the object pointed to by inner.
6942     */
6943    bool is_owned;
6944 } LDKInMemorySigner;
6945
6946 /**
6947  * The contents of CResult_InMemorySignerDecodeErrorZ
6948  */
6949 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6950    /**
6951     * A pointer to the contents in the success state.
6952     * Reading from this pointer when `result_ok` is not set is undefined.
6953     */
6954    struct LDKInMemorySigner *result;
6955    /**
6956     * A pointer to the contents in the error state.
6957     * Reading from this pointer when `result_ok` is set is undefined.
6958     */
6959    struct LDKDecodeError *err;
6960 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6961
6962 /**
6963  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6964  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6965  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6966  */
6967 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6968    /**
6969     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6970     * `err` or `result` depending on the state of `result_ok`.
6971     */
6972    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6973    /**
6974     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6975     */
6976    bool result_ok;
6977 } LDKCResult_InMemorySignerDecodeErrorZ;
6978
6979 /**
6980  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6981  * This corresponds to std::vector in C++
6982  */
6983 typedef struct LDKCVec_TxOutZ {
6984    /**
6985     * The elements in the array.
6986     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6987     */
6988    struct LDKTxOut *data;
6989    /**
6990     * The number of elements pointed to by `data`.
6991     */
6992    uintptr_t datalen;
6993 } LDKCVec_TxOutZ;
6994
6995 /**
6996  * The contents of CResult_TransactionNoneZ
6997  */
6998 typedef union LDKCResult_TransactionNoneZPtr {
6999    /**
7000     * A pointer to the contents in the success state.
7001     * Reading from this pointer when `result_ok` is not set is undefined.
7002     */
7003    struct LDKTransaction *result;
7004    /**
7005     * Note that this value is always NULL, as there are no contents in the Err variant
7006     */
7007    void *err;
7008 } LDKCResult_TransactionNoneZPtr;
7009
7010 /**
7011  * A CResult_TransactionNoneZ represents the result of a fallible operation,
7012  * containing a crate::c_types::Transaction on success and a () on failure.
7013  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7014  */
7015 typedef struct LDKCResult_TransactionNoneZ {
7016    /**
7017     * The contents of this CResult_TransactionNoneZ, accessible via either
7018     * `err` or `result` depending on the state of `result_ok`.
7019     */
7020    union LDKCResult_TransactionNoneZPtr contents;
7021    /**
7022     * Whether this CResult_TransactionNoneZ represents a success state.
7023     */
7024    bool result_ok;
7025 } LDKCResult_TransactionNoneZ;
7026
7027 /**
7028  * The contents of CResult_NoneErrorZ
7029  */
7030 typedef union LDKCResult_NoneErrorZPtr {
7031    /**
7032     * Note that this value is always NULL, as there are no contents in the OK variant
7033     */
7034    void *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    enum LDKIOError *err;
7040 } LDKCResult_NoneErrorZPtr;
7041
7042 /**
7043  * A CResult_NoneErrorZ represents the result of a fallible operation,
7044  * containing a () on success and a crate::c_types::IOError on failure.
7045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7046  */
7047 typedef struct LDKCResult_NoneErrorZ {
7048    /**
7049     * The contents of this CResult_NoneErrorZ, accessible via either
7050     * `err` or `result` depending on the state of `result_ok`.
7051     */
7052    union LDKCResult_NoneErrorZPtr contents;
7053    /**
7054     * Whether this CResult_NoneErrorZ represents a success state.
7055     */
7056    bool result_ok;
7057 } LDKCResult_NoneErrorZ;
7058
7059 /**
7060  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7061  * This corresponds to std::vector in C++
7062  */
7063 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
7064    /**
7065     * The elements in the array.
7066     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7067     */
7068    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
7069    /**
7070     * The number of elements pointed to by `data`.
7071     */
7072    uintptr_t datalen;
7073 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
7074
7075 /**
7076  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7077  */
7078 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7079    /**
7080     * A pointer to the contents in the success state.
7081     * Reading from this pointer when `result_ok` is not set is undefined.
7082     */
7083    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
7084    /**
7085     * A pointer to the contents in the error state.
7086     * Reading from this pointer when `result_ok` is set is undefined.
7087     */
7088    enum LDKIOError *err;
7089 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
7090
7091 /**
7092  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7093  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7095  */
7096 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7097    /**
7098     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7099     * `err` or `result` depending on the state of `result_ok`.
7100     */
7101    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7102    /**
7103     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7104     */
7105    bool result_ok;
7106 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7107
7108 /**
7109  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
7110  * too-high values)
7111  */
7112 typedef enum LDKAPIError_Tag {
7113    /**
7114     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
7115     * are documented, but generally indicates some precondition of a function was violated.
7116     */
7117    LDKAPIError_APIMisuseError,
7118    /**
7119     * Due to a high feerate, we were unable to complete the request.
7120     * For example, this may be returned if the feerate implies we cannot open a channel at the
7121     * requested value, but opening a larger channel would succeed.
7122     */
7123    LDKAPIError_FeeRateTooHigh,
7124    /**
7125     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
7126     * too-many-hops, etc).
7127     */
7128    LDKAPIError_RouteError,
7129    /**
7130     * We were unable to complete the request as the Channel required to do so is unable to
7131     * complete the request (or was not found). This can take many forms, including disconnected
7132     * peer, channel at capacity, channel shutting down, etc.
7133     */
7134    LDKAPIError_ChannelUnavailable,
7135    /**
7136     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
7137     * attempted action to fail.
7138     */
7139    LDKAPIError_MonitorUpdateFailed,
7140    /**
7141     * Must be last for serialization purposes
7142     */
7143    LDKAPIError_Sentinel,
7144 } LDKAPIError_Tag;
7145
7146 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
7147    /**
7148     * A human-readable error message
7149     */
7150    struct LDKStr err;
7151 } LDKAPIError_LDKAPIMisuseError_Body;
7152
7153 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7154    /**
7155     * A human-readable error message
7156     */
7157    struct LDKStr err;
7158    /**
7159     * The feerate which was too high.
7160     */
7161    uint32_t feerate;
7162 } LDKAPIError_LDKFeeRateTooHigh_Body;
7163
7164 typedef struct LDKAPIError_LDKRouteError_Body {
7165    /**
7166     * A human-readable error message
7167     */
7168    struct LDKStr err;
7169 } LDKAPIError_LDKRouteError_Body;
7170
7171 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7172    /**
7173     * A human-readable error message
7174     */
7175    struct LDKStr err;
7176 } LDKAPIError_LDKChannelUnavailable_Body;
7177
7178 typedef struct MUST_USE_STRUCT LDKAPIError {
7179    LDKAPIError_Tag tag;
7180    union {
7181       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7182       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7183       LDKAPIError_LDKRouteError_Body route_error;
7184       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7185    };
7186 } LDKAPIError;
7187
7188 /**
7189  * The contents of CResult_NoneAPIErrorZ
7190  */
7191 typedef union LDKCResult_NoneAPIErrorZPtr {
7192    /**
7193     * Note that this value is always NULL, as there are no contents in the OK variant
7194     */
7195    void *result;
7196    /**
7197     * A pointer to the contents in the error state.
7198     * Reading from this pointer when `result_ok` is set is undefined.
7199     */
7200    struct LDKAPIError *err;
7201 } LDKCResult_NoneAPIErrorZPtr;
7202
7203 /**
7204  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7205  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7207  */
7208 typedef struct LDKCResult_NoneAPIErrorZ {
7209    /**
7210     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7211     * `err` or `result` depending on the state of `result_ok`.
7212     */
7213    union LDKCResult_NoneAPIErrorZPtr contents;
7214    /**
7215     * Whether this CResult_NoneAPIErrorZ represents a success state.
7216     */
7217    bool result_ok;
7218 } LDKCResult_NoneAPIErrorZ;
7219
7220 /**
7221  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7222  * This corresponds to std::vector in C++
7223  */
7224 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7225    /**
7226     * The elements in the array.
7227     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7228     */
7229    struct LDKCResult_NoneAPIErrorZ *data;
7230    /**
7231     * The number of elements pointed to by `data`.
7232     */
7233    uintptr_t datalen;
7234 } LDKCVec_CResult_NoneAPIErrorZZ;
7235
7236 /**
7237  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7238  * This corresponds to std::vector in C++
7239  */
7240 typedef struct LDKCVec_APIErrorZ {
7241    /**
7242     * The elements in the array.
7243     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7244     */
7245    struct LDKAPIError *data;
7246    /**
7247     * The number of elements pointed to by `data`.
7248     */
7249    uintptr_t datalen;
7250 } LDKCVec_APIErrorZ;
7251
7252 /**
7253  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7254  * Err() type describing which state the payment is in, see the description of individual enum
7255  * states for more.
7256  */
7257 typedef enum LDKPaymentSendFailure_Tag {
7258    /**
7259     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7260     * send the payment at all. No channel state has been changed or messages sent to peers, and
7261     * once you've changed the parameter at error, you can freely retry the payment in full.
7262     */
7263    LDKPaymentSendFailure_ParameterError,
7264    /**
7265     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7266     * from attempting to send the payment at all. No channel state has been changed or messages
7267     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7268     * payment in full.
7269     *
7270     * The results here are ordered the same as the paths in the route object which was passed to
7271     * send_payment.
7272     */
7273    LDKPaymentSendFailure_PathParameterError,
7274    /**
7275     * All paths which were attempted failed to send, with no channel state change taking place.
7276     * You can freely retry the payment in full (though you probably want to do so over different
7277     * paths than the ones selected).
7278     */
7279    LDKPaymentSendFailure_AllFailedRetrySafe,
7280    /**
7281     * Some paths which were attempted failed to send, though possibly not all. At least some
7282     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7283     * in over-/re-payment.
7284     *
7285     * The results here are ordered the same as the paths in the route object which was passed to
7286     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7287     * retried (though there is currently no API with which to do so).
7288     *
7289     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7290     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7291     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7292     * with the latest update_id.
7293     */
7294    LDKPaymentSendFailure_PartialFailure,
7295    /**
7296     * Must be last for serialization purposes
7297     */
7298    LDKPaymentSendFailure_Sentinel,
7299 } LDKPaymentSendFailure_Tag;
7300
7301 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7302    LDKPaymentSendFailure_Tag tag;
7303    union {
7304       struct {
7305          struct LDKAPIError parameter_error;
7306       };
7307       struct {
7308          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7309       };
7310       struct {
7311          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7312       };
7313       struct {
7314          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
7315       };
7316    };
7317 } LDKPaymentSendFailure;
7318
7319 /**
7320  * The contents of CResult_NonePaymentSendFailureZ
7321  */
7322 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7323    /**
7324     * Note that this value is always NULL, as there are no contents in the OK variant
7325     */
7326    void *result;
7327    /**
7328     * A pointer to the contents in the error state.
7329     * Reading from this pointer when `result_ok` is set is undefined.
7330     */
7331    struct LDKPaymentSendFailure *err;
7332 } LDKCResult_NonePaymentSendFailureZPtr;
7333
7334 /**
7335  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7336  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7337  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7338  */
7339 typedef struct LDKCResult_NonePaymentSendFailureZ {
7340    /**
7341     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7342     * `err` or `result` depending on the state of `result_ok`.
7343     */
7344    union LDKCResult_NonePaymentSendFailureZPtr contents;
7345    /**
7346     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7347     */
7348    bool result_ok;
7349 } LDKCResult_NonePaymentSendFailureZ;
7350
7351 /**
7352  * A tuple of 2 elements. See the individual fields for the types contained.
7353  */
7354 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7355    /**
7356     * The element at position 0
7357     */
7358    struct LDKThirtyTwoBytes a;
7359    /**
7360     * The element at position 1
7361     */
7362    struct LDKThirtyTwoBytes b;
7363 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7364
7365 /**
7366  * The contents of CResult_PaymentSecretAPIErrorZ
7367  */
7368 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7369    /**
7370     * A pointer to the contents in the success state.
7371     * Reading from this pointer when `result_ok` is not set is undefined.
7372     */
7373    struct LDKThirtyTwoBytes *result;
7374    /**
7375     * A pointer to the contents in the error state.
7376     * Reading from this pointer when `result_ok` is set is undefined.
7377     */
7378    struct LDKAPIError *err;
7379 } LDKCResult_PaymentSecretAPIErrorZPtr;
7380
7381 /**
7382  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7383  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7384  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7385  */
7386 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7387    /**
7388     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7389     * `err` or `result` depending on the state of `result_ok`.
7390     */
7391    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7392    /**
7393     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7394     */
7395    bool result_ok;
7396 } LDKCResult_PaymentSecretAPIErrorZ;
7397
7398 /**
7399  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7400  * This corresponds to std::vector in C++
7401  */
7402 typedef struct LDKCVec_ChannelMonitorZ {
7403    /**
7404     * The elements in the array.
7405     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7406     */
7407    struct LDKChannelMonitor *data;
7408    /**
7409     * The number of elements pointed to by `data`.
7410     */
7411    uintptr_t datalen;
7412 } LDKCVec_ChannelMonitorZ;
7413
7414 /**
7415  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7416  * blocks are connected and disconnected.
7417  *
7418  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7419  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7420  * channel state changes and HTLCs are resolved. See method documentation for specific
7421  * requirements.
7422  *
7423  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7424  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7425  * without taking any further action such as persisting the current state.
7426  *
7427  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7428  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7429  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7430  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7431  * multiple instances.
7432  *
7433  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7434  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7435  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
7436  */
7437 typedef struct LDKWatch {
7438    /**
7439     * An opaque pointer which is passed to your function implementations as an argument.
7440     * This has no meaning in the LDK, and can be NULL or any other value.
7441     */
7442    void *this_arg;
7443    /**
7444     * Watches a channel identified by `funding_txo` using `monitor`.
7445     *
7446     * Implementations are responsible for watching the chain for the funding transaction along
7447     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7448     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7449     *
7450     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7451     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7452     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7453     */
7454    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7455    /**
7456     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7457     *
7458     * Implementations must call [`update_monitor`] with the given update. See
7459     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7460     *
7461     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7462     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7463     */
7464    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7465    /**
7466     * Returns any monitor events since the last call. Subsequent calls must only return new
7467     * events.
7468     */
7469    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
7470    /**
7471     * Frees any resources associated with this object given its this_arg pointer.
7472     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7473     */
7474    void (*free)(void *this_arg);
7475 } LDKWatch;
7476
7477 /**
7478  * An interface to send a transaction to the Bitcoin network.
7479  */
7480 typedef struct LDKBroadcasterInterface {
7481    /**
7482     * An opaque pointer which is passed to your function implementations as an argument.
7483     * This has no meaning in the LDK, and can be NULL or any other value.
7484     */
7485    void *this_arg;
7486    /**
7487     * Sends a transaction out to (hopefully) be mined.
7488     */
7489    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7490    /**
7491     * Frees any resources associated with this object given its this_arg pointer.
7492     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7493     */
7494    void (*free)(void *this_arg);
7495 } LDKBroadcasterInterface;
7496
7497 /**
7498  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7499  * own the memory pointed to by data.
7500  */
7501 typedef struct LDKu8slice {
7502    /**
7503     * A pointer to the byte buffer
7504     */
7505    const uint8_t *data;
7506    /**
7507     * The number of bytes pointed to by `data`.
7508     */
7509    uintptr_t datalen;
7510 } LDKu8slice;
7511
7512 /**
7513  * A trait to describe an object which can get user secrets and key material.
7514  */
7515 typedef struct LDKKeysInterface {
7516    /**
7517     * An opaque pointer which is passed to your function implementations as an argument.
7518     * This has no meaning in the LDK, and can be NULL or any other value.
7519     */
7520    void *this_arg;
7521    /**
7522     * Get node secret key (aka node_id or network_key).
7523     *
7524     * This method must return the same value each time it is called.
7525     */
7526    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
7527    /**
7528     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7529     *
7530     * This method should return a different value each time it is called, to avoid linking
7531     * on-chain funds across channels as controlled to the same user.
7532     */
7533    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7534    /**
7535     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
7536     * a channel.
7537     *
7538     * This method should return a different value each time it is called, to avoid linking
7539     * on-chain funds across channels as controlled to the same user.
7540     */
7541    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
7542    /**
7543     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7544     * restarted with some stale data!
7545     *
7546     * This method must return a different value each time it is called.
7547     */
7548    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7549    /**
7550     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7551     * onion packets and for temporary channel IDs. There is no requirement that these be
7552     * persisted anywhere, though they must be unique across restarts.
7553     *
7554     * This method must return a different value each time it is called.
7555     */
7556    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7557    /**
7558     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7559     * This is only called during deserialization of other objects which contain
7560     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7561     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7562     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7563     * you've read all of the provided bytes to ensure no corruption occurred.
7564     */
7565    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7566    /**
7567     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
7568     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
7569     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7570     * blindly signing the hash.
7571     */
7572    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
7573    /**
7574     * Frees any resources associated with this object given its this_arg pointer.
7575     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7576     */
7577    void (*free)(void *this_arg);
7578 } LDKKeysInterface;
7579
7580 /**
7581  * A trait which should be implemented to provide feerate information on a number of time
7582  * horizons.
7583  *
7584  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7585  * called from inside the library in response to chain events, P2P events, or timer events).
7586  */
7587 typedef struct LDKFeeEstimator {
7588    /**
7589     * An opaque pointer which is passed to your function implementations as an argument.
7590     * This has no meaning in the LDK, and can be NULL or any other value.
7591     */
7592    void *this_arg;
7593    /**
7594     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7595     *
7596     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
7597     * don't put us below 1 satoshi-per-byte).
7598     *
7599     * This translates to:
7600     *  * satoshis-per-byte * 250
7601     *  * ceil(satoshis-per-kbyte / 4)
7602     */
7603    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7604    /**
7605     * Frees any resources associated with this object given its this_arg pointer.
7606     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7607     */
7608    void (*free)(void *this_arg);
7609 } LDKFeeEstimator;
7610
7611 /**
7612  * A trait encapsulating the operations required of a logger
7613  */
7614 typedef struct LDKLogger {
7615    /**
7616     * An opaque pointer which is passed to your function implementations as an argument.
7617     * This has no meaning in the LDK, and can be NULL or any other value.
7618     */
7619    void *this_arg;
7620    /**
7621     * Logs the `Record`
7622     */
7623    void (*log)(const void *this_arg, const char *record);
7624    /**
7625     * Frees any resources associated with this object given its this_arg pointer.
7626     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7627     */
7628    void (*free)(void *this_arg);
7629 } LDKLogger;
7630
7631
7632
7633 /**
7634  * Manager which keeps track of a number of channels and sends messages to the appropriate
7635  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7636  *
7637  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7638  * to individual Channels.
7639  *
7640  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7641  * all peers during write/read (though does not modify this instance, only the instance being
7642  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7643  * called funding_transaction_generated for outbound channels).
7644  *
7645  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7646  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7647  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7648  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7649  * the serialization process). If the deserialized version is out-of-date compared to the
7650  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7651  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7652  *
7653  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7654  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7655  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7656  * block_connected() to step towards your best block) upon deserialization before using the
7657  * object!
7658  *
7659  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7660  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7661  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7662  * offline for a full minute. In order to track this, you must call
7663  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7664  *
7665  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7666  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7667  * essentially you should default to using a SimpleRefChannelManager, and use a
7668  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7669  * you're using lightning-net-tokio.
7670  */
7671 typedef struct MUST_USE_STRUCT LDKChannelManager {
7672    /**
7673     * A pointer to the opaque Rust object.
7674     * Nearly everywhere, inner must be non-null, however in places where
7675     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7676     */
7677    LDKnativeChannelManager *inner;
7678    /**
7679     * Indicates that this is the only struct which contains the same pointer.
7680     * Rust functions which take ownership of an object provided via an argument require
7681     * this to be true and invalidate the object pointed to by inner.
7682     */
7683    bool is_owned;
7684 } LDKChannelManager;
7685
7686 /**
7687  * A tuple of 2 elements. See the individual fields for the types contained.
7688  */
7689 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7690    /**
7691     * The element at position 0
7692     */
7693    struct LDKThirtyTwoBytes a;
7694    /**
7695     * The element at position 1
7696     */
7697    struct LDKChannelManager b;
7698 } LDKC2Tuple_BlockHashChannelManagerZ;
7699
7700 /**
7701  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7702  */
7703 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7704    /**
7705     * A pointer to the contents in the success state.
7706     * Reading from this pointer when `result_ok` is not set is undefined.
7707     */
7708    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7709    /**
7710     * A pointer to the contents in the error state.
7711     * Reading from this pointer when `result_ok` is set is undefined.
7712     */
7713    struct LDKDecodeError *err;
7714 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7715
7716 /**
7717  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7718  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7720  */
7721 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7722    /**
7723     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7724     * `err` or `result` depending on the state of `result_ok`.
7725     */
7726    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7727    /**
7728     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7729     */
7730    bool result_ok;
7731 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7732
7733 /**
7734  * A trait indicating an object may generate message send events
7735  */
7736 typedef struct LDKMessageSendEventsProvider {
7737    /**
7738     * An opaque pointer which is passed to your function implementations as an argument.
7739     * This has no meaning in the LDK, and can be NULL or any other value.
7740     */
7741    void *this_arg;
7742    /**
7743     * Gets the list of pending events which were generated by previous actions, clearing the list
7744     * in the process.
7745     */
7746    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7747    /**
7748     * Frees any resources associated with this object given its this_arg pointer.
7749     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7750     */
7751    void (*free)(void *this_arg);
7752 } LDKMessageSendEventsProvider;
7753
7754 /**
7755  * A trait implemented for objects handling events from [`EventsProvider`].
7756  */
7757 typedef struct LDKEventHandler {
7758    /**
7759     * An opaque pointer which is passed to your function implementations as an argument.
7760     * This has no meaning in the LDK, and can be NULL or any other value.
7761     */
7762    void *this_arg;
7763    /**
7764     * Handles the given [`Event`].
7765     *
7766     * See [`EventsProvider`] for details that must be considered when implementing this method.
7767     */
7768    void (*handle_event)(const void *this_arg, struct LDKEvent event);
7769    /**
7770     * Frees any resources associated with this object given its this_arg pointer.
7771     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7772     */
7773    void (*free)(void *this_arg);
7774 } LDKEventHandler;
7775
7776 /**
7777  * A trait indicating an object may generate events.
7778  *
7779  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
7780  *
7781  * # Requirements
7782  *
7783  * See [`process_pending_events`] for requirements around event processing.
7784  *
7785  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
7786  * event since the last invocation. The handler must either act upon the event immediately
7787  * or preserve it for later handling.
7788  *
7789  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
7790  * consult the provider's documentation on the implication of processing events and how a handler
7791  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
7792  * [`ChainMonitor::process_pending_events`]).
7793  *
7794  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
7795  * own type(s).
7796  *
7797  * [`process_pending_events`]: Self::process_pending_events
7798  * [`handle_event`]: EventHandler::handle_event
7799  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
7800  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
7801  */
7802 typedef struct LDKEventsProvider {
7803    /**
7804     * An opaque pointer which is passed to your function implementations as an argument.
7805     * This has no meaning in the LDK, and can be NULL or any other value.
7806     */
7807    void *this_arg;
7808    /**
7809     * Processes any events generated since the last call using the given event handler.
7810     *
7811     * Subsequent calls must only process new events. However, handlers must be capable of handling
7812     * duplicate events across process restarts. This may occur if the provider was recovered from
7813     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
7814     */
7815    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
7816    /**
7817     * Frees any resources associated with this object given its this_arg pointer.
7818     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7819     */
7820    void (*free)(void *this_arg);
7821 } LDKEventsProvider;
7822
7823
7824
7825 /**
7826  * Configuration we set when applicable.
7827  *
7828  * Default::default() provides sane defaults.
7829  */
7830 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7831    /**
7832     * A pointer to the opaque Rust object.
7833     * Nearly everywhere, inner must be non-null, however in places where
7834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7835     */
7836    LDKnativeChannelHandshakeConfig *inner;
7837    /**
7838     * Indicates that this is the only struct which contains the same pointer.
7839     * Rust functions which take ownership of an object provided via an argument require
7840     * this to be true and invalidate the object pointed to by inner.
7841     */
7842    bool is_owned;
7843 } LDKChannelHandshakeConfig;
7844
7845
7846
7847 /**
7848  * Optional channel limits which are applied during channel creation.
7849  *
7850  * These limits are only applied to our counterparty's limits, not our own.
7851  *
7852  * Use 0/<type>::max_value() as appropriate to skip checking.
7853  *
7854  * Provides sane defaults for most configurations.
7855  *
7856  * Most additional limits are disabled except those with which specify a default in individual
7857  * field documentation. Note that this may result in barely-usable channels, but since they
7858  * are applied mostly only to incoming channels that's not much of a problem.
7859  */
7860 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7861    /**
7862     * A pointer to the opaque Rust object.
7863     * Nearly everywhere, inner must be non-null, however in places where
7864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7865     */
7866    LDKnativeChannelHandshakeLimits *inner;
7867    /**
7868     * Indicates that this is the only struct which contains the same pointer.
7869     * Rust functions which take ownership of an object provided via an argument require
7870     * this to be true and invalidate the object pointed to by inner.
7871     */
7872    bool is_owned;
7873 } LDKChannelHandshakeLimits;
7874
7875
7876
7877 /**
7878  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7879  *
7880  * Default::default() provides sane defaults for most configurations
7881  * (but currently with 0 relay fees!)
7882  */
7883 typedef struct MUST_USE_STRUCT LDKUserConfig {
7884    /**
7885     * A pointer to the opaque Rust object.
7886     * Nearly everywhere, inner must be non-null, however in places where
7887     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7888     */
7889    LDKnativeUserConfig *inner;
7890    /**
7891     * Indicates that this is the only struct which contains the same pointer.
7892     * Rust functions which take ownership of an object provided via an argument require
7893     * this to be true and invalidate the object pointed to by inner.
7894     */
7895    bool is_owned;
7896 } LDKUserConfig;
7897
7898 /**
7899  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7900  * UTXOs.
7901  */
7902 typedef struct LDKAccess {
7903    /**
7904     * An opaque pointer which is passed to your function implementations as an argument.
7905     * This has no meaning in the LDK, and can be NULL or any other value.
7906     */
7907    void *this_arg;
7908    /**
7909     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7910     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7911     * is unknown.
7912     *
7913     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7914     */
7915    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7916    /**
7917     * Frees any resources associated with this object given its this_arg pointer.
7918     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7919     */
7920    void (*free)(void *this_arg);
7921 } LDKAccess;
7922
7923 /**
7924  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7925  * chain.
7926  *
7927  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7928  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7929  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7930  * when needed.
7931  */
7932 typedef struct LDKListen {
7933    /**
7934     * An opaque pointer which is passed to your function implementations as an argument.
7935     * This has no meaning in the LDK, and can be NULL or any other value.
7936     */
7937    void *this_arg;
7938    /**
7939     * Notifies the listener that a block was added at the given height.
7940     */
7941    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7942    /**
7943     * Notifies the listener that a block was removed at the given height.
7944     */
7945    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7946    /**
7947     * Frees any resources associated with this object given its this_arg pointer.
7948     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7949     */
7950    void (*free)(void *this_arg);
7951 } LDKListen;
7952
7953 /**
7954  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7955  * unconfirmed during a chain reorganization.
7956  *
7957  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7958  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7959  * related to registered transactions and outputs. Upon notification, it would pass along the
7960  * matching transactions using this interface.
7961  *
7962  * # Use
7963  *
7964  * The intended use is as follows:
7965  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7966  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7967  *   that has been reorganized out of the chain.
7968  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7969  *
7970  * # Order
7971  *
7972  * Clients must call these methods in chain order. Specifically:
7973  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7974  *   block.
7975  * - Dependent transactions within the same block must be given in topological order, possibly in
7976  *   separate calls.
7977  * - Unconfirmed transactions must be given after the original confirmations and before any
7978  *   reconfirmation.
7979  *
7980  * See individual method documentation for further details.
7981  *
7982  * [`transactions_confirmed`]: Self::transactions_confirmed
7983  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7984  * [`best_block_updated`]: Self::best_block_updated
7985  * [`get_relevant_txids`]: Self::get_relevant_txids
7986  */
7987 typedef struct LDKConfirm {
7988    /**
7989     * An opaque pointer which is passed to your function implementations as an argument.
7990     * This has no meaning in the LDK, and can be NULL or any other value.
7991     */
7992    void *this_arg;
7993    /**
7994     * Processes transactions confirmed in a block with a given header and height.
7995     *
7996     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7997     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7998     * appearing in the same block do not need to be included in the same call; instead, multiple
7999     * calls with additional transactions may be made so long as they are made in [chain order].
8000     *
8001     * May be called before or after [`best_block_updated`] for the corresponding block. However,
8002     * in the event of a chain reorganization, it must not be called with a `header` that is no
8003     * longer in the chain as of the last call to [`best_block_updated`].
8004     *
8005     * [chain order]: Confirm#Order
8006     * [`best_block_updated`]: Self::best_block_updated
8007     */
8008    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
8009    /**
8010     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
8011     *
8012     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
8013     * reorganized out of the best chain. Once called, the given transaction should not be returned
8014     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
8015     *
8016     * [`get_relevant_txids`]: Self::get_relevant_txids
8017     * [`transactions_confirmed`]: Self::transactions_confirmed
8018     */
8019    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
8020    /**
8021     * Processes an update to the best header connected at the given height.
8022     *
8023     * Should be called when a new header is available but may be skipped for intermediary blocks
8024     * if they become available at the same time.
8025     */
8026    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8027    /**
8028     * Returns transactions that should be monitored for reorganization out of the chain.
8029     *
8030     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
8031     * confirmations to be safe from a chain reorganization. Should not include any transactions
8032     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
8033     *
8034     * May be called to determine the subset of transactions that must still be monitored for
8035     * reorganization. Will be idempotent between calls but may change as a result of calls to the
8036     * other interface methods. Thus, this is useful to determine which transactions may need to be
8037     * given to [`transaction_unconfirmed`].
8038     *
8039     * [`transactions_confirmed`]: Self::transactions_confirmed
8040     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8041     */
8042    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
8043    /**
8044     * Frees any resources associated with this object given its this_arg pointer.
8045     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8046     */
8047    void (*free)(void *this_arg);
8048 } LDKConfirm;
8049
8050
8051
8052 /**
8053  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8054  *
8055  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8056  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8057  * the return value of [`Filter::register_output`].
8058  *
8059  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8060  * may have been spent there. See [`Filter::register_output`] for details.
8061  *
8062  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8063  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8064  */
8065 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8066    /**
8067     * A pointer to the opaque Rust object.
8068     * Nearly everywhere, inner must be non-null, however in places where
8069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8070     */
8071    LDKnativeWatchedOutput *inner;
8072    /**
8073     * Indicates that this is the only struct which contains the same pointer.
8074     * Rust functions which take ownership of an object provided via an argument require
8075     * this to be true and invalidate the object pointed to by inner.
8076     */
8077    bool is_owned;
8078 } LDKWatchedOutput;
8079
8080 /**
8081  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8082  * channels.
8083  *
8084  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8085  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8086  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8087  * receiving full blocks from a chain source, any further filtering is unnecessary.
8088  *
8089  * After an output has been registered, subsequent block retrievals from the chain source must not
8090  * exclude any transactions matching the new criteria nor any in-block descendants of such
8091  * transactions.
8092  *
8093  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8094  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8095  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8096  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8097  *
8098  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8099  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8100  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8101  */
8102 typedef struct LDKFilter {
8103    /**
8104     * An opaque pointer which is passed to your function implementations as an argument.
8105     * This has no meaning in the LDK, and can be NULL or any other value.
8106     */
8107    void *this_arg;
8108    /**
8109     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8110     * a spending condition.
8111     */
8112    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8113    /**
8114     * Registers interest in spends of a transaction output.
8115     *
8116     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8117     * output that is found in the corresponding block along with its index.
8118     *
8119     * This return value is useful for Electrum clients in order to supply in-block descendant
8120     * transactions which otherwise were not included. This is not necessary for other clients if
8121     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8122     * full block).
8123     */
8124    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8125    /**
8126     * Frees any resources associated with this object given its this_arg pointer.
8127     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8128     */
8129    void (*free)(void *this_arg);
8130 } LDKFilter;
8131
8132 /**
8133  * `Persist` defines behavior for persisting channel monitors: this could mean
8134  * writing once to disk, and/or uploading to one or more backup services.
8135  *
8136  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8137  * to disk/backups. And, on every update, you **must** persist either the
8138  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8139  * of situations such as revoking a transaction, then crashing before this
8140  * revocation can be persisted, then unintentionally broadcasting a revoked
8141  * transaction and losing money. This is a risk because previous channel states
8142  * are toxic, so it's important that whatever channel state is persisted is
8143  * kept up-to-date.
8144  */
8145 typedef struct LDKPersist {
8146    /**
8147     * An opaque pointer which is passed to your function implementations as an argument.
8148     * This has no meaning in the LDK, and can be NULL or any other value.
8149     */
8150    void *this_arg;
8151    /**
8152     * Persist a new channel's data. The data can be stored any way you want, but
8153     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8154     * it is up to you to maintain a correct mapping between the outpoint and the
8155     * stored channel data). Note that you **must** persist every new monitor to
8156     * disk. See the `Persist` trait documentation for more details.
8157     *
8158     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8159     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8160     */
8161    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8162    /**
8163     * Update one channel's data. The provided `ChannelMonitor` has already
8164     * applied the given update.
8165     *
8166     * Note that on every update, you **must** persist either the
8167     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8168     * the `Persist` trait documentation for more details.
8169     *
8170     * If an implementer chooses to persist the updates only, they need to make
8171     * sure that all the updates are applied to the `ChannelMonitors` *before*
8172     * the set of channel monitors is given to the `ChannelManager`
8173     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8174     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8175     * persisted, then there is no need to persist individual updates.
8176     *
8177     * Note that there could be a performance tradeoff between persisting complete
8178     * channel monitors on every update vs. persisting only updates and applying
8179     * them in batches. The size of each monitor grows `O(number of state updates)`
8180     * whereas updates are small and `O(1)`.
8181     *
8182     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8183     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8184     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8185     */
8186    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);
8187    /**
8188     * Frees any resources associated with this object given its this_arg pointer.
8189     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8190     */
8191    void (*free)(void *this_arg);
8192 } LDKPersist;
8193
8194
8195
8196 /**
8197  * An implementation of [`chain::Watch`] for monitoring channels.
8198  *
8199  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8200  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8201  * or used independently to monitor channels remotely. See the [module-level documentation] for
8202  * details.
8203  *
8204  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8205  * [module-level documentation]: crate::chain::chainmonitor
8206  */
8207 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8208    /**
8209     * A pointer to the opaque Rust object.
8210     * Nearly everywhere, inner must be non-null, however in places where
8211     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8212     */
8213    LDKnativeChainMonitor *inner;
8214    /**
8215     * Indicates that this is the only struct which contains the same pointer.
8216     * Rust functions which take ownership of an object provided via an argument require
8217     * this to be true and invalidate the object pointed to by inner.
8218     */
8219    bool is_owned;
8220 } LDKChainMonitor;
8221
8222
8223
8224 /**
8225  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8226  * and derives keys from that.
8227  *
8228  * Your node_id is seed/0'
8229  * ChannelMonitor closes may use seed/1'
8230  * Cooperative closes may use seed/2'
8231  * The two close keys may be needed to claim on-chain funds!
8232  */
8233 typedef struct MUST_USE_STRUCT LDKKeysManager {
8234    /**
8235     * A pointer to the opaque Rust object.
8236     * Nearly everywhere, inner must be non-null, however in places where
8237     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8238     */
8239    LDKnativeKeysManager *inner;
8240    /**
8241     * Indicates that this is the only struct which contains the same pointer.
8242     * Rust functions which take ownership of an object provided via an argument require
8243     * this to be true and invalidate the object pointed to by inner.
8244     */
8245    bool is_owned;
8246 } LDKKeysManager;
8247
8248
8249
8250 /**
8251  * Chain-related parameters used to construct a new `ChannelManager`.
8252  *
8253  * Typically, the block-specific parameters are derived from the best block hash for the network,
8254  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8255  * are not needed when deserializing a previously constructed `ChannelManager`.
8256  */
8257 typedef struct MUST_USE_STRUCT LDKChainParameters {
8258    /**
8259     * A pointer to the opaque Rust object.
8260     * Nearly everywhere, inner must be non-null, however in places where
8261     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8262     */
8263    LDKnativeChainParameters *inner;
8264    /**
8265     * Indicates that this is the only struct which contains the same pointer.
8266     * Rust functions which take ownership of an object provided via an argument require
8267     * this to be true and invalidate the object pointed to by inner.
8268     */
8269    bool is_owned;
8270 } LDKChainParameters;
8271
8272
8273
8274 /**
8275  * The best known block as identified by its hash and height.
8276  */
8277 typedef struct MUST_USE_STRUCT LDKBestBlock {
8278    /**
8279     * A pointer to the opaque Rust object.
8280     * Nearly everywhere, inner must be non-null, however in places where
8281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8282     */
8283    LDKnativeBestBlock *inner;
8284    /**
8285     * Indicates that this is the only struct which contains the same pointer.
8286     * Rust functions which take ownership of an object provided via an argument require
8287     * this to be true and invalidate the object pointed to by inner.
8288     */
8289    bool is_owned;
8290 } LDKBestBlock;
8291
8292 /**
8293  * A 3-byte byte array.
8294  */
8295 typedef struct LDKThreeBytes {
8296    /**
8297     * The three bytes
8298     */
8299    uint8_t data[3];
8300 } LDKThreeBytes;
8301
8302 /**
8303  * A trait to describe an object which can receive channel messages.
8304  *
8305  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8306  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8307  */
8308 typedef struct LDKChannelMessageHandler {
8309    /**
8310     * An opaque pointer which is passed to your function implementations as an argument.
8311     * This has no meaning in the LDK, and can be NULL or any other value.
8312     */
8313    void *this_arg;
8314    /**
8315     * Handle an incoming open_channel message from the given peer.
8316     */
8317    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8318    /**
8319     * Handle an incoming accept_channel message from the given peer.
8320     */
8321    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8322    /**
8323     * Handle an incoming funding_created message from the given peer.
8324     */
8325    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8326    /**
8327     * Handle an incoming funding_signed message from the given peer.
8328     */
8329    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8330    /**
8331     * Handle an incoming funding_locked message from the given peer.
8332     */
8333    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8334    /**
8335     * Handle an incoming shutdown message from the given peer.
8336     */
8337    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);
8338    /**
8339     * Handle an incoming closing_signed message from the given peer.
8340     */
8341    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8342    /**
8343     * Handle an incoming update_add_htlc message from the given peer.
8344     */
8345    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8346    /**
8347     * Handle an incoming update_fulfill_htlc message from the given peer.
8348     */
8349    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8350    /**
8351     * Handle an incoming update_fail_htlc message from the given peer.
8352     */
8353    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8354    /**
8355     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8356     */
8357    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8358    /**
8359     * Handle an incoming commitment_signed message from the given peer.
8360     */
8361    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8362    /**
8363     * Handle an incoming revoke_and_ack message from the given peer.
8364     */
8365    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8366    /**
8367     * Handle an incoming update_fee message from the given peer.
8368     */
8369    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8370    /**
8371     * Handle an incoming announcement_signatures message from the given peer.
8372     */
8373    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8374    /**
8375     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8376     * is believed to be possible in the future (eg they're sending us messages we don't
8377     * understand or indicate they require unknown feature bits), no_connection_possible is set
8378     * and any outstanding channels should be failed.
8379     */
8380    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8381    /**
8382     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8383     */
8384    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8385    /**
8386     * Handle an incoming channel_reestablish message from the given peer.
8387     */
8388    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8389    /**
8390     * Handle an incoming channel update from the given peer.
8391     */
8392    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8393    /**
8394     * Handle an incoming error message from the given peer.
8395     */
8396    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8397    /**
8398     * Implementation of MessageSendEventsProvider for this object.
8399     */
8400    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8401    /**
8402     * Frees any resources associated with this object given its this_arg pointer.
8403     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8404     */
8405    void (*free)(void *this_arg);
8406 } LDKChannelMessageHandler;
8407
8408
8409
8410 /**
8411  * Arguments for the creation of a ChannelManager that are not deserialized.
8412  *
8413  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8414  * is:
8415  * 1) Deserialize all stored ChannelMonitors.
8416  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8417  *    <(BlockHash, ChannelManager)>::read(reader, args)
8418  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8419  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8420  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8421  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8422  *    ChannelMonitor::get_funding_txo().
8423  * 4) Reconnect blocks on your ChannelMonitors.
8424  * 5) Disconnect/connect blocks on the ChannelManager.
8425  * 6) Move the ChannelMonitors into your local chain::Watch.
8426  *
8427  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8428  * call any other methods on the newly-deserialized ChannelManager.
8429  *
8430  * Note that because some channels may be closed during deserialization, it is critical that you
8431  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8432  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8433  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8434  * not force-close the same channels but consider them live), you may end up revoking a state for
8435  * which you've already broadcasted the transaction.
8436  */
8437 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8438    /**
8439     * A pointer to the opaque Rust object.
8440     * Nearly everywhere, inner must be non-null, however in places where
8441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8442     */
8443    LDKnativeChannelManagerReadArgs *inner;
8444    /**
8445     * Indicates that this is the only struct which contains the same pointer.
8446     * Rust functions which take ownership of an object provided via an argument require
8447     * this to be true and invalidate the object pointed to by inner.
8448     */
8449    bool is_owned;
8450 } LDKChannelManagerReadArgs;
8451
8452
8453
8454 /**
8455  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8456  * This is used to convince the recipient that the channel is at a certain commitment
8457  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8458  * and even later commitments may have been revoked.
8459  */
8460 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8461    /**
8462     * A pointer to the opaque Rust object.
8463     * Nearly everywhere, inner must be non-null, however in places where
8464     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8465     */
8466    LDKnativeDataLossProtect *inner;
8467    /**
8468     * Indicates that this is the only struct which contains the same pointer.
8469     * Rust functions which take ownership of an object provided via an argument require
8470     * this to be true and invalidate the object pointed to by inner.
8471     */
8472    bool is_owned;
8473 } LDKDataLossProtect;
8474
8475 /**
8476  * A trait to describe an object which can receive routing messages.
8477  *
8478  * # Implementor DoS Warnings
8479  *
8480  * For `gossip_queries` messages there are potential DoS vectors when handling
8481  * inbound queries. Implementors using an on-disk network graph should be aware of
8482  * repeated disk I/O for queries accessing different parts of the network graph.
8483  */
8484 typedef struct LDKRoutingMessageHandler {
8485    /**
8486     * An opaque pointer which is passed to your function implementations as an argument.
8487     * This has no meaning in the LDK, and can be NULL or any other value.
8488     */
8489    void *this_arg;
8490    /**
8491     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8492     * false or returning an Err otherwise.
8493     */
8494    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8495    /**
8496     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8497     * or returning an Err otherwise.
8498     */
8499    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8500    /**
8501     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8502     * false or returning an Err otherwise.
8503     */
8504    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8505    /**
8506     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8507     */
8508    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8509    /**
8510     * Gets a subset of the channel announcements and updates required to dump our routing table
8511     * to a remote node, starting at the short_channel_id indicated by starting_point and
8512     * including the batch_amount entries immediately higher in numerical value than starting_point.
8513     */
8514    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8515    /**
8516     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8517     * starting at the node *after* the provided publickey and including batch_amount entries
8518     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8519     * If None is provided for starting_point, we start at the first node.
8520     */
8521    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8522    /**
8523     * Called when a connection is established with a peer. This can be used to
8524     * perform routing table synchronization using a strategy defined by the
8525     * implementor.
8526     */
8527    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8528    /**
8529     * Handles the reply of a query we initiated to learn about channels
8530     * for a given range of blocks. We can expect to receive one or more
8531     * replies to a single query.
8532     */
8533    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8534    /**
8535     * Handles the reply of a query we initiated asking for routing gossip
8536     * messages for a list of channels. We should receive this message when
8537     * a node has completed its best effort to send us the pertaining routing
8538     * gossip messages.
8539     */
8540    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8541    /**
8542     * Handles when a peer asks us to send a list of short_channel_ids
8543     * for the requested range of blocks.
8544     */
8545    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8546    /**
8547     * Handles when a peer asks us to send routing gossip messages for a
8548     * list of short_channel_ids.
8549     */
8550    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8551    /**
8552     * Implementation of MessageSendEventsProvider for this object.
8553     */
8554    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8555    /**
8556     * Frees any resources associated with this object given its this_arg pointer.
8557     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8558     */
8559    void (*free)(void *this_arg);
8560 } LDKRoutingMessageHandler;
8561
8562
8563
8564 /**
8565  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8566  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8567  */
8568 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8569    /**
8570     * A pointer to the opaque Rust object.
8571     * Nearly everywhere, inner must be non-null, however in places where
8572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8573     */
8574    LDKnativeIgnoringMessageHandler *inner;
8575    /**
8576     * Indicates that this is the only struct which contains the same pointer.
8577     * Rust functions which take ownership of an object provided via an argument require
8578     * this to be true and invalidate the object pointed to by inner.
8579     */
8580    bool is_owned;
8581 } LDKIgnoringMessageHandler;
8582
8583
8584
8585 /**
8586  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8587  * You can provide one of these as the route_handler in a MessageHandler.
8588  */
8589 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8590    /**
8591     * A pointer to the opaque Rust object.
8592     * Nearly everywhere, inner must be non-null, however in places where
8593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8594     */
8595    LDKnativeErroringMessageHandler *inner;
8596    /**
8597     * Indicates that this is the only struct which contains the same pointer.
8598     * Rust functions which take ownership of an object provided via an argument require
8599     * this to be true and invalidate the object pointed to by inner.
8600     */
8601    bool is_owned;
8602 } LDKErroringMessageHandler;
8603
8604
8605
8606 /**
8607  * Provides references to trait impls which handle different types of messages.
8608  */
8609 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8610    /**
8611     * A pointer to the opaque Rust object.
8612     * Nearly everywhere, inner must be non-null, however in places where
8613     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8614     */
8615    LDKnativeMessageHandler *inner;
8616    /**
8617     * Indicates that this is the only struct which contains the same pointer.
8618     * Rust functions which take ownership of an object provided via an argument require
8619     * this to be true and invalidate the object pointed to by inner.
8620     */
8621    bool is_owned;
8622 } LDKMessageHandler;
8623
8624 /**
8625  * Provides an object which can be used to send data to and which uniquely identifies a connection
8626  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8627  * implement Hash to meet the PeerManager API.
8628  *
8629  * For efficiency, Clone should be relatively cheap for this type.
8630  *
8631  * You probably want to just extend an int and put a file descriptor in a struct and implement
8632  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8633  * be careful to ensure you don't have races whereby you might register a new connection with an
8634  * fd which is the same as a previous one which has yet to be removed via
8635  * PeerManager::socket_disconnected().
8636  */
8637 typedef struct LDKSocketDescriptor {
8638    /**
8639     * An opaque pointer which is passed to your function implementations as an argument.
8640     * This has no meaning in the LDK, and can be NULL or any other value.
8641     */
8642    void *this_arg;
8643    /**
8644     * Attempts to send some data from the given slice to the peer.
8645     *
8646     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8647     * Note that in the disconnected case, socket_disconnected must still fire and further write
8648     * attempts may occur until that time.
8649     *
8650     * If the returned size is smaller than data.len(), a write_available event must
8651     * trigger the next time more data can be written. Additionally, until the a send_data event
8652     * completes fully, no further read_events should trigger on the same peer!
8653     *
8654     * If a read_event on this descriptor had previously returned true (indicating that read
8655     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8656     * indicating that read events on this descriptor should resume. A resume_read of false does
8657     * *not* imply that further read events should be paused.
8658     */
8659    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8660    /**
8661     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8662     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8663     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8664     * though races may occur whereby disconnect_socket is called after a call to
8665     * socket_disconnected but prior to socket_disconnected returning.
8666     */
8667    void (*disconnect_socket)(void *this_arg);
8668    /**
8669     * Checks if two objects are equal given this object's this_arg pointer and another object.
8670     */
8671    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8672    /**
8673     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8674     * This is used, for example, for inclusion of this object in a hash map.
8675     */
8676    uint64_t (*hash)(const void *this_arg);
8677    /**
8678     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8679     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8680     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8681     */
8682    void *(*clone)(const void *this_arg);
8683    /**
8684     * Frees any resources associated with this object given its this_arg pointer.
8685     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8686     */
8687    void (*free)(void *this_arg);
8688 } LDKSocketDescriptor;
8689
8690
8691
8692 /**
8693  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8694  * events into messages which it passes on to its MessageHandlers.
8695  *
8696  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8697  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8698  * essentially you should default to using a SimpleRefPeerManager, and use a
8699  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8700  * you're using lightning-net-tokio.
8701  */
8702 typedef struct MUST_USE_STRUCT LDKPeerManager {
8703    /**
8704     * A pointer to the opaque Rust object.
8705     * Nearly everywhere, inner must be non-null, however in places where
8706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8707     */
8708    LDKnativePeerManager *inner;
8709    /**
8710     * Indicates that this is the only struct which contains the same pointer.
8711     * Rust functions which take ownership of an object provided via an argument require
8712     * this to be true and invalidate the object pointed to by inner.
8713     */
8714    bool is_owned;
8715 } LDKPeerManager;
8716
8717
8718
8719 /**
8720  * Static channel fields used to build transactions given per-commitment fields, organized by
8721  * broadcaster/countersignatory.
8722  *
8723  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8724  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8725  */
8726 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8727    /**
8728     * A pointer to the opaque Rust object.
8729     * Nearly everywhere, inner must be non-null, however in places where
8730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8731     */
8732    LDKnativeDirectedChannelTransactionParameters *inner;
8733    /**
8734     * Indicates that this is the only struct which contains the same pointer.
8735     * Rust functions which take ownership of an object provided via an argument require
8736     * this to be true and invalidate the object pointed to by inner.
8737     */
8738    bool is_owned;
8739 } LDKDirectedChannelTransactionParameters;
8740
8741
8742
8743 /**
8744  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8745  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8746  * the C bindings, as it can be done directly in Rust code.
8747  */
8748 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8749    /**
8750     * A pointer to the opaque Rust object.
8751     * Nearly everywhere, inner must be non-null, however in places where
8752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8753     */
8754    LDKnativeLockedNetworkGraph *inner;
8755    /**
8756     * Indicates that this is the only struct which contains the same pointer.
8757     * Rust functions which take ownership of an object provided via an argument require
8758     * this to be true and invalidate the object pointed to by inner.
8759     */
8760    bool is_owned;
8761 } LDKLockedNetworkGraph;
8762
8763
8764
8765 /**
8766  * Receives and validates network updates from peers,
8767  * stores authentic and relevant data as a network graph.
8768  * This network graph is then used for routing payments.
8769  * Provides interface to help with initial routing sync by
8770  * serving historical announcements.
8771  */
8772 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
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    LDKnativeNetGraphMsgHandler *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 } LDKNetGraphMsgHandler;
8786
8787
8788
8789 /**
8790  * FilesystemPersister persists channel data on disk, where each channel's
8791  * data is stored in a file named after its funding outpoint.
8792  *
8793  * Warning: this module does the best it can with calls to persist data, but it
8794  * can only guarantee that the data is passed to the drive. It is up to the
8795  * drive manufacturers to do the actual persistence properly, which they often
8796  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8797  * user to validate their entire storage stack, to ensure the writes are
8798  * persistent.
8799  * Corollary: especially when dealing with larger amounts of money, it is best
8800  * practice to have multiple channel data backups and not rely only on one
8801  * FilesystemPersister.
8802  */
8803 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8804    /**
8805     * A pointer to the opaque Rust object.
8806     * Nearly everywhere, inner must be non-null, however in places where
8807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8808     */
8809    LDKnativeFilesystemPersister *inner;
8810    /**
8811     * Indicates that this is the only struct which contains the same pointer.
8812     * Rust functions which take ownership of an object provided via an argument require
8813     * this to be true and invalidate the object pointed to by inner.
8814     */
8815    bool is_owned;
8816 } LDKFilesystemPersister;
8817
8818
8819
8820 /**
8821  * Data of the `RawInvoice` that is encoded in the data part
8822  */
8823 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8824    /**
8825     * A pointer to the opaque Rust object.
8826     * Nearly everywhere, inner must be non-null, however in places where
8827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8828     */
8829    LDKnativeRawDataPart *inner;
8830    /**
8831     * Indicates that this is the only struct which contains the same pointer.
8832     * Rust functions which take ownership of an object provided via an argument require
8833     * this to be true and invalidate the object pointed to by inner.
8834     */
8835    bool is_owned;
8836 } LDKRawDataPart;
8837
8838
8839
8840 /**
8841  * SHA-256 hash
8842  */
8843 typedef struct MUST_USE_STRUCT LDKSha256 {
8844    /**
8845     * A pointer to the opaque Rust object.
8846     * Nearly everywhere, inner must be non-null, however in places where
8847     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8848     */
8849    LDKnativeSha256 *inner;
8850    /**
8851     * Indicates that this is the only struct which contains the same pointer.
8852     * Rust functions which take ownership of an object provided via an argument require
8853     * this to be true and invalidate the object pointed to by inner.
8854     */
8855    bool is_owned;
8856 } LDKSha256;
8857
8858
8859
8860 /**
8861  * `min_final_cltv_expiry` to use for the last HTLC in the route
8862  */
8863 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8864    /**
8865     * A pointer to the opaque Rust object.
8866     * Nearly everywhere, inner must be non-null, however in places where
8867     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8868     */
8869    LDKnativeMinFinalCltvExpiry *inner;
8870    /**
8871     * Indicates that this is the only struct which contains the same pointer.
8872     * Rust functions which take ownership of an object provided via an argument require
8873     * this to be true and invalidate the object pointed to by inner.
8874     */
8875    bool is_owned;
8876 } LDKMinFinalCltvExpiry;
8877
8878 /**
8879  * Integer in the range `0..32`
8880  */
8881 typedef struct LDKu5 {
8882    uint8_t _0;
8883 } LDKu5;
8884
8885 /**
8886  * A 20-byte byte array.
8887  */
8888 typedef struct LDKTwentyBytes {
8889    /**
8890     * The twenty bytes
8891     */
8892    uint8_t data[20];
8893 } LDKTwentyBytes;
8894
8895 /**
8896  * Fallback address in case no LN payment is possible
8897  */
8898 typedef enum LDKFallback_Tag {
8899    LDKFallback_SegWitProgram,
8900    LDKFallback_PubKeyHash,
8901    LDKFallback_ScriptHash,
8902    /**
8903     * Must be last for serialization purposes
8904     */
8905    LDKFallback_Sentinel,
8906 } LDKFallback_Tag;
8907
8908 typedef struct LDKFallback_LDKSegWitProgram_Body {
8909    struct LDKu5 version;
8910    struct LDKCVec_u8Z program;
8911 } LDKFallback_LDKSegWitProgram_Body;
8912
8913 typedef struct MUST_USE_STRUCT LDKFallback {
8914    LDKFallback_Tag tag;
8915    union {
8916       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8917       struct {
8918          struct LDKTwentyBytes pub_key_hash;
8919       };
8920       struct {
8921          struct LDKTwentyBytes script_hash;
8922       };
8923    };
8924 } LDKFallback;
8925
8926 extern const uintptr_t MAX_BUF_SIZE;
8927
8928 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8929
8930 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8931
8932 extern const uint32_t ANTI_REORG_DELAY;
8933
8934 extern const uint16_t BREAKDOWN_TIMEOUT;
8935
8936 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8937
8938 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8939
8940 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8941
8942 extern const uint8_t TAG_PAYMENT_HASH;
8943
8944 extern const uint8_t TAG_DESCRIPTION;
8945
8946 extern const uint8_t TAG_PAYEE_PUB_KEY;
8947
8948 extern const uint8_t TAG_DESCRIPTION_HASH;
8949
8950 extern const uint8_t TAG_EXPIRY_TIME;
8951
8952 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
8953
8954 extern const uint8_t TAG_FALLBACK;
8955
8956 extern const uint8_t TAG_ROUTE;
8957
8958 extern const uint8_t TAG_PAYMENT_SECRET;
8959
8960 extern const uint8_t TAG_FEATURES;
8961
8962 struct LDKStr _ldk_get_compiled_version(void);
8963
8964 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
8965
8966 /**
8967  * Frees the data buffer, if data_is_owned is set and datalen > 0.
8968  */
8969 void Transaction_free(struct LDKTransaction _res);
8970
8971 /**
8972  * Frees the data pointed to by script_pubkey.
8973  */
8974 void TxOut_free(struct LDKTxOut _res);
8975
8976 /**
8977  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
8978  */
8979 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
8980
8981 /**
8982  * Frees the data buffer, if chars_is_owned is set and len > 0.
8983  */
8984 void Str_free(struct LDKStr _res);
8985
8986 /**
8987  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
8988  */
8989 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
8990
8991 /**
8992  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
8993  */
8994 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
8995
8996 /**
8997  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
8998  */
8999 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
9000
9001 /**
9002  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9003  * but with all dynamically-allocated buffers duplicated in new buffers.
9004  */
9005 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
9006
9007 /**
9008  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
9009  */
9010 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
9011
9012 /**
9013  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
9014  */
9015 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
9016
9017 /**
9018  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
9019  */
9020 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
9021
9022 /**
9023  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9024  * but with all dynamically-allocated buffers duplicated in new buffers.
9025  */
9026 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
9027
9028 /**
9029  * Creates a new CResult_SecretKeyErrorZ in the success state.
9030  */
9031 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9032
9033 /**
9034  * Creates a new CResult_SecretKeyErrorZ in the error state.
9035  */
9036 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9037
9038 /**
9039  * Frees any resources used by the CResult_SecretKeyErrorZ.
9040  */
9041 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9042
9043 /**
9044  * Creates a new CResult_PublicKeyErrorZ in the success state.
9045  */
9046 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9047
9048 /**
9049  * Creates a new CResult_PublicKeyErrorZ in the error state.
9050  */
9051 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9052
9053 /**
9054  * Frees any resources used by the CResult_PublicKeyErrorZ.
9055  */
9056 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9057
9058 /**
9059  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9060  */
9061 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9062
9063 /**
9064  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9065  */
9066 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9067
9068 /**
9069  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9070  */
9071 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9072
9073 /**
9074  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9075  * but with all dynamically-allocated buffers duplicated in new buffers.
9076  */
9077 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9078
9079 /**
9080  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9081  */
9082 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9083
9084 /**
9085  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9086  */
9087 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9088
9089 /**
9090  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9091  */
9092 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9093
9094 /**
9095  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9096  * but with all dynamically-allocated buffers duplicated in new buffers.
9097  */
9098 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9099
9100 /**
9101  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9102  */
9103 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9104
9105 /**
9106  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9107  */
9108 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9109
9110 /**
9111  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9112  */
9113 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9114
9115 /**
9116  * Constructs a new COption_u32Z containing a u32
9117  */
9118 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9119
9120 /**
9121  * Constructs a new COption_u32Z containing nothing
9122  */
9123 struct LDKCOption_u32Z COption_u32Z_none(void);
9124
9125 /**
9126  * Frees any resources associated with the u32, if we are in the Some state
9127  */
9128 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9129
9130 /**
9131  * Creates a new COption_u32Z which has the same data as `orig`
9132  * but with all dynamically-allocated buffers duplicated in new buffers.
9133  */
9134 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9135
9136 /**
9137  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9138  */
9139 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9140
9141 /**
9142  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9143  */
9144 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9145
9146 /**
9147  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9148  */
9149 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9150
9151 /**
9152  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9153  * but with all dynamically-allocated buffers duplicated in new buffers.
9154  */
9155 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9156
9157 /**
9158  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9159  */
9160 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9161
9162 /**
9163  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9164  */
9165 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9166
9167 /**
9168  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9169  */
9170 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9171
9172 /**
9173  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9174  * but with all dynamically-allocated buffers duplicated in new buffers.
9175  */
9176 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9177
9178 /**
9179  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9180  */
9181 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9182
9183 /**
9184  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9185  */
9186 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9187
9188 /**
9189  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9190  */
9191 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9192
9193 /**
9194  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9195  * but with all dynamically-allocated buffers duplicated in new buffers.
9196  */
9197 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9198
9199 /**
9200  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9201  */
9202 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9203
9204 /**
9205  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9206  */
9207 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9208
9209 /**
9210  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9211  */
9212 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9213
9214 /**
9215  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9216  */
9217 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9218
9219 /**
9220  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9221  * but with all dynamically-allocated buffers duplicated in new buffers.
9222  */
9223 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9224
9225 /**
9226  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9227  */
9228 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9229
9230 /**
9231  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9232  */
9233 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9234
9235 /**
9236  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9237  */
9238 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9239
9240 /**
9241  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9242  * but with all dynamically-allocated buffers duplicated in new buffers.
9243  */
9244 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9245
9246 /**
9247  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9248  */
9249 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9250
9251 /**
9252  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9253  */
9254 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9255
9256 /**
9257  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9258  */
9259 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9260
9261 /**
9262  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9263  * but with all dynamically-allocated buffers duplicated in new buffers.
9264  */
9265 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9266
9267 /**
9268  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9269  */
9270 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9271
9272 /**
9273  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9274  */
9275 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9276
9277 /**
9278  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9279  */
9280 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9281
9282 /**
9283  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9284  */
9285 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9286
9287 /**
9288  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9289  */
9290 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9291
9292 /**
9293  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9294  */
9295 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9296
9297 /**
9298  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9299  * but with all dynamically-allocated buffers duplicated in new buffers.
9300  */
9301 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9302
9303 /**
9304  * Creates a new CResult_SiPrefixNoneZ in the success state.
9305  */
9306 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
9307
9308 /**
9309  * Creates a new CResult_SiPrefixNoneZ in the error state.
9310  */
9311 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
9312
9313 /**
9314  * Frees any resources used by the CResult_SiPrefixNoneZ.
9315  */
9316 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
9317
9318 /**
9319  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
9320  * but with all dynamically-allocated buffers duplicated in new buffers.
9321  */
9322 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
9323
9324 /**
9325  * Creates a new CResult_InvoiceNoneZ in the success state.
9326  */
9327 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
9328
9329 /**
9330  * Creates a new CResult_InvoiceNoneZ in the error state.
9331  */
9332 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
9333
9334 /**
9335  * Frees any resources used by the CResult_InvoiceNoneZ.
9336  */
9337 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
9338
9339 /**
9340  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
9341  * but with all dynamically-allocated buffers duplicated in new buffers.
9342  */
9343 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
9344
9345 /**
9346  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
9347  */
9348 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
9349
9350 /**
9351  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
9352  */
9353 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
9354
9355 /**
9356  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
9357  */
9358 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
9359
9360 /**
9361  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
9362  * but with all dynamically-allocated buffers duplicated in new buffers.
9363  */
9364 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
9365
9366 /**
9367  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9368  */
9369 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9370
9371 /**
9372  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9373  */
9374 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
9375
9376 /**
9377  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9378  */
9379 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
9380
9381 /**
9382  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
9383  */
9384 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
9385
9386 /**
9387  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
9388  */
9389 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
9390
9391 /**
9392  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
9393  */
9394 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
9395
9396 /**
9397  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9398  */
9399 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9400
9401 /**
9402  * Constructs a new COption_u64Z containing a u64
9403  */
9404 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9405
9406 /**
9407  * Constructs a new COption_u64Z containing nothing
9408  */
9409 struct LDKCOption_u64Z COption_u64Z_none(void);
9410
9411 /**
9412  * Frees any resources associated with the u64, if we are in the Some state
9413  */
9414 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9415
9416 /**
9417  * Creates a new COption_u64Z which has the same data as `orig`
9418  * but with all dynamically-allocated buffers duplicated in new buffers.
9419  */
9420 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9421
9422 /**
9423  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9424  */
9425 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
9426
9427 /**
9428  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9429  */
9430 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
9431
9432 /**
9433  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9434  */
9435 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
9436
9437 /**
9438  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9439  * but with all dynamically-allocated buffers duplicated in new buffers.
9440  */
9441 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
9442
9443 /**
9444  * Creates a new CResult_NoneSemanticErrorZ in the success state.
9445  */
9446 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
9447
9448 /**
9449  * Creates a new CResult_NoneSemanticErrorZ in the error state.
9450  */
9451 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
9452
9453 /**
9454  * Frees any resources used by the CResult_NoneSemanticErrorZ.
9455  */
9456 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
9457
9458 /**
9459  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
9460  * but with all dynamically-allocated buffers duplicated in new buffers.
9461  */
9462 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
9463
9464 /**
9465  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
9466  */
9467 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
9468
9469 /**
9470  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
9471  */
9472 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
9473
9474 /**
9475  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
9476  */
9477 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
9478
9479 /**
9480  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
9481  * but with all dynamically-allocated buffers duplicated in new buffers.
9482  */
9483 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
9484
9485 /**
9486  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
9487  */
9488 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
9489
9490 /**
9491  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
9492  */
9493 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
9494
9495 /**
9496  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
9497  */
9498 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
9499
9500 /**
9501  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9502  * but with all dynamically-allocated buffers duplicated in new buffers.
9503  */
9504 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
9505
9506 /**
9507  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
9508  */
9509 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
9510
9511 /**
9512  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
9513  */
9514 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
9515
9516 /**
9517  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
9518  */
9519 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
9520
9521 /**
9522  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
9523  * but with all dynamically-allocated buffers duplicated in new buffers.
9524  */
9525 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
9526
9527 /**
9528  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9529  */
9530 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9531
9532 /**
9533  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
9534  */
9535 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
9536
9537 /**
9538  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
9539  */
9540 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
9541
9542 /**
9543  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
9544  */
9545 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
9546
9547 /**
9548  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
9549  * but with all dynamically-allocated buffers duplicated in new buffers.
9550  */
9551 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
9552
9553 /**
9554  * Creates a new CResult_StringErrorZ in the success state.
9555  */
9556 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
9557
9558 /**
9559  * Creates a new CResult_StringErrorZ in the error state.
9560  */
9561 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
9562
9563 /**
9564  * Frees any resources used by the CResult_StringErrorZ.
9565  */
9566 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
9567
9568 /**
9569  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9570  */
9571 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
9572
9573 /**
9574  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9575  */
9576 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9577
9578 /**
9579  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9580  */
9581 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
9582
9583 /**
9584  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9585  * but with all dynamically-allocated buffers duplicated in new buffers.
9586  */
9587 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
9588
9589 /**
9590  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9591  */
9592 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
9593
9594 /**
9595  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9596  */
9597 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9598
9599 /**
9600  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9601  */
9602 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
9603
9604 /**
9605  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9606  * but with all dynamically-allocated buffers duplicated in new buffers.
9607  */
9608 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
9609
9610 /**
9611  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
9612  */
9613 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
9614
9615 /**
9616  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
9617  */
9618 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
9619
9620 /**
9621  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
9622  */
9623 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
9624
9625 /**
9626  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
9627  * but with all dynamically-allocated buffers duplicated in new buffers.
9628  */
9629 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
9630
9631 /**
9632  * Creates a new tuple which has the same data as `orig`
9633  * but with all dynamically-allocated buffers duplicated in new buffers.
9634  */
9635 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
9636
9637 /**
9638  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9639  */
9640 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
9641
9642 /**
9643  * Frees any resources used by the C2Tuple_OutPointScriptZ.
9644  */
9645 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
9646
9647 /**
9648  * Creates a new tuple which has the same data as `orig`
9649  * but with all dynamically-allocated buffers duplicated in new buffers.
9650  */
9651 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
9652
9653 /**
9654  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
9655  */
9656 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
9657
9658 /**
9659  * Frees any resources used by the C2Tuple_u32ScriptZ.
9660  */
9661 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
9662
9663 /**
9664  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9665  */
9666 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
9667
9668 /**
9669  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9670  */
9671 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
9672
9673 /**
9674  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9675  */
9676 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
9677
9678 /**
9679  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9680  */
9681 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
9682
9683 /**
9684  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9685  */
9686 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9687
9688 /**
9689  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9690  */
9691 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
9692
9693 /**
9694  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9695  */
9696 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
9697
9698 /**
9699  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9700  */
9701 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9702
9703 /**
9704  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9705  */
9706 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9707
9708 /**
9709  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9710  */
9711 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9712
9713 /**
9714  * Creates a new tuple which has the same data as `orig`
9715  * but with all dynamically-allocated buffers duplicated in new buffers.
9716  */
9717 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
9718
9719 /**
9720  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
9721  */
9722 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
9723
9724 /**
9725  * Frees any resources used by the C2Tuple_u32TxOutZ.
9726  */
9727 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
9728
9729 /**
9730  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9731  */
9732 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
9733
9734 /**
9735  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9736  */
9737 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
9738
9739 /**
9740  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9741  */
9742 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
9743
9744 /**
9745  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9746  */
9747 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
9748
9749 /**
9750  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9751  */
9752 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9753
9754 /**
9755  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9756  */
9757 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9758
9759 /**
9760  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9761  */
9762 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9763
9764 /**
9765  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9766  */
9767 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9768
9769 /**
9770  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9771  * but with all dynamically-allocated buffers duplicated in new buffers.
9772  */
9773 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9774
9775 /**
9776  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9777  */
9778 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9779
9780 /**
9781  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9782  */
9783 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9784
9785 /**
9786  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9787  */
9788 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
9789
9790 /**
9791  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9792  */
9793 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
9794
9795 /**
9796  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9797  */
9798 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
9799
9800 /**
9801  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9802  */
9803 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9804
9805 /**
9806  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9807  */
9808 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9809
9810 /**
9811  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9812  */
9813 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9814
9815 /**
9816  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9817  * but with all dynamically-allocated buffers duplicated in new buffers.
9818  */
9819 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9820
9821 /**
9822  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9823  */
9824 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9825
9826 /**
9827  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9828  */
9829 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9830
9831 /**
9832  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9833  */
9834 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9835
9836 /**
9837  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9838  */
9839 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9840
9841 /**
9842  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9843  */
9844 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9845
9846 /**
9847  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9848  * but with all dynamically-allocated buffers duplicated in new buffers.
9849  */
9850 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9851
9852 /**
9853  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9854  */
9855 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9856
9857 /**
9858  * Creates a new CResult_RouteLightningErrorZ in the success state.
9859  */
9860 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9861
9862 /**
9863  * Creates a new CResult_RouteLightningErrorZ in the error state.
9864  */
9865 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9866
9867 /**
9868  * Frees any resources used by the CResult_RouteLightningErrorZ.
9869  */
9870 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9871
9872 /**
9873  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9874  * but with all dynamically-allocated buffers duplicated in new buffers.
9875  */
9876 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9877
9878 /**
9879  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9880  */
9881 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9882
9883 /**
9884  * Creates a new CResult_boolLightningErrorZ in the success state.
9885  */
9886 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
9887
9888 /**
9889  * Creates a new CResult_boolLightningErrorZ in the error state.
9890  */
9891 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
9892
9893 /**
9894  * Frees any resources used by the CResult_boolLightningErrorZ.
9895  */
9896 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
9897
9898 /**
9899  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9900  * but with all dynamically-allocated buffers duplicated in new buffers.
9901  */
9902 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
9903
9904 /**
9905  * Creates a new tuple which has the same data as `orig`
9906  * but with all dynamically-allocated buffers duplicated in new buffers.
9907  */
9908 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
9909
9910 /**
9911  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9912  */
9913 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
9914
9915 /**
9916  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9917  */
9918 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
9919
9920 /**
9921  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9922  */
9923 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
9924
9925 /**
9926  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9927  */
9928 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
9929
9930 /**
9931  * Creates a new CResult_NoneLightningErrorZ in the success state.
9932  */
9933 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
9934
9935 /**
9936  * Creates a new CResult_NoneLightningErrorZ in the error state.
9937  */
9938 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
9939
9940 /**
9941  * Frees any resources used by the CResult_NoneLightningErrorZ.
9942  */
9943 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
9944
9945 /**
9946  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9947  * but with all dynamically-allocated buffers duplicated in new buffers.
9948  */
9949 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
9950
9951 /**
9952  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9953  */
9954 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
9955
9956 /**
9957  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9958  */
9959 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
9960
9961 /**
9962  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9963  */
9964 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9965
9966 /**
9967  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9968  */
9969 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
9970
9971 /**
9972  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9973  * but with all dynamically-allocated buffers duplicated in new buffers.
9974  */
9975 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
9976
9977 /**
9978  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
9979  */
9980 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
9981
9982 /**
9983  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
9984  */
9985 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
9986
9987 /**
9988  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
9989  */
9990 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
9991
9992 /**
9993  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9994  * but with all dynamically-allocated buffers duplicated in new buffers.
9995  */
9996 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
9997
9998 /**
9999  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
10000  */
10001 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
10002
10003 /**
10004  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
10005  */
10006 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10007
10008 /**
10009  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
10010  */
10011 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
10012
10013 /**
10014  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10015  * but with all dynamically-allocated buffers duplicated in new buffers.
10016  */
10017 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
10018
10019 /**
10020  * Creates a new CResult_TxOutAccessErrorZ in the success state.
10021  */
10022 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
10023
10024 /**
10025  * Creates a new CResult_TxOutAccessErrorZ in the error state.
10026  */
10027 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
10028
10029 /**
10030  * Frees any resources used by the CResult_TxOutAccessErrorZ.
10031  */
10032 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
10033
10034 /**
10035  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
10036  * but with all dynamically-allocated buffers duplicated in new buffers.
10037  */
10038 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
10039
10040 /**
10041  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
10042  */
10043 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
10044
10045 /**
10046  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
10047  */
10048 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
10049
10050 /**
10051  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
10052  */
10053 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
10054
10055 /**
10056  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10057  */
10058 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
10059
10060 /**
10061  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10062  */
10063 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
10064
10065 /**
10066  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10067  */
10068 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10069
10070 /**
10071  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10072  */
10073 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
10074
10075 /**
10076  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10077  * but with all dynamically-allocated buffers duplicated in new buffers.
10078  */
10079 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10080
10081 /**
10082  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10083  */
10084 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
10085
10086 /**
10087  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10088  */
10089 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10090
10091 /**
10092  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10093  */
10094 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
10095
10096 /**
10097  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10098  * but with all dynamically-allocated buffers duplicated in new buffers.
10099  */
10100 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10101
10102 /**
10103  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10104  */
10105 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
10106
10107 /**
10108  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10109  */
10110 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
10111
10112 /**
10113  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10114  */
10115 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
10116
10117 /**
10118  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10119  * but with all dynamically-allocated buffers duplicated in new buffers.
10120  */
10121 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10122
10123 /**
10124  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10125  */
10126 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
10127
10128 /**
10129  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10130  */
10131 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10132
10133 /**
10134  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10135  */
10136 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10137
10138 /**
10139  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10140  */
10141 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10142
10143 /**
10144  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10145  * but with all dynamically-allocated buffers duplicated in new buffers.
10146  */
10147 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10148
10149 /**
10150  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10151  */
10152 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10153
10154 /**
10155  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10156  */
10157 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10158
10159 /**
10160  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10161  */
10162 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10163
10164 /**
10165  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10166  */
10167 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10168
10169 /**
10170  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10171  * but with all dynamically-allocated buffers duplicated in new buffers.
10172  */
10173 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10174
10175 /**
10176  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10177  */
10178 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10179
10180 /**
10181  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10182  */
10183 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10184
10185 /**
10186  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10187  */
10188 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10189
10190 /**
10191  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10192  * but with all dynamically-allocated buffers duplicated in new buffers.
10193  */
10194 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10195
10196 /**
10197  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
10198  */
10199 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
10200
10201 /**
10202  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
10203  */
10204 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10205
10206 /**
10207  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
10208  */
10209 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
10210
10211 /**
10212  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
10213  */
10214 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
10215
10216 /**
10217  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
10218  */
10219 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10220
10221 /**
10222  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
10223  */
10224 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
10225
10226 /**
10227  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10228  */
10229 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10230
10231 /**
10232  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10233  */
10234 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10235
10236 /**
10237  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10238  */
10239 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10240
10241 /**
10242  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10243  */
10244 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10245
10246 /**
10247  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10248  */
10249 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10250
10251 /**
10252  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10253  */
10254 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10255
10256 /**
10257  * Creates a new CResult_NetAddressu8Z in the success state.
10258  */
10259 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10260
10261 /**
10262  * Creates a new CResult_NetAddressu8Z in the error state.
10263  */
10264 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10265
10266 /**
10267  * Frees any resources used by the CResult_NetAddressu8Z.
10268  */
10269 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10270
10271 /**
10272  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10273  * but with all dynamically-allocated buffers duplicated in new buffers.
10274  */
10275 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10276
10277 /**
10278  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10279  */
10280 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10281
10282 /**
10283  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10284  */
10285 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10286
10287 /**
10288  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10289  */
10290 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10291
10292 /**
10293  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10294  * but with all dynamically-allocated buffers duplicated in new buffers.
10295  */
10296 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10297
10298 /**
10299  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10300  */
10301 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
10302
10303 /**
10304  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10305  */
10306 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
10307
10308 /**
10309  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10310  */
10311 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
10312
10313 /**
10314  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10315  * but with all dynamically-allocated buffers duplicated in new buffers.
10316  */
10317 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
10318
10319 /**
10320  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10321  */
10322 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10323
10324 /**
10325  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10326  */
10327 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10328
10329 /**
10330  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10331  */
10332 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10333
10334 /**
10335  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10336  */
10337 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10338
10339 /**
10340  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10341  */
10342 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10343
10344 /**
10345  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10346  */
10347 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10348
10349 /**
10350  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10351  */
10352 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10353
10354 /**
10355  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10356  * but with all dynamically-allocated buffers duplicated in new buffers.
10357  */
10358 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10359
10360 /**
10361  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10362  */
10363 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10364
10365 /**
10366  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10367  */
10368 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10369
10370 /**
10371  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10372  */
10373 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10374
10375 /**
10376  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10377  * but with all dynamically-allocated buffers duplicated in new buffers.
10378  */
10379 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10380
10381 /**
10382  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10383  */
10384 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10385
10386 /**
10387  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10388  */
10389 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10390
10391 /**
10392  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10393  */
10394 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10395
10396 /**
10397  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10398  * but with all dynamically-allocated buffers duplicated in new buffers.
10399  */
10400 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10401
10402 /**
10403  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10404  */
10405 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10406
10407 /**
10408  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10409  */
10410 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10411
10412 /**
10413  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10414  */
10415 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10416
10417 /**
10418  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10419  * but with all dynamically-allocated buffers duplicated in new buffers.
10420  */
10421 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10422
10423 /**
10424  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10425  */
10426 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10427
10428 /**
10429  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10430  */
10431 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10432
10433 /**
10434  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10435  */
10436 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10437
10438 /**
10439  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10440  * but with all dynamically-allocated buffers duplicated in new buffers.
10441  */
10442 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10443
10444 /**
10445  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10446  */
10447 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10448
10449 /**
10450  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10451  */
10452 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10453
10454 /**
10455  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10456  */
10457 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10458
10459 /**
10460  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10461  * but with all dynamically-allocated buffers duplicated in new buffers.
10462  */
10463 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10464
10465 /**
10466  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10467  */
10468 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10469
10470 /**
10471  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10472  */
10473 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10474
10475 /**
10476  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10477  */
10478 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10479
10480 /**
10481  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10482  * but with all dynamically-allocated buffers duplicated in new buffers.
10483  */
10484 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10485
10486 /**
10487  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10488  */
10489 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10490
10491 /**
10492  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10493  */
10494 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10495
10496 /**
10497  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10498  */
10499 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
10500
10501 /**
10502  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10503  * but with all dynamically-allocated buffers duplicated in new buffers.
10504  */
10505 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
10506
10507 /**
10508  * Creates a new CResult_InitDecodeErrorZ in the success state.
10509  */
10510 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
10511
10512 /**
10513  * Creates a new CResult_InitDecodeErrorZ in the error state.
10514  */
10515 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
10516
10517 /**
10518  * Frees any resources used by the CResult_InitDecodeErrorZ.
10519  */
10520 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
10521
10522 /**
10523  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10524  * but with all dynamically-allocated buffers duplicated in new buffers.
10525  */
10526 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
10527
10528 /**
10529  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10530  */
10531 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
10532
10533 /**
10534  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10535  */
10536 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
10537
10538 /**
10539  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10540  */
10541 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
10542
10543 /**
10544  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10545  * but with all dynamically-allocated buffers duplicated in new buffers.
10546  */
10547 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
10548
10549 /**
10550  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10551  */
10552 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
10553
10554 /**
10555  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10556  */
10557 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
10558
10559 /**
10560  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10561  */
10562 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
10563
10564 /**
10565  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10566  * but with all dynamically-allocated buffers duplicated in new buffers.
10567  */
10568 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
10569
10570 /**
10571  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10572  */
10573 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
10574
10575 /**
10576  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10577  */
10578 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
10579
10580 /**
10581  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10582  */
10583 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
10584
10585 /**
10586  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10587  * but with all dynamically-allocated buffers duplicated in new buffers.
10588  */
10589 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
10590
10591 /**
10592  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10593  */
10594 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
10595
10596 /**
10597  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10598  */
10599 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10600
10601 /**
10602  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10603  */
10604 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
10605
10606 /**
10607  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10608  * but with all dynamically-allocated buffers duplicated in new buffers.
10609  */
10610 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
10611
10612 /**
10613  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10614  */
10615 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
10616
10617 /**
10618  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10619  */
10620 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10621
10622 /**
10623  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10624  */
10625 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
10626
10627 /**
10628  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10629  * but with all dynamically-allocated buffers duplicated in new buffers.
10630  */
10631 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
10632
10633 /**
10634  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10635  */
10636 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
10637
10638 /**
10639  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10640  */
10641 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
10642
10643 /**
10644  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10645  */
10646 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
10647
10648 /**
10649  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10650  * but with all dynamically-allocated buffers duplicated in new buffers.
10651  */
10652 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
10653
10654 /**
10655  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10656  */
10657 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
10658
10659 /**
10660  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10661  */
10662 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10663
10664 /**
10665  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10666  */
10667 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
10668
10669 /**
10670  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10671  * but with all dynamically-allocated buffers duplicated in new buffers.
10672  */
10673 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
10674
10675 /**
10676  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10677  */
10678 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
10679
10680 /**
10681  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10682  */
10683 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10684
10685 /**
10686  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10687  */
10688 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
10689
10690 /**
10691  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10692  * but with all dynamically-allocated buffers duplicated in new buffers.
10693  */
10694 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
10695
10696 /**
10697  * Creates a new CResult_PingDecodeErrorZ in the success state.
10698  */
10699 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
10700
10701 /**
10702  * Creates a new CResult_PingDecodeErrorZ in the error state.
10703  */
10704 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
10705
10706 /**
10707  * Frees any resources used by the CResult_PingDecodeErrorZ.
10708  */
10709 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
10710
10711 /**
10712  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10713  * but with all dynamically-allocated buffers duplicated in new buffers.
10714  */
10715 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
10716
10717 /**
10718  * Creates a new CResult_PongDecodeErrorZ in the success state.
10719  */
10720 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
10721
10722 /**
10723  * Creates a new CResult_PongDecodeErrorZ in the error state.
10724  */
10725 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
10726
10727 /**
10728  * Frees any resources used by the CResult_PongDecodeErrorZ.
10729  */
10730 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
10731
10732 /**
10733  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10734  * but with all dynamically-allocated buffers duplicated in new buffers.
10735  */
10736 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
10737
10738 /**
10739  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10740  */
10741 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
10742
10743 /**
10744  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10745  */
10746 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10747
10748 /**
10749  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10750  */
10751 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
10752
10753 /**
10754  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10755  * but with all dynamically-allocated buffers duplicated in new buffers.
10756  */
10757 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10758
10759 /**
10760  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10761  */
10762 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
10763
10764 /**
10765  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10766  */
10767 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10768
10769 /**
10770  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10771  */
10772 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
10773
10774 /**
10775  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10776  * but with all dynamically-allocated buffers duplicated in new buffers.
10777  */
10778 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10779
10780 /**
10781  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10782  */
10783 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
10784
10785 /**
10786  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10787  */
10788 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10789
10790 /**
10791  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10792  */
10793 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
10794
10795 /**
10796  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10797  * but with all dynamically-allocated buffers duplicated in new buffers.
10798  */
10799 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10800
10801 /**
10802  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10803  */
10804 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
10805
10806 /**
10807  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10808  */
10809 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10810
10811 /**
10812  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10813  */
10814 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
10815
10816 /**
10817  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10818  * but with all dynamically-allocated buffers duplicated in new buffers.
10819  */
10820 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10821
10822 /**
10823  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10824  */
10825 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
10826
10827 /**
10828  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10829  */
10830 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
10831
10832 /**
10833  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10834  */
10835 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
10836
10837 /**
10838  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10839  * but with all dynamically-allocated buffers duplicated in new buffers.
10840  */
10841 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
10842
10843 /**
10844  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10845  */
10846 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
10847
10848 /**
10849  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10850  */
10851 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10852
10853 /**
10854  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10855  */
10856 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
10857
10858 /**
10859  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10860  * but with all dynamically-allocated buffers duplicated in new buffers.
10861  */
10862 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10863
10864 /**
10865  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10866  */
10867 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
10868
10869 /**
10870  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10871  */
10872 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10873
10874 /**
10875  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10876  */
10877 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
10878
10879 /**
10880  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10881  * but with all dynamically-allocated buffers duplicated in new buffers.
10882  */
10883 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10884
10885 /**
10886  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10887  */
10888 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
10889
10890 /**
10891  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10892  */
10893 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
10894
10895 /**
10896  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10897  */
10898 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
10899
10900 /**
10901  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10902  * but with all dynamically-allocated buffers duplicated in new buffers.
10903  */
10904 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
10905
10906 /**
10907  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10908  */
10909 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
10910
10911 /**
10912  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10913  */
10914 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
10915
10916 /**
10917  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10918  */
10919 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
10920
10921 /**
10922  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10923  * but with all dynamically-allocated buffers duplicated in new buffers.
10924  */
10925 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
10926
10927 /**
10928  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10929  */
10930 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
10931
10932 /**
10933  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10934  */
10935 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10936
10937 /**
10938  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10939  */
10940 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
10941
10942 /**
10943  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10944  * but with all dynamically-allocated buffers duplicated in new buffers.
10945  */
10946 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10947
10948 /**
10949  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10950  */
10951 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
10952
10953 /**
10954  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10955  */
10956 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10957
10958 /**
10959  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10960  */
10961 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
10962
10963 /**
10964  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10965  * but with all dynamically-allocated buffers duplicated in new buffers.
10966  */
10967 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10968
10969 /**
10970  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10971  */
10972 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
10973
10974 /**
10975  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10976  */
10977 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
10978
10979 /**
10980  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10981  */
10982 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
10983
10984 /**
10985  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10986  * but with all dynamically-allocated buffers duplicated in new buffers.
10987  */
10988 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
10989
10990 /**
10991  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10992  */
10993 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
10994
10995 /**
10996  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10997  */
10998 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
10999
11000 /**
11001  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11002  */
11003 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
11004
11005 /**
11006  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11007  * but with all dynamically-allocated buffers duplicated in new buffers.
11008  */
11009 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
11010
11011 /**
11012  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
11013  */
11014 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
11015
11016 /**
11017  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
11018  */
11019 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11020
11021 /**
11022  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
11023  */
11024 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
11025
11026 /**
11027  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11028  * but with all dynamically-allocated buffers duplicated in new buffers.
11029  */
11030 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11031
11032 /**
11033  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
11034  */
11035 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
11036
11037 /**
11038  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
11039  */
11040 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11041
11042 /**
11043  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
11044  */
11045 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
11046
11047 /**
11048  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11049  * but with all dynamically-allocated buffers duplicated in new buffers.
11050  */
11051 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11052
11053 /**
11054  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
11055  */
11056 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
11057
11058 /**
11059  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
11060  */
11061 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11062
11063 /**
11064  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
11065  */
11066 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
11067
11068 /**
11069  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
11070  * but with all dynamically-allocated buffers duplicated in new buffers.
11071  */
11072 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11073
11074 /**
11075  * Creates a new tuple which has the same data as `orig`
11076  * but with all dynamically-allocated buffers duplicated in new buffers.
11077  */
11078 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
11079
11080 /**
11081  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
11082  */
11083 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
11084
11085 /**
11086  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
11087  */
11088 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
11089
11090 /**
11091  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
11092  */
11093 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
11094
11095 /**
11096  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
11097  */
11098 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
11099
11100 /**
11101  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
11102  */
11103 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
11104
11105 /**
11106  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
11107  * but with all dynamically-allocated buffers duplicated in new buffers.
11108  */
11109 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
11110
11111 /**
11112  * Creates a new CResult_SignatureNoneZ in the success state.
11113  */
11114 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
11115
11116 /**
11117  * Creates a new CResult_SignatureNoneZ in the error state.
11118  */
11119 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
11120
11121 /**
11122  * Frees any resources used by the CResult_SignatureNoneZ.
11123  */
11124 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
11125
11126 /**
11127  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
11128  * but with all dynamically-allocated buffers duplicated in new buffers.
11129  */
11130 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
11131
11132 /**
11133  * Creates a new CResult_SignDecodeErrorZ in the success state.
11134  */
11135 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
11136
11137 /**
11138  * Creates a new CResult_SignDecodeErrorZ in the error state.
11139  */
11140 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
11141
11142 /**
11143  * Frees any resources used by the CResult_SignDecodeErrorZ.
11144  */
11145 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
11146
11147 /**
11148  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
11149  * but with all dynamically-allocated buffers duplicated in new buffers.
11150  */
11151 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
11152
11153 /**
11154  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
11155  */
11156 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
11157
11158 /**
11159  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
11160  */
11161 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
11162
11163 /**
11164  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
11165  */
11166 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
11167
11168 /**
11169  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
11170  * but with all dynamically-allocated buffers duplicated in new buffers.
11171  */
11172 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
11173
11174 /**
11175  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11176  */
11177 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
11178
11179 /**
11180  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
11181  */
11182 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
11183
11184 /**
11185  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
11186  */
11187 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
11188
11189 /**
11190  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
11191  */
11192 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
11193
11194 /**
11195  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
11196  * but with all dynamically-allocated buffers duplicated in new buffers.
11197  */
11198 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
11199
11200 /**
11201  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
11202  */
11203 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
11204
11205 /**
11206  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
11207  */
11208 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
11209
11210 /**
11211  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
11212  */
11213 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
11214
11215 /**
11216  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
11217  * but with all dynamically-allocated buffers duplicated in new buffers.
11218  */
11219 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
11220
11221 /**
11222  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11223  */
11224 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
11225
11226 /**
11227  * Creates a new CResult_TransactionNoneZ in the success state.
11228  */
11229 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
11230
11231 /**
11232  * Creates a new CResult_TransactionNoneZ in the error state.
11233  */
11234 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
11235
11236 /**
11237  * Frees any resources used by the CResult_TransactionNoneZ.
11238  */
11239 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
11240
11241 /**
11242  * Creates a new CResult_NoneErrorZ in the success state.
11243  */
11244 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11245
11246 /**
11247  * Creates a new CResult_NoneErrorZ in the error state.
11248  */
11249 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
11250
11251 /**
11252  * Frees any resources used by the CResult_NoneErrorZ.
11253  */
11254 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
11255
11256 /**
11257  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11258  */
11259 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
11260
11261 /**
11262  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
11263  */
11264 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
11265
11266 /**
11267  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
11268  */
11269 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
11270
11271 /**
11272  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
11273  */
11274 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
11275
11276 /**
11277  * Creates a new CResult_NoneAPIErrorZ in the success state.
11278  */
11279 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
11280
11281 /**
11282  * Creates a new CResult_NoneAPIErrorZ in the error state.
11283  */
11284 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
11285
11286 /**
11287  * Frees any resources used by the CResult_NoneAPIErrorZ.
11288  */
11289 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11290
11291 /**
11292  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11293  * but with all dynamically-allocated buffers duplicated in new buffers.
11294  */
11295 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11296
11297 /**
11298  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11299  */
11300 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11301
11302 /**
11303  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11304  */
11305 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11306
11307 /**
11308  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11309  */
11310 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11311
11312 /**
11313  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11314  */
11315 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11316
11317 /**
11318  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11319  */
11320 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11321
11322 /**
11323  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11324  * but with all dynamically-allocated buffers duplicated in new buffers.
11325  */
11326 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11327
11328 /**
11329  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11330  */
11331 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11332
11333 /**
11334  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11335  */
11336 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11337
11338 /**
11339  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11340  */
11341 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11342
11343 /**
11344  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11345  */
11346 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11347
11348 /**
11349  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11350  */
11351 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11352
11353 /**
11354  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11355  */
11356 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11357
11358 /**
11359  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11360  */
11361 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11362
11363 /**
11364  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11365  */
11366 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11367
11368 /**
11369  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11370  */
11371 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11372
11373 /**
11374  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11375  */
11376 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11377
11378 /**
11379  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11380  */
11381 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11382
11383 /**
11384  * Frees any resources used by the Event
11385  */
11386 void Event_free(struct LDKEvent this_ptr);
11387
11388 /**
11389  * Creates a copy of the Event
11390  */
11391 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11392
11393 /**
11394  * Serialize the Event object into a byte array which can be read by Event_read
11395  */
11396 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11397
11398 /**
11399  * Frees any resources used by the MessageSendEvent
11400  */
11401 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11402
11403 /**
11404  * Creates a copy of the MessageSendEvent
11405  */
11406 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11407
11408 /**
11409  * Calls the free function if one is set
11410  */
11411 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11412
11413 /**
11414  * Calls the free function if one is set
11415  */
11416 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11417
11418 /**
11419  * Calls the free function if one is set
11420  */
11421 void EventHandler_free(struct LDKEventHandler this_ptr);
11422
11423 /**
11424  * Frees any resources used by the APIError
11425  */
11426 void APIError_free(struct LDKAPIError this_ptr);
11427
11428 /**
11429  * Creates a copy of the APIError
11430  */
11431 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11432
11433 /**
11434  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11435  * 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.
11436  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11437  */
11438 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11439
11440 /**
11441  * Recovers the PublicKey of the signer of the message given the message and the signature.
11442  */
11443 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11444
11445 /**
11446  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11447  * and the PublicKey.
11448  */
11449 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11450
11451 /**
11452  * Creates a copy of the Level
11453  */
11454 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11455
11456 /**
11457  * Checks if two Levels contain equal inner contents.
11458  * This ignores pointers and is_owned flags and looks at the values in fields.
11459  */
11460 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11461
11462 /**
11463  * Checks if two Levels contain equal inner contents.
11464  */
11465 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11466
11467 /**
11468  * Returns the most verbose logging level.
11469  */
11470 MUST_USE_RES enum LDKLevel Level_max(void);
11471
11472 /**
11473  * Calls the free function if one is set
11474  */
11475 void Logger_free(struct LDKLogger this_ptr);
11476
11477 /**
11478  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11479  */
11480 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11481
11482 /**
11483  * Confirmations we will wait for before considering the channel locked in.
11484  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11485  * equivalent limit applied to outbound channels).
11486  *
11487  * Default value: 6.
11488  */
11489 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11490
11491 /**
11492  * Confirmations we will wait for before considering the channel locked in.
11493  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11494  * equivalent limit applied to outbound channels).
11495  *
11496  * Default value: 6.
11497  */
11498 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11499
11500 /**
11501  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11502  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11503  * transaction).
11504  *
11505  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11506  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11507  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11508  * possibly with time in between to RBF the spending transaction).
11509  *
11510  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11511  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11512  * our channel.
11513  *
11514  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11515  * can tweak config to ask for more security, not less.
11516  */
11517 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11518
11519 /**
11520  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11521  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11522  * transaction).
11523  *
11524  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11525  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11526  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11527  * possibly with time in between to RBF the spending transaction).
11528  *
11529  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11530  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11531  * our channel.
11532  *
11533  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11534  * can tweak config to ask for more security, not less.
11535  */
11536 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11537
11538 /**
11539  * Set to the smallest value HTLC we will accept to process.
11540  *
11541  * This value is sent to our counterparty on channel-open and we close the channel any time
11542  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11543  *
11544  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11545  * by the protocol.
11546  */
11547 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11548
11549 /**
11550  * Set to the smallest value HTLC we will accept to process.
11551  *
11552  * This value is sent to our counterparty on channel-open and we close the channel any time
11553  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11554  *
11555  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11556  * by the protocol.
11557  */
11558 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11559
11560 /**
11561  * Constructs a new ChannelHandshakeConfig given each field
11562  */
11563 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);
11564
11565 /**
11566  * Creates a copy of the ChannelHandshakeConfig
11567  */
11568 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11569
11570 /**
11571  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11572  */
11573 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11574
11575 /**
11576  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11577  */
11578 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11579
11580 /**
11581  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11582  * only applies to inbound channels.
11583  *
11584  * Default value: 0.
11585  */
11586 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11587
11588 /**
11589  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11590  * only applies to inbound channels.
11591  *
11592  * Default value: 0.
11593  */
11594 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11595
11596 /**
11597  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11598  * you to limit the maximum minimum-size they can require.
11599  *
11600  * Default value: u64::max_value.
11601  */
11602 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11603
11604 /**
11605  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11606  * you to limit the maximum minimum-size they can require.
11607  *
11608  * Default value: u64::max_value.
11609  */
11610 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11611
11612 /**
11613  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11614  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11615  *
11616  * Default value: 0.
11617  */
11618 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11619
11620 /**
11621  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11622  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11623  *
11624  * Default value: 0.
11625  */
11626 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11627
11628 /**
11629  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11630  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11631  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11632  *
11633  * Default value: u64::max_value.
11634  */
11635 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11636
11637 /**
11638  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11639  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11640  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11641  *
11642  * Default value: u64::max_value.
11643  */
11644 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11645
11646 /**
11647  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11648  * time. This allows you to set a minimum such value.
11649  *
11650  * Default value: 0.
11651  */
11652 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11653
11654 /**
11655  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11656  * time. This allows you to set a minimum such value.
11657  *
11658  * Default value: 0.
11659  */
11660 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11661
11662 /**
11663  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11664  * certain number of blocks, specified by the node which is not the funder (as the funder can
11665  * assume they aren't going to double-spend themselves).
11666  * This config allows you to set a limit on the maximum amount of time to wait.
11667  *
11668  * Default value: 144, or roughly one day and only applies to outbound channels.
11669  */
11670 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11671
11672 /**
11673  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11674  * certain number of blocks, specified by the node which is not the funder (as the funder can
11675  * assume they aren't going to double-spend themselves).
11676  * This config allows you to set a limit on the maximum amount of time to wait.
11677  *
11678  * Default value: 144, or roughly one day and only applies to outbound channels.
11679  */
11680 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11681
11682 /**
11683  * Set to force the incoming channel to match our announced channel preference in
11684  * ChannelConfig.
11685  *
11686  * Default value: true, to make the default that no announced channels are possible (which is
11687  * appropriate for any nodes which are not online very reliably).
11688  */
11689 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11690
11691 /**
11692  * Set to force the incoming channel to match our announced channel preference in
11693  * ChannelConfig.
11694  *
11695  * Default value: true, to make the default that no announced channels are possible (which is
11696  * appropriate for any nodes which are not online very reliably).
11697  */
11698 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11699
11700 /**
11701  * Set to the amount of time we're willing to wait to claim money back to us.
11702  *
11703  * Not checking this value would be a security issue, as our peer would be able to set it to
11704  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11705  *
11706  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11707  * reduce the loss of having useless locked funds (if your peer accepts)
11708  */
11709 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11710
11711 /**
11712  * Set to the amount of time we're willing to wait to claim money back to us.
11713  *
11714  * Not checking this value would be a security issue, as our peer would be able to set it to
11715  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11716  *
11717  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11718  * reduce the loss of having useless locked funds (if your peer accepts)
11719  */
11720 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11721
11722 /**
11723  * Constructs a new ChannelHandshakeLimits given each field
11724  */
11725 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);
11726
11727 /**
11728  * Creates a copy of the ChannelHandshakeLimits
11729  */
11730 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11731
11732 /**
11733  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11734  */
11735 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11736
11737 /**
11738  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11739  */
11740 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11741
11742 /**
11743  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11744  * This may be allowed to change at runtime in a later update, however doing so must result in
11745  * update messages sent to notify all nodes of our updated relay fee.
11746  *
11747  * Default value: 0.
11748  */
11749 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11750
11751 /**
11752  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11753  * This may be allowed to change at runtime in a later update, however doing so must result in
11754  * update messages sent to notify all nodes of our updated relay fee.
11755  *
11756  * Default value: 0.
11757  */
11758 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11759
11760 /**
11761  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11762  * the channel this config applies to.
11763  *
11764  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11765  * HTLC balance when a channel appears on-chain whereas
11766  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11767  * (non-HTLC-encumbered) balance.
11768  *
11769  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11770  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11771  * commitment transaction at least once per this many blocks (minus some margin to allow us
11772  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11773  * the spending transaction).
11774  *
11775  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11776  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11777  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11778  *
11779  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11780  */
11781 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11782
11783 /**
11784  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11785  * the channel this config applies to.
11786  *
11787  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11788  * HTLC balance when a channel appears on-chain whereas
11789  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11790  * (non-HTLC-encumbered) balance.
11791  *
11792  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11793  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11794  * commitment transaction at least once per this many blocks (minus some margin to allow us
11795  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11796  * the spending transaction).
11797  *
11798  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11799  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11800  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11801  *
11802  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11803  */
11804 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11805
11806 /**
11807  * Set to announce the channel publicly and notify all nodes that they can route via this
11808  * channel.
11809  *
11810  * This should only be set to true for nodes which expect to be online reliably.
11811  *
11812  * As the node which funds a channel picks this value this will only apply for new outbound
11813  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11814  *
11815  * This cannot be changed after the initial channel handshake.
11816  *
11817  * Default value: false.
11818  */
11819 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11820
11821 /**
11822  * Set to announce the channel publicly and notify all nodes that they can route via this
11823  * channel.
11824  *
11825  * This should only be set to true for nodes which expect to be online reliably.
11826  *
11827  * As the node which funds a channel picks this value this will only apply for new outbound
11828  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11829  *
11830  * This cannot be changed after the initial channel handshake.
11831  *
11832  * Default value: false.
11833  */
11834 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11835
11836 /**
11837  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11838  * supports it, they will then enforce the mutual-close output to us matches what we provided
11839  * at intialization, preventing us from closing to an alternate pubkey.
11840  *
11841  * This is set to true by default to provide a slight increase in security, though ultimately
11842  * any attacker who is able to take control of a channel can just as easily send the funds via
11843  * lightning payments, so we never require that our counterparties support this option.
11844  *
11845  * This cannot be changed after a channel has been initialized.
11846  *
11847  * Default value: true.
11848  */
11849 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11850
11851 /**
11852  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11853  * supports it, they will then enforce the mutual-close output to us matches what we provided
11854  * at intialization, preventing us from closing to an alternate pubkey.
11855  *
11856  * This is set to true by default to provide a slight increase in security, though ultimately
11857  * any attacker who is able to take control of a channel can just as easily send the funds via
11858  * lightning payments, so we never require that our counterparties support this option.
11859  *
11860  * This cannot be changed after a channel has been initialized.
11861  *
11862  * Default value: true.
11863  */
11864 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11865
11866 /**
11867  * Constructs a new ChannelConfig given each field
11868  */
11869 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
11870
11871 /**
11872  * Creates a copy of the ChannelConfig
11873  */
11874 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
11875
11876 /**
11877  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
11878  */
11879 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
11880
11881 /**
11882  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
11883  */
11884 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
11885
11886 /**
11887  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
11888  */
11889 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
11890
11891 /**
11892  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
11893  */
11894 void UserConfig_free(struct LDKUserConfig this_obj);
11895
11896 /**
11897  * Channel config that we propose to our counterparty.
11898  */
11899 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11900
11901 /**
11902  * Channel config that we propose to our counterparty.
11903  */
11904 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
11905
11906 /**
11907  * Limits applied to our counterparty's proposed channel config settings.
11908  */
11909 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11910
11911 /**
11912  * Limits applied to our counterparty's proposed channel config settings.
11913  */
11914 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
11915
11916 /**
11917  * Channel config which affects behavior during channel lifetime.
11918  */
11919 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11920
11921 /**
11922  * Channel config which affects behavior during channel lifetime.
11923  */
11924 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
11925
11926 /**
11927  * Constructs a new UserConfig given each field
11928  */
11929 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);
11930
11931 /**
11932  * Creates a copy of the UserConfig
11933  */
11934 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
11935
11936 /**
11937  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
11938  */
11939 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
11940
11941 /**
11942  * Creates a copy of the AccessError
11943  */
11944 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
11945
11946 /**
11947  * Calls the free function if one is set
11948  */
11949 void Access_free(struct LDKAccess this_ptr);
11950
11951 /**
11952  * Calls the free function if one is set
11953  */
11954 void Listen_free(struct LDKListen this_ptr);
11955
11956 /**
11957  * Calls the free function if one is set
11958  */
11959 void Confirm_free(struct LDKConfirm this_ptr);
11960
11961 /**
11962  * Calls the free function if one is set
11963  */
11964 void Watch_free(struct LDKWatch this_ptr);
11965
11966 /**
11967  * Calls the free function if one is set
11968  */
11969 void Filter_free(struct LDKFilter this_ptr);
11970
11971 /**
11972  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
11973  */
11974 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
11975
11976 /**
11977  * First block where the transaction output may have been spent.
11978  */
11979 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11980
11981 /**
11982  * First block where the transaction output may have been spent.
11983  */
11984 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11985
11986 /**
11987  * Outpoint identifying the transaction output.
11988  */
11989 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11990
11991 /**
11992  * Outpoint identifying the transaction output.
11993  */
11994 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11995
11996 /**
11997  * Spending condition of the transaction output.
11998  */
11999 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12000
12001 /**
12002  * Spending condition of the transaction output.
12003  */
12004 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12005
12006 /**
12007  * Constructs a new WatchedOutput given each field
12008  */
12009 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
12010
12011 /**
12012  * Calls the free function if one is set
12013  */
12014 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
12015
12016 /**
12017  * Creates a copy of the ConfirmationTarget
12018  */
12019 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
12020
12021 /**
12022  * Calls the free function if one is set
12023  */
12024 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
12025
12026 /**
12027  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
12028  */
12029 void ChainMonitor_free(struct LDKChainMonitor this_obj);
12030
12031 /**
12032  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
12033  *
12034  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
12035  * will call back to it indicating transactions and outputs of interest. This allows clients to
12036  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
12037  * always need to fetch full blocks absent another means for determining which blocks contain
12038  * transactions relevant to the watched channels.
12039  */
12040 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
12041
12042 /**
12043  * Constructs a new Listen which calls the relevant methods on this_arg.
12044  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12045  */
12046 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12047
12048 /**
12049  * Constructs a new Confirm which calls the relevant methods on this_arg.
12050  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12051  */
12052 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12053
12054 /**
12055  * Constructs a new Watch which calls the relevant methods on this_arg.
12056  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
12057  */
12058 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12059
12060 /**
12061  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12062  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12063  */
12064 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12065
12066 /**
12067  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
12068  */
12069 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
12070
12071 /**
12072  * The sequence number of this update. Updates *must* be replayed in-order according to this
12073  * sequence number (and updates may panic if they are not). The update_id values are strictly
12074  * increasing and increase by one for each new update, with one exception specified below.
12075  *
12076  * This sequence number is also used to track up to which points updates which returned
12077  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12078  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12079  *
12080  * The only instance where update_id values are not strictly increasing is the case where we
12081  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12082  * its docs for more details.
12083  */
12084 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
12085
12086 /**
12087  * The sequence number of this update. Updates *must* be replayed in-order according to this
12088  * sequence number (and updates may panic if they are not). The update_id values are strictly
12089  * increasing and increase by one for each new update, with one exception specified below.
12090  *
12091  * This sequence number is also used to track up to which points updates which returned
12092  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12093  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12094  *
12095  * The only instance where update_id values are not strictly increasing is the case where we
12096  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12097  * its docs for more details.
12098  */
12099 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
12100
12101 /**
12102  * Creates a copy of the ChannelMonitorUpdate
12103  */
12104 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
12105
12106 /**
12107  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
12108  */
12109 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
12110
12111 /**
12112  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
12113  */
12114 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
12115
12116 /**
12117  * Creates a copy of the ChannelMonitorUpdateErr
12118  */
12119 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
12120
12121 /**
12122  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
12123  */
12124 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
12125
12126 /**
12127  * Creates a copy of the MonitorUpdateError
12128  */
12129 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
12130
12131 /**
12132  * Frees any resources used by the MonitorEvent
12133  */
12134 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
12135
12136 /**
12137  * Creates a copy of the MonitorEvent
12138  */
12139 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
12140
12141 /**
12142  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
12143  */
12144 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
12145
12146 /**
12147  * Creates a copy of the HTLCUpdate
12148  */
12149 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
12150
12151 /**
12152  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
12153  */
12154 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
12155
12156 /**
12157  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
12158  */
12159 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
12160
12161 /**
12162  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12163  */
12164 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12165
12166 /**
12167  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12168  */
12169 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12170
12171 /**
12172  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12173  * itself.
12174  *
12175  * panics if the given update is not the next update by update_id.
12176  */
12177 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);
12178
12179 /**
12180  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12181  * ChannelMonitor.
12182  */
12183 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12184
12185 /**
12186  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12187  */
12188 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12189
12190 /**
12191  * Gets a list of txids, with their output scripts (in the order they appear in the
12192  * transaction), which we must learn about spends of via block_connected().
12193  */
12194 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12195
12196 /**
12197  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12198  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12199  * have been registered.
12200  */
12201 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12202
12203 /**
12204  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12205  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12206  */
12207 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12208
12209 /**
12210  * Gets the list of pending events which were generated by previous actions, clearing the list
12211  * in the process.
12212  *
12213  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12214  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12215  * no internal locking in ChannelMonitors.
12216  */
12217 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12218
12219 /**
12220  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12221  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12222  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12223  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12224  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12225  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12226  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12227  * out-of-band the other node operator to coordinate with him if option is available to you.
12228  * In any-case, choice is up to the user.
12229  */
12230 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);
12231
12232 /**
12233  * Processes transactions in a newly connected block, which may result in any of the following:
12234  * - update the monitor's state against resolved HTLCs
12235  * - punish the counterparty in the case of seeing a revoked commitment transaction
12236  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12237  * - detect settled outputs for later spending
12238  * - schedule and bump any in-flight claims
12239  *
12240  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12241  * [`get_outputs_to_watch`].
12242  *
12243  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12244  */
12245 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);
12246
12247 /**
12248  * Determines if the disconnected block contained any transactions of interest and updates
12249  * appropriately.
12250  */
12251 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);
12252
12253 /**
12254  * Processes transactions confirmed in a block with the given header and height, returning new
12255  * outputs to watch. See [`block_connected`] for details.
12256  *
12257  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12258  * blocks. See [`chain::Confirm`] for calling expectations.
12259  *
12260  * [`block_connected`]: Self::block_connected
12261  */
12262 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);
12263
12264 /**
12265  * Processes a transaction that was reorganized out of the chain.
12266  *
12267  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12268  * than blocks. See [`chain::Confirm`] for calling expectations.
12269  *
12270  * [`block_disconnected`]: Self::block_disconnected
12271  */
12272 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);
12273
12274 /**
12275  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12276  * [`block_connected`] for details.
12277  *
12278  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12279  * blocks. See [`chain::Confirm`] for calling expectations.
12280  *
12281  * [`block_connected`]: Self::block_connected
12282  */
12283 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);
12284
12285 /**
12286  * Returns the set of txids that should be monitored for re-organization out of the chain.
12287  */
12288 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12289
12290 /**
12291  * Calls the free function if one is set
12292  */
12293 void Persist_free(struct LDKPersist this_ptr);
12294
12295 /**
12296  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12297  */
12298 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12299
12300 /**
12301  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12302  */
12303 void OutPoint_free(struct LDKOutPoint this_obj);
12304
12305 /**
12306  * The referenced transaction's txid.
12307  */
12308 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12309
12310 /**
12311  * The referenced transaction's txid.
12312  */
12313 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12314
12315 /**
12316  * The index of the referenced output in its transaction's vout.
12317  */
12318 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12319
12320 /**
12321  * The index of the referenced output in its transaction's vout.
12322  */
12323 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12324
12325 /**
12326  * Constructs a new OutPoint given each field
12327  */
12328 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12329
12330 /**
12331  * Creates a copy of the OutPoint
12332  */
12333 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12334
12335 /**
12336  * Checks if two OutPoints contain equal inner contents.
12337  * This ignores pointers and is_owned flags and looks at the values in fields.
12338  * Two objects with NULL inner values will be considered "equal" here.
12339  */
12340 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12341
12342 /**
12343  * Checks if two OutPoints contain equal inner contents.
12344  */
12345 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12346
12347 /**
12348  * Convert an `OutPoint` to a lightning channel id.
12349  */
12350 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12351
12352 /**
12353  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12354  */
12355 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12356
12357 /**
12358  * Read a OutPoint from a byte array, created by OutPoint_write
12359  */
12360 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12361
12362 /**
12363  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12364  */
12365 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12366
12367 /**
12368  * The outpoint which is spendable
12369  */
12370 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12371
12372 /**
12373  * The outpoint which is spendable
12374  */
12375 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12376
12377 /**
12378  * Per commitment point to derive delayed_payment_key by key holder
12379  */
12380 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12381
12382 /**
12383  * Per commitment point to derive delayed_payment_key by key holder
12384  */
12385 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12386
12387 /**
12388  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12389  * the witness_script.
12390  */
12391 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12392
12393 /**
12394  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12395  * the witness_script.
12396  */
12397 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12398
12399 /**
12400  * The output which is referenced by the given outpoint
12401  */
12402 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12403
12404 /**
12405  * The revocation point specific to the commitment transaction which was broadcast. Used to
12406  * derive the witnessScript for this output.
12407  */
12408 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12409
12410 /**
12411  * The revocation point specific to the commitment transaction which was broadcast. Used to
12412  * derive the witnessScript for this output.
12413  */
12414 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12415
12416 /**
12417  * Arbitrary identification information returned by a call to
12418  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12419  * the channel to spend the output.
12420  */
12421 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12422
12423 /**
12424  * Arbitrary identification information returned by a call to
12425  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12426  * the channel to spend the output.
12427  */
12428 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12429
12430 /**
12431  * The value of the channel which this output originated from, possibly indirectly.
12432  */
12433 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12434
12435 /**
12436  * The value of the channel which this output originated from, possibly indirectly.
12437  */
12438 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12439
12440 /**
12441  * Constructs a new DelayedPaymentOutputDescriptor given each field
12442  */
12443 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);
12444
12445 /**
12446  * Creates a copy of the DelayedPaymentOutputDescriptor
12447  */
12448 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12449
12450 /**
12451  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
12452  */
12453 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
12454
12455 /**
12456  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
12457  */
12458 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
12459
12460 /**
12461  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12462  */
12463 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12464
12465 /**
12466  * The outpoint which is spendable
12467  */
12468 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12469
12470 /**
12471  * The outpoint which is spendable
12472  */
12473 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12474
12475 /**
12476  * The output which is referenced by the given outpoint
12477  */
12478 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12479
12480 /**
12481  * Arbitrary identification information returned by a call to
12482  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12483  * the channel to spend the output.
12484  */
12485 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12486
12487 /**
12488  * Arbitrary identification information returned by a call to
12489  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12490  * the channel to spend the output.
12491  */
12492 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12493
12494 /**
12495  * The value of the channel which this transactions spends.
12496  */
12497 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12498
12499 /**
12500  * The value of the channel which this transactions spends.
12501  */
12502 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12503
12504 /**
12505  * Constructs a new StaticPaymentOutputDescriptor given each field
12506  */
12507 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);
12508
12509 /**
12510  * Creates a copy of the StaticPaymentOutputDescriptor
12511  */
12512 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12513
12514 /**
12515  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
12516  */
12517 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
12518
12519 /**
12520  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
12521  */
12522 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
12523
12524 /**
12525  * Frees any resources used by the SpendableOutputDescriptor
12526  */
12527 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12528
12529 /**
12530  * Creates a copy of the SpendableOutputDescriptor
12531  */
12532 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12533
12534 /**
12535  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12536  */
12537 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12538
12539 /**
12540  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12541  */
12542 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12543
12544 /**
12545  * Calls the free function if one is set
12546  */
12547 void BaseSign_free(struct LDKBaseSign this_ptr);
12548
12549 /**
12550  * Creates a copy of a Sign
12551  */
12552 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12553
12554 /**
12555  * Calls the free function if one is set
12556  */
12557 void Sign_free(struct LDKSign this_ptr);
12558
12559 /**
12560  * Calls the free function if one is set
12561  */
12562 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12563
12564 /**
12565  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12566  */
12567 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12568
12569 /**
12570  * Private key of anchor tx
12571  */
12572 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12573
12574 /**
12575  * Private key of anchor tx
12576  */
12577 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12578
12579 /**
12580  * Holder secret key for blinded revocation pubkey
12581  */
12582 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12583
12584 /**
12585  * Holder secret key for blinded revocation pubkey
12586  */
12587 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12588
12589 /**
12590  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12591  */
12592 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12593
12594 /**
12595  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12596  */
12597 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12598
12599 /**
12600  * Holder secret key used in HTLC tx
12601  */
12602 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12603
12604 /**
12605  * Holder secret key used in HTLC tx
12606  */
12607 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12608
12609 /**
12610  * Holder htlc secret key used in commitment tx htlc outputs
12611  */
12612 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12613
12614 /**
12615  * Holder htlc secret key used in commitment tx htlc outputs
12616  */
12617 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12618
12619 /**
12620  * Commitment seed
12621  */
12622 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12623
12624 /**
12625  * Commitment seed
12626  */
12627 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12628
12629 /**
12630  * Creates a copy of the InMemorySigner
12631  */
12632 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12633
12634 /**
12635  * Create a new InMemorySigner
12636  */
12637 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);
12638
12639 /**
12640  * Counterparty pubkeys.
12641  * Will panic if ready_channel wasn't called.
12642  */
12643 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12644
12645 /**
12646  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12647  * transactions, ie the amount of time that we have to wait to recover our funds if we
12648  * broadcast a transaction.
12649  * Will panic if ready_channel wasn't called.
12650  */
12651 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12652
12653 /**
12654  * The contest_delay value specified by us and applied on transactions broadcastable
12655  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12656  * if they broadcast a transaction.
12657  * Will panic if ready_channel wasn't called.
12658  */
12659 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12660
12661 /**
12662  * Whether the holder is the initiator
12663  * Will panic if ready_channel wasn't called.
12664  */
12665 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12666
12667 /**
12668  * Funding outpoint
12669  * Will panic if ready_channel wasn't called.
12670  */
12671 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12672
12673 /**
12674  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12675  * building transactions.
12676  *
12677  * Will panic if ready_channel wasn't called.
12678  */
12679 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12680
12681 /**
12682  * Sign the single input of spend_tx at index `input_idx` which spends the output
12683  * described by descriptor, returning the witness stack for the input.
12684  *
12685  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12686  * or is not spending the outpoint described by `descriptor.outpoint`.
12687  */
12688 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);
12689
12690 /**
12691  * Sign the single input of spend_tx at index `input_idx` which spends the output
12692  * described by descriptor, returning the witness stack for the input.
12693  *
12694  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12695  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12696  * sequence set to `descriptor.to_self_delay`.
12697  */
12698 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);
12699
12700 /**
12701  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12702  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12703  */
12704 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12705
12706 /**
12707  * Constructs a new Sign which calls the relevant methods on this_arg.
12708  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12709  */
12710 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12711
12712 /**
12713  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12714  */
12715 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12716
12717 /**
12718  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12719  */
12720 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12721
12722 /**
12723  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12724  */
12725 void KeysManager_free(struct LDKKeysManager this_obj);
12726
12727 /**
12728  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12729  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12730  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12731  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12732  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12733  * simply use the current time (with very high precision).
12734  *
12735  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12736  * obviously, starting_time should be unique every time you reload the library - it is only
12737  * used to generate new ephemeral key data (which will be stored by the individual channel if
12738  * necessary).
12739  *
12740  * Note that the seed is required to recover certain on-chain funds independent of
12741  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12742  * channel, and some on-chain during-closing funds.
12743  *
12744  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12745  * versions. Once the library is more fully supported, the docs will be updated to include a
12746  * detailed description of the guarantee.
12747  */
12748 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12749
12750 /**
12751  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12752  *
12753  * Key derivation parameters are accessible through a per-channel secrets
12754  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12755  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12756  */
12757 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]);
12758
12759 /**
12760  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12761  * output to the given change destination (if sufficient change value remains). The
12762  * transaction will have a feerate, at least, of the given value.
12763  *
12764  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12765  * if a descriptor was duplicated.
12766  *
12767  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12768  *
12769  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12770  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12771  */
12772 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);
12773
12774 /**
12775  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12776  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12777  */
12778 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12779
12780 /**
12781  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12782  */
12783 void ChannelManager_free(struct LDKChannelManager this_obj);
12784
12785 /**
12786  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12787  */
12788 void ChainParameters_free(struct LDKChainParameters this_obj);
12789
12790 /**
12791  * The network for determining the `chain_hash` in Lightning messages.
12792  */
12793 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12794
12795 /**
12796  * The network for determining the `chain_hash` in Lightning messages.
12797  */
12798 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12799
12800 /**
12801  * The hash and height of the latest block successfully connected.
12802  *
12803  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12804  */
12805 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12806
12807 /**
12808  * The hash and height of the latest block successfully connected.
12809  *
12810  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12811  */
12812 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12813
12814 /**
12815  * Constructs a new ChainParameters given each field
12816  */
12817 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12818
12819 /**
12820  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12821  */
12822 void BestBlock_free(struct LDKBestBlock this_obj);
12823
12824 /**
12825  * Creates a copy of the BestBlock
12826  */
12827 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12828
12829 /**
12830  * Returns the best block from the genesis of the given network.
12831  */
12832 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12833
12834 /**
12835  * Returns the best block as identified by the given block hash and height.
12836  */
12837 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12838
12839 /**
12840  * Returns the best block hash.
12841  */
12842 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12843
12844 /**
12845  * Returns the best block height.
12846  */
12847 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12848
12849 /**
12850  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12851  */
12852 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12853
12854 /**
12855  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12856  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12857  * Note that this means this value is *not* persistent - it can change once during the
12858  * lifetime of the channel.
12859  */
12860 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12861
12862 /**
12863  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12864  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12865  * Note that this means this value is *not* persistent - it can change once during the
12866  * lifetime of the channel.
12867  */
12868 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12869
12870 /**
12871  * The Channel's funding transaction output, if we've negotiated the funding transaction with
12872  * our counterparty already.
12873  *
12874  * Note that, if this has been set, `channel_id` will be equivalent to
12875  * `funding_txo.unwrap().to_channel_id()`.
12876  */
12877 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12878
12879 /**
12880  * The Channel's funding transaction output, if we've negotiated the funding transaction with
12881  * our counterparty already.
12882  *
12883  * Note that, if this has been set, `channel_id` will be equivalent to
12884  * `funding_txo.unwrap().to_channel_id()`.
12885  */
12886 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12887
12888 /**
12889  * The position of the funding transaction in the chain. None if the funding transaction has
12890  * not yet been confirmed and the channel fully opened.
12891  */
12892 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12893
12894 /**
12895  * The position of the funding transaction in the chain. None if the funding transaction has
12896  * not yet been confirmed and the channel fully opened.
12897  */
12898 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
12899
12900 /**
12901  * The node_id of our counterparty
12902  */
12903 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12904
12905 /**
12906  * The node_id of our counterparty
12907  */
12908 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12909
12910 /**
12911  * The Features the channel counterparty provided upon last connection.
12912  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12913  * many routing-relevant features are present in the init context.
12914  */
12915 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12916
12917 /**
12918  * The Features the channel counterparty provided upon last connection.
12919  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12920  * many routing-relevant features are present in the init context.
12921  */
12922 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
12923
12924 /**
12925  * The value, in satoshis, of this channel as appears in the funding output
12926  */
12927 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12928
12929 /**
12930  * The value, in satoshis, of this channel as appears in the funding output
12931  */
12932 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12933
12934 /**
12935  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12936  */
12937 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12938
12939 /**
12940  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12941  */
12942 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12943
12944 /**
12945  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12946  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12947  * available for inclusion in new outbound HTLCs). This further does not include any pending
12948  * outgoing HTLCs which are awaiting some other resolution to be sent.
12949  */
12950 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12951
12952 /**
12953  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12954  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12955  * available for inclusion in new outbound HTLCs). This further does not include any pending
12956  * outgoing HTLCs which are awaiting some other resolution to be sent.
12957  */
12958 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12959
12960 /**
12961  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12962  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12963  * available for inclusion in new inbound HTLCs).
12964  * Note that there are some corner cases not fully handled here, so the actual available
12965  * inbound capacity may be slightly higher than this.
12966  */
12967 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12968
12969 /**
12970  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12971  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12972  * available for inclusion in new inbound HTLCs).
12973  * Note that there are some corner cases not fully handled here, so the actual available
12974  * inbound capacity may be slightly higher than this.
12975  */
12976 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12977
12978 /**
12979  * True if the channel was initiated (and thus funded) by us.
12980  */
12981 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12982
12983 /**
12984  * True if the channel was initiated (and thus funded) by us.
12985  */
12986 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12987
12988 /**
12989  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
12990  * channel is not currently being shut down. `funding_locked` message exchange implies the
12991  * required confirmation count has been reached (and we were connected to the peer at some
12992  * point after the funding transaction received enough confirmations).
12993  */
12994 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12995
12996 /**
12997  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
12998  * channel is not currently being shut down. `funding_locked` message exchange implies the
12999  * required confirmation count has been reached (and we were connected to the peer at some
13000  * point after the funding transaction received enough confirmations).
13001  */
13002 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13003
13004 /**
13005  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13006  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13007  * channel is not currently negotiating a shutdown.
13008  *
13009  * This is a strict superset of `is_funding_locked`.
13010  */
13011 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13012
13013 /**
13014  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13015  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13016  * channel is not currently negotiating a shutdown.
13017  *
13018  * This is a strict superset of `is_funding_locked`.
13019  */
13020 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13021
13022 /**
13023  * True if this channel is (or will be) publicly-announced.
13024  */
13025 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13026
13027 /**
13028  * True if this channel is (or will be) publicly-announced.
13029  */
13030 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13031
13032 /**
13033  * Creates a copy of the ChannelDetails
13034  */
13035 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
13036
13037 /**
13038  * Frees any resources used by the PaymentSendFailure
13039  */
13040 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
13041
13042 /**
13043  * Creates a copy of the PaymentSendFailure
13044  */
13045 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
13046
13047 /**
13048  * Constructs a new ChannelManager to hold several channels and route between them.
13049  *
13050  * This is the main \"logic hub\" for all channel-related actions, and implements
13051  * ChannelMessageHandler.
13052  *
13053  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
13054  *
13055  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
13056  *
13057  * Users need to notify the new ChannelManager when a new block is connected or
13058  * disconnected using its `block_connected` and `block_disconnected` methods, starting
13059  * from after `params.latest_hash`.
13060  */
13061 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);
13062
13063 /**
13064  * Gets the current configuration applied to all new channels,  as
13065  */
13066 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
13067
13068 /**
13069  * Creates a new outbound channel to the given remote node and with the given value.
13070  *
13071  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
13072  * tracking of which events correspond with which create_channel call. Note that the
13073  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
13074  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
13075  * otherwise ignored.
13076  *
13077  * If successful, will generate a SendOpenChannel message event, so you should probably poll
13078  * PeerManager::process_events afterwards.
13079  *
13080  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
13081  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
13082  */
13083 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
13084
13085 /**
13086  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
13087  * more information.
13088  */
13089 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13090
13091 /**
13092  * Gets the list of usable channels, in random order. Useful as an argument to
13093  * get_route to ensure non-announced channels are used.
13094  *
13095  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
13096  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
13097  * are.
13098  */
13099 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13100
13101 /**
13102  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
13103  * will be accepted on the given channel, and after additional timeout/the closing of all
13104  * pending HTLCs, the channel will be closed on chain.
13105  *
13106  * May generate a SendShutdown message event on success, which should be relayed.
13107  */
13108 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13109
13110 /**
13111  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
13112  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
13113  */
13114 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13115
13116 /**
13117  * Force close all channels, immediately broadcasting the latest local commitment transaction
13118  * for each to the chain and rejecting new HTLCs on each.
13119  */
13120 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13121
13122 /**
13123  * Sends a payment along a given route.
13124  *
13125  * Value parameters are provided via the last hop in route, see documentation for RouteHop
13126  * fields for more info.
13127  *
13128  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
13129  * payment), we don't do anything to stop you! We always try to ensure that if the provided
13130  * next hop knows the preimage to payment_hash they can claim an additional amount as
13131  * specified in the last hop in the route! Thus, you should probably do your own
13132  * payment_preimage tracking (which you should already be doing as they represent \"proof of
13133  * payment\") and prevent double-sends yourself.
13134  *
13135  * May generate SendHTLCs message(s) event on success, which should be relayed.
13136  *
13137  * Each path may have a different return value, and PaymentSendValue may return a Vec with
13138  * each entry matching the corresponding-index entry in the route paths, see
13139  * PaymentSendFailure for more info.
13140  *
13141  * In general, a path may raise:
13142  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
13143  *    node public key) is specified.
13144  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
13145  *    (including due to previous monitor update failure or new permanent monitor update
13146  *    failure).
13147  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
13148  *    relevant updates.
13149  *
13150  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
13151  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
13152  * different route unless you intend to pay twice!
13153  *
13154  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
13155  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
13156  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
13157  * must not contain multiple paths as multi-path payments require a recipient-provided
13158  * payment_secret.
13159  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
13160  * bit set (either as required or as available). If multiple paths are present in the Route,
13161  * we assume the invoice had the basic_mpp feature set.
13162  */
13163 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
13164
13165 /**
13166  * Call this upon creation of a funding transaction for the given channel.
13167  *
13168  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
13169  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
13170  *
13171  * Panics if a funding transaction has already been provided for this channel.
13172  *
13173  * May panic if the output found in the funding transaction is duplicative with some other
13174  * channel (note that this should be trivially prevented by using unique funding transaction
13175  * keys per-channel).
13176  *
13177  * Do NOT broadcast the funding transaction yourself. When we have safely received our
13178  * counterparty's signature the funding transaction will automatically be broadcast via the
13179  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
13180  *
13181  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13182  * not currently support replacing a funding transaction on an existing channel. Instead,
13183  * create a new channel with a conflicting funding transaction.
13184  *
13185  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13186  */
13187 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);
13188
13189 /**
13190  * Regenerates channel_announcements and generates a signed node_announcement from the given
13191  * arguments, providing them in corresponding events via
13192  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13193  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13194  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13195  * our network addresses.
13196  *
13197  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13198  * node to humans. They carry no in-protocol meaning.
13199  *
13200  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13201  * accepts incoming connections. These will be included in the node_announcement, publicly
13202  * tying these addresses together and to this node. If you wish to preserve user privacy,
13203  * addresses should likely contain only Tor Onion addresses.
13204  *
13205  * Panics if `addresses` is absurdly large (more than 500).
13206  *
13207  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13208  */
13209 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13210
13211 /**
13212  * Processes HTLCs which are pending waiting on random forward delay.
13213  *
13214  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13215  * Will likely generate further events.
13216  */
13217 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13218
13219 /**
13220  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13221  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13222  * to inform the network about the uselessness of these channels.
13223  *
13224  * This method handles all the details, and must be called roughly once per minute.
13225  *
13226  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13227  */
13228 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13229
13230 /**
13231  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13232  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13233  * along the path (including in our own channel on which we received it).
13234  * Returns false if no payment was found to fail backwards, true if the process of failing the
13235  * HTLC backwards has been started.
13236  */
13237 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13238
13239 /**
13240  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13241  * generating message events for the net layer to claim the payment, if possible. Thus, you
13242  * should probably kick the net layer to go send messages if this returns true!
13243  *
13244  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13245  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13246  * event matches your expectation. If you fail to do so and call this method, you may provide
13247  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13248  *
13249  * May panic if called except in response to a PaymentReceived event.
13250  *
13251  * [`create_inbound_payment`]: Self::create_inbound_payment
13252  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13253  */
13254 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13255
13256 /**
13257  * Gets the node_id held by this ChannelManager
13258  */
13259 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13260
13261 /**
13262  * Restores a single, given channel to normal operation after a
13263  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13264  * operation.
13265  *
13266  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13267  * fully committed in every copy of the given channels' ChannelMonitors.
13268  *
13269  * Note that there is no effect to calling with a highest_applied_update_id other than the
13270  * current latest ChannelMonitorUpdate and one call to this function after multiple
13271  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13272  * exists largely only to prevent races between this and concurrent update_monitor calls.
13273  *
13274  * Thus, the anticipated use is, at a high level:
13275  *  1) You register a chain::Watch with this ChannelManager,
13276  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13277  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13278  *     any time it cannot do so instantly,
13279  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13280  *  4) once all remote copies are updated, you call this function with the update_id that
13281  *     completed, and once it is the latest the Channel will be re-enabled.
13282  */
13283 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);
13284
13285 /**
13286  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13287  * to pay us.
13288  *
13289  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13290  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13291  *
13292  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13293  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13294  * passed directly to [`claim_funds`].
13295  *
13296  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13297  *
13298  * [`claim_funds`]: Self::claim_funds
13299  * [`PaymentReceived`]: events::Event::PaymentReceived
13300  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13301  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13302  */
13303 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);
13304
13305 /**
13306  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13307  * stored external to LDK.
13308  *
13309  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13310  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13311  * the `min_value_msat` provided here, if one is provided.
13312  *
13313  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13314  * method may return an Err if another payment with the same payment_hash is still pending.
13315  *
13316  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
13317  * allow tracking of which events correspond with which calls to this and
13318  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13319  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13320  * with invoice metadata stored elsewhere.
13321  *
13322  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13323  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13324  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13325  * sender \"proof-of-payment\" unless they have paid the required amount.
13326  *
13327  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13328  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13329  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13330  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13331  * invoices when no timeout is set.
13332  *
13333  * Note that we use block header time to time-out pending inbound payments (with some margin
13334  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13335  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13336  * If you need exact expiry semantics, you should enforce them upon receipt of
13337  * [`PaymentReceived`].
13338  *
13339  * Pending inbound payments are stored in memory and in serialized versions of this
13340  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13341  * space is limited, you may wish to rate-limit inbound payment creation.
13342  *
13343  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13344  *
13345  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13346  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13347  *
13348  * [`create_inbound_payment`]: Self::create_inbound_payment
13349  * [`PaymentReceived`]: events::Event::PaymentReceived
13350  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
13351  */
13352 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);
13353
13354 /**
13355  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13356  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13357  */
13358 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13359
13360 /**
13361  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13362  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13363  */
13364 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13365
13366 /**
13367  * Constructs a new Listen which calls the relevant methods on this_arg.
13368  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13369  */
13370 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13371
13372 /**
13373  * Constructs a new Confirm which calls the relevant methods on this_arg.
13374  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13375  */
13376 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13377
13378 /**
13379  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13380  * indicating whether persistence is necessary. Only one listener on
13381  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13382  * up.
13383  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13384  */
13385 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13386
13387 /**
13388  * Blocks until ChannelManager needs to be persisted. Only one listener on
13389  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13390  * up.
13391  */
13392 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13393
13394 /**
13395  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13396  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13397  */
13398 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13399
13400 /**
13401  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13402  */
13403 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13404
13405 /**
13406  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13407  */
13408 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13409
13410 /**
13411  * The keys provider which will give us relevant keys. Some keys will be loaded during
13412  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13413  * signing data.
13414  */
13415 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13416
13417 /**
13418  * The keys provider which will give us relevant keys. Some keys will be loaded during
13419  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13420  * signing data.
13421  */
13422 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13423
13424 /**
13425  * The fee_estimator for use in the ChannelManager in the future.
13426  *
13427  * No calls to the FeeEstimator will be made during deserialization.
13428  */
13429 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13430
13431 /**
13432  * The fee_estimator for use in the ChannelManager in the future.
13433  *
13434  * No calls to the FeeEstimator will be made during deserialization.
13435  */
13436 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13437
13438 /**
13439  * The chain::Watch for use in the ChannelManager in the future.
13440  *
13441  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13442  * you have deserialized ChannelMonitors separately and will add them to your
13443  * chain::Watch after deserializing this ChannelManager.
13444  */
13445 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13446
13447 /**
13448  * The chain::Watch for use in the ChannelManager in the future.
13449  *
13450  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13451  * you have deserialized ChannelMonitors separately and will add them to your
13452  * chain::Watch after deserializing this ChannelManager.
13453  */
13454 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13455
13456 /**
13457  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13458  * used to broadcast the latest local commitment transactions of channels which must be
13459  * force-closed during deserialization.
13460  */
13461 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13462
13463 /**
13464  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13465  * used to broadcast the latest local commitment transactions of channels which must be
13466  * force-closed during deserialization.
13467  */
13468 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13469
13470 /**
13471  * The Logger for use in the ChannelManager and which may be used to log information during
13472  * deserialization.
13473  */
13474 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13475
13476 /**
13477  * The Logger for use in the ChannelManager and which may be used to log information during
13478  * deserialization.
13479  */
13480 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13481
13482 /**
13483  * Default settings used for new channels. Any existing channels will continue to use the
13484  * runtime settings which were stored when the ChannelManager was serialized.
13485  */
13486 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13487
13488 /**
13489  * Default settings used for new channels. Any existing channels will continue to use the
13490  * runtime settings which were stored when the ChannelManager was serialized.
13491  */
13492 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13493
13494 /**
13495  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13496  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13497  * populate a HashMap directly from C.
13498  */
13499 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);
13500
13501 /**
13502  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13503  */
13504 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13505
13506 /**
13507  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13508  */
13509 void DecodeError_free(struct LDKDecodeError this_obj);
13510
13511 /**
13512  * Creates a copy of the DecodeError
13513  */
13514 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13515
13516 /**
13517  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13518  */
13519 void Init_free(struct LDKInit this_obj);
13520
13521 /**
13522  * The relevant features which the sender supports
13523  */
13524 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13525
13526 /**
13527  * The relevant features which the sender supports
13528  */
13529 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13530
13531 /**
13532  * Constructs a new Init given each field
13533  */
13534 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13535
13536 /**
13537  * Creates a copy of the Init
13538  */
13539 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13540
13541 /**
13542  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13543  */
13544 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13545
13546 /**
13547  * The channel ID involved in the error
13548  */
13549 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13550
13551 /**
13552  * The channel ID involved in the error
13553  */
13554 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13555
13556 /**
13557  * A possibly human-readable error description.
13558  * The string should be sanitized before it is used (e.g. emitted to logs
13559  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13560  * vulnerability in the terminal emulator or the logging subsystem.
13561  */
13562 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13563
13564 /**
13565  * A possibly human-readable error description.
13566  * The string should be sanitized before it is used (e.g. emitted to logs
13567  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13568  * vulnerability in the terminal emulator or the logging subsystem.
13569  */
13570 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13571
13572 /**
13573  * Constructs a new ErrorMessage given each field
13574  */
13575 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13576
13577 /**
13578  * Creates a copy of the ErrorMessage
13579  */
13580 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13581
13582 /**
13583  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13584  */
13585 void Ping_free(struct LDKPing this_obj);
13586
13587 /**
13588  * The desired response length
13589  */
13590 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13591
13592 /**
13593  * The desired response length
13594  */
13595 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13596
13597 /**
13598  * The ping packet size.
13599  * This field is not sent on the wire. byteslen zeros are sent.
13600  */
13601 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13602
13603 /**
13604  * The ping packet size.
13605  * This field is not sent on the wire. byteslen zeros are sent.
13606  */
13607 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13608
13609 /**
13610  * Constructs a new Ping given each field
13611  */
13612 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13613
13614 /**
13615  * Creates a copy of the Ping
13616  */
13617 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13618
13619 /**
13620  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13621  */
13622 void Pong_free(struct LDKPong this_obj);
13623
13624 /**
13625  * The pong packet size.
13626  * This field is not sent on the wire. byteslen zeros are sent.
13627  */
13628 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13629
13630 /**
13631  * The pong packet size.
13632  * This field is not sent on the wire. byteslen zeros are sent.
13633  */
13634 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13635
13636 /**
13637  * Constructs a new Pong given each field
13638  */
13639 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13640
13641 /**
13642  * Creates a copy of the Pong
13643  */
13644 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13645
13646 /**
13647  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13648  */
13649 void OpenChannel_free(struct LDKOpenChannel this_obj);
13650
13651 /**
13652  * The genesis hash of the blockchain where the channel is to be opened
13653  */
13654 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13655
13656 /**
13657  * The genesis hash of the blockchain where the channel is to be opened
13658  */
13659 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13660
13661 /**
13662  * A temporary channel ID, until the funding outpoint is announced
13663  */
13664 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13665
13666 /**
13667  * A temporary channel ID, until the funding outpoint is announced
13668  */
13669 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13670
13671 /**
13672  * The channel value
13673  */
13674 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13675
13676 /**
13677  * The channel value
13678  */
13679 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13680
13681 /**
13682  * The amount to push to the counterparty as part of the open, in milli-satoshi
13683  */
13684 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13685
13686 /**
13687  * The amount to push to the counterparty as part of the open, in milli-satoshi
13688  */
13689 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13690
13691 /**
13692  * The threshold below which outputs on transactions broadcast by sender will be omitted
13693  */
13694 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13695
13696 /**
13697  * The threshold below which outputs on transactions broadcast by sender will be omitted
13698  */
13699 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13700
13701 /**
13702  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13703  */
13704 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13705
13706 /**
13707  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13708  */
13709 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13710
13711 /**
13712  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13713  */
13714 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13715
13716 /**
13717  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13718  */
13719 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13720
13721 /**
13722  * The minimum HTLC size incoming to sender, in milli-satoshi
13723  */
13724 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13725
13726 /**
13727  * The minimum HTLC size incoming to sender, in milli-satoshi
13728  */
13729 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13730
13731 /**
13732  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13733  */
13734 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13735
13736 /**
13737  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13738  */
13739 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13740
13741 /**
13742  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13743  */
13744 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13745
13746 /**
13747  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13748  */
13749 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13750
13751 /**
13752  * The maximum number of inbound HTLCs towards sender
13753  */
13754 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13755
13756 /**
13757  * The maximum number of inbound HTLCs towards sender
13758  */
13759 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13760
13761 /**
13762  * The sender's key controlling the funding transaction
13763  */
13764 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13765
13766 /**
13767  * The sender's key controlling the funding transaction
13768  */
13769 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13770
13771 /**
13772  * Used to derive a revocation key for transactions broadcast by counterparty
13773  */
13774 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13775
13776 /**
13777  * Used to derive a revocation key for transactions broadcast by counterparty
13778  */
13779 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13780
13781 /**
13782  * A payment key to sender for transactions broadcast by counterparty
13783  */
13784 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13785
13786 /**
13787  * A payment key to sender for transactions broadcast by counterparty
13788  */
13789 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13790
13791 /**
13792  * Used to derive a payment key to sender for transactions broadcast by sender
13793  */
13794 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13795
13796 /**
13797  * Used to derive a payment key to sender for transactions broadcast by sender
13798  */
13799 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13800
13801 /**
13802  * Used to derive an HTLC payment key to sender
13803  */
13804 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13805
13806 /**
13807  * Used to derive an HTLC payment key to sender
13808  */
13809 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13810
13811 /**
13812  * The first to-be-broadcast-by-sender transaction's per commitment point
13813  */
13814 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13815
13816 /**
13817  * The first to-be-broadcast-by-sender transaction's per commitment point
13818  */
13819 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13820
13821 /**
13822  * Channel flags
13823  */
13824 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13825
13826 /**
13827  * Channel flags
13828  */
13829 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13830
13831 /**
13832  * Creates a copy of the OpenChannel
13833  */
13834 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13835
13836 /**
13837  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13838  */
13839 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13840
13841 /**
13842  * A temporary channel ID, until the funding outpoint is announced
13843  */
13844 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13845
13846 /**
13847  * A temporary channel ID, until the funding outpoint is announced
13848  */
13849 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13850
13851 /**
13852  * The threshold below which outputs on transactions broadcast by sender will be omitted
13853  */
13854 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13855
13856 /**
13857  * The threshold below which outputs on transactions broadcast by sender will be omitted
13858  */
13859 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13860
13861 /**
13862  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13863  */
13864 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13865
13866 /**
13867  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13868  */
13869 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13870
13871 /**
13872  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13873  */
13874 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13875
13876 /**
13877  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13878  */
13879 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13880
13881 /**
13882  * The minimum HTLC size incoming to sender, in milli-satoshi
13883  */
13884 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13885
13886 /**
13887  * The minimum HTLC size incoming to sender, in milli-satoshi
13888  */
13889 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13890
13891 /**
13892  * Minimum depth of the funding transaction before the channel is considered open
13893  */
13894 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13895
13896 /**
13897  * Minimum depth of the funding transaction before the channel is considered open
13898  */
13899 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
13900
13901 /**
13902  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13903  */
13904 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13905
13906 /**
13907  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13908  */
13909 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13910
13911 /**
13912  * The maximum number of inbound HTLCs towards sender
13913  */
13914 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13915
13916 /**
13917  * The maximum number of inbound HTLCs towards sender
13918  */
13919 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13920
13921 /**
13922  * The sender's key controlling the funding transaction
13923  */
13924 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13925
13926 /**
13927  * The sender's key controlling the funding transaction
13928  */
13929 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13930
13931 /**
13932  * Used to derive a revocation key for transactions broadcast by counterparty
13933  */
13934 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13935
13936 /**
13937  * Used to derive a revocation key for transactions broadcast by counterparty
13938  */
13939 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13940
13941 /**
13942  * A payment key to sender for transactions broadcast by counterparty
13943  */
13944 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13945
13946 /**
13947  * A payment key to sender for transactions broadcast by counterparty
13948  */
13949 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13950
13951 /**
13952  * Used to derive a payment key to sender for transactions broadcast by sender
13953  */
13954 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13955
13956 /**
13957  * Used to derive a payment key to sender for transactions broadcast by sender
13958  */
13959 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13960
13961 /**
13962  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13963  */
13964 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13965
13966 /**
13967  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13968  */
13969 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13970
13971 /**
13972  * The first to-be-broadcast-by-sender transaction's per commitment point
13973  */
13974 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13975
13976 /**
13977  * The first to-be-broadcast-by-sender transaction's per commitment point
13978  */
13979 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13980
13981 /**
13982  * Creates a copy of the AcceptChannel
13983  */
13984 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
13985
13986 /**
13987  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
13988  */
13989 void FundingCreated_free(struct LDKFundingCreated this_obj);
13990
13991 /**
13992  * A temporary channel ID, until the funding is established
13993  */
13994 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13995
13996 /**
13997  * A temporary channel ID, until the funding is established
13998  */
13999 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14000
14001 /**
14002  * The funding transaction ID
14003  */
14004 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14005
14006 /**
14007  * The funding transaction ID
14008  */
14009 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14010
14011 /**
14012  * The specific output index funding this channel
14013  */
14014 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14015
14016 /**
14017  * The specific output index funding this channel
14018  */
14019 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
14020
14021 /**
14022  * The signature of the channel initiator (funder) on the funding transaction
14023  */
14024 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * The signature of the channel initiator (funder) on the funding transaction
14028  */
14029 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
14030
14031 /**
14032  * Constructs a new FundingCreated given each field
14033  */
14034 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);
14035
14036 /**
14037  * Creates a copy of the FundingCreated
14038  */
14039 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
14040
14041 /**
14042  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
14043  */
14044 void FundingSigned_free(struct LDKFundingSigned this_obj);
14045
14046 /**
14047  * The channel ID
14048  */
14049 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
14050
14051 /**
14052  * The channel ID
14053  */
14054 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14055
14056 /**
14057  * The signature of the channel acceptor (fundee) on the funding transaction
14058  */
14059 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
14060
14061 /**
14062  * The signature of the channel acceptor (fundee) on the funding transaction
14063  */
14064 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14065
14066 /**
14067  * Constructs a new FundingSigned given each field
14068  */
14069 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
14070
14071 /**
14072  * Creates a copy of the FundingSigned
14073  */
14074 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
14075
14076 /**
14077  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
14078  */
14079 void FundingLocked_free(struct LDKFundingLocked this_obj);
14080
14081 /**
14082  * The channel ID
14083  */
14084 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
14085
14086 /**
14087  * The channel ID
14088  */
14089 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14090
14091 /**
14092  * The per-commitment point of the second commitment transaction
14093  */
14094 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
14095
14096 /**
14097  * The per-commitment point of the second commitment transaction
14098  */
14099 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14100
14101 /**
14102  * Constructs a new FundingLocked given each field
14103  */
14104 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
14105
14106 /**
14107  * Creates a copy of the FundingLocked
14108  */
14109 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
14110
14111 /**
14112  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
14113  */
14114 void Shutdown_free(struct LDKShutdown this_obj);
14115
14116 /**
14117  * The channel ID
14118  */
14119 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
14120
14121 /**
14122  * The channel ID
14123  */
14124 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14125
14126 /**
14127  * The destination of this peer's funds on closing.
14128  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14129  */
14130 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
14131
14132 /**
14133  * The destination of this peer's funds on closing.
14134  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14135  */
14136 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14137
14138 /**
14139  * Constructs a new Shutdown given each field
14140  */
14141 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
14142
14143 /**
14144  * Creates a copy of the Shutdown
14145  */
14146 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
14147
14148 /**
14149  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
14150  */
14151 void ClosingSigned_free(struct LDKClosingSigned this_obj);
14152
14153 /**
14154  * The channel ID
14155  */
14156 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
14157
14158 /**
14159  * The channel ID
14160  */
14161 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14162
14163 /**
14164  * The proposed total fee for the closing transaction
14165  */
14166 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14167
14168 /**
14169  * The proposed total fee for the closing transaction
14170  */
14171 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
14172
14173 /**
14174  * A signature on the closing transaction
14175  */
14176 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14177
14178 /**
14179  * A signature on the closing transaction
14180  */
14181 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14182
14183 /**
14184  * Constructs a new ClosingSigned given each field
14185  */
14186 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14187
14188 /**
14189  * Creates a copy of the ClosingSigned
14190  */
14191 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14192
14193 /**
14194  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14195  */
14196 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14197
14198 /**
14199  * The channel ID
14200  */
14201 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14202
14203 /**
14204  * The channel ID
14205  */
14206 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14207
14208 /**
14209  * The HTLC ID
14210  */
14211 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14212
14213 /**
14214  * The HTLC ID
14215  */
14216 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14217
14218 /**
14219  * The HTLC value in milli-satoshi
14220  */
14221 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14222
14223 /**
14224  * The HTLC value in milli-satoshi
14225  */
14226 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14227
14228 /**
14229  * The payment hash, the pre-image of which controls HTLC redemption
14230  */
14231 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14232
14233 /**
14234  * The payment hash, the pre-image of which controls HTLC redemption
14235  */
14236 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14237
14238 /**
14239  * The expiry height of the HTLC
14240  */
14241 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14242
14243 /**
14244  * The expiry height of the HTLC
14245  */
14246 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14247
14248 /**
14249  * Creates a copy of the UpdateAddHTLC
14250  */
14251 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14252
14253 /**
14254  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14255  */
14256 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14257
14258 /**
14259  * The channel ID
14260  */
14261 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14262
14263 /**
14264  * The channel ID
14265  */
14266 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14267
14268 /**
14269  * The HTLC ID
14270  */
14271 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14272
14273 /**
14274  * The HTLC ID
14275  */
14276 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14277
14278 /**
14279  * The pre-image of the payment hash, allowing HTLC redemption
14280  */
14281 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14282
14283 /**
14284  * The pre-image of the payment hash, allowing HTLC redemption
14285  */
14286 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14287
14288 /**
14289  * Constructs a new UpdateFulfillHTLC given each field
14290  */
14291 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14292
14293 /**
14294  * Creates a copy of the UpdateFulfillHTLC
14295  */
14296 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14297
14298 /**
14299  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14300  */
14301 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14302
14303 /**
14304  * The channel ID
14305  */
14306 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14307
14308 /**
14309  * The channel ID
14310  */
14311 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14312
14313 /**
14314  * The HTLC ID
14315  */
14316 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14317
14318 /**
14319  * The HTLC ID
14320  */
14321 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14322
14323 /**
14324  * Creates a copy of the UpdateFailHTLC
14325  */
14326 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14327
14328 /**
14329  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14330  */
14331 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14332
14333 /**
14334  * The channel ID
14335  */
14336 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14337
14338 /**
14339  * The channel ID
14340  */
14341 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14342
14343 /**
14344  * The HTLC ID
14345  */
14346 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14347
14348 /**
14349  * The HTLC ID
14350  */
14351 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14352
14353 /**
14354  * The failure code
14355  */
14356 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14357
14358 /**
14359  * The failure code
14360  */
14361 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14362
14363 /**
14364  * Creates a copy of the UpdateFailMalformedHTLC
14365  */
14366 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14367
14368 /**
14369  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14370  */
14371 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14372
14373 /**
14374  * The channel ID
14375  */
14376 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14377
14378 /**
14379  * The channel ID
14380  */
14381 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14382
14383 /**
14384  * A signature on the commitment transaction
14385  */
14386 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14387
14388 /**
14389  * A signature on the commitment transaction
14390  */
14391 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14392
14393 /**
14394  * Signatures on the HTLC transactions
14395  */
14396 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14397
14398 /**
14399  * Constructs a new CommitmentSigned given each field
14400  */
14401 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14402
14403 /**
14404  * Creates a copy of the CommitmentSigned
14405  */
14406 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14407
14408 /**
14409  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14410  */
14411 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14412
14413 /**
14414  * The channel ID
14415  */
14416 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14417
14418 /**
14419  * The channel ID
14420  */
14421 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14422
14423 /**
14424  * The secret corresponding to the per-commitment point
14425  */
14426 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14427
14428 /**
14429  * The secret corresponding to the per-commitment point
14430  */
14431 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14432
14433 /**
14434  * The next sender-broadcast commitment transaction's per-commitment point
14435  */
14436 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14437
14438 /**
14439  * The next sender-broadcast commitment transaction's per-commitment point
14440  */
14441 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14442
14443 /**
14444  * Constructs a new RevokeAndACK given each field
14445  */
14446 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);
14447
14448 /**
14449  * Creates a copy of the RevokeAndACK
14450  */
14451 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14452
14453 /**
14454  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14455  */
14456 void UpdateFee_free(struct LDKUpdateFee this_obj);
14457
14458 /**
14459  * The channel ID
14460  */
14461 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14462
14463 /**
14464  * The channel ID
14465  */
14466 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14467
14468 /**
14469  * Fee rate per 1000-weight of the transaction
14470  */
14471 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14472
14473 /**
14474  * Fee rate per 1000-weight of the transaction
14475  */
14476 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14477
14478 /**
14479  * Constructs a new UpdateFee given each field
14480  */
14481 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14482
14483 /**
14484  * Creates a copy of the UpdateFee
14485  */
14486 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14487
14488 /**
14489  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14490  */
14491 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14492
14493 /**
14494  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14495  * belonging to the recipient
14496  */
14497 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14498
14499 /**
14500  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14501  * belonging to the recipient
14502  */
14503 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14504
14505 /**
14506  * The sender's per-commitment point for their current commitment transaction
14507  */
14508 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14509
14510 /**
14511  * The sender's per-commitment point for their current commitment transaction
14512  */
14513 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14514
14515 /**
14516  * Constructs a new DataLossProtect given each field
14517  */
14518 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14519
14520 /**
14521  * Creates a copy of the DataLossProtect
14522  */
14523 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14524
14525 /**
14526  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14527  */
14528 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14529
14530 /**
14531  * The channel ID
14532  */
14533 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14534
14535 /**
14536  * The channel ID
14537  */
14538 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14539
14540 /**
14541  * The next commitment number for the sender
14542  */
14543 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14544
14545 /**
14546  * The next commitment number for the sender
14547  */
14548 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14549
14550 /**
14551  * The next commitment number for the recipient
14552  */
14553 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14554
14555 /**
14556  * The next commitment number for the recipient
14557  */
14558 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14559
14560 /**
14561  * Creates a copy of the ChannelReestablish
14562  */
14563 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14564
14565 /**
14566  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14567  */
14568 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14569
14570 /**
14571  * The channel ID
14572  */
14573 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14574
14575 /**
14576  * The channel ID
14577  */
14578 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14579
14580 /**
14581  * The short channel ID
14582  */
14583 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14584
14585 /**
14586  * The short channel ID
14587  */
14588 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14589
14590 /**
14591  * A signature by the node key
14592  */
14593 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14594
14595 /**
14596  * A signature by the node key
14597  */
14598 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14599
14600 /**
14601  * A signature by the funding key
14602  */
14603 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14604
14605 /**
14606  * A signature by the funding key
14607  */
14608 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14609
14610 /**
14611  * Constructs a new AnnouncementSignatures given each field
14612  */
14613 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);
14614
14615 /**
14616  * Creates a copy of the AnnouncementSignatures
14617  */
14618 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14619
14620 /**
14621  * Frees any resources used by the NetAddress
14622  */
14623 void NetAddress_free(struct LDKNetAddress this_ptr);
14624
14625 /**
14626  * Creates a copy of the NetAddress
14627  */
14628 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14629
14630 /**
14631  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14632  */
14633 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14634
14635 /**
14636  * Read a Result from a byte array, created by Result_write
14637  */
14638 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14639
14640 /**
14641  * Read a NetAddress from a byte array, created by NetAddress_write
14642  */
14643 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
14644
14645 /**
14646  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14647  */
14648 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14649
14650 /**
14651  * The advertised features
14652  */
14653 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14654
14655 /**
14656  * The advertised features
14657  */
14658 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14659
14660 /**
14661  * A strictly monotonic announcement counter, with gaps allowed
14662  */
14663 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14664
14665 /**
14666  * A strictly monotonic announcement counter, with gaps allowed
14667  */
14668 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14669
14670 /**
14671  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14672  * to this node).
14673  */
14674 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14675
14676 /**
14677  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14678  * to this node).
14679  */
14680 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14681
14682 /**
14683  * An RGB color for UI purposes
14684  */
14685 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14686
14687 /**
14688  * An RGB color for UI purposes
14689  */
14690 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14691
14692 /**
14693  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14694  * of uniqueness.
14695  */
14696 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14697
14698 /**
14699  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14700  * of uniqueness.
14701  */
14702 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14703
14704 /**
14705  * List of addresses on which this node is reachable
14706  */
14707 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14708
14709 /**
14710  * Creates a copy of the UnsignedNodeAnnouncement
14711  */
14712 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14713
14714 /**
14715  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14716  */
14717 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14718
14719 /**
14720  * The signature by the node key
14721  */
14722 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14723
14724 /**
14725  * The signature by the node key
14726  */
14727 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14728
14729 /**
14730  * The actual content of the announcement
14731  */
14732 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14733
14734 /**
14735  * The actual content of the announcement
14736  */
14737 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14738
14739 /**
14740  * Constructs a new NodeAnnouncement given each field
14741  */
14742 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14743
14744 /**
14745  * Creates a copy of the NodeAnnouncement
14746  */
14747 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14748
14749 /**
14750  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14751  */
14752 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14753
14754 /**
14755  * The advertised channel features
14756  */
14757 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14758
14759 /**
14760  * The advertised channel features
14761  */
14762 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14763
14764 /**
14765  * The genesis hash of the blockchain where the channel is to be opened
14766  */
14767 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14768
14769 /**
14770  * The genesis hash of the blockchain where the channel is to be opened
14771  */
14772 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14773
14774 /**
14775  * The short channel ID
14776  */
14777 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14778
14779 /**
14780  * The short channel ID
14781  */
14782 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14783
14784 /**
14785  * One of the two node_ids which are endpoints of this channel
14786  */
14787 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14788
14789 /**
14790  * One of the two node_ids which are endpoints of this channel
14791  */
14792 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14793
14794 /**
14795  * The other of the two node_ids which are endpoints of this channel
14796  */
14797 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14798
14799 /**
14800  * The other of the two node_ids which are endpoints of this channel
14801  */
14802 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14803
14804 /**
14805  * The funding key for the first node
14806  */
14807 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14808
14809 /**
14810  * The funding key for the first node
14811  */
14812 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14813
14814 /**
14815  * The funding key for the second node
14816  */
14817 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14818
14819 /**
14820  * The funding key for the second node
14821  */
14822 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14823
14824 /**
14825  * Creates a copy of the UnsignedChannelAnnouncement
14826  */
14827 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14828
14829 /**
14830  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14831  */
14832 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14833
14834 /**
14835  * Authentication of the announcement by the first public node
14836  */
14837 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14838
14839 /**
14840  * Authentication of the announcement by the first public node
14841  */
14842 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14843
14844 /**
14845  * Authentication of the announcement by the second public node
14846  */
14847 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14848
14849 /**
14850  * Authentication of the announcement by the second public node
14851  */
14852 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14853
14854 /**
14855  * Proof of funding UTXO ownership by the first public node
14856  */
14857 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14858
14859 /**
14860  * Proof of funding UTXO ownership by the first public node
14861  */
14862 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14863
14864 /**
14865  * Proof of funding UTXO ownership by the second public node
14866  */
14867 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14868
14869 /**
14870  * Proof of funding UTXO ownership by the second public node
14871  */
14872 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14873
14874 /**
14875  * The actual announcement
14876  */
14877 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14878
14879 /**
14880  * The actual announcement
14881  */
14882 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
14883
14884 /**
14885  * Constructs a new ChannelAnnouncement given each field
14886  */
14887 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);
14888
14889 /**
14890  * Creates a copy of the ChannelAnnouncement
14891  */
14892 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
14893
14894 /**
14895  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
14896  */
14897 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
14898
14899 /**
14900  * The genesis hash of the blockchain where the channel is to be opened
14901  */
14902 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
14903
14904 /**
14905  * The genesis hash of the blockchain where the channel is to be opened
14906  */
14907 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14908
14909 /**
14910  * The short channel ID
14911  */
14912 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14913
14914 /**
14915  * The short channel ID
14916  */
14917 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14918
14919 /**
14920  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14921  */
14922 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14923
14924 /**
14925  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14926  */
14927 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14928
14929 /**
14930  * Channel flags
14931  */
14932 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14933
14934 /**
14935  * Channel flags
14936  */
14937 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
14938
14939 /**
14940  * The number of blocks such that if:
14941  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14942  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14943  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14944  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14945  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14946  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14947  * constructing the route.
14948  */
14949 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14950
14951 /**
14952  * The number of blocks such that if:
14953  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14954  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14955  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14956  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14957  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14958  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14959  * constructing the route.
14960  */
14961 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
14962
14963 /**
14964  * The minimum HTLC size incoming to sender, in milli-satoshi
14965  */
14966 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14967
14968 /**
14969  * The minimum HTLC size incoming to sender, in milli-satoshi
14970  */
14971 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14972
14973 /**
14974  * The base HTLC fee charged by sender, in milli-satoshi
14975  */
14976 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14977
14978 /**
14979  * The base HTLC fee charged by sender, in milli-satoshi
14980  */
14981 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14982
14983 /**
14984  * The amount to fee multiplier, in micro-satoshi
14985  */
14986 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14987
14988 /**
14989  * The amount to fee multiplier, in micro-satoshi
14990  */
14991 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14992
14993 /**
14994  * Creates a copy of the UnsignedChannelUpdate
14995  */
14996 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
14997
14998 /**
14999  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
15000  */
15001 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
15002
15003 /**
15004  * A signature of the channel update
15005  */
15006 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15007
15008 /**
15009  * A signature of the channel update
15010  */
15011 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
15012
15013 /**
15014  * The actual channel update
15015  */
15016 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15017
15018 /**
15019  * The actual channel update
15020  */
15021 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
15022
15023 /**
15024  * Constructs a new ChannelUpdate given each field
15025  */
15026 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
15027
15028 /**
15029  * Creates a copy of the ChannelUpdate
15030  */
15031 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
15032
15033 /**
15034  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
15035  */
15036 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
15037
15038 /**
15039  * The genesis hash of the blockchain being queried
15040  */
15041 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
15042
15043 /**
15044  * The genesis hash of the blockchain being queried
15045  */
15046 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15047
15048 /**
15049  * The height of the first block for the channel UTXOs being queried
15050  */
15051 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15052
15053 /**
15054  * The height of the first block for the channel UTXOs being queried
15055  */
15056 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15057
15058 /**
15059  * The number of blocks to include in the query results
15060  */
15061 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15062
15063 /**
15064  * The number of blocks to include in the query results
15065  */
15066 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15067
15068 /**
15069  * Constructs a new QueryChannelRange given each field
15070  */
15071 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
15072
15073 /**
15074  * Creates a copy of the QueryChannelRange
15075  */
15076 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
15077
15078 /**
15079  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
15080  */
15081 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
15082
15083 /**
15084  * The genesis hash of the blockchain being queried
15085  */
15086 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
15087
15088 /**
15089  * The genesis hash of the blockchain being queried
15090  */
15091 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15092
15093 /**
15094  * The height of the first block in the range of the reply
15095  */
15096 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15097
15098 /**
15099  * The height of the first block in the range of the reply
15100  */
15101 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15102
15103 /**
15104  * The number of blocks included in the range of the reply
15105  */
15106 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15107
15108 /**
15109  * The number of blocks included in the range of the reply
15110  */
15111 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15112
15113 /**
15114  * True when this is the final reply for a query
15115  */
15116 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15117
15118 /**
15119  * True when this is the final reply for a query
15120  */
15121 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
15122
15123 /**
15124  * The short_channel_ids in the channel range
15125  */
15126 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15127
15128 /**
15129  * Constructs a new ReplyChannelRange given each field
15130  */
15131 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);
15132
15133 /**
15134  * Creates a copy of the ReplyChannelRange
15135  */
15136 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
15137
15138 /**
15139  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
15140  */
15141 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
15142
15143 /**
15144  * The genesis hash of the blockchain being queried
15145  */
15146 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
15147
15148 /**
15149  * The genesis hash of the blockchain being queried
15150  */
15151 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15152
15153 /**
15154  * The short_channel_ids that are being queried
15155  */
15156 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15157
15158 /**
15159  * Constructs a new QueryShortChannelIds given each field
15160  */
15161 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
15162
15163 /**
15164  * Creates a copy of the QueryShortChannelIds
15165  */
15166 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
15167
15168 /**
15169  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
15170  */
15171 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
15172
15173 /**
15174  * The genesis hash of the blockchain that was queried
15175  */
15176 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
15177
15178 /**
15179  * The genesis hash of the blockchain that was queried
15180  */
15181 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15182
15183 /**
15184  * Indicates if the query recipient maintains up-to-date channel
15185  * information for the chain_hash
15186  */
15187 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15188
15189 /**
15190  * Indicates if the query recipient maintains up-to-date channel
15191  * information for the chain_hash
15192  */
15193 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15194
15195 /**
15196  * Constructs a new ReplyShortChannelIdsEnd given each field
15197  */
15198 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15199
15200 /**
15201  * Creates a copy of the ReplyShortChannelIdsEnd
15202  */
15203 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15204
15205 /**
15206  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15207  */
15208 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15209
15210 /**
15211  * The genesis hash of the blockchain for channel and node information
15212  */
15213 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15214
15215 /**
15216  * The genesis hash of the blockchain for channel and node information
15217  */
15218 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15219
15220 /**
15221  * The starting unix timestamp
15222  */
15223 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15224
15225 /**
15226  * The starting unix timestamp
15227  */
15228 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15229
15230 /**
15231  * The range of information in seconds
15232  */
15233 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15234
15235 /**
15236  * The range of information in seconds
15237  */
15238 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15239
15240 /**
15241  * Constructs a new GossipTimestampFilter given each field
15242  */
15243 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15244
15245 /**
15246  * Creates a copy of the GossipTimestampFilter
15247  */
15248 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15249
15250 /**
15251  * Frees any resources used by the ErrorAction
15252  */
15253 void ErrorAction_free(struct LDKErrorAction this_ptr);
15254
15255 /**
15256  * Creates a copy of the ErrorAction
15257  */
15258 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15259
15260 /**
15261  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15262  */
15263 void LightningError_free(struct LDKLightningError this_obj);
15264
15265 /**
15266  * A human-readable message describing the error
15267  */
15268 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15269
15270 /**
15271  * A human-readable message describing the error
15272  */
15273 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15274
15275 /**
15276  * The action which should be taken against the offending peer.
15277  */
15278 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15279
15280 /**
15281  * The action which should be taken against the offending peer.
15282  */
15283 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15284
15285 /**
15286  * Constructs a new LightningError given each field
15287  */
15288 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15289
15290 /**
15291  * Creates a copy of the LightningError
15292  */
15293 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15294
15295 /**
15296  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15297  */
15298 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15299
15300 /**
15301  * update_add_htlc messages which should be sent
15302  */
15303 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15304
15305 /**
15306  * update_fulfill_htlc messages which should be sent
15307  */
15308 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15309
15310 /**
15311  * update_fail_htlc messages which should be sent
15312  */
15313 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15314
15315 /**
15316  * update_fail_malformed_htlc messages which should be sent
15317  */
15318 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15319
15320 /**
15321  * An update_fee message which should be sent
15322  */
15323 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15324
15325 /**
15326  * An update_fee message which should be sent
15327  */
15328 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15329
15330 /**
15331  * Finally, the commitment_signed message which should be sent
15332  */
15333 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15334
15335 /**
15336  * Finally, the commitment_signed message which should be sent
15337  */
15338 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15339
15340 /**
15341  * Constructs a new CommitmentUpdate given each field
15342  */
15343 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);
15344
15345 /**
15346  * Creates a copy of the CommitmentUpdate
15347  */
15348 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15349
15350 /**
15351  * Frees any resources used by the HTLCFailChannelUpdate
15352  */
15353 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15354
15355 /**
15356  * Creates a copy of the HTLCFailChannelUpdate
15357  */
15358 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15359
15360 /**
15361  * Calls the free function if one is set
15362  */
15363 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15364
15365 /**
15366  * Calls the free function if one is set
15367  */
15368 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15369
15370 /**
15371  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15372  */
15373 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15374
15375 /**
15376  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15377  */
15378 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15379
15380 /**
15381  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15382  */
15383 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15384
15385 /**
15386  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15387  */
15388 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15389
15390 /**
15391  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15392  */
15393 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15394
15395 /**
15396  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15397  */
15398 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15399
15400 /**
15401  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15402  */
15403 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15404
15405 /**
15406  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15407  */
15408 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15409
15410 /**
15411  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15412  */
15413 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15414
15415 /**
15416  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15417  */
15418 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15419
15420 /**
15421  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15422  */
15423 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15424
15425 /**
15426  * Read a FundingCreated from a byte array, created by FundingCreated_write
15427  */
15428 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15429
15430 /**
15431  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15432  */
15433 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15434
15435 /**
15436  * Read a FundingSigned from a byte array, created by FundingSigned_write
15437  */
15438 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15439
15440 /**
15441  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15442  */
15443 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15444
15445 /**
15446  * Read a FundingLocked from a byte array, created by FundingLocked_write
15447  */
15448 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15449
15450 /**
15451  * Serialize the Init object into a byte array which can be read by Init_read
15452  */
15453 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15454
15455 /**
15456  * Read a Init from a byte array, created by Init_write
15457  */
15458 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15459
15460 /**
15461  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15462  */
15463 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15464
15465 /**
15466  * Read a OpenChannel from a byte array, created by OpenChannel_write
15467  */
15468 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15469
15470 /**
15471  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15472  */
15473 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15474
15475 /**
15476  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15477  */
15478 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15479
15480 /**
15481  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15482  */
15483 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15484
15485 /**
15486  * Read a Shutdown from a byte array, created by Shutdown_write
15487  */
15488 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15489
15490 /**
15491  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15492  */
15493 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15494
15495 /**
15496  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15497  */
15498 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15499
15500 /**
15501  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15502  */
15503 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15504
15505 /**
15506  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15507  */
15508 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15509
15510 /**
15511  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15512  */
15513 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15514
15515 /**
15516  * Read a UpdateFee from a byte array, created by UpdateFee_write
15517  */
15518 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15519
15520 /**
15521  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15522  */
15523 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15524
15525 /**
15526  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15527  */
15528 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15529
15530 /**
15531  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15532  */
15533 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15534
15535 /**
15536  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15537  */
15538 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15539
15540 /**
15541  * Serialize the Ping object into a byte array which can be read by Ping_read
15542  */
15543 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15544
15545 /**
15546  * Read a Ping from a byte array, created by Ping_write
15547  */
15548 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15549
15550 /**
15551  * Serialize the Pong object into a byte array which can be read by Pong_read
15552  */
15553 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15554
15555 /**
15556  * Read a Pong from a byte array, created by Pong_write
15557  */
15558 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15559
15560 /**
15561  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15562  */
15563 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15564
15565 /**
15566  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15567  */
15568 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15569
15570 /**
15571  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15572  */
15573 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15574
15575 /**
15576  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15577  */
15578 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15579
15580 /**
15581  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15582  */
15583 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15584
15585 /**
15586  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15587  */
15588 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15589
15590 /**
15591  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15592  */
15593 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15594
15595 /**
15596  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15597  */
15598 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15599
15600 /**
15601  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15602  */
15603 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15604
15605 /**
15606  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15607  */
15608 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15609
15610 /**
15611  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15612  */
15613 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15614
15615 /**
15616  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15617  */
15618 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15619
15620 /**
15621  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15622  */
15623 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15624
15625 /**
15626  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15627  */
15628 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15629
15630 /**
15631  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15632  */
15633 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15634
15635 /**
15636  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15637  */
15638 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15639
15640 /**
15641  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15642  */
15643 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15644
15645 /**
15646  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15647  */
15648 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15649
15650 /**
15651  *\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
15652  */
15653 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15654
15655 /**
15656  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15657  */
15658 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15659
15660 /**
15661  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15662  */
15663 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15664
15665 /**
15666  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15667  */
15668 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15669
15670 /**
15671  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15672  */
15673 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15674
15675 /**
15676  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15677  */
15678 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15679
15680 /**
15681  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15682  */
15683 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15684
15685 /**
15686  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15687  */
15688 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15689
15690 /**
15691  * Constructs a new IgnoringMessageHandler given each field
15692  */
15693 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15694
15695 /**
15696  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15697  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15698  */
15699 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15700
15701 /**
15702  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15703  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15704  */
15705 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15706
15707 /**
15708  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15709  */
15710 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15711
15712 /**
15713  * Constructs a new ErroringMessageHandler
15714  */
15715 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15716
15717 /**
15718  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15719  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15720  */
15721 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15722
15723 /**
15724  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15725  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15726  */
15727 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15728
15729 /**
15730  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15731  */
15732 void MessageHandler_free(struct LDKMessageHandler this_obj);
15733
15734 /**
15735  * A message handler which handles messages specific to channels. Usually this is just a
15736  * ChannelManager object or a ErroringMessageHandler.
15737  */
15738 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15739
15740 /**
15741  * A message handler which handles messages specific to channels. Usually this is just a
15742  * ChannelManager object or a ErroringMessageHandler.
15743  */
15744 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15745
15746 /**
15747  * A message handler which handles messages updating our knowledge of the network channel
15748  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15749  */
15750 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15751
15752 /**
15753  * A message handler which handles messages updating our knowledge of the network channel
15754  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15755  */
15756 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15757
15758 /**
15759  * Constructs a new MessageHandler given each field
15760  */
15761 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15762
15763 /**
15764  * Creates a copy of a SocketDescriptor
15765  */
15766 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15767
15768 /**
15769  * Calls the free function if one is set
15770  */
15771 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15772
15773 /**
15774  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15775  */
15776 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15777
15778 /**
15779  * Used to indicate that we probably can't make any future connections to this peer, implying
15780  * we should go ahead and force-close any channels we have with it.
15781  */
15782 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15783
15784 /**
15785  * Used to indicate that we probably can't make any future connections to this peer, implying
15786  * we should go ahead and force-close any channels we have with it.
15787  */
15788 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15789
15790 /**
15791  * Constructs a new PeerHandleError given each field
15792  */
15793 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15794
15795 /**
15796  * Creates a copy of the PeerHandleError
15797  */
15798 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15799
15800 /**
15801  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15802  */
15803 void PeerManager_free(struct LDKPeerManager this_obj);
15804
15805 /**
15806  * Constructs a new PeerManager with the given message handlers and node_id secret key
15807  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15808  * cryptographically secure random bytes.
15809  */
15810 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);
15811
15812 /**
15813  * Get the list of node ids for peers which have completed the initial handshake.
15814  *
15815  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15816  * new_outbound_connection, however entries will only appear once the initial handshake has
15817  * completed and we are sure the remote peer has the private key for the given node_id.
15818  */
15819 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15820
15821 /**
15822  * Indicates a new outbound connection has been established to a node with the given node_id.
15823  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15824  * descriptor but must disconnect the connection immediately.
15825  *
15826  * Returns a small number of bytes to send to the remote node (currently always 50).
15827  *
15828  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15829  * socket_disconnected().
15830  */
15831 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);
15832
15833 /**
15834  * Indicates a new inbound connection has been established.
15835  *
15836  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15837  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15838  * call socket_disconnected for the new descriptor but must disconnect the connection
15839  * immediately.
15840  *
15841  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15842  * socket_disconnected called.
15843  */
15844 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15845
15846 /**
15847  * Indicates that there is room to write data to the given socket descriptor.
15848  *
15849  * May return an Err to indicate that the connection should be closed.
15850  *
15851  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15852  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15853  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15854  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15855  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15856  * new_\\*_connection event.
15857  */
15858 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15859
15860 /**
15861  * Indicates that data was read from the given socket descriptor.
15862  *
15863  * May return an Err to indicate that the connection should be closed.
15864  *
15865  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15866  * Thus, however, you almost certainly want to call process_events() after any read_event to
15867  * generate send_data calls to handle responses.
15868  *
15869  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
15870  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
15871  *
15872  * Panics if the descriptor was not previously registered in a new_*_connection event.
15873  */
15874 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);
15875
15876 /**
15877  * Checks for any events generated by our handlers and processes them. Includes sending most
15878  * response messages as well as messages generated by calls to handler functions directly (eg
15879  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
15880  */
15881 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
15882
15883 /**
15884  * Indicates that the given socket descriptor's connection is now closed.
15885  *
15886  * This must only be called if the socket has been disconnected by the peer or your own
15887  * decision to disconnect it and must NOT be called in any case where other parts of this
15888  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
15889  * the peer.
15890  *
15891  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
15892  */
15893 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15894
15895 /**
15896  * Disconnect a peer given its node id.
15897  *
15898  * Set no_connection_possible to true to prevent any further connection with this peer,
15899  * force-closing any channels we have with it.
15900  *
15901  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
15902  * so be careful about reentrancy issues.
15903  */
15904 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
15905
15906 /**
15907  * This function should be called roughly once every 30 seconds.
15908  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
15909  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
15910  */
15911 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
15912
15913 /**
15914  * Build the commitment secret from the seed and the commitment number
15915  */
15916 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
15917
15918 /**
15919  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
15920  * from the base secret and the per_commitment_point.
15921  *
15922  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15923  * generated (ie our own).
15924  */
15925 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
15926
15927 /**
15928  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
15929  * from the base point and the per_commitment_key. This is the public equivalent of
15930  * derive_private_key - using only public keys to derive a public key instead of private keys.
15931  *
15932  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15933  * generated (ie our own).
15934  */
15935 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
15936
15937 /**
15938  * Derives a per-commitment-transaction revocation key from its constituent parts.
15939  *
15940  * Only the cheating participant owns a valid witness to propagate a revoked
15941  * commitment transaction, thus per_commitment_secret always come from cheater
15942  * and revocation_base_secret always come from punisher, which is the broadcaster
15943  * of the transaction spending with this key knowledge.
15944  *
15945  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15946  * generated (ie our own).
15947  */
15948 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
15949
15950 /**
15951  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
15952  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
15953  * public key instead of private keys.
15954  *
15955  * Only the cheating participant owns a valid witness to propagate a revoked
15956  * commitment transaction, thus per_commitment_point always come from cheater
15957  * and revocation_base_point always come from punisher, which is the broadcaster
15958  * of the transaction spending with this key knowledge.
15959  *
15960  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15961  * generated (ie our own).
15962  */
15963 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
15964
15965 /**
15966  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
15967  */
15968 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
15969
15970 /**
15971  * The broadcaster's per-commitment public key which was used to derive the other keys.
15972  */
15973 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15974
15975 /**
15976  * The broadcaster's per-commitment public key which was used to derive the other keys.
15977  */
15978 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15979
15980 /**
15981  * The revocation key which is used to allow the broadcaster of the commitment
15982  * transaction to provide their counterparty the ability to punish them if they broadcast
15983  * an old state.
15984  */
15985 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15986
15987 /**
15988  * The revocation key which is used to allow the broadcaster of the commitment
15989  * transaction to provide their counterparty the ability to punish them if they broadcast
15990  * an old state.
15991  */
15992 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15993
15994 /**
15995  * Broadcaster's HTLC Key
15996  */
15997 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15998
15999 /**
16000  * Broadcaster's HTLC Key
16001  */
16002 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16003
16004 /**
16005  * Countersignatory's HTLC Key
16006  */
16007 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16008
16009 /**
16010  * Countersignatory's HTLC Key
16011  */
16012 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16013
16014 /**
16015  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16016  */
16017 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16018
16019 /**
16020  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16021  */
16022 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16023
16024 /**
16025  * Constructs a new TxCreationKeys given each field
16026  */
16027 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);
16028
16029 /**
16030  * Creates a copy of the TxCreationKeys
16031  */
16032 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
16033
16034 /**
16035  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
16036  */
16037 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
16038
16039 /**
16040  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
16041  */
16042 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
16043
16044 /**
16045  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
16046  */
16047 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
16048
16049 /**
16050  * The public key which is used to sign all commitment transactions, as it appears in the
16051  * on-chain channel lock-in 2-of-2 multisig output.
16052  */
16053 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16054
16055 /**
16056  * The public key which is used to sign all commitment transactions, as it appears in the
16057  * on-chain channel lock-in 2-of-2 multisig output.
16058  */
16059 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16060
16061 /**
16062  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16063  * revocation keys. This is combined with the per-commitment-secret generated by the
16064  * counterparty to create a secret which the counterparty can reveal to revoke previous
16065  * states.
16066  */
16067 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16068
16069 /**
16070  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16071  * revocation keys. This is combined with the per-commitment-secret generated by the
16072  * counterparty to create a secret which the counterparty can reveal to revoke previous
16073  * states.
16074  */
16075 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16076
16077 /**
16078  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16079  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16080  * static across every commitment transaction.
16081  */
16082 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16083
16084 /**
16085  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16086  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16087  * static across every commitment transaction.
16088  */
16089 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16090
16091 /**
16092  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16093  * public key which receives non-HTLC-encumbered funds which are only available for spending
16094  * after some delay (or can be claimed via the revocation path).
16095  */
16096 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16097
16098 /**
16099  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16100  * public key which receives non-HTLC-encumbered funds which are only available for spending
16101  * after some delay (or can be claimed via the revocation path).
16102  */
16103 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16104
16105 /**
16106  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16107  * which is used to encumber HTLC-in-flight outputs.
16108  */
16109 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16110
16111 /**
16112  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16113  * which is used to encumber HTLC-in-flight outputs.
16114  */
16115 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16116
16117 /**
16118  * Constructs a new ChannelPublicKeys given each field
16119  */
16120 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);
16121
16122 /**
16123  * Creates a copy of the ChannelPublicKeys
16124  */
16125 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
16126
16127 /**
16128  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
16129  */
16130 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
16131
16132 /**
16133  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
16134  */
16135 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
16136
16137 /**
16138  * Create per-state keys from channel base points and the per-commitment point.
16139  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16140  */
16141 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);
16142
16143 /**
16144  * Generate per-state keys from channel static keys.
16145  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16146  */
16147 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);
16148
16149 /**
16150  * A script either spendable by the revocation
16151  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
16152  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
16153  */
16154 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
16155
16156 /**
16157  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
16158  */
16159 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
16160
16161 /**
16162  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16163  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16164  * need to compare this value to whether the commitment transaction in question is that of
16165  * the counterparty or our own.
16166  */
16167 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16168
16169 /**
16170  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16171  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16172  * need to compare this value to whether the commitment transaction in question is that of
16173  * the counterparty or our own.
16174  */
16175 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
16176
16177 /**
16178  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16179  * this divided by 1000.
16180  */
16181 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16182
16183 /**
16184  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16185  * this divided by 1000.
16186  */
16187 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16188
16189 /**
16190  * The CLTV lock-time at which this HTLC expires.
16191  */
16192 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16193
16194 /**
16195  * The CLTV lock-time at which this HTLC expires.
16196  */
16197 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16198
16199 /**
16200  * The hash of the preimage which unlocks this HTLC.
16201  */
16202 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16203
16204 /**
16205  * The hash of the preimage which unlocks this HTLC.
16206  */
16207 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16208
16209 /**
16210  * The position within the commitment transactions' outputs. This may be None if the value is
16211  * below the dust limit (in which case no output appears in the commitment transaction and the
16212  * value is spent to additional transaction fees).
16213  */
16214 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16215
16216 /**
16217  * The position within the commitment transactions' outputs. This may be None if the value is
16218  * below the dust limit (in which case no output appears in the commitment transaction and the
16219  * value is spent to additional transaction fees).
16220  */
16221 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16222
16223 /**
16224  * Constructs a new HTLCOutputInCommitment given each field
16225  */
16226 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);
16227
16228 /**
16229  * Creates a copy of the HTLCOutputInCommitment
16230  */
16231 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16232
16233 /**
16234  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16235  */
16236 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16237
16238 /**
16239  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16240  */
16241 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16242
16243 /**
16244  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16245  * does not need to have its previous_output_index filled.
16246  */
16247 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16248
16249 /**
16250  * Gets the redeemscript for a funding output from the two funding public keys.
16251  * Note that the order of funding public keys does not matter.
16252  */
16253 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16254
16255 /**
16256  * panics if htlc.transaction_output_index.is_none()!
16257  */
16258 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[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);
16259
16260 /**
16261  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16262  */
16263 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16264
16265 /**
16266  * Holder public keys
16267  */
16268 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16269
16270 /**
16271  * Holder public keys
16272  */
16273 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16274
16275 /**
16276  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16277  */
16278 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16279
16280 /**
16281  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16282  */
16283 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16284
16285 /**
16286  * Whether the holder is the initiator of this channel.
16287  * This is an input to the commitment number obscure factor computation.
16288  */
16289 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16290
16291 /**
16292  * Whether the holder is the initiator of this channel.
16293  * This is an input to the commitment number obscure factor computation.
16294  */
16295 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16296
16297 /**
16298  * The late-bound counterparty channel transaction parameters.
16299  * These parameters are populated at the point in the protocol where the counterparty provides them.
16300  */
16301 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16302
16303 /**
16304  * The late-bound counterparty channel transaction parameters.
16305  * These parameters are populated at the point in the protocol where the counterparty provides them.
16306  */
16307 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16308
16309 /**
16310  * The late-bound funding outpoint
16311  */
16312 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16313
16314 /**
16315  * The late-bound funding outpoint
16316  */
16317 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16318
16319 /**
16320  * Constructs a new ChannelTransactionParameters given each field
16321  */
16322 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);
16323
16324 /**
16325  * Creates a copy of the ChannelTransactionParameters
16326  */
16327 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16328
16329 /**
16330  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16331  */
16332 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16333
16334 /**
16335  * Counter-party public keys
16336  */
16337 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16338
16339 /**
16340  * Counter-party public keys
16341  */
16342 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16343
16344 /**
16345  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16346  */
16347 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16348
16349 /**
16350  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16351  */
16352 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16353
16354 /**
16355  * Constructs a new CounterpartyChannelTransactionParameters given each field
16356  */
16357 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
16358
16359 /**
16360  * Creates a copy of the CounterpartyChannelTransactionParameters
16361  */
16362 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16363
16364 /**
16365  * Whether the late bound parameters are populated.
16366  */
16367 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16368
16369 /**
16370  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16371  * given that the holder is the broadcaster.
16372  *
16373  * self.is_populated() must be true before calling this function.
16374  */
16375 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16376
16377 /**
16378  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16379  * given that the counterparty is the broadcaster.
16380  *
16381  * self.is_populated() must be true before calling this function.
16382  */
16383 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16384
16385 /**
16386  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16387  */
16388 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16389
16390 /**
16391  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16392  */
16393 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16394
16395 /**
16396  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16397  */
16398 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16399
16400 /**
16401  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16402  */
16403 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16404
16405 /**
16406  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16407  */
16408 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16409
16410 /**
16411  * Get the channel pubkeys for the broadcaster
16412  */
16413 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16414
16415 /**
16416  * Get the channel pubkeys for the countersignatory
16417  */
16418 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16419
16420 /**
16421  * Get the contest delay applicable to the transactions.
16422  * Note that the contest delay was selected by the countersignatory.
16423  */
16424 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16425
16426 /**
16427  * Whether the channel is outbound from the broadcaster.
16428  *
16429  * The boolean representing the side that initiated the channel is
16430  * an input to the commitment number obscure factor computation.
16431  */
16432 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16433
16434 /**
16435  * The funding outpoint
16436  */
16437 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16438
16439 /**
16440  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16441  */
16442 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16443
16444 /**
16445  * Our counterparty's signature for the transaction
16446  */
16447 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16448
16449 /**
16450  * Our counterparty's signature for the transaction
16451  */
16452 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16453
16454 /**
16455  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16456  */
16457 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16458
16459 /**
16460  * Creates a copy of the HolderCommitmentTransaction
16461  */
16462 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16463
16464 /**
16465  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16466  */
16467 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16468
16469 /**
16470  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16471  */
16472 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16473
16474 /**
16475  * Create a new holder transaction with the given counterparty signatures.
16476  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16477  */
16478 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);
16479
16480 /**
16481  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16482  */
16483 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16484
16485 /**
16486  * The commitment transaction
16487  */
16488 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16489
16490 /**
16491  * The commitment transaction
16492  */
16493 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16494
16495 /**
16496  * The txid for the commitment transaction.
16497  *
16498  * This is provided as a performance optimization, instead of calling transaction.txid()
16499  * multiple times.
16500  */
16501 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16502
16503 /**
16504  * The txid for the commitment transaction.
16505  *
16506  * This is provided as a performance optimization, instead of calling transaction.txid()
16507  * multiple times.
16508  */
16509 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16510
16511 /**
16512  * Constructs a new BuiltCommitmentTransaction given each field
16513  */
16514 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16515
16516 /**
16517  * Creates a copy of the BuiltCommitmentTransaction
16518  */
16519 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16520
16521 /**
16522  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16523  */
16524 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16525
16526 /**
16527  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16528  */
16529 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16530
16531 /**
16532  * Get the SIGHASH_ALL sighash value of the transaction.
16533  *
16534  * This can be used to verify a signature.
16535  */
16536 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);
16537
16538 /**
16539  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16540  * because we are about to broadcast a holder transaction.
16541  */
16542 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);
16543
16544 /**
16545  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16546  */
16547 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16548
16549 /**
16550  * Creates a copy of the CommitmentTransaction
16551  */
16552 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16553
16554 /**
16555  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16556  */
16557 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16558
16559 /**
16560  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16561  */
16562 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16563
16564 /**
16565  * The backwards-counting commitment number
16566  */
16567 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16568
16569 /**
16570  * The value to be sent to the broadcaster
16571  */
16572 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16573
16574 /**
16575  * The value to be sent to the counterparty
16576  */
16577 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16578
16579 /**
16580  * The feerate paid per 1000-weight-unit in this commitment transaction.
16581  */
16582 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16583
16584 /**
16585  * Trust our pre-built transaction and derived transaction creation public keys.
16586  *
16587  * Applies a wrapper which allows access to these fields.
16588  *
16589  * This should only be used if you fully trust the builder of this object.  It should not
16590  *\tbe used by an external signer - instead use the verify function.
16591  */
16592 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16593
16594 /**
16595  * Verify our pre-built transaction and derived transaction creation public keys.
16596  *
16597  * Applies a wrapper which allows access to these fields.
16598  *
16599  * An external validating signer must call this method before signing
16600  * or using the built transaction.
16601  */
16602 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);
16603
16604 /**
16605  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16606  */
16607 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16608
16609 /**
16610  * The transaction ID of the built Bitcoin transaction
16611  */
16612 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16613
16614 /**
16615  * The pre-built Bitcoin commitment transaction
16616  */
16617 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16618
16619 /**
16620  * The pre-calculated transaction creation public keys.
16621  */
16622 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16623
16624 /**
16625  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16626  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16627  *
16628  * The returned Vec has one entry for each HTLC, and in the same order.
16629  */
16630 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);
16631
16632 /**
16633  * Get the transaction number obscure factor
16634  */
16635 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16636
16637 /**
16638  * Checks if two InitFeaturess contain equal inner contents.
16639  * This ignores pointers and is_owned flags and looks at the values in fields.
16640  * Two objects with NULL inner values will be considered "equal" here.
16641  */
16642 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
16643
16644 /**
16645  * Checks if two NodeFeaturess contain equal inner contents.
16646  * This ignores pointers and is_owned flags and looks at the values in fields.
16647  * Two objects with NULL inner values will be considered "equal" here.
16648  */
16649 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
16650
16651 /**
16652  * Checks if two ChannelFeaturess contain equal inner contents.
16653  * This ignores pointers and is_owned flags and looks at the values in fields.
16654  * Two objects with NULL inner values will be considered "equal" here.
16655  */
16656 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
16657
16658 /**
16659  * Checks if two InvoiceFeaturess contain equal inner contents.
16660  * This ignores pointers and is_owned flags and looks at the values in fields.
16661  * Two objects with NULL inner values will be considered "equal" here.
16662  */
16663 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
16664
16665 /**
16666  * Creates a copy of the InitFeatures
16667  */
16668 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16669
16670 /**
16671  * Creates a copy of the NodeFeatures
16672  */
16673 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16674
16675 /**
16676  * Creates a copy of the ChannelFeatures
16677  */
16678 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16679
16680 /**
16681  * Creates a copy of the InvoiceFeatures
16682  */
16683 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16684
16685 /**
16686  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16687  */
16688 void InitFeatures_free(struct LDKInitFeatures this_obj);
16689
16690 /**
16691  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16692  */
16693 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16694
16695 /**
16696  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16697  */
16698 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16699
16700 /**
16701  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16702  */
16703 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16704
16705 /**
16706  * Create a blank Features with no features set
16707  */
16708 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16709
16710 /**
16711  * Creates a Features with the bits set which are known by the implementation
16712  */
16713 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16714
16715 /**
16716  * Create a blank Features with no features set
16717  */
16718 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16719
16720 /**
16721  * Creates a Features with the bits set which are known by the implementation
16722  */
16723 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16724
16725 /**
16726  * Create a blank Features with no features set
16727  */
16728 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16729
16730 /**
16731  * Creates a Features with the bits set which are known by the implementation
16732  */
16733 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16734
16735 /**
16736  * Create a blank Features with no features set
16737  */
16738 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16739
16740 /**
16741  * Creates a Features with the bits set which are known by the implementation
16742  */
16743 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16744
16745 /**
16746  * Returns whether the `payment_secret` feature is supported.
16747  */
16748 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
16749
16750 /**
16751  * Returns whether the `payment_secret` feature is supported.
16752  */
16753 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
16754
16755 /**
16756  * Returns whether the `payment_secret` feature is supported.
16757  */
16758 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
16759
16760 /**
16761  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16762  */
16763 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16764
16765 /**
16766  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16767  */
16768 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16769
16770 /**
16771  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16772  */
16773 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16774
16775 /**
16776  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16777  */
16778 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16779
16780 /**
16781  * Read a InitFeatures from a byte array, created by InitFeatures_write
16782  */
16783 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16784
16785 /**
16786  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16787  */
16788 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16789
16790 /**
16791  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16792  */
16793 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16794
16795 /**
16796  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16797  */
16798 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16799
16800 /**
16801  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16802  */
16803 void RouteHop_free(struct LDKRouteHop this_obj);
16804
16805 /**
16806  * The node_id of the node at this hop.
16807  */
16808 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16809
16810 /**
16811  * The node_id of the node at this hop.
16812  */
16813 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16814
16815 /**
16816  * The node_announcement features of the node at this hop. For the last hop, these may be
16817  * amended to match the features present in the invoice this node generated.
16818  */
16819 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16820
16821 /**
16822  * The node_announcement features of the node at this hop. For the last hop, these may be
16823  * amended to match the features present in the invoice this node generated.
16824  */
16825 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16826
16827 /**
16828  * The channel that should be used from the previous hop to reach this node.
16829  */
16830 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16831
16832 /**
16833  * The channel that should be used from the previous hop to reach this node.
16834  */
16835 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16836
16837 /**
16838  * The channel_announcement features of the channel that should be used from the previous hop
16839  * to reach this node.
16840  */
16841 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16842
16843 /**
16844  * The channel_announcement features of the channel that should be used from the previous hop
16845  * to reach this node.
16846  */
16847 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16848
16849 /**
16850  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16851  * For the last hop, this should be the full value of the payment (might be more than
16852  * requested if we had to match htlc_minimum_msat).
16853  */
16854 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16855
16856 /**
16857  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16858  * For the last hop, this should be the full value of the payment (might be more than
16859  * requested if we had to match htlc_minimum_msat).
16860  */
16861 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16862
16863 /**
16864  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16865  * expected at the destination, in excess of the current block height.
16866  */
16867 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16868
16869 /**
16870  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16871  * expected at the destination, in excess of the current block height.
16872  */
16873 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
16874
16875 /**
16876  * Constructs a new RouteHop given each field
16877  */
16878 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);
16879
16880 /**
16881  * Creates a copy of the RouteHop
16882  */
16883 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
16884
16885 /**
16886  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
16887  */
16888 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
16889
16890 /**
16891  * Read a RouteHop from a byte array, created by RouteHop_write
16892  */
16893 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
16894
16895 /**
16896  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
16897  */
16898 void Route_free(struct LDKRoute this_obj);
16899
16900 /**
16901  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
16902  * last RouteHop in each path must be the same.
16903  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
16904  * destination. Thus, this must always be at least length one. While the maximum length of any
16905  * given path is variable, keeping the length of any path to less than 20 should currently
16906  * ensure it is viable.
16907  */
16908 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
16909
16910 /**
16911  * Constructs a new Route given each field
16912  */
16913 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
16914
16915 /**
16916  * Creates a copy of the Route
16917  */
16918 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
16919
16920 /**
16921  * Serialize the Route object into a byte array which can be read by Route_read
16922  */
16923 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
16924
16925 /**
16926  * Read a Route from a byte array, created by Route_write
16927  */
16928 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
16929
16930 /**
16931  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
16932  */
16933 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
16934
16935 /**
16936  * The node_id of the non-target end of the route
16937  */
16938 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16939
16940 /**
16941  * The node_id of the non-target end of the route
16942  */
16943 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16944
16945 /**
16946  * The short_channel_id of this channel
16947  */
16948 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16949
16950 /**
16951  * The short_channel_id of this channel
16952  */
16953 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
16954
16955 /**
16956  * The fees which must be paid to use this channel
16957  */
16958 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16959
16960 /**
16961  * The fees which must be paid to use this channel
16962  */
16963 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16964
16965 /**
16966  * The difference in CLTV values between this node and the next node.
16967  */
16968 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16969
16970 /**
16971  * The difference in CLTV values between this node and the next node.
16972  */
16973 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
16974
16975 /**
16976  * The minimum value, in msat, which must be relayed to the next hop.
16977  */
16978 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16979
16980 /**
16981  * The minimum value, in msat, which must be relayed to the next hop.
16982  */
16983 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16984
16985 /**
16986  * The maximum value in msat available for routing with a single HTLC.
16987  */
16988 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16989
16990 /**
16991  * The maximum value in msat available for routing with a single HTLC.
16992  */
16993 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16994
16995 /**
16996  * Constructs a new RouteHintHop given each field
16997  */
16998 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);
16999
17000 /**
17001  * Checks if two RouteHintHops contain equal inner contents.
17002  * This ignores pointers and is_owned flags and looks at the values in fields.
17003  * Two objects with NULL inner values will be considered "equal" here.
17004  */
17005 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
17006
17007 /**
17008  * Creates a copy of the RouteHintHop
17009  */
17010 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
17011
17012 /**
17013  * Gets a route from us (payer) to the given target node (payee).
17014  *
17015  * If the payee provided features in their invoice, they should be provided via payee_features.
17016  * Without this, MPP will only be used if the payee's features are available in the network graph.
17017  *
17018  * Extra routing hops between known nodes and the target will be used if they are included in
17019  * last_hops.
17020  *
17021  * If some channels aren't announced, it may be useful to fill in a first_hops with the
17022  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
17023  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
17024  * in first_hops will be used.
17025  *
17026  * Panics if first_hops contains channels without short_channel_ids
17027  * (ChannelManager::list_usable_channels will never include such channels).
17028  *
17029  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
17030  * equal), however the enabled/disabled bit on such channels as well as the
17031  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
17032  */
17033 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
17034
17035 /**
17036  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
17037  */
17038 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
17039
17040 /**
17041  * Creates a copy of the NetworkGraph
17042  */
17043 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
17044
17045 /**
17046  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
17047  */
17048 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
17049
17050 /**
17051  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
17052  */
17053 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
17054
17055 /**
17056  * Creates a new tracker of the actual state of the network of channels and nodes,
17057  * assuming a fresh network graph.
17058  * Chain monitor is used to make sure announced channels exist on-chain,
17059  * channel data is correct, and that the announcement is signed with
17060  * channel owners' keys.
17061  */
17062 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
17063
17064 /**
17065  * Creates a new tracker of the actual state of the network of channels and nodes,
17066  * assuming an existing Network Graph.
17067  */
17068 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
17069
17070 /**
17071  * Adds a provider used to check new announcements. Does not affect
17072  * existing announcements unless they are updated.
17073  * Add, update or remove the provider would replace the current one.
17074  */
17075 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
17076
17077 /**
17078  * Take a read lock on the network_graph and return it in the C-bindings
17079  * newtype helper. This is likely only useful when called via the C
17080  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
17081  * yourself.
17082  */
17083 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17084
17085 /**
17086  * Get a reference to the NetworkGraph which this read-lock contains.
17087  */
17088 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
17089
17090 /**
17091  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17092  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17093  */
17094 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17095
17096 /**
17097  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17098  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17099  */
17100 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17101
17102 /**
17103  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
17104  */
17105 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
17106
17107 /**
17108  * When the last update to the channel direction was issued.
17109  * Value is opaque, as set in the announcement.
17110  */
17111 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17112
17113 /**
17114  * When the last update to the channel direction was issued.
17115  * Value is opaque, as set in the announcement.
17116  */
17117 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
17118
17119 /**
17120  * Whether the channel can be currently used for payments (in this one direction).
17121  */
17122 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17123
17124 /**
17125  * Whether the channel can be currently used for payments (in this one direction).
17126  */
17127 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
17128
17129 /**
17130  * The difference in CLTV values that you must have when routing through this channel.
17131  */
17132 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17133
17134 /**
17135  * The difference in CLTV values that you must have when routing through this channel.
17136  */
17137 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
17138
17139 /**
17140  * The minimum value, which must be relayed to the next hop via the channel
17141  */
17142 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17143
17144 /**
17145  * The minimum value, which must be relayed to the next hop via the channel
17146  */
17147 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
17148
17149 /**
17150  * The maximum value which may be relayed to the next hop via the channel.
17151  */
17152 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17153
17154 /**
17155  * The maximum value which may be relayed to the next hop via the channel.
17156  */
17157 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17158
17159 /**
17160  * Fees charged when the channel is used for routing
17161  */
17162 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17163
17164 /**
17165  * Fees charged when the channel is used for routing
17166  */
17167 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17168
17169 /**
17170  * Most recent update for the channel received from the network
17171  * Mostly redundant with the data we store in fields explicitly.
17172  * Everything else is useful only for sending out for initial routing sync.
17173  * Not stored if contains excess data to prevent DoS.
17174  */
17175 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17176
17177 /**
17178  * Most recent update for the channel received from the network
17179  * Mostly redundant with the data we store in fields explicitly.
17180  * Everything else is useful only for sending out for initial routing sync.
17181  * Not stored if contains excess data to prevent DoS.
17182  */
17183 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
17184
17185 /**
17186  * Constructs a new DirectionalChannelInfo given each field
17187  */
17188 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);
17189
17190 /**
17191  * Creates a copy of the DirectionalChannelInfo
17192  */
17193 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17194
17195 /**
17196  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17197  */
17198 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17199
17200 /**
17201  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17202  */
17203 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17204
17205 /**
17206  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17207  */
17208 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17209
17210 /**
17211  * Protocol features of a channel communicated during its announcement
17212  */
17213 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17214
17215 /**
17216  * Protocol features of a channel communicated during its announcement
17217  */
17218 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17219
17220 /**
17221  * Source node of the first direction of a channel
17222  */
17223 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17224
17225 /**
17226  * Source node of the first direction of a channel
17227  */
17228 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17229
17230 /**
17231  * Details about the first direction of a channel
17232  */
17233 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17234
17235 /**
17236  * Details about the first direction of a channel
17237  */
17238 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17239
17240 /**
17241  * Source node of the second direction of a channel
17242  */
17243 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17244
17245 /**
17246  * Source node of the second direction of a channel
17247  */
17248 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17249
17250 /**
17251  * Details about the second direction of a channel
17252  */
17253 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17254
17255 /**
17256  * Details about the second direction of a channel
17257  */
17258 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17259
17260 /**
17261  * The channel capacity as seen on-chain, if chain lookup is available.
17262  */
17263 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17264
17265 /**
17266  * The channel capacity as seen on-chain, if chain lookup is available.
17267  */
17268 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17269
17270 /**
17271  * An initial announcement of the channel
17272  * Mostly redundant with the data we store in fields explicitly.
17273  * Everything else is useful only for sending out for initial routing sync.
17274  * Not stored if contains excess data to prevent DoS.
17275  */
17276 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17277
17278 /**
17279  * An initial announcement of the channel
17280  * Mostly redundant with the data we store in fields explicitly.
17281  * Everything else is useful only for sending out for initial routing sync.
17282  * Not stored if contains excess data to prevent DoS.
17283  */
17284 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17285
17286 /**
17287  * Constructs a new ChannelInfo given each field
17288  */
17289 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
17290
17291 /**
17292  * Creates a copy of the ChannelInfo
17293  */
17294 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17295
17296 /**
17297  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17298  */
17299 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17300
17301 /**
17302  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17303  */
17304 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17305
17306 /**
17307  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
17308  */
17309 void RoutingFees_free(struct LDKRoutingFees this_obj);
17310
17311 /**
17312  * Flat routing fee in satoshis
17313  */
17314 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17315
17316 /**
17317  * Flat routing fee in satoshis
17318  */
17319 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17320
17321 /**
17322  * Liquidity-based routing fee in millionths of a routed amount.
17323  * In other words, 10000 is 1%.
17324  */
17325 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17326
17327 /**
17328  * Liquidity-based routing fee in millionths of a routed amount.
17329  * In other words, 10000 is 1%.
17330  */
17331 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17332
17333 /**
17334  * Constructs a new RoutingFees given each field
17335  */
17336 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
17337
17338 /**
17339  * Checks if two RoutingFeess contain equal inner contents.
17340  * This ignores pointers and is_owned flags and looks at the values in fields.
17341  * Two objects with NULL inner values will be considered "equal" here.
17342  */
17343 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
17344
17345 /**
17346  * Creates a copy of the RoutingFees
17347  */
17348 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
17349
17350 /**
17351  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
17352  */
17353 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
17354
17355 /**
17356  * Read a RoutingFees from a byte array, created by RoutingFees_write
17357  */
17358 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
17359
17360 /**
17361  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
17362  */
17363 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
17364
17365 /**
17366  * Protocol features the node announced support for
17367  */
17368 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17369
17370 /**
17371  * Protocol features the node announced support for
17372  */
17373 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17374
17375 /**
17376  * When the last known update to the node state was issued.
17377  * Value is opaque, as set in the announcement.
17378  */
17379 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17380
17381 /**
17382  * When the last known update to the node state was issued.
17383  * Value is opaque, as set in the announcement.
17384  */
17385 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
17386
17387 /**
17388  * Color assigned to the node
17389  */
17390 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
17391
17392 /**
17393  * Color assigned to the node
17394  */
17395 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17396
17397 /**
17398  * Moniker assigned to the node.
17399  * May be invalid or malicious (eg control chars),
17400  * should not be exposed to the user.
17401  */
17402 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
17403
17404 /**
17405  * Moniker assigned to the node.
17406  * May be invalid or malicious (eg control chars),
17407  * should not be exposed to the user.
17408  */
17409 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17410
17411 /**
17412  * Internet-level addresses via which one can connect to the node
17413  */
17414 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17415
17416 /**
17417  * An initial announcement of the node
17418  * Mostly redundant with the data we store in fields explicitly.
17419  * Everything else is useful only for sending out for initial routing sync.
17420  * Not stored if contains excess data to prevent DoS.
17421  */
17422 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17423
17424 /**
17425  * An initial announcement of the node
17426  * Mostly redundant with the data we store in fields explicitly.
17427  * Everything else is useful only for sending out for initial routing sync.
17428  * Not stored if contains excess data to prevent DoS.
17429  */
17430 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17431
17432 /**
17433  * Constructs a new NodeAnnouncementInfo given each field
17434  */
17435 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);
17436
17437 /**
17438  * Creates a copy of the NodeAnnouncementInfo
17439  */
17440 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17441
17442 /**
17443  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17444  */
17445 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17446
17447 /**
17448  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17449  */
17450 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17451
17452 /**
17453  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17454  */
17455 void NodeInfo_free(struct LDKNodeInfo this_obj);
17456
17457 /**
17458  * All valid channels a node has announced
17459  */
17460 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17461
17462 /**
17463  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17464  * The two fields (flat and proportional fee) are independent,
17465  * meaning they don't have to refer to the same channel.
17466  */
17467 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17468
17469 /**
17470  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17471  * The two fields (flat and proportional fee) are independent,
17472  * meaning they don't have to refer to the same channel.
17473  */
17474 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17475
17476 /**
17477  * More information about a node from node_announcement.
17478  * Optional because we store a Node entry after learning about it from
17479  * a channel announcement, but before receiving a node announcement.
17480  */
17481 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17482
17483 /**
17484  * More information about a node from node_announcement.
17485  * Optional because we store a Node entry after learning about it from
17486  * a channel announcement, but before receiving a node announcement.
17487  */
17488 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17489
17490 /**
17491  * Constructs a new NodeInfo given each field
17492  */
17493 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17494
17495 /**
17496  * Creates a copy of the NodeInfo
17497  */
17498 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17499
17500 /**
17501  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17502  */
17503 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17504
17505 /**
17506  * Read a NodeInfo from a byte array, created by NodeInfo_write
17507  */
17508 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17509
17510 /**
17511  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17512  */
17513 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17514
17515 /**
17516  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17517  */
17518 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17519
17520 /**
17521  * Creates a new, empty, network graph.
17522  */
17523 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17524
17525 /**
17526  * For an already known node (from channel announcements), update its stored properties from a
17527  * given node announcement.
17528  *
17529  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17530  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17531  * routing messages from a source using a protocol other than the lightning P2P protocol.
17532  */
17533 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17534
17535 /**
17536  * For an already known node (from channel announcements), update its stored properties from a
17537  * given node announcement without verifying the associated signatures. Because we aren't
17538  * given the associated signatures here we cannot relay the node announcement to any of our
17539  * peers.
17540  */
17541 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17542
17543 /**
17544  * Store or update channel info from a channel announcement.
17545  *
17546  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17547  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17548  * routing messages from a source using a protocol other than the lightning P2P protocol.
17549  *
17550  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17551  * the corresponding UTXO exists on chain and is correctly-formatted.
17552  */
17553 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
17554
17555 /**
17556  * Store or update channel info from a channel announcement without verifying the associated
17557  * signatures. Because we aren't given the associated signatures here we cannot relay the
17558  * channel announcement to any of our peers.
17559  *
17560  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17561  * the corresponding UTXO exists on chain and is correctly-formatted.
17562  */
17563 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
17564
17565 /**
17566  * Close a channel if a corresponding HTLC fail was sent.
17567  * If permanent, removes a channel from the local storage.
17568  * May cause the removal of nodes too, if this was their last channel.
17569  * If not permanent, makes channels unavailable for routing.
17570  */
17571 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17572
17573 /**
17574  * For an already known (from announcement) channel, update info about one of the directions
17575  * of the channel.
17576  *
17577  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17578  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17579  * routing messages from a source using a protocol other than the lightning P2P protocol.
17580  */
17581 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17582
17583 /**
17584  * For an already known (from announcement) channel, update info about one of the directions
17585  * of the channel without verifying the associated signatures. Because we aren't given the
17586  * associated signatures here we cannot relay the channel update to any of our peers.
17587  */
17588 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17589
17590 /**
17591  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17592  */
17593 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17594
17595 /**
17596  * Initialize a new FilesystemPersister and set the path to the individual channels'
17597  * files.
17598  */
17599 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17600
17601 /**
17602  * Get the directory which was provided when this persister was initialized.
17603  */
17604 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17605
17606 /**
17607  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17608  * initialization, within a file called \"manager\".
17609  */
17610 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17611
17612 /**
17613  * Read `ChannelMonitor`s from disk.
17614  */
17615 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17616
17617 /**
17618  * Constructs a new Persist which calls the relevant methods on this_arg.
17619  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17620  */
17621 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17622
17623 /**
17624  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17625  *
17626  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17627  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17628  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17629  * since this check is fast we recommend to do it anyway.
17630  *
17631  * If this function fails this is considered a bug. Please open an issue describing your
17632  * platform and stating your current system time.
17633  *
17634  * # Panics
17635  * If the check fails this function panics. By calling this function on startup you ensure that
17636  * this wont happen at an arbitrary later point in time.
17637  */
17638 void check_platform(void);
17639
17640 /**
17641  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17642  */
17643 void Invoice_free(struct LDKInvoice this_obj);
17644
17645 /**
17646  * Checks if two Invoices contain equal inner contents.
17647  * This ignores pointers and is_owned flags and looks at the values in fields.
17648  * Two objects with NULL inner values will be considered "equal" here.
17649  */
17650 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
17651
17652 /**
17653  * Creates a copy of the Invoice
17654  */
17655 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17656
17657 /**
17658  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17659  */
17660 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17661
17662 /**
17663  * Checks if two SignedRawInvoices contain equal inner contents.
17664  * This ignores pointers and is_owned flags and looks at the values in fields.
17665  * Two objects with NULL inner values will be considered "equal" here.
17666  */
17667 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
17668
17669 /**
17670  * Creates a copy of the SignedRawInvoice
17671  */
17672 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17673
17674 /**
17675  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17676  */
17677 void RawInvoice_free(struct LDKRawInvoice this_obj);
17678
17679 /**
17680  * data part
17681  */
17682 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17683
17684 /**
17685  * data part
17686  */
17687 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17688
17689 /**
17690  * Checks if two RawInvoices contain equal inner contents.
17691  * This ignores pointers and is_owned flags and looks at the values in fields.
17692  * Two objects with NULL inner values will be considered "equal" here.
17693  */
17694 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
17695
17696 /**
17697  * Creates a copy of the RawInvoice
17698  */
17699 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17700
17701 /**
17702  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17703  */
17704 void RawDataPart_free(struct LDKRawDataPart this_obj);
17705
17706 /**
17707  * generation time of the invoice
17708  */
17709 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17710
17711 /**
17712  * generation time of the invoice
17713  */
17714 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17715
17716 /**
17717  * Checks if two RawDataParts contain equal inner contents.
17718  * This ignores pointers and is_owned flags and looks at the values in fields.
17719  * Two objects with NULL inner values will be considered "equal" here.
17720  */
17721 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
17722
17723 /**
17724  * Creates a copy of the RawDataPart
17725  */
17726 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17727
17728 /**
17729  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17730  */
17731 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17732
17733 /**
17734  * Checks if two PositiveTimestamps contain equal inner contents.
17735  * This ignores pointers and is_owned flags and looks at the values in fields.
17736  * Two objects with NULL inner values will be considered "equal" here.
17737  */
17738 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
17739
17740 /**
17741  * Creates a copy of the PositiveTimestamp
17742  */
17743 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17744
17745 /**
17746  * Creates a copy of the SiPrefix
17747  */
17748 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17749
17750 /**
17751  * Checks if two SiPrefixs contain equal inner contents.
17752  * This ignores pointers and is_owned flags and looks at the values in fields.
17753  */
17754 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
17755
17756 /**
17757  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17758  * This is effectively 10^12 * the prefix multiplier
17759  */
17760 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17761
17762 /**
17763  * Creates a copy of the Currency
17764  */
17765 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17766
17767 /**
17768  * Checks if two Currencys contain equal inner contents.
17769  * This ignores pointers and is_owned flags and looks at the values in fields.
17770  */
17771 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
17772
17773 /**
17774  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17775  */
17776 void Sha256_free(struct LDKSha256 this_obj);
17777
17778 /**
17779  * Checks if two Sha256s contain equal inner contents.
17780  * This ignores pointers and is_owned flags and looks at the values in fields.
17781  * Two objects with NULL inner values will be considered "equal" here.
17782  */
17783 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
17784
17785 /**
17786  * Creates a copy of the Sha256
17787  */
17788 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17789
17790 /**
17791  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17792  */
17793 void Description_free(struct LDKDescription this_obj);
17794
17795 /**
17796  * Checks if two Descriptions contain equal inner contents.
17797  * This ignores pointers and is_owned flags and looks at the values in fields.
17798  * Two objects with NULL inner values will be considered "equal" here.
17799  */
17800 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
17801
17802 /**
17803  * Creates a copy of the Description
17804  */
17805 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17806
17807 /**
17808  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17809  */
17810 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17811
17812 /**
17813  * Checks if two PayeePubKeys contain equal inner contents.
17814  * This ignores pointers and is_owned flags and looks at the values in fields.
17815  * Two objects with NULL inner values will be considered "equal" here.
17816  */
17817 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
17818
17819 /**
17820  * Creates a copy of the PayeePubKey
17821  */
17822 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17823
17824 /**
17825  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17826  */
17827 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17828
17829 /**
17830  * Checks if two ExpiryTimes contain equal inner contents.
17831  * This ignores pointers and is_owned flags and looks at the values in fields.
17832  * Two objects with NULL inner values will be considered "equal" here.
17833  */
17834 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
17835
17836 /**
17837  * Creates a copy of the ExpiryTime
17838  */
17839 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
17840
17841 /**
17842  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
17843  */
17844 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
17845
17846 /**
17847  * Checks if two MinFinalCltvExpirys contain equal inner contents.
17848  * This ignores pointers and is_owned flags and looks at the values in fields.
17849  * Two objects with NULL inner values will be considered "equal" here.
17850  */
17851 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
17852
17853 /**
17854  * Creates a copy of the MinFinalCltvExpiry
17855  */
17856 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
17857
17858 /**
17859  * Frees any resources used by the Fallback
17860  */
17861 void Fallback_free(struct LDKFallback this_ptr);
17862
17863 /**
17864  * Creates a copy of the Fallback
17865  */
17866 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
17867
17868 /**
17869  * Checks if two Fallbacks contain equal inner contents.
17870  * This ignores pointers and is_owned flags and looks at the values in fields.
17871  */
17872 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
17873
17874 /**
17875  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
17876  */
17877 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
17878
17879 /**
17880  * Checks if two InvoiceSignatures contain equal inner contents.
17881  * This ignores pointers and is_owned flags and looks at the values in fields.
17882  * Two objects with NULL inner values will be considered "equal" here.
17883  */
17884 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
17885
17886 /**
17887  * Creates a copy of the InvoiceSignature
17888  */
17889 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
17890
17891 /**
17892  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17893  */
17894 void RouteHint_free(struct LDKRouteHint this_obj);
17895
17896 /**
17897  * Checks if two RouteHints contain equal inner contents.
17898  * This ignores pointers and is_owned flags and looks at the values in fields.
17899  * Two objects with NULL inner values will be considered "equal" here.
17900  */
17901 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
17902
17903 /**
17904  * Creates a copy of the RouteHint
17905  */
17906 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17907
17908 /**
17909  * Disassembles the `SignedRawInvoice` into its three parts:
17910  *  1. raw invoice
17911  *  2. hash of the raw invoice
17912  *  3. signature
17913  */
17914 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
17915
17916 /**
17917  * The `RawInvoice` which was signed.
17918  */
17919 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17920
17921 /**
17922  * The hash of the `RawInvoice` that was signed.
17923  */
17924 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
17925
17926 /**
17927  * InvoiceSignature for the invoice.
17928  */
17929 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17930
17931 /**
17932  * Recovers the public key used for signing the invoice from the recoverable signature.
17933  */
17934 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17935
17936 /**
17937  * Checks if the signature is valid for the included payee public key or if none exists if it's
17938  * valid for the recovered signature (which should always be true?).
17939  */
17940 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17941
17942 /**
17943  * Calculate the hash of the encoded `RawInvoice`
17944  */
17945 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17946
17947 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17948
17949 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17950
17951 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17952
17953 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17954
17955 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17956
17957 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17958
17959 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17960
17961 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17962
17963 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17964
17965 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17966
17967 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17968
17969 /**
17970  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
17971  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17972  * `CreationError::TimestampOutOfBounds`.
17973  */
17974 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
17975
17976 /**
17977  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
17978  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17979  * `CreationError::TimestampOutOfBounds`.
17980  */
17981 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
17982
17983 /**
17984  * Returns the UNIX timestamp representing the stored time
17985  */
17986 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17987
17988 /**
17989  * Returns a reference to the internal `SystemTime` time representation
17990  */
17991 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17992
17993 /**
17994  * Transform the `Invoice` into it's unchecked version
17995  */
17996 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
17997
17998 /**
17999  * Check that the invoice is signed correctly and that key recovery works
18000  */
18001 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
18002
18003 /**
18004  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
18005  * ```
18006  * use lightning_invoice::*;
18007  *
18008  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
18009  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
18010  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
18011  * \tky03ylcqca784w\";
18012  *
18013  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
18014  *
18015  * assert!(Invoice::from_signed(signed).is_ok());
18016  * ```
18017  */
18018 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
18019
18020 /**
18021  * Returns the `Invoice`'s timestamp (should equal it's creation time)
18022  */
18023 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
18024
18025 /**
18026  * Returns the hash to which we will receive the preimage on completion of the payment
18027  */
18028 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
18029
18030 /**
18031  * Get the payee's public key if one was included in the invoice
18032  */
18033 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18034
18035 /**
18036  * Get the payment secret if one was included in the invoice
18037  */
18038 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
18039
18040 /**
18041  * Get the invoice features if they were included in the invoice
18042  */
18043 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
18044
18045 /**
18046  * Recover the payee's public key (only to be used if none was included in the invoice)
18047  */
18048 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18049
18050 /**
18051  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
18052  */
18053 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
18054
18055 /**
18056  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
18057  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
18058  */
18059 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
18060
18061 /**
18062  * Returns a list of all routes included in the invoice
18063  */
18064 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
18065
18066 /**
18067  * Returns the currency for which the invoice was issued
18068  */
18069 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
18070
18071 /**
18072  * Returns the amount if specified in the invoice as pico <currency>.
18073  */
18074 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
18075
18076 /**
18077  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
18078  * returns `CreationError::DescriptionTooLong` otherwise
18079  *
18080  * Please note that single characters may use more than one byte due to UTF8 encoding.
18081  */
18082 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
18083
18084 /**
18085  * Returns the underlying description `String`
18086  */
18087 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
18088
18089 /**
18090  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
18091  * overflow on adding the `EpiryTime` to it then this function will return a
18092  * `CreationError::ExpiryTimeOutOfBounds`.
18093  */
18094 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
18095
18096 /**
18097  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
18098  * would overflow on adding the `EpiryTime` to it then this function will return a
18099  * `CreationError::ExpiryTimeOutOfBounds`.
18100  */
18101 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
18102
18103 /**
18104  * Returns the expiry time in seconds
18105  */
18106 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18107
18108 /**
18109  * Returns a reference to the underlying `Duration` (=expiry time)
18110  */
18111 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18112
18113 /**
18114  * Create a new (partial) route from a list of hops
18115  */
18116 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
18117
18118 /**
18119  * Returrn the underlying vector of hops
18120  */
18121 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
18122
18123 /**
18124  * Creates a copy of the CreationError
18125  */
18126 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
18127
18128 /**
18129  * Checks if two CreationErrors contain equal inner contents.
18130  * This ignores pointers and is_owned flags and looks at the values in fields.
18131  */
18132 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
18133
18134 /**
18135  * Get the string representation of a CreationError object
18136  */
18137 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
18138
18139 /**
18140  * Creates a copy of the SemanticError
18141  */
18142 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
18143
18144 /**
18145  * Checks if two SemanticErrors contain equal inner contents.
18146  * This ignores pointers and is_owned flags and looks at the values in fields.
18147  */
18148 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
18149
18150 /**
18151  * Get the string representation of a SemanticError object
18152  */
18153 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
18154
18155 /**
18156  * Frees any resources used by the SignOrCreationError
18157  */
18158 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
18159
18160 /**
18161  * Creates a copy of the SignOrCreationError
18162  */
18163 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
18164
18165 /**
18166  * Checks if two SignOrCreationErrors contain equal inner contents.
18167  * This ignores pointers and is_owned flags and looks at the values in fields.
18168  */
18169 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
18170
18171 /**
18172  * Get the string representation of a SignOrCreationError object
18173  */
18174 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
18175
18176 /**
18177  * Utility to construct an invoice. Generally, unless you want to do something like a custom
18178  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
18179  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
18180  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
18181  * that the payment secret is valid when the invoice is paid.
18182  */
18183 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);
18184
18185 /**
18186  * Read a SiPrefix object from a string
18187  */
18188 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
18189
18190 /**
18191  * Read a Invoice object from a string
18192  */
18193 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18194
18195 /**
18196  * Read a SignedRawInvoice object from a string
18197  */
18198 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18199
18200 /**
18201  * Get the string representation of a Invoice object
18202  */
18203 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18204
18205 /**
18206  * Get the string representation of a SignedRawInvoice object
18207  */
18208 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18209
18210 /**
18211  * Get the string representation of a Currency object
18212  */
18213 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18214
18215 /**
18216  * Get the string representation of a SiPrefix object
18217  */
18218 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18219
18220 #endif /* LDK_C_BINDINGS_H */
18221
18222 #include <ldk_ver.h>