Update auto-generated bindings to match latest upstream
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <ldk_rust_types.h>
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet/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  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3161  * This corresponds to std::vector in C++
3162  */
3163 typedef struct LDKCVec_RouteHopZ {
3164    /**
3165     * The elements in the array.
3166     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3167     */
3168    struct LDKRouteHop *data;
3169    /**
3170     * The number of elements pointed to by `data`.
3171     */
3172    uintptr_t datalen;
3173 } LDKCVec_RouteHopZ;
3174
3175 /**
3176  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3177  * This corresponds to std::vector in C++
3178  */
3179 typedef struct LDKCVec_CVec_RouteHopZZ {
3180    /**
3181     * The elements in the array.
3182     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3183     */
3184    struct LDKCVec_RouteHopZ *data;
3185    /**
3186     * The number of elements pointed to by `data`.
3187     */
3188    uintptr_t datalen;
3189 } LDKCVec_CVec_RouteHopZZ;
3190
3191
3192
3193 /**
3194  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3195  * it can take multiple paths. Each path is composed of one or more hops through the network.
3196  */
3197 typedef struct MUST_USE_STRUCT LDKRoute {
3198    /**
3199     * A pointer to the opaque Rust object.
3200     * Nearly everywhere, inner must be non-null, however in places where
3201     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3202     */
3203    LDKnativeRoute *inner;
3204    /**
3205     * Indicates that this is the only struct which contains the same pointer.
3206     * Rust functions which take ownership of an object provided via an argument require
3207     * this to be true and invalidate the object pointed to by inner.
3208     */
3209    bool is_owned;
3210 } LDKRoute;
3211
3212 /**
3213  * The contents of CResult_RouteDecodeErrorZ
3214  */
3215 typedef union LDKCResult_RouteDecodeErrorZPtr {
3216    /**
3217     * A pointer to the contents in the success state.
3218     * Reading from this pointer when `result_ok` is not set is undefined.
3219     */
3220    struct LDKRoute *result;
3221    /**
3222     * A pointer to the contents in the error state.
3223     * Reading from this pointer when `result_ok` is set is undefined.
3224     */
3225    struct LDKDecodeError *err;
3226 } LDKCResult_RouteDecodeErrorZPtr;
3227
3228 /**
3229  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3230  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3232  */
3233 typedef struct LDKCResult_RouteDecodeErrorZ {
3234    /**
3235     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3236     * `err` or `result` depending on the state of `result_ok`.
3237     */
3238    union LDKCResult_RouteDecodeErrorZPtr contents;
3239    /**
3240     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3241     */
3242    bool result_ok;
3243 } LDKCResult_RouteDecodeErrorZ;
3244
3245
3246
3247 /**
3248  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
3249  */
3250 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3251    /**
3252     * A pointer to the opaque Rust object.
3253     * Nearly everywhere, inner must be non-null, however in places where
3254     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3255     */
3256    LDKnativeChannelDetails *inner;
3257    /**
3258     * Indicates that this is the only struct which contains the same pointer.
3259     * Rust functions which take ownership of an object provided via an argument require
3260     * this to be true and invalidate the object pointed to by inner.
3261     */
3262    bool is_owned;
3263 } LDKChannelDetails;
3264
3265 /**
3266  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3267  * This corresponds to std::vector in C++
3268  */
3269 typedef struct LDKCVec_ChannelDetailsZ {
3270    /**
3271     * The elements in the array.
3272     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3273     */
3274    struct LDKChannelDetails *data;
3275    /**
3276     * The number of elements pointed to by `data`.
3277     */
3278    uintptr_t datalen;
3279 } LDKCVec_ChannelDetailsZ;
3280
3281
3282
3283 /**
3284  * An Err type for failure to process messages.
3285  */
3286 typedef struct MUST_USE_STRUCT LDKLightningError {
3287    /**
3288     * A pointer to the opaque Rust object.
3289     * Nearly everywhere, inner must be non-null, however in places where
3290     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3291     */
3292    LDKnativeLightningError *inner;
3293    /**
3294     * Indicates that this is the only struct which contains the same pointer.
3295     * Rust functions which take ownership of an object provided via an argument require
3296     * this to be true and invalidate the object pointed to by inner.
3297     */
3298    bool is_owned;
3299 } LDKLightningError;
3300
3301 /**
3302  * The contents of CResult_RouteLightningErrorZ
3303  */
3304 typedef union LDKCResult_RouteLightningErrorZPtr {
3305    /**
3306     * A pointer to the contents in the success state.
3307     * Reading from this pointer when `result_ok` is not set is undefined.
3308     */
3309    struct LDKRoute *result;
3310    /**
3311     * A pointer to the contents in the error state.
3312     * Reading from this pointer when `result_ok` is set is undefined.
3313     */
3314    struct LDKLightningError *err;
3315 } LDKCResult_RouteLightningErrorZPtr;
3316
3317 /**
3318  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3319  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3320  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3321  */
3322 typedef struct LDKCResult_RouteLightningErrorZ {
3323    /**
3324     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3325     * `err` or `result` depending on the state of `result_ok`.
3326     */
3327    union LDKCResult_RouteLightningErrorZPtr contents;
3328    /**
3329     * Whether this CResult_RouteLightningErrorZ represents a success state.
3330     */
3331    bool result_ok;
3332 } LDKCResult_RouteLightningErrorZ;
3333
3334
3335
3336 /**
3337  * An accept_channel message to be sent or received from a peer
3338  */
3339 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3340    /**
3341     * A pointer to the opaque Rust object.
3342     * Nearly everywhere, inner must be non-null, however in places where
3343     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3344     */
3345    LDKnativeAcceptChannel *inner;
3346    /**
3347     * Indicates that this is the only struct which contains the same pointer.
3348     * Rust functions which take ownership of an object provided via an argument require
3349     * this to be true and invalidate the object pointed to by inner.
3350     */
3351    bool is_owned;
3352 } LDKAcceptChannel;
3353
3354
3355
3356 /**
3357  * An open_channel message to be sent or received from a peer
3358  */
3359 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3360    /**
3361     * A pointer to the opaque Rust object.
3362     * Nearly everywhere, inner must be non-null, however in places where
3363     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3364     */
3365    LDKnativeOpenChannel *inner;
3366    /**
3367     * Indicates that this is the only struct which contains the same pointer.
3368     * Rust functions which take ownership of an object provided via an argument require
3369     * this to be true and invalidate the object pointed to by inner.
3370     */
3371    bool is_owned;
3372 } LDKOpenChannel;
3373
3374
3375
3376 /**
3377  * A funding_created message to be sent or received from a peer
3378  */
3379 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3380    /**
3381     * A pointer to the opaque Rust object.
3382     * Nearly everywhere, inner must be non-null, however in places where
3383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3384     */
3385    LDKnativeFundingCreated *inner;
3386    /**
3387     * Indicates that this is the only struct which contains the same pointer.
3388     * Rust functions which take ownership of an object provided via an argument require
3389     * this to be true and invalidate the object pointed to by inner.
3390     */
3391    bool is_owned;
3392 } LDKFundingCreated;
3393
3394
3395
3396 /**
3397  * A funding_signed message to be sent or received from a peer
3398  */
3399 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3400    /**
3401     * A pointer to the opaque Rust object.
3402     * Nearly everywhere, inner must be non-null, however in places where
3403     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3404     */
3405    LDKnativeFundingSigned *inner;
3406    /**
3407     * Indicates that this is the only struct which contains the same pointer.
3408     * Rust functions which take ownership of an object provided via an argument require
3409     * this to be true and invalidate the object pointed to by inner.
3410     */
3411    bool is_owned;
3412 } LDKFundingSigned;
3413
3414
3415
3416 /**
3417  * A funding_locked message to be sent or received from a peer
3418  */
3419 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3420    /**
3421     * A pointer to the opaque Rust object.
3422     * Nearly everywhere, inner must be non-null, however in places where
3423     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3424     */
3425    LDKnativeFundingLocked *inner;
3426    /**
3427     * Indicates that this is the only struct which contains the same pointer.
3428     * Rust functions which take ownership of an object provided via an argument require
3429     * this to be true and invalidate the object pointed to by inner.
3430     */
3431    bool is_owned;
3432 } LDKFundingLocked;
3433
3434
3435
3436 /**
3437  * An announcement_signatures message to be sent or received from a peer
3438  */
3439 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3440    /**
3441     * A pointer to the opaque Rust object.
3442     * Nearly everywhere, inner must be non-null, however in places where
3443     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3444     */
3445    LDKnativeAnnouncementSignatures *inner;
3446    /**
3447     * Indicates that this is the only struct which contains the same pointer.
3448     * Rust functions which take ownership of an object provided via an argument require
3449     * this to be true and invalidate the object pointed to by inner.
3450     */
3451    bool is_owned;
3452 } LDKAnnouncementSignatures;
3453
3454
3455
3456 /**
3457  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3458  * transaction updates if they were pending.
3459  */
3460 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3461    /**
3462     * A pointer to the opaque Rust object.
3463     * Nearly everywhere, inner must be non-null, however in places where
3464     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3465     */
3466    LDKnativeCommitmentUpdate *inner;
3467    /**
3468     * Indicates that this is the only struct which contains the same pointer.
3469     * Rust functions which take ownership of an object provided via an argument require
3470     * this to be true and invalidate the object pointed to by inner.
3471     */
3472    bool is_owned;
3473 } LDKCommitmentUpdate;
3474
3475
3476
3477 /**
3478  * A revoke_and_ack message to be sent or received from a peer
3479  */
3480 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3481    /**
3482     * A pointer to the opaque Rust object.
3483     * Nearly everywhere, inner must be non-null, however in places where
3484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3485     */
3486    LDKnativeRevokeAndACK *inner;
3487    /**
3488     * Indicates that this is the only struct which contains the same pointer.
3489     * Rust functions which take ownership of an object provided via an argument require
3490     * this to be true and invalidate the object pointed to by inner.
3491     */
3492    bool is_owned;
3493 } LDKRevokeAndACK;
3494
3495
3496
3497 /**
3498  * A closing_signed message to be sent or received from a peer
3499  */
3500 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3501    /**
3502     * A pointer to the opaque Rust object.
3503     * Nearly everywhere, inner must be non-null, however in places where
3504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3505     */
3506    LDKnativeClosingSigned *inner;
3507    /**
3508     * Indicates that this is the only struct which contains the same pointer.
3509     * Rust functions which take ownership of an object provided via an argument require
3510     * this to be true and invalidate the object pointed to by inner.
3511     */
3512    bool is_owned;
3513 } LDKClosingSigned;
3514
3515
3516
3517 /**
3518  * A shutdown message to be sent or received from a peer
3519  */
3520 typedef struct MUST_USE_STRUCT LDKShutdown {
3521    /**
3522     * A pointer to the opaque Rust object.
3523     * Nearly everywhere, inner must be non-null, however in places where
3524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3525     */
3526    LDKnativeShutdown *inner;
3527    /**
3528     * Indicates that this is the only struct which contains the same pointer.
3529     * Rust functions which take ownership of an object provided via an argument require
3530     * this to be true and invalidate the object pointed to by inner.
3531     */
3532    bool is_owned;
3533 } LDKShutdown;
3534
3535
3536
3537 /**
3538  * A channel_reestablish message to be sent or received from a peer
3539  */
3540 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3541    /**
3542     * A pointer to the opaque Rust object.
3543     * Nearly everywhere, inner must be non-null, however in places where
3544     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3545     */
3546    LDKnativeChannelReestablish *inner;
3547    /**
3548     * Indicates that this is the only struct which contains the same pointer.
3549     * Rust functions which take ownership of an object provided via an argument require
3550     * this to be true and invalidate the object pointed to by inner.
3551     */
3552    bool is_owned;
3553 } LDKChannelReestablish;
3554
3555
3556
3557 /**
3558  * A channel_announcement message to be sent or received from a peer
3559  */
3560 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3561    /**
3562     * A pointer to the opaque Rust object.
3563     * Nearly everywhere, inner must be non-null, however in places where
3564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3565     */
3566    LDKnativeChannelAnnouncement *inner;
3567    /**
3568     * Indicates that this is the only struct which contains the same pointer.
3569     * Rust functions which take ownership of an object provided via an argument require
3570     * this to be true and invalidate the object pointed to by inner.
3571     */
3572    bool is_owned;
3573 } LDKChannelAnnouncement;
3574
3575
3576
3577 /**
3578  * A channel_update message to be sent or received from a peer
3579  */
3580 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
3581    /**
3582     * A pointer to the opaque Rust object.
3583     * Nearly everywhere, inner must be non-null, however in places where
3584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3585     */
3586    LDKnativeChannelUpdate *inner;
3587    /**
3588     * Indicates that this is the only struct which contains the same pointer.
3589     * Rust functions which take ownership of an object provided via an argument require
3590     * this to be true and invalidate the object pointed to by inner.
3591     */
3592    bool is_owned;
3593 } LDKChannelUpdate;
3594
3595
3596
3597 /**
3598  * A node_announcement message to be sent or received from a peer
3599  */
3600 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3601    /**
3602     * A pointer to the opaque Rust object.
3603     * Nearly everywhere, inner must be non-null, however in places where
3604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3605     */
3606    LDKnativeNodeAnnouncement *inner;
3607    /**
3608     * Indicates that this is the only struct which contains the same pointer.
3609     * Rust functions which take ownership of an object provided via an argument require
3610     * this to be true and invalidate the object pointed to by inner.
3611     */
3612    bool is_owned;
3613 } LDKNodeAnnouncement;
3614
3615
3616
3617 /**
3618  * An error message to be sent or received from a peer
3619  */
3620 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3621    /**
3622     * A pointer to the opaque Rust object.
3623     * Nearly everywhere, inner must be non-null, however in places where
3624     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3625     */
3626    LDKnativeErrorMessage *inner;
3627    /**
3628     * Indicates that this is the only struct which contains the same pointer.
3629     * Rust functions which take ownership of an object provided via an argument require
3630     * this to be true and invalidate the object pointed to by inner.
3631     */
3632    bool is_owned;
3633 } LDKErrorMessage;
3634
3635 /**
3636  * Used to put an error message in a LightningError
3637  */
3638 typedef enum LDKErrorAction_Tag {
3639    /**
3640     * The peer took some action which made us think they were useless. Disconnect them.
3641     */
3642    LDKErrorAction_DisconnectPeer,
3643    /**
3644     * The peer did something harmless that we weren't able to process, just log and ignore
3645     */
3646    LDKErrorAction_IgnoreError,
3647    /**
3648     * The peer did something incorrect. Tell them.
3649     */
3650    LDKErrorAction_SendErrorMessage,
3651    /**
3652     * Must be last for serialization purposes
3653     */
3654    LDKErrorAction_Sentinel,
3655 } LDKErrorAction_Tag;
3656
3657 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3658    /**
3659     * An error message which we should make an effort to send before we disconnect.
3660     */
3661    struct LDKErrorMessage msg;
3662 } LDKErrorAction_LDKDisconnectPeer_Body;
3663
3664 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3665    /**
3666     * The message to send.
3667     */
3668    struct LDKErrorMessage msg;
3669 } LDKErrorAction_LDKSendErrorMessage_Body;
3670
3671 typedef struct MUST_USE_STRUCT LDKErrorAction {
3672    LDKErrorAction_Tag tag;
3673    union {
3674       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3675       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3676    };
3677 } LDKErrorAction;
3678
3679 /**
3680  * The information we received from a peer along the route of a payment we originated. This is
3681  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3682  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3683  */
3684 typedef enum LDKHTLCFailChannelUpdate_Tag {
3685    /**
3686     * We received an error which included a full ChannelUpdate message.
3687     */
3688    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
3689    /**
3690     * We received an error which indicated only that a channel has been closed
3691     */
3692    LDKHTLCFailChannelUpdate_ChannelClosed,
3693    /**
3694     * We received an error which indicated only that a node has failed
3695     */
3696    LDKHTLCFailChannelUpdate_NodeFailure,
3697    /**
3698     * Must be last for serialization purposes
3699     */
3700    LDKHTLCFailChannelUpdate_Sentinel,
3701 } LDKHTLCFailChannelUpdate_Tag;
3702
3703 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
3704    /**
3705     * The unwrapped message we received
3706     */
3707    struct LDKChannelUpdate msg;
3708 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
3709
3710 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
3711    /**
3712     * The short_channel_id which has now closed.
3713     */
3714    uint64_t short_channel_id;
3715    /**
3716     * when this true, this channel should be permanently removed from the
3717     * consideration. Otherwise, this channel can be restored as new channel_update is received
3718     */
3719    bool is_permanent;
3720 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
3721
3722 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
3723    /**
3724     * The node_id that has failed.
3725     */
3726    struct LDKPublicKey node_id;
3727    /**
3728     * when this true, node should be permanently removed from the
3729     * consideration. Otherwise, the channels connected to this node can be
3730     * restored as new channel_update is received
3731     */
3732    bool is_permanent;
3733 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
3734
3735 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
3736    LDKHTLCFailChannelUpdate_Tag tag;
3737    union {
3738       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3739       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
3740       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
3741    };
3742 } LDKHTLCFailChannelUpdate;
3743
3744
3745
3746 /**
3747  * A query_channel_range message is used to query a peer for channel
3748  * UTXOs in a range of blocks. The recipient of a query makes a best
3749  * effort to reply to the query using one or more reply_channel_range
3750  * messages.
3751  */
3752 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3753    /**
3754     * A pointer to the opaque Rust object.
3755     * Nearly everywhere, inner must be non-null, however in places where
3756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3757     */
3758    LDKnativeQueryChannelRange *inner;
3759    /**
3760     * Indicates that this is the only struct which contains the same pointer.
3761     * Rust functions which take ownership of an object provided via an argument require
3762     * this to be true and invalidate the object pointed to by inner.
3763     */
3764    bool is_owned;
3765 } LDKQueryChannelRange;
3766
3767
3768
3769 /**
3770  * A query_short_channel_ids message is used to query a peer for
3771  * routing gossip messages related to one or more short_channel_ids.
3772  * The query recipient will reply with the latest, if available,
3773  * channel_announcement, channel_update and node_announcement messages
3774  * it maintains for the requested short_channel_ids followed by a
3775  * reply_short_channel_ids_end message. The short_channel_ids sent in
3776  * this query are encoded. We only support encoding_type=0 uncompressed
3777  * serialization and do not support encoding_type=1 zlib serialization.
3778  */
3779 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3780    /**
3781     * A pointer to the opaque Rust object.
3782     * Nearly everywhere, inner must be non-null, however in places where
3783     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3784     */
3785    LDKnativeQueryShortChannelIds *inner;
3786    /**
3787     * Indicates that this is the only struct which contains the same pointer.
3788     * Rust functions which take ownership of an object provided via an argument require
3789     * this to be true and invalidate the object pointed to by inner.
3790     */
3791    bool is_owned;
3792 } LDKQueryShortChannelIds;
3793
3794
3795
3796 /**
3797  * A reply_channel_range message is a reply to a query_channel_range
3798  * message. Multiple reply_channel_range messages can be sent in reply
3799  * to a single query_channel_range message. The query recipient makes a
3800  * best effort to respond based on their local network view which may
3801  * not be a perfect view of the network. The short_channel_ids in the
3802  * reply are encoded. We only support encoding_type=0 uncompressed
3803  * serialization and do not support encoding_type=1 zlib serialization.
3804  */
3805 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3806    /**
3807     * A pointer to the opaque Rust object.
3808     * Nearly everywhere, inner must be non-null, however in places where
3809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3810     */
3811    LDKnativeReplyChannelRange *inner;
3812    /**
3813     * Indicates that this is the only struct which contains the same pointer.
3814     * Rust functions which take ownership of an object provided via an argument require
3815     * this to be true and invalidate the object pointed to by inner.
3816     */
3817    bool is_owned;
3818 } LDKReplyChannelRange;
3819
3820 /**
3821  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3822  * broadcast to most peers).
3823  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3824  */
3825 typedef enum LDKMessageSendEvent_Tag {
3826    /**
3827     * Used to indicate that we've accepted a channel open and should send the accept_channel
3828     * message provided to the given peer.
3829     */
3830    LDKMessageSendEvent_SendAcceptChannel,
3831    /**
3832     * Used to indicate that we've initiated a channel open and should send the open_channel
3833     * message provided to the given peer.
3834     */
3835    LDKMessageSendEvent_SendOpenChannel,
3836    /**
3837     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3838     */
3839    LDKMessageSendEvent_SendFundingCreated,
3840    /**
3841     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3842     */
3843    LDKMessageSendEvent_SendFundingSigned,
3844    /**
3845     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3846     */
3847    LDKMessageSendEvent_SendFundingLocked,
3848    /**
3849     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3850     */
3851    LDKMessageSendEvent_SendAnnouncementSignatures,
3852    /**
3853     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3854     * message should be sent to the peer with the given node_id.
3855     */
3856    LDKMessageSendEvent_UpdateHTLCs,
3857    /**
3858     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3859     */
3860    LDKMessageSendEvent_SendRevokeAndACK,
3861    /**
3862     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3863     */
3864    LDKMessageSendEvent_SendClosingSigned,
3865    /**
3866     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3867     */
3868    LDKMessageSendEvent_SendShutdown,
3869    /**
3870     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3871     */
3872    LDKMessageSendEvent_SendChannelReestablish,
3873    /**
3874     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3875     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3876     *
3877     * Note that after doing so, you very likely (unless you did so very recently) want to call
3878     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3879     * This ensures that any nodes which see our channel_announcement also have a relevant
3880     * node_announcement, including relevant feature flags which may be important for routing
3881     * through or to us.
3882     */
3883    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3884    /**
3885     * Used to indicate that a node_announcement should be broadcast to all peers.
3886     */
3887    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3888    /**
3889     * Used to indicate that a channel_update should be broadcast to all peers.
3890     */
3891    LDKMessageSendEvent_BroadcastChannelUpdate,
3892    /**
3893     * Broadcast an error downstream to be handled
3894     */
3895    LDKMessageSendEvent_HandleError,
3896    /**
3897     * When a payment fails we may receive updates back from the hop where it failed. In such
3898     * cases this event is generated so that we can inform the network graph of this information.
3899     */
3900    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3901    /**
3902     * Query a peer for channels with funding transaction UTXOs in a block range.
3903     */
3904    LDKMessageSendEvent_SendChannelRangeQuery,
3905    /**
3906     * Request routing gossip messages from a peer for a list of channels identified by
3907     * their short_channel_ids.
3908     */
3909    LDKMessageSendEvent_SendShortIdsQuery,
3910    /**
3911     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3912     * emitted during processing of the query.
3913     */
3914    LDKMessageSendEvent_SendReplyChannelRange,
3915    /**
3916     * Must be last for serialization purposes
3917     */
3918    LDKMessageSendEvent_Sentinel,
3919 } LDKMessageSendEvent_Tag;
3920
3921 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3922    /**
3923     * The node_id of the node which should receive this message
3924     */
3925    struct LDKPublicKey node_id;
3926    /**
3927     * The message which should be sent.
3928     */
3929    struct LDKAcceptChannel msg;
3930 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3931
3932 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3933    /**
3934     * The node_id of the node which should receive this message
3935     */
3936    struct LDKPublicKey node_id;
3937    /**
3938     * The message which should be sent.
3939     */
3940    struct LDKOpenChannel msg;
3941 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3942
3943 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3944    /**
3945     * The node_id of the node which should receive this message
3946     */
3947    struct LDKPublicKey node_id;
3948    /**
3949     * The message which should be sent.
3950     */
3951    struct LDKFundingCreated msg;
3952 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3953
3954 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_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 LDKFundingSigned msg;
3963 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3964
3965 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3966    /**
3967     * The node_id of the node which should receive these message(s)
3968     */
3969    struct LDKPublicKey node_id;
3970    /**
3971     * The funding_locked message which should be sent.
3972     */
3973    struct LDKFundingLocked msg;
3974 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3975
3976 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3977    /**
3978     * The node_id of the node which should receive these message(s)
3979     */
3980    struct LDKPublicKey node_id;
3981    /**
3982     * The announcement_signatures message which should be sent.
3983     */
3984    struct LDKAnnouncementSignatures msg;
3985 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3986
3987 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3988    /**
3989     * The node_id of the node which should receive these message(s)
3990     */
3991    struct LDKPublicKey node_id;
3992    /**
3993     * The update messages which should be sent. ALL messages in the struct should be sent!
3994     */
3995    struct LDKCommitmentUpdate updates;
3996 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3997
3998 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3999    /**
4000     * The node_id of the node which should receive this message
4001     */
4002    struct LDKPublicKey node_id;
4003    /**
4004     * The message which should be sent.
4005     */
4006    struct LDKRevokeAndACK msg;
4007 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4008
4009 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4010    /**
4011     * The node_id of the node which should receive this message
4012     */
4013    struct LDKPublicKey node_id;
4014    /**
4015     * The message which should be sent.
4016     */
4017    struct LDKClosingSigned msg;
4018 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4019
4020 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4021    /**
4022     * The node_id of the node which should receive this message
4023     */
4024    struct LDKPublicKey node_id;
4025    /**
4026     * The message which should be sent.
4027     */
4028    struct LDKShutdown msg;
4029 } LDKMessageSendEvent_LDKSendShutdown_Body;
4030
4031 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_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 LDKChannelReestablish msg;
4040 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4041
4042 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4043    /**
4044     * The channel_announcement which should be sent.
4045     */
4046    struct LDKChannelAnnouncement msg;
4047    /**
4048     * The followup channel_update which should be sent.
4049     */
4050    struct LDKChannelUpdate update_msg;
4051 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4052
4053 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4054    /**
4055     * The node_announcement which should be sent.
4056     */
4057    struct LDKNodeAnnouncement msg;
4058 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4059
4060 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4061    /**
4062     * The channel_update which should be sent.
4063     */
4064    struct LDKChannelUpdate msg;
4065 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4066
4067 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4068    /**
4069     * The node_id of the node which should receive this message
4070     */
4071    struct LDKPublicKey node_id;
4072    /**
4073     * The action which should be taken.
4074     */
4075    struct LDKErrorAction action;
4076 } LDKMessageSendEvent_LDKHandleError_Body;
4077
4078 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
4079    /**
4080     * The channel/node update which should be sent to NetGraphMsgHandler
4081     */
4082    struct LDKHTLCFailChannelUpdate update;
4083 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
4084
4085 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4086    /**
4087     * The node_id of this message recipient
4088     */
4089    struct LDKPublicKey node_id;
4090    /**
4091     * The query_channel_range which should be sent.
4092     */
4093    struct LDKQueryChannelRange msg;
4094 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4095
4096 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4097    /**
4098     * The node_id of this message recipient
4099     */
4100    struct LDKPublicKey node_id;
4101    /**
4102     * The query_short_channel_ids which should be sent.
4103     */
4104    struct LDKQueryShortChannelIds msg;
4105 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4106
4107 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4108    /**
4109     * The node_id of this message recipient
4110     */
4111    struct LDKPublicKey node_id;
4112    /**
4113     * The reply_channel_range which should be sent.
4114     */
4115    struct LDKReplyChannelRange msg;
4116 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4117
4118 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4119    LDKMessageSendEvent_Tag tag;
4120    union {
4121       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4122       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4123       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4124       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4125       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4126       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4127       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4128       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4129       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4130       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4131       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4132       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4133       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4134       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4135       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4136       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
4137       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4138       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4139       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4140    };
4141 } LDKMessageSendEvent;
4142
4143 /**
4144  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4145  * This corresponds to std::vector in C++
4146  */
4147 typedef struct LDKCVec_MessageSendEventZ {
4148    /**
4149     * The elements in the array.
4150     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4151     */
4152    struct LDKMessageSendEvent *data;
4153    /**
4154     * The number of elements pointed to by `data`.
4155     */
4156    uintptr_t datalen;
4157 } LDKCVec_MessageSendEventZ;
4158
4159 /**
4160  * The contents of CResult_boolLightningErrorZ
4161  */
4162 typedef union LDKCResult_boolLightningErrorZPtr {
4163    /**
4164     * A pointer to the contents in the success state.
4165     * Reading from this pointer when `result_ok` is not set is undefined.
4166     */
4167    bool *result;
4168    /**
4169     * A pointer to the contents in the error state.
4170     * Reading from this pointer when `result_ok` is set is undefined.
4171     */
4172    struct LDKLightningError *err;
4173 } LDKCResult_boolLightningErrorZPtr;
4174
4175 /**
4176  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4177  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4179  */
4180 typedef struct LDKCResult_boolLightningErrorZ {
4181    /**
4182     * The contents of this CResult_boolLightningErrorZ, accessible via either
4183     * `err` or `result` depending on the state of `result_ok`.
4184     */
4185    union LDKCResult_boolLightningErrorZPtr contents;
4186    /**
4187     * Whether this CResult_boolLightningErrorZ represents a success state.
4188     */
4189    bool result_ok;
4190 } LDKCResult_boolLightningErrorZ;
4191
4192 /**
4193  * A tuple of 3 elements. See the individual fields for the types contained.
4194  */
4195 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4196    /**
4197     * The element at position 0
4198     */
4199    struct LDKChannelAnnouncement a;
4200    /**
4201     * The element at position 1
4202     */
4203    struct LDKChannelUpdate b;
4204    /**
4205     * The element at position 2
4206     */
4207    struct LDKChannelUpdate c;
4208 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4209
4210 /**
4211  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4212  * This corresponds to std::vector in C++
4213  */
4214 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4215    /**
4216     * The elements in the array.
4217     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4218     */
4219    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4220    /**
4221     * The number of elements pointed to by `data`.
4222     */
4223    uintptr_t datalen;
4224 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
4225
4226 /**
4227  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4228  * This corresponds to std::vector in C++
4229  */
4230 typedef struct LDKCVec_NodeAnnouncementZ {
4231    /**
4232     * The elements in the array.
4233     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4234     */
4235    struct LDKNodeAnnouncement *data;
4236    /**
4237     * The number of elements pointed to by `data`.
4238     */
4239    uintptr_t datalen;
4240 } LDKCVec_NodeAnnouncementZ;
4241
4242 /**
4243  * The contents of CResult_NoneLightningErrorZ
4244  */
4245 typedef union LDKCResult_NoneLightningErrorZPtr {
4246    /**
4247     * Note that this value is always NULL, as there are no contents in the OK variant
4248     */
4249    void *result;
4250    /**
4251     * A pointer to the contents in the error state.
4252     * Reading from this pointer when `result_ok` is set is undefined.
4253     */
4254    struct LDKLightningError *err;
4255 } LDKCResult_NoneLightningErrorZPtr;
4256
4257 /**
4258  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4259  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4261  */
4262 typedef struct LDKCResult_NoneLightningErrorZ {
4263    /**
4264     * The contents of this CResult_NoneLightningErrorZ, accessible via either
4265     * `err` or `result` depending on the state of `result_ok`.
4266     */
4267    union LDKCResult_NoneLightningErrorZPtr contents;
4268    /**
4269     * Whether this CResult_NoneLightningErrorZ represents a success state.
4270     */
4271    bool result_ok;
4272 } LDKCResult_NoneLightningErrorZ;
4273
4274 /**
4275  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4276  * This corresponds to std::vector in C++
4277  */
4278 typedef struct LDKCVec_PublicKeyZ {
4279    /**
4280     * The elements in the array.
4281     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4282     */
4283    struct LDKPublicKey *data;
4284    /**
4285     * The number of elements pointed to by `data`.
4286     */
4287    uintptr_t datalen;
4288 } LDKCVec_PublicKeyZ;
4289
4290
4291
4292 /**
4293  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
4294  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
4295  * descriptor.
4296  */
4297 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
4298    /**
4299     * A pointer to the opaque Rust object.
4300     * Nearly everywhere, inner must be non-null, however in places where
4301     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4302     */
4303    LDKnativePeerHandleError *inner;
4304    /**
4305     * Indicates that this is the only struct which contains the same pointer.
4306     * Rust functions which take ownership of an object provided via an argument require
4307     * this to be true and invalidate the object pointed to by inner.
4308     */
4309    bool is_owned;
4310 } LDKPeerHandleError;
4311
4312 /**
4313  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
4314  */
4315 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
4316    /**
4317     * A pointer to the contents in the success state.
4318     * Reading from this pointer when `result_ok` is not set is undefined.
4319     */
4320    struct LDKCVec_u8Z *result;
4321    /**
4322     * A pointer to the contents in the error state.
4323     * Reading from this pointer when `result_ok` is set is undefined.
4324     */
4325    struct LDKPeerHandleError *err;
4326 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
4327
4328 /**
4329  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4330  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4331  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4332  */
4333 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
4334    /**
4335     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4336     * `err` or `result` depending on the state of `result_ok`.
4337     */
4338    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
4339    /**
4340     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4341     */
4342    bool result_ok;
4343 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
4344
4345 /**
4346  * The contents of CResult_NonePeerHandleErrorZ
4347  */
4348 typedef union LDKCResult_NonePeerHandleErrorZPtr {
4349    /**
4350     * Note that this value is always NULL, as there are no contents in the OK variant
4351     */
4352    void *result;
4353    /**
4354     * A pointer to the contents in the error state.
4355     * Reading from this pointer when `result_ok` is set is undefined.
4356     */
4357    struct LDKPeerHandleError *err;
4358 } LDKCResult_NonePeerHandleErrorZPtr;
4359
4360 /**
4361  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4362  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4364  */
4365 typedef struct LDKCResult_NonePeerHandleErrorZ {
4366    /**
4367     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4368     * `err` or `result` depending on the state of `result_ok`.
4369     */
4370    union LDKCResult_NonePeerHandleErrorZPtr contents;
4371    /**
4372     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
4373     */
4374    bool result_ok;
4375 } LDKCResult_NonePeerHandleErrorZ;
4376
4377 /**
4378  * The contents of CResult_boolPeerHandleErrorZ
4379  */
4380 typedef union LDKCResult_boolPeerHandleErrorZPtr {
4381    /**
4382     * A pointer to the contents in the success state.
4383     * Reading from this pointer when `result_ok` is not set is undefined.
4384     */
4385    bool *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_boolPeerHandleErrorZPtr;
4392
4393 /**
4394  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4395  * containing a bool 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_boolPeerHandleErrorZ {
4399    /**
4400     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4401     * `err` or `result` depending on the state of `result_ok`.
4402     */
4403    union LDKCResult_boolPeerHandleErrorZPtr contents;
4404    /**
4405     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
4406     */
4407    bool result_ok;
4408 } LDKCResult_boolPeerHandleErrorZ;
4409
4410 /**
4411  * The contents of CResult_TxOutAccessErrorZ
4412  */
4413 typedef union LDKCResult_TxOutAccessErrorZPtr {
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    struct LDKTxOut *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    enum LDKAccessError *err;
4424 } LDKCResult_TxOutAccessErrorZPtr;
4425
4426 /**
4427  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4428  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4429  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4430  */
4431 typedef struct LDKCResult_TxOutAccessErrorZ {
4432    /**
4433     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4434     * `err` or `result` depending on the state of `result_ok`.
4435     */
4436    union LDKCResult_TxOutAccessErrorZPtr contents;
4437    /**
4438     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4439     */
4440    bool result_ok;
4441 } LDKCResult_TxOutAccessErrorZ;
4442
4443 /**
4444  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4445  */
4446 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4447    /**
4448     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4449     */
4450    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4451    /**
4452     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4453     */
4454    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4455    /**
4456     * Must be last for serialization purposes
4457     */
4458    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4459 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4460
4461 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4462    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4463    union {
4464       struct {
4465          struct LDKC2Tuple_usizeTransactionZ some;
4466       };
4467    };
4468 } LDKCOption_C2Tuple_usizeTransactionZZ;
4469
4470
4471
4472 /**
4473  * Details about one direction of a channel. Received
4474  * within a channel update.
4475  */
4476 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
4477    /**
4478     * A pointer to the opaque Rust object.
4479     * Nearly everywhere, inner must be non-null, however in places where
4480     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4481     */
4482    LDKnativeDirectionalChannelInfo *inner;
4483    /**
4484     * Indicates that this is the only struct which contains the same pointer.
4485     * Rust functions which take ownership of an object provided via an argument require
4486     * this to be true and invalidate the object pointed to by inner.
4487     */
4488    bool is_owned;
4489 } LDKDirectionalChannelInfo;
4490
4491 /**
4492  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4493  */
4494 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
4495    /**
4496     * A pointer to the contents in the success state.
4497     * Reading from this pointer when `result_ok` is not set is undefined.
4498     */
4499    struct LDKDirectionalChannelInfo *result;
4500    /**
4501     * A pointer to the contents in the error state.
4502     * Reading from this pointer when `result_ok` is set is undefined.
4503     */
4504    struct LDKDecodeError *err;
4505 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
4506
4507 /**
4508  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4509  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4510  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4511  */
4512 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
4513    /**
4514     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4515     * `err` or `result` depending on the state of `result_ok`.
4516     */
4517    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
4518    /**
4519     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4520     */
4521    bool result_ok;
4522 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
4523
4524
4525
4526 /**
4527  * Details about a channel (both directions).
4528  * Received within a channel announcement.
4529  */
4530 typedef struct MUST_USE_STRUCT LDKChannelInfo {
4531    /**
4532     * A pointer to the opaque Rust object.
4533     * Nearly everywhere, inner must be non-null, however in places where
4534     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4535     */
4536    LDKnativeChannelInfo *inner;
4537    /**
4538     * Indicates that this is the only struct which contains the same pointer.
4539     * Rust functions which take ownership of an object provided via an argument require
4540     * this to be true and invalidate the object pointed to by inner.
4541     */
4542    bool is_owned;
4543 } LDKChannelInfo;
4544
4545 /**
4546  * The contents of CResult_ChannelInfoDecodeErrorZ
4547  */
4548 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
4549    /**
4550     * A pointer to the contents in the success state.
4551     * Reading from this pointer when `result_ok` is not set is undefined.
4552     */
4553    struct LDKChannelInfo *result;
4554    /**
4555     * A pointer to the contents in the error state.
4556     * Reading from this pointer when `result_ok` is set is undefined.
4557     */
4558    struct LDKDecodeError *err;
4559 } LDKCResult_ChannelInfoDecodeErrorZPtr;
4560
4561 /**
4562  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4563  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4564  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4565  */
4566 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
4567    /**
4568     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4569     * `err` or `result` depending on the state of `result_ok`.
4570     */
4571    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
4572    /**
4573     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4574     */
4575    bool result_ok;
4576 } LDKCResult_ChannelInfoDecodeErrorZ;
4577
4578
4579
4580 /**
4581  * Fees for routing via a given channel or a node
4582  */
4583 typedef struct MUST_USE_STRUCT LDKRoutingFees {
4584    /**
4585     * A pointer to the opaque Rust object.
4586     * Nearly everywhere, inner must be non-null, however in places where
4587     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4588     */
4589    LDKnativeRoutingFees *inner;
4590    /**
4591     * Indicates that this is the only struct which contains the same pointer.
4592     * Rust functions which take ownership of an object provided via an argument require
4593     * this to be true and invalidate the object pointed to by inner.
4594     */
4595    bool is_owned;
4596 } LDKRoutingFees;
4597
4598 /**
4599  * The contents of CResult_RoutingFeesDecodeErrorZ
4600  */
4601 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
4602    /**
4603     * A pointer to the contents in the success state.
4604     * Reading from this pointer when `result_ok` is not set is undefined.
4605     */
4606    struct LDKRoutingFees *result;
4607    /**
4608     * A pointer to the contents in the error state.
4609     * Reading from this pointer when `result_ok` is set is undefined.
4610     */
4611    struct LDKDecodeError *err;
4612 } LDKCResult_RoutingFeesDecodeErrorZPtr;
4613
4614 /**
4615  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4616  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4617  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4618  */
4619 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
4620    /**
4621     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4622     * `err` or `result` depending on the state of `result_ok`.
4623     */
4624    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
4625    /**
4626     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4627     */
4628    bool result_ok;
4629 } LDKCResult_RoutingFeesDecodeErrorZ;
4630
4631 /**
4632  * A 4-byte byte array.
4633  */
4634 typedef struct LDKFourBytes {
4635    /**
4636     * The four bytes
4637     */
4638    uint8_t data[4];
4639 } LDKFourBytes;
4640
4641 /**
4642  * A 16-byte byte array.
4643  */
4644 typedef struct LDKSixteenBytes {
4645    /**
4646     * The sixteen bytes
4647     */
4648    uint8_t data[16];
4649 } LDKSixteenBytes;
4650
4651 /**
4652  * A 10-byte byte array.
4653  */
4654 typedef struct LDKTenBytes {
4655    /**
4656     * The ten bytes
4657     */
4658    uint8_t data[10];
4659 } LDKTenBytes;
4660
4661 /**
4662  * An address which can be used to connect to a remote peer
4663  */
4664 typedef enum LDKNetAddress_Tag {
4665    /**
4666     * An IPv4 address/port on which the peer is listening.
4667     */
4668    LDKNetAddress_IPv4,
4669    /**
4670     * An IPv6 address/port on which the peer is listening.
4671     */
4672    LDKNetAddress_IPv6,
4673    /**
4674     * An old-style Tor onion address/port on which the peer is listening.
4675     */
4676    LDKNetAddress_OnionV2,
4677    /**
4678     * A new-style Tor onion address/port on which the peer is listening.
4679     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4680     * wrap as base32 and append \".onion\".
4681     */
4682    LDKNetAddress_OnionV3,
4683    /**
4684     * Must be last for serialization purposes
4685     */
4686    LDKNetAddress_Sentinel,
4687 } LDKNetAddress_Tag;
4688
4689 typedef struct LDKNetAddress_LDKIPv4_Body {
4690    /**
4691     * The 4-byte IPv4 address
4692     */
4693    struct LDKFourBytes addr;
4694    /**
4695     * The port on which the node is listening
4696     */
4697    uint16_t port;
4698 } LDKNetAddress_LDKIPv4_Body;
4699
4700 typedef struct LDKNetAddress_LDKIPv6_Body {
4701    /**
4702     * The 16-byte IPv6 address
4703     */
4704    struct LDKSixteenBytes addr;
4705    /**
4706     * The port on which the node is listening
4707     */
4708    uint16_t port;
4709 } LDKNetAddress_LDKIPv6_Body;
4710
4711 typedef struct LDKNetAddress_LDKOnionV2_Body {
4712    /**
4713     * The bytes (usually encoded in base32 with \".onion\" appended)
4714     */
4715    struct LDKTenBytes addr;
4716    /**
4717     * The port on which the node is listening
4718     */
4719    uint16_t port;
4720 } LDKNetAddress_LDKOnionV2_Body;
4721
4722 typedef struct LDKNetAddress_LDKOnionV3_Body {
4723    /**
4724     * The ed25519 long-term public key of the peer
4725     */
4726    struct LDKThirtyTwoBytes ed25519_pubkey;
4727    /**
4728     * The checksum of the pubkey and version, as included in the onion address
4729     */
4730    uint16_t checksum;
4731    /**
4732     * The version byte, as defined by the Tor Onion v3 spec.
4733     */
4734    uint8_t version;
4735    /**
4736     * The port on which the node is listening
4737     */
4738    uint16_t port;
4739 } LDKNetAddress_LDKOnionV3_Body;
4740
4741 typedef struct MUST_USE_STRUCT LDKNetAddress {
4742    LDKNetAddress_Tag tag;
4743    union {
4744       LDKNetAddress_LDKIPv4_Body i_pv4;
4745       LDKNetAddress_LDKIPv6_Body i_pv6;
4746       LDKNetAddress_LDKOnionV2_Body onion_v2;
4747       LDKNetAddress_LDKOnionV3_Body onion_v3;
4748    };
4749 } LDKNetAddress;
4750
4751 /**
4752  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4753  * This corresponds to std::vector in C++
4754  */
4755 typedef struct LDKCVec_NetAddressZ {
4756    /**
4757     * The elements in the array.
4758     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4759     */
4760    struct LDKNetAddress *data;
4761    /**
4762     * The number of elements pointed to by `data`.
4763     */
4764    uintptr_t datalen;
4765 } LDKCVec_NetAddressZ;
4766
4767
4768
4769 /**
4770  * Information received in the latest node_announcement from this node.
4771  */
4772 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4773    /**
4774     * A pointer to the opaque Rust object.
4775     * Nearly everywhere, inner must be non-null, however in places where
4776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4777     */
4778    LDKnativeNodeAnnouncementInfo *inner;
4779    /**
4780     * Indicates that this is the only struct which contains the same pointer.
4781     * Rust functions which take ownership of an object provided via an argument require
4782     * this to be true and invalidate the object pointed to by inner.
4783     */
4784    bool is_owned;
4785 } LDKNodeAnnouncementInfo;
4786
4787 /**
4788  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4789  */
4790 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4791    /**
4792     * A pointer to the contents in the success state.
4793     * Reading from this pointer when `result_ok` is not set is undefined.
4794     */
4795    struct LDKNodeAnnouncementInfo *result;
4796    /**
4797     * A pointer to the contents in the error state.
4798     * Reading from this pointer when `result_ok` is set is undefined.
4799     */
4800    struct LDKDecodeError *err;
4801 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4802
4803 /**
4804  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4805  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4807  */
4808 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4809    /**
4810     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4811     * `err` or `result` depending on the state of `result_ok`.
4812     */
4813    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4814    /**
4815     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4816     */
4817    bool result_ok;
4818 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4819
4820 /**
4821  * A dynamically-allocated array of u64s of arbitrary size.
4822  * This corresponds to std::vector in C++
4823  */
4824 typedef struct LDKCVec_u64Z {
4825    /**
4826     * The elements in the array.
4827     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4828     */
4829    uint64_t *data;
4830    /**
4831     * The number of elements pointed to by `data`.
4832     */
4833    uintptr_t datalen;
4834 } LDKCVec_u64Z;
4835
4836
4837
4838 /**
4839  * Details about a node in the network, known from the network announcement.
4840  */
4841 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4842    /**
4843     * A pointer to the opaque Rust object.
4844     * Nearly everywhere, inner must be non-null, however in places where
4845     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4846     */
4847    LDKnativeNodeInfo *inner;
4848    /**
4849     * Indicates that this is the only struct which contains the same pointer.
4850     * Rust functions which take ownership of an object provided via an argument require
4851     * this to be true and invalidate the object pointed to by inner.
4852     */
4853    bool is_owned;
4854 } LDKNodeInfo;
4855
4856 /**
4857  * The contents of CResult_NodeInfoDecodeErrorZ
4858  */
4859 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4860    /**
4861     * A pointer to the contents in the success state.
4862     * Reading from this pointer when `result_ok` is not set is undefined.
4863     */
4864    struct LDKNodeInfo *result;
4865    /**
4866     * A pointer to the contents in the error state.
4867     * Reading from this pointer when `result_ok` is set is undefined.
4868     */
4869    struct LDKDecodeError *err;
4870 } LDKCResult_NodeInfoDecodeErrorZPtr;
4871
4872 /**
4873  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4874  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4875  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4876  */
4877 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4878    /**
4879     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4880     * `err` or `result` depending on the state of `result_ok`.
4881     */
4882    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4883    /**
4884     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4885     */
4886    bool result_ok;
4887 } LDKCResult_NodeInfoDecodeErrorZ;
4888
4889
4890
4891 /**
4892  * Represents the network as nodes and channels between them
4893  */
4894 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4895    /**
4896     * A pointer to the opaque Rust object.
4897     * Nearly everywhere, inner must be non-null, however in places where
4898     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4899     */
4900    LDKnativeNetworkGraph *inner;
4901    /**
4902     * Indicates that this is the only struct which contains the same pointer.
4903     * Rust functions which take ownership of an object provided via an argument require
4904     * this to be true and invalidate the object pointed to by inner.
4905     */
4906    bool is_owned;
4907 } LDKNetworkGraph;
4908
4909 /**
4910  * The contents of CResult_NetworkGraphDecodeErrorZ
4911  */
4912 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4913    /**
4914     * A pointer to the contents in the success state.
4915     * Reading from this pointer when `result_ok` is not set is undefined.
4916     */
4917    struct LDKNetworkGraph *result;
4918    /**
4919     * A pointer to the contents in the error state.
4920     * Reading from this pointer when `result_ok` is set is undefined.
4921     */
4922    struct LDKDecodeError *err;
4923 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4924
4925 /**
4926  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4927  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4929  */
4930 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4931    /**
4932     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4933     * `err` or `result` depending on the state of `result_ok`.
4934     */
4935    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4936    /**
4937     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4938     */
4939    bool result_ok;
4940 } LDKCResult_NetworkGraphDecodeErrorZ;
4941
4942
4943
4944 /**
4945  * Features used within an `init` message.
4946  */
4947 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4948    /**
4949     * A pointer to the opaque Rust object.
4950     * Nearly everywhere, inner must be non-null, however in places where
4951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4952     */
4953    LDKnativeInitFeatures *inner;
4954    /**
4955     * Indicates that this is the only struct which contains the same pointer.
4956     * Rust functions which take ownership of an object provided via an argument require
4957     * this to be true and invalidate the object pointed to by inner.
4958     */
4959    bool is_owned;
4960 } LDKInitFeatures;
4961
4962 /**
4963  * The contents of CResult_InitFeaturesDecodeErrorZ
4964  */
4965 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4966    /**
4967     * A pointer to the contents in the success state.
4968     * Reading from this pointer when `result_ok` is not set is undefined.
4969     */
4970    struct LDKInitFeatures *result;
4971    /**
4972     * A pointer to the contents in the error state.
4973     * Reading from this pointer when `result_ok` is set is undefined.
4974     */
4975    struct LDKDecodeError *err;
4976 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4977
4978 /**
4979  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4980  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4981  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4982  */
4983 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4984    /**
4985     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4986     * `err` or `result` depending on the state of `result_ok`.
4987     */
4988    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4989    /**
4990     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4991     */
4992    bool result_ok;
4993 } LDKCResult_InitFeaturesDecodeErrorZ;
4994
4995
4996
4997 /**
4998  * Features used within a `node_announcement` message.
4999  */
5000 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5001    /**
5002     * A pointer to the opaque Rust object.
5003     * Nearly everywhere, inner must be non-null, however in places where
5004     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5005     */
5006    LDKnativeNodeFeatures *inner;
5007    /**
5008     * Indicates that this is the only struct which contains the same pointer.
5009     * Rust functions which take ownership of an object provided via an argument require
5010     * this to be true and invalidate the object pointed to by inner.
5011     */
5012    bool is_owned;
5013 } LDKNodeFeatures;
5014
5015 /**
5016  * The contents of CResult_NodeFeaturesDecodeErrorZ
5017  */
5018 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5019    /**
5020     * A pointer to the contents in the success state.
5021     * Reading from this pointer when `result_ok` is not set is undefined.
5022     */
5023    struct LDKNodeFeatures *result;
5024    /**
5025     * A pointer to the contents in the error state.
5026     * Reading from this pointer when `result_ok` is set is undefined.
5027     */
5028    struct LDKDecodeError *err;
5029 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5030
5031 /**
5032  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5033  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5034  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5035  */
5036 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5037    /**
5038     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5039     * `err` or `result` depending on the state of `result_ok`.
5040     */
5041    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5042    /**
5043     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5044     */
5045    bool result_ok;
5046 } LDKCResult_NodeFeaturesDecodeErrorZ;
5047
5048
5049
5050 /**
5051  * Features used within a `channel_announcement` message.
5052  */
5053 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5054    /**
5055     * A pointer to the opaque Rust object.
5056     * Nearly everywhere, inner must be non-null, however in places where
5057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5058     */
5059    LDKnativeChannelFeatures *inner;
5060    /**
5061     * Indicates that this is the only struct which contains the same pointer.
5062     * Rust functions which take ownership of an object provided via an argument require
5063     * this to be true and invalidate the object pointed to by inner.
5064     */
5065    bool is_owned;
5066 } LDKChannelFeatures;
5067
5068 /**
5069  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5070  */
5071 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5072    /**
5073     * A pointer to the contents in the success state.
5074     * Reading from this pointer when `result_ok` is not set is undefined.
5075     */
5076    struct LDKChannelFeatures *result;
5077    /**
5078     * A pointer to the contents in the error state.
5079     * Reading from this pointer when `result_ok` is set is undefined.
5080     */
5081    struct LDKDecodeError *err;
5082 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5083
5084 /**
5085  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5086  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5087  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5088  */
5089 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5090    /**
5091     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5092     * `err` or `result` depending on the state of `result_ok`.
5093     */
5094    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5095    /**
5096     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5097     */
5098    bool result_ok;
5099 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5100
5101
5102
5103 /**
5104  * Features used within an invoice.
5105  */
5106 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5107    /**
5108     * A pointer to the opaque Rust object.
5109     * Nearly everywhere, inner must be non-null, however in places where
5110     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5111     */
5112    LDKnativeInvoiceFeatures *inner;
5113    /**
5114     * Indicates that this is the only struct which contains the same pointer.
5115     * Rust functions which take ownership of an object provided via an argument require
5116     * this to be true and invalidate the object pointed to by inner.
5117     */
5118    bool is_owned;
5119 } LDKInvoiceFeatures;
5120
5121 /**
5122  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5123  */
5124 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5125    /**
5126     * A pointer to the contents in the success state.
5127     * Reading from this pointer when `result_ok` is not set is undefined.
5128     */
5129    struct LDKInvoiceFeatures *result;
5130    /**
5131     * A pointer to the contents in the error state.
5132     * Reading from this pointer when `result_ok` is set is undefined.
5133     */
5134    struct LDKDecodeError *err;
5135 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5136
5137 /**
5138  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5139  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5141  */
5142 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5143    /**
5144     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5145     * `err` or `result` depending on the state of `result_ok`.
5146     */
5147    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5148    /**
5149     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5150     */
5151    bool result_ok;
5152 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5153
5154 /**
5155  * The contents of CResult_NetAddressu8Z
5156  */
5157 typedef union LDKCResult_NetAddressu8ZPtr {
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 LDKNetAddress *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    uint8_t *err;
5168 } LDKCResult_NetAddressu8ZPtr;
5169
5170 /**
5171  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5172  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5174  */
5175 typedef struct LDKCResult_NetAddressu8Z {
5176    /**
5177     * The contents of this CResult_NetAddressu8Z, accessible via either
5178     * `err` or `result` depending on the state of `result_ok`.
5179     */
5180    union LDKCResult_NetAddressu8ZPtr contents;
5181    /**
5182     * Whether this CResult_NetAddressu8Z represents a success state.
5183     */
5184    bool result_ok;
5185 } LDKCResult_NetAddressu8Z;
5186
5187 /**
5188  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5189  */
5190 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
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 LDKCResult_NetAddressu8Z *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    struct LDKDecodeError *err;
5201 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5202
5203 /**
5204  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5205  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5207  */
5208 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5209    /**
5210     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5211     * `err` or `result` depending on the state of `result_ok`.
5212     */
5213    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5214    /**
5215     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5216     */
5217    bool result_ok;
5218 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5219
5220 /**
5221  * The contents of CResult_NetAddressDecodeErrorZ
5222  */
5223 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
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 LDKNetAddress *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_NetAddressDecodeErrorZPtr;
5235
5236 /**
5237  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
5238  * containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressDecodeErrorZ {
5242    /**
5243     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
5244     * `err` or `result` depending on the state of `result_ok`.
5245     */
5246    union LDKCResult_NetAddressDecodeErrorZPtr contents;
5247    /**
5248     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
5249     */
5250    bool result_ok;
5251 } LDKCResult_NetAddressDecodeErrorZ;
5252
5253
5254
5255 /**
5256  * An update_add_htlc message to be sent or received from a peer
5257  */
5258 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
5259    /**
5260     * A pointer to the opaque Rust object.
5261     * Nearly everywhere, inner must be non-null, however in places where
5262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5263     */
5264    LDKnativeUpdateAddHTLC *inner;
5265    /**
5266     * Indicates that this is the only struct which contains the same pointer.
5267     * Rust functions which take ownership of an object provided via an argument require
5268     * this to be true and invalidate the object pointed to by inner.
5269     */
5270    bool is_owned;
5271 } LDKUpdateAddHTLC;
5272
5273 /**
5274  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5275  * This corresponds to std::vector in C++
5276  */
5277 typedef struct LDKCVec_UpdateAddHTLCZ {
5278    /**
5279     * The elements in the array.
5280     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5281     */
5282    struct LDKUpdateAddHTLC *data;
5283    /**
5284     * The number of elements pointed to by `data`.
5285     */
5286    uintptr_t datalen;
5287 } LDKCVec_UpdateAddHTLCZ;
5288
5289
5290
5291 /**
5292  * An update_fulfill_htlc message to be sent or received from a peer
5293  */
5294 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5295    /**
5296     * A pointer to the opaque Rust object.
5297     * Nearly everywhere, inner must be non-null, however in places where
5298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5299     */
5300    LDKnativeUpdateFulfillHTLC *inner;
5301    /**
5302     * Indicates that this is the only struct which contains the same pointer.
5303     * Rust functions which take ownership of an object provided via an argument require
5304     * this to be true and invalidate the object pointed to by inner.
5305     */
5306    bool is_owned;
5307 } LDKUpdateFulfillHTLC;
5308
5309 /**
5310  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5311  * This corresponds to std::vector in C++
5312  */
5313 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5314    /**
5315     * The elements in the array.
5316     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5317     */
5318    struct LDKUpdateFulfillHTLC *data;
5319    /**
5320     * The number of elements pointed to by `data`.
5321     */
5322    uintptr_t datalen;
5323 } LDKCVec_UpdateFulfillHTLCZ;
5324
5325
5326
5327 /**
5328  * An update_fail_htlc message to be sent or received from a peer
5329  */
5330 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5331    /**
5332     * A pointer to the opaque Rust object.
5333     * Nearly everywhere, inner must be non-null, however in places where
5334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5335     */
5336    LDKnativeUpdateFailHTLC *inner;
5337    /**
5338     * Indicates that this is the only struct which contains the same pointer.
5339     * Rust functions which take ownership of an object provided via an argument require
5340     * this to be true and invalidate the object pointed to by inner.
5341     */
5342    bool is_owned;
5343 } LDKUpdateFailHTLC;
5344
5345 /**
5346  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5347  * This corresponds to std::vector in C++
5348  */
5349 typedef struct LDKCVec_UpdateFailHTLCZ {
5350    /**
5351     * The elements in the array.
5352     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5353     */
5354    struct LDKUpdateFailHTLC *data;
5355    /**
5356     * The number of elements pointed to by `data`.
5357     */
5358    uintptr_t datalen;
5359 } LDKCVec_UpdateFailHTLCZ;
5360
5361
5362
5363 /**
5364  * An update_fail_malformed_htlc message to be sent or received from a peer
5365  */
5366 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5367    /**
5368     * A pointer to the opaque Rust object.
5369     * Nearly everywhere, inner must be non-null, however in places where
5370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5371     */
5372    LDKnativeUpdateFailMalformedHTLC *inner;
5373    /**
5374     * Indicates that this is the only struct which contains the same pointer.
5375     * Rust functions which take ownership of an object provided via an argument require
5376     * this to be true and invalidate the object pointed to by inner.
5377     */
5378    bool is_owned;
5379 } LDKUpdateFailMalformedHTLC;
5380
5381 /**
5382  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5383  * This corresponds to std::vector in C++
5384  */
5385 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5386    /**
5387     * The elements in the array.
5388     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5389     */
5390    struct LDKUpdateFailMalformedHTLC *data;
5391    /**
5392     * The number of elements pointed to by `data`.
5393     */
5394    uintptr_t datalen;
5395 } LDKCVec_UpdateFailMalformedHTLCZ;
5396
5397 /**
5398  * The contents of CResult_AcceptChannelDecodeErrorZ
5399  */
5400 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5401    /**
5402     * A pointer to the contents in the success state.
5403     * Reading from this pointer when `result_ok` is not set is undefined.
5404     */
5405    struct LDKAcceptChannel *result;
5406    /**
5407     * A pointer to the contents in the error state.
5408     * Reading from this pointer when `result_ok` is set is undefined.
5409     */
5410    struct LDKDecodeError *err;
5411 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5412
5413 /**
5414  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5415  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5416  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5417  */
5418 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5419    /**
5420     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5421     * `err` or `result` depending on the state of `result_ok`.
5422     */
5423    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5424    /**
5425     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5426     */
5427    bool result_ok;
5428 } LDKCResult_AcceptChannelDecodeErrorZ;
5429
5430 /**
5431  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5432  */
5433 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
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 LDKAnnouncementSignatures *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_AnnouncementSignaturesDecodeErrorZPtr;
5445
5446 /**
5447  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5448  * containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ {
5452    /**
5453     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5454     * `err` or `result` depending on the state of `result_ok`.
5455     */
5456    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5457    /**
5458     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5459     */
5460    bool result_ok;
5461 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5462
5463 /**
5464  * The contents of CResult_ChannelReestablishDecodeErrorZ
5465  */
5466 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
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 LDKChannelReestablish *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_ChannelReestablishDecodeErrorZPtr;
5478
5479 /**
5480  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5481  * containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
5485    /**
5486     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5487     * `err` or `result` depending on the state of `result_ok`.
5488     */
5489    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5490    /**
5491     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5492     */
5493    bool result_ok;
5494 } LDKCResult_ChannelReestablishDecodeErrorZ;
5495
5496 /**
5497  * The contents of CResult_ClosingSignedDecodeErrorZ
5498  */
5499 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
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 LDKClosingSigned *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_ClosingSignedDecodeErrorZPtr;
5511
5512 /**
5513  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5514  * containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
5518    /**
5519     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5520     * `err` or `result` depending on the state of `result_ok`.
5521     */
5522    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5523    /**
5524     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5525     */
5526    bool result_ok;
5527 } LDKCResult_ClosingSignedDecodeErrorZ;
5528
5529
5530
5531 /**
5532  * A commitment_signed message to be sent or received from a peer
5533  */
5534 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5535    /**
5536     * A pointer to the opaque Rust object.
5537     * Nearly everywhere, inner must be non-null, however in places where
5538     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5539     */
5540    LDKnativeCommitmentSigned *inner;
5541    /**
5542     * Indicates that this is the only struct which contains the same pointer.
5543     * Rust functions which take ownership of an object provided via an argument require
5544     * this to be true and invalidate the object pointed to by inner.
5545     */
5546    bool is_owned;
5547 } LDKCommitmentSigned;
5548
5549 /**
5550  * The contents of CResult_CommitmentSignedDecodeErrorZ
5551  */
5552 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
5553    /**
5554     * A pointer to the contents in the success state.
5555     * Reading from this pointer when `result_ok` is not set is undefined.
5556     */
5557    struct LDKCommitmentSigned *result;
5558    /**
5559     * A pointer to the contents in the error state.
5560     * Reading from this pointer when `result_ok` is set is undefined.
5561     */
5562    struct LDKDecodeError *err;
5563 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
5564
5565 /**
5566  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5567  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5568  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5569  */
5570 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
5571    /**
5572     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5573     * `err` or `result` depending on the state of `result_ok`.
5574     */
5575    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5576    /**
5577     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5578     */
5579    bool result_ok;
5580 } LDKCResult_CommitmentSignedDecodeErrorZ;
5581
5582 /**
5583  * The contents of CResult_FundingCreatedDecodeErrorZ
5584  */
5585 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
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 LDKFundingCreated *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_FundingCreatedDecodeErrorZPtr;
5597
5598 /**
5599  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5600  * containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
5604    /**
5605     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5606     * `err` or `result` depending on the state of `result_ok`.
5607     */
5608    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5609    /**
5610     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5611     */
5612    bool result_ok;
5613 } LDKCResult_FundingCreatedDecodeErrorZ;
5614
5615 /**
5616  * The contents of CResult_FundingSignedDecodeErrorZ
5617  */
5618 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
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 LDKFundingSigned *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_FundingSignedDecodeErrorZPtr;
5630
5631 /**
5632  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5633  * containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
5637    /**
5638     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5639     * `err` or `result` depending on the state of `result_ok`.
5640     */
5641    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5642    /**
5643     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5644     */
5645    bool result_ok;
5646 } LDKCResult_FundingSignedDecodeErrorZ;
5647
5648 /**
5649  * The contents of CResult_FundingLockedDecodeErrorZ
5650  */
5651 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
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 LDKFundingLocked *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_FundingLockedDecodeErrorZPtr;
5663
5664 /**
5665  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5666  * containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
5670    /**
5671     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5672     * `err` or `result` depending on the state of `result_ok`.
5673     */
5674    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5675    /**
5676     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5677     */
5678    bool result_ok;
5679 } LDKCResult_FundingLockedDecodeErrorZ;
5680
5681
5682
5683 /**
5684  * An init message to be sent or received from a peer
5685  */
5686 typedef struct MUST_USE_STRUCT LDKInit {
5687    /**
5688     * A pointer to the opaque Rust object.
5689     * Nearly everywhere, inner must be non-null, however in places where
5690     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5691     */
5692    LDKnativeInit *inner;
5693    /**
5694     * Indicates that this is the only struct which contains the same pointer.
5695     * Rust functions which take ownership of an object provided via an argument require
5696     * this to be true and invalidate the object pointed to by inner.
5697     */
5698    bool is_owned;
5699 } LDKInit;
5700
5701 /**
5702  * The contents of CResult_InitDecodeErrorZ
5703  */
5704 typedef union LDKCResult_InitDecodeErrorZPtr {
5705    /**
5706     * A pointer to the contents in the success state.
5707     * Reading from this pointer when `result_ok` is not set is undefined.
5708     */
5709    struct LDKInit *result;
5710    /**
5711     * A pointer to the contents in the error state.
5712     * Reading from this pointer when `result_ok` is set is undefined.
5713     */
5714    struct LDKDecodeError *err;
5715 } LDKCResult_InitDecodeErrorZPtr;
5716
5717 /**
5718  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5719  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5721  */
5722 typedef struct LDKCResult_InitDecodeErrorZ {
5723    /**
5724     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5725     * `err` or `result` depending on the state of `result_ok`.
5726     */
5727    union LDKCResult_InitDecodeErrorZPtr contents;
5728    /**
5729     * Whether this CResult_InitDecodeErrorZ represents a success state.
5730     */
5731    bool result_ok;
5732 } LDKCResult_InitDecodeErrorZ;
5733
5734 /**
5735  * The contents of CResult_OpenChannelDecodeErrorZ
5736  */
5737 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
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 LDKOpenChannel *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_OpenChannelDecodeErrorZPtr;
5749
5750 /**
5751  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5752  * containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
5756    /**
5757     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5758     * `err` or `result` depending on the state of `result_ok`.
5759     */
5760    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5761    /**
5762     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5763     */
5764    bool result_ok;
5765 } LDKCResult_OpenChannelDecodeErrorZ;
5766
5767 /**
5768  * The contents of CResult_RevokeAndACKDecodeErrorZ
5769  */
5770 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
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 LDKRevokeAndACK *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_RevokeAndACKDecodeErrorZPtr;
5782
5783 /**
5784  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5785  * containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
5789    /**
5790     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5791     * `err` or `result` depending on the state of `result_ok`.
5792     */
5793    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5794    /**
5795     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5796     */
5797    bool result_ok;
5798 } LDKCResult_RevokeAndACKDecodeErrorZ;
5799
5800 /**
5801  * The contents of CResult_ShutdownDecodeErrorZ
5802  */
5803 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
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 LDKShutdown *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_ShutdownDecodeErrorZPtr;
5815
5816 /**
5817  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5818  * containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
5822    /**
5823     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5824     * `err` or `result` depending on the state of `result_ok`.
5825     */
5826    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5827    /**
5828     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5829     */
5830    bool result_ok;
5831 } LDKCResult_ShutdownDecodeErrorZ;
5832
5833 /**
5834  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5835  */
5836 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
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 LDKUpdateFailHTLC *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_UpdateFailHTLCDecodeErrorZPtr;
5848
5849 /**
5850  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5851  * containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
5855    /**
5856     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5857     * `err` or `result` depending on the state of `result_ok`.
5858     */
5859    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5860    /**
5861     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5862     */
5863    bool result_ok;
5864 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5865
5866 /**
5867  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5868  */
5869 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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 LDKUpdateFailMalformedHTLC *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_UpdateFailMalformedHTLCDecodeErrorZPtr;
5881
5882 /**
5883  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5884  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
5888    /**
5889     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5890     * `err` or `result` depending on the state of `result_ok`.
5891     */
5892    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5893    /**
5894     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5895     */
5896    bool result_ok;
5897 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5898
5899
5900
5901 /**
5902  * An update_fee message to be sent or received from a peer
5903  */
5904 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5905    /**
5906     * A pointer to the opaque Rust object.
5907     * Nearly everywhere, inner must be non-null, however in places where
5908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5909     */
5910    LDKnativeUpdateFee *inner;
5911    /**
5912     * Indicates that this is the only struct which contains the same pointer.
5913     * Rust functions which take ownership of an object provided via an argument require
5914     * this to be true and invalidate the object pointed to by inner.
5915     */
5916    bool is_owned;
5917 } LDKUpdateFee;
5918
5919 /**
5920  * The contents of CResult_UpdateFeeDecodeErrorZ
5921  */
5922 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5923    /**
5924     * A pointer to the contents in the success state.
5925     * Reading from this pointer when `result_ok` is not set is undefined.
5926     */
5927    struct LDKUpdateFee *result;
5928    /**
5929     * A pointer to the contents in the error state.
5930     * Reading from this pointer when `result_ok` is set is undefined.
5931     */
5932    struct LDKDecodeError *err;
5933 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5934
5935 /**
5936  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5937  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5939  */
5940 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5941    /**
5942     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5943     * `err` or `result` depending on the state of `result_ok`.
5944     */
5945    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5946    /**
5947     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5948     */
5949    bool result_ok;
5950 } LDKCResult_UpdateFeeDecodeErrorZ;
5951
5952 /**
5953  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5954  */
5955 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
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 LDKUpdateFulfillHTLC *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_UpdateFulfillHTLCDecodeErrorZPtr;
5967
5968 /**
5969  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5970  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
5974    /**
5975     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5976     * `err` or `result` depending on the state of `result_ok`.
5977     */
5978    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5979    /**
5980     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5981     */
5982    bool result_ok;
5983 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5984
5985 /**
5986  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5987  */
5988 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
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 LDKUpdateAddHTLC *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_UpdateAddHTLCDecodeErrorZPtr;
6000
6001 /**
6002  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6003  * containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
6007    /**
6008     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6009     * `err` or `result` depending on the state of `result_ok`.
6010     */
6011    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
6012    /**
6013     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6014     */
6015    bool result_ok;
6016 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
6017
6018
6019
6020 /**
6021  * A ping message to be sent or received from a peer
6022  */
6023 typedef struct MUST_USE_STRUCT LDKPing {
6024    /**
6025     * A pointer to the opaque Rust object.
6026     * Nearly everywhere, inner must be non-null, however in places where
6027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6028     */
6029    LDKnativePing *inner;
6030    /**
6031     * Indicates that this is the only struct which contains the same pointer.
6032     * Rust functions which take ownership of an object provided via an argument require
6033     * this to be true and invalidate the object pointed to by inner.
6034     */
6035    bool is_owned;
6036 } LDKPing;
6037
6038 /**
6039  * The contents of CResult_PingDecodeErrorZ
6040  */
6041 typedef union LDKCResult_PingDecodeErrorZPtr {
6042    /**
6043     * A pointer to the contents in the success state.
6044     * Reading from this pointer when `result_ok` is not set is undefined.
6045     */
6046    struct LDKPing *result;
6047    /**
6048     * A pointer to the contents in the error state.
6049     * Reading from this pointer when `result_ok` is set is undefined.
6050     */
6051    struct LDKDecodeError *err;
6052 } LDKCResult_PingDecodeErrorZPtr;
6053
6054 /**
6055  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6056  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058  */
6059 typedef struct LDKCResult_PingDecodeErrorZ {
6060    /**
6061     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6062     * `err` or `result` depending on the state of `result_ok`.
6063     */
6064    union LDKCResult_PingDecodeErrorZPtr contents;
6065    /**
6066     * Whether this CResult_PingDecodeErrorZ represents a success state.
6067     */
6068    bool result_ok;
6069 } LDKCResult_PingDecodeErrorZ;
6070
6071
6072
6073 /**
6074  * A pong message to be sent or received from a peer
6075  */
6076 typedef struct MUST_USE_STRUCT LDKPong {
6077    /**
6078     * A pointer to the opaque Rust object.
6079     * Nearly everywhere, inner must be non-null, however in places where
6080     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6081     */
6082    LDKnativePong *inner;
6083    /**
6084     * Indicates that this is the only struct which contains the same pointer.
6085     * Rust functions which take ownership of an object provided via an argument require
6086     * this to be true and invalidate the object pointed to by inner.
6087     */
6088    bool is_owned;
6089 } LDKPong;
6090
6091 /**
6092  * The contents of CResult_PongDecodeErrorZ
6093  */
6094 typedef union LDKCResult_PongDecodeErrorZPtr {
6095    /**
6096     * A pointer to the contents in the success state.
6097     * Reading from this pointer when `result_ok` is not set is undefined.
6098     */
6099    struct LDKPong *result;
6100    /**
6101     * A pointer to the contents in the error state.
6102     * Reading from this pointer when `result_ok` is set is undefined.
6103     */
6104    struct LDKDecodeError *err;
6105 } LDKCResult_PongDecodeErrorZPtr;
6106
6107 /**
6108  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6109  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6111  */
6112 typedef struct LDKCResult_PongDecodeErrorZ {
6113    /**
6114     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6115     * `err` or `result` depending on the state of `result_ok`.
6116     */
6117    union LDKCResult_PongDecodeErrorZPtr contents;
6118    /**
6119     * Whether this CResult_PongDecodeErrorZ represents a success state.
6120     */
6121    bool result_ok;
6122 } LDKCResult_PongDecodeErrorZ;
6123
6124 /**
6125  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6126  */
6127 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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 LDKUnsignedChannelAnnouncement *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_UnsignedChannelAnnouncementDecodeErrorZPtr;
6139
6140 /**
6141  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6142  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
6146    /**
6147     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6148     * `err` or `result` depending on the state of `result_ok`.
6149     */
6150    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6151    /**
6152     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6153     */
6154    bool result_ok;
6155 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6156
6157 /**
6158  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6159  */
6160 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
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 LDKChannelAnnouncement *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_ChannelAnnouncementDecodeErrorZPtr;
6172
6173 /**
6174  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6175  * containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
6179    /**
6180     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6181     * `err` or `result` depending on the state of `result_ok`.
6182     */
6183    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6184    /**
6185     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6186     */
6187    bool result_ok;
6188 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6189
6190
6191
6192 /**
6193  * The unsigned part of a channel_update
6194  */
6195 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6196    /**
6197     * A pointer to the opaque Rust object.
6198     * Nearly everywhere, inner must be non-null, however in places where
6199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6200     */
6201    LDKnativeUnsignedChannelUpdate *inner;
6202    /**
6203     * Indicates that this is the only struct which contains the same pointer.
6204     * Rust functions which take ownership of an object provided via an argument require
6205     * this to be true and invalidate the object pointed to by inner.
6206     */
6207    bool is_owned;
6208 } LDKUnsignedChannelUpdate;
6209
6210 /**
6211  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6212  */
6213 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
6214    /**
6215     * A pointer to the contents in the success state.
6216     * Reading from this pointer when `result_ok` is not set is undefined.
6217     */
6218    struct LDKUnsignedChannelUpdate *result;
6219    /**
6220     * A pointer to the contents in the error state.
6221     * Reading from this pointer when `result_ok` is set is undefined.
6222     */
6223    struct LDKDecodeError *err;
6224 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
6225
6226 /**
6227  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6228  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6229  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6230  */
6231 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
6232    /**
6233     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6234     * `err` or `result` depending on the state of `result_ok`.
6235     */
6236    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6237    /**
6238     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6239     */
6240    bool result_ok;
6241 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6242
6243 /**
6244  * The contents of CResult_ChannelUpdateDecodeErrorZ
6245  */
6246 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
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 LDKChannelUpdate *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_ChannelUpdateDecodeErrorZPtr;
6258
6259 /**
6260  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6261  * containing a crate::lightning::ln::msgs::ChannelUpdate 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_ChannelUpdateDecodeErrorZ {
6265    /**
6266     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6267     * `err` or `result` depending on the state of `result_ok`.
6268     */
6269    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6270    /**
6271     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6272     */
6273    bool result_ok;
6274 } LDKCResult_ChannelUpdateDecodeErrorZ;
6275
6276 /**
6277  * The contents of CResult_ErrorMessageDecodeErrorZ
6278  */
6279 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
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 LDKErrorMessage *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_ErrorMessageDecodeErrorZPtr;
6291
6292 /**
6293  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6294  * containing a crate::lightning::ln::msgs::ErrorMessage 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_ErrorMessageDecodeErrorZ {
6298    /**
6299     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6300     * `err` or `result` depending on the state of `result_ok`.
6301     */
6302    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6303    /**
6304     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6305     */
6306    bool result_ok;
6307 } LDKCResult_ErrorMessageDecodeErrorZ;
6308
6309
6310
6311 /**
6312  * The unsigned part of a node_announcement
6313  */
6314 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6315    /**
6316     * A pointer to the opaque Rust object.
6317     * Nearly everywhere, inner must be non-null, however in places where
6318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6319     */
6320    LDKnativeUnsignedNodeAnnouncement *inner;
6321    /**
6322     * Indicates that this is the only struct which contains the same pointer.
6323     * Rust functions which take ownership of an object provided via an argument require
6324     * this to be true and invalidate the object pointed to by inner.
6325     */
6326    bool is_owned;
6327 } LDKUnsignedNodeAnnouncement;
6328
6329 /**
6330  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6331  */
6332 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6333    /**
6334     * A pointer to the contents in the success state.
6335     * Reading from this pointer when `result_ok` is not set is undefined.
6336     */
6337    struct LDKUnsignedNodeAnnouncement *result;
6338    /**
6339     * A pointer to the contents in the error state.
6340     * Reading from this pointer when `result_ok` is set is undefined.
6341     */
6342    struct LDKDecodeError *err;
6343 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
6344
6345 /**
6346  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6347  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6349  */
6350 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
6351    /**
6352     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6353     * `err` or `result` depending on the state of `result_ok`.
6354     */
6355    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6356    /**
6357     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6358     */
6359    bool result_ok;
6360 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6361
6362 /**
6363  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6364  */
6365 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
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 LDKNodeAnnouncement *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_NodeAnnouncementDecodeErrorZPtr;
6377
6378 /**
6379  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6380  * containing a crate::lightning::ln::msgs::NodeAnnouncement 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_NodeAnnouncementDecodeErrorZ {
6384    /**
6385     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6386     * `err` or `result` depending on the state of `result_ok`.
6387     */
6388    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6389    /**
6390     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6391     */
6392    bool result_ok;
6393 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6394
6395 /**
6396  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6397  */
6398 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
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 LDKQueryShortChannelIds *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_QueryShortChannelIdsDecodeErrorZPtr;
6410
6411 /**
6412  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6413  * containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_QueryShortChannelIdsDecodeErrorZ {
6417    /**
6418     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6419     * `err` or `result` depending on the state of `result_ok`.
6420     */
6421    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6422    /**
6423     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6424     */
6425    bool result_ok;
6426 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6427
6428
6429
6430 /**
6431  * A reply_short_channel_ids_end message is sent as a reply to a
6432  * query_short_channel_ids message. The query recipient makes a best
6433  * effort to respond based on their local network view which may not be
6434  * a perfect view of the network.
6435  */
6436 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6437    /**
6438     * A pointer to the opaque Rust object.
6439     * Nearly everywhere, inner must be non-null, however in places where
6440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6441     */
6442    LDKnativeReplyShortChannelIdsEnd *inner;
6443    /**
6444     * Indicates that this is the only struct which contains the same pointer.
6445     * Rust functions which take ownership of an object provided via an argument require
6446     * this to be true and invalidate the object pointed to by inner.
6447     */
6448    bool is_owned;
6449 } LDKReplyShortChannelIdsEnd;
6450
6451 /**
6452  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6453  */
6454 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6455    /**
6456     * A pointer to the contents in the success state.
6457     * Reading from this pointer when `result_ok` is not set is undefined.
6458     */
6459    struct LDKReplyShortChannelIdsEnd *result;
6460    /**
6461     * A pointer to the contents in the error state.
6462     * Reading from this pointer when `result_ok` is set is undefined.
6463     */
6464    struct LDKDecodeError *err;
6465 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6466
6467 /**
6468  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6469  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
6470  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6471  */
6472 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6473    /**
6474     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6475     * `err` or `result` depending on the state of `result_ok`.
6476     */
6477    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6478    /**
6479     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6480     */
6481    bool result_ok;
6482 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6483
6484 /**
6485  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6486  */
6487 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
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 LDKQueryChannelRange *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_QueryChannelRangeDecodeErrorZPtr;
6499
6500 /**
6501  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6502  * containing a crate::lightning::ln::msgs::QueryChannelRange 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_QueryChannelRangeDecodeErrorZ {
6506    /**
6507     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6508     * `err` or `result` depending on the state of `result_ok`.
6509     */
6510    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6511    /**
6512     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6513     */
6514    bool result_ok;
6515 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6516
6517 /**
6518  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6519  */
6520 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
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 LDKReplyChannelRange *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_ReplyChannelRangeDecodeErrorZPtr;
6532
6533 /**
6534  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6535  * containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
6539    /**
6540     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6541     * `err` or `result` depending on the state of `result_ok`.
6542     */
6543    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6544    /**
6545     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6546     */
6547    bool result_ok;
6548 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6549
6550
6551
6552 /**
6553  * A gossip_timestamp_filter message is used by a node to request
6554  * gossip relay for messages in the requested time range when the
6555  * gossip_queries feature has been negotiated.
6556  */
6557 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6558    /**
6559     * A pointer to the opaque Rust object.
6560     * Nearly everywhere, inner must be non-null, however in places where
6561     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6562     */
6563    LDKnativeGossipTimestampFilter *inner;
6564    /**
6565     * Indicates that this is the only struct which contains the same pointer.
6566     * Rust functions which take ownership of an object provided via an argument require
6567     * this to be true and invalidate the object pointed to by inner.
6568     */
6569    bool is_owned;
6570 } LDKGossipTimestampFilter;
6571
6572 /**
6573  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6574  */
6575 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6576    /**
6577     * A pointer to the contents in the success state.
6578     * Reading from this pointer when `result_ok` is not set is undefined.
6579     */
6580    struct LDKGossipTimestampFilter *result;
6581    /**
6582     * A pointer to the contents in the error state.
6583     * Reading from this pointer when `result_ok` is set is undefined.
6584     */
6585    struct LDKDecodeError *err;
6586 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6587
6588 /**
6589  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6590  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
6591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6592  */
6593 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6594    /**
6595     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6596     * `err` or `result` depending on the state of `result_ok`.
6597     */
6598    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6599    /**
6600     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6601     */
6602    bool result_ok;
6603 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6604
6605 /**
6606  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
6607  * may occur.
6608  */
6609 typedef enum LDKSignOrCreationError_Tag {
6610    /**
6611     * An error occurred during signing
6612     */
6613    LDKSignOrCreationError_SignError,
6614    /**
6615     * An error occurred while building the transaction
6616     */
6617    LDKSignOrCreationError_CreationError,
6618    /**
6619     * Must be last for serialization purposes
6620     */
6621    LDKSignOrCreationError_Sentinel,
6622 } LDKSignOrCreationError_Tag;
6623
6624 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
6625    LDKSignOrCreationError_Tag tag;
6626    union {
6627       struct {
6628          enum LDKCreationError creation_error;
6629       };
6630    };
6631 } LDKSignOrCreationError;
6632
6633 /**
6634  * The contents of CResult_InvoiceSignOrCreationErrorZ
6635  */
6636 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
6637    /**
6638     * A pointer to the contents in the success state.
6639     * Reading from this pointer when `result_ok` is not set is undefined.
6640     */
6641    struct LDKInvoice *result;
6642    /**
6643     * A pointer to the contents in the error state.
6644     * Reading from this pointer when `result_ok` is set is undefined.
6645     */
6646    struct LDKSignOrCreationError *err;
6647 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
6648
6649 /**
6650  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
6651  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
6652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6653  */
6654 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
6655    /**
6656     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
6657     * `err` or `result` depending on the state of `result_ok`.
6658     */
6659    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
6660    /**
6661     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
6662     */
6663    bool result_ok;
6664 } LDKCResult_InvoiceSignOrCreationErrorZ;
6665
6666 /**
6667  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6668  */
6669 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
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 LDKSpendableOutputDescriptor *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 LDKDecodeError *err;
6680 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6681
6682 /**
6683  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6684  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6686  */
6687 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6688    /**
6689     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6690     * `err` or `result` depending on the state of `result_ok`.
6691     */
6692    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6693    /**
6694     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6695     */
6696    bool result_ok;
6697 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6698
6699 /**
6700  * The contents of CResult_SignDecodeErrorZ
6701  */
6702 typedef union LDKCResult_SignDecodeErrorZPtr {
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 LDKSign *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_SignDecodeErrorZPtr;
6714
6715 /**
6716  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6717  * containing a crate::lightning::chain::keysinterface::Sign 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_SignDecodeErrorZ {
6721    /**
6722     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6723     * `err` or `result` depending on the state of `result_ok`.
6724     */
6725    union LDKCResult_SignDecodeErrorZPtr contents;
6726    /**
6727     * Whether this CResult_SignDecodeErrorZ represents a success state.
6728     */
6729    bool result_ok;
6730 } LDKCResult_SignDecodeErrorZ;
6731
6732 /**
6733  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6734  * allows recovering the exact public key which created the signature given the message.
6735  */
6736 typedef struct LDKRecoverableSignature {
6737    /**
6738     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6739     * recovery.
6740     */
6741    uint8_t serialized_form[68];
6742 } LDKRecoverableSignature;
6743
6744 /**
6745  * The contents of CResult_RecoverableSignatureNoneZ
6746  */
6747 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6748    /**
6749     * A pointer to the contents in the success state.
6750     * Reading from this pointer when `result_ok` is not set is undefined.
6751     */
6752    struct LDKRecoverableSignature *result;
6753    /**
6754     * Note that this value is always NULL, as there are no contents in the Err variant
6755     */
6756    void *err;
6757 } LDKCResult_RecoverableSignatureNoneZPtr;
6758
6759 /**
6760  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6761  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6762  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6763  */
6764 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6765    /**
6766     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6767     * `err` or `result` depending on the state of `result_ok`.
6768     */
6769    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6770    /**
6771     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6772     */
6773    bool result_ok;
6774 } LDKCResult_RecoverableSignatureNoneZ;
6775
6776 /**
6777  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6778  * This corresponds to std::vector in C++
6779  */
6780 typedef struct LDKCVec_CVec_u8ZZ {
6781    /**
6782     * The elements in the array.
6783     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6784     */
6785    struct LDKCVec_u8Z *data;
6786    /**
6787     * The number of elements pointed to by `data`.
6788     */
6789    uintptr_t datalen;
6790 } LDKCVec_CVec_u8ZZ;
6791
6792 /**
6793  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6794  */
6795 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6796    /**
6797     * A pointer to the contents in the success state.
6798     * Reading from this pointer when `result_ok` is not set is undefined.
6799     */
6800    struct LDKCVec_CVec_u8ZZ *result;
6801    /**
6802     * Note that this value is always NULL, as there are no contents in the Err variant
6803     */
6804    void *err;
6805 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6806
6807 /**
6808  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6809  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6810  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6811  */
6812 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6813    /**
6814     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6815     * `err` or `result` depending on the state of `result_ok`.
6816     */
6817    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6818    /**
6819     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6820     */
6821    bool result_ok;
6822 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6823
6824
6825
6826 /**
6827  * A simple implementation of Sign that just keeps the private keys in memory.
6828  *
6829  * This implementation performs no policy checks and is insufficient by itself as
6830  * a secure external signer.
6831  */
6832 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6833    /**
6834     * A pointer to the opaque Rust object.
6835     * Nearly everywhere, inner must be non-null, however in places where
6836     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6837     */
6838    LDKnativeInMemorySigner *inner;
6839    /**
6840     * Indicates that this is the only struct which contains the same pointer.
6841     * Rust functions which take ownership of an object provided via an argument require
6842     * this to be true and invalidate the object pointed to by inner.
6843     */
6844    bool is_owned;
6845 } LDKInMemorySigner;
6846
6847 /**
6848  * The contents of CResult_InMemorySignerDecodeErrorZ
6849  */
6850 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6851    /**
6852     * A pointer to the contents in the success state.
6853     * Reading from this pointer when `result_ok` is not set is undefined.
6854     */
6855    struct LDKInMemorySigner *result;
6856    /**
6857     * A pointer to the contents in the error state.
6858     * Reading from this pointer when `result_ok` is set is undefined.
6859     */
6860    struct LDKDecodeError *err;
6861 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6862
6863 /**
6864  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6865  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6866  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6867  */
6868 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6869    /**
6870     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6871     * `err` or `result` depending on the state of `result_ok`.
6872     */
6873    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6874    /**
6875     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6876     */
6877    bool result_ok;
6878 } LDKCResult_InMemorySignerDecodeErrorZ;
6879
6880 /**
6881  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6882  * This corresponds to std::vector in C++
6883  */
6884 typedef struct LDKCVec_TxOutZ {
6885    /**
6886     * The elements in the array.
6887     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6888     */
6889    struct LDKTxOut *data;
6890    /**
6891     * The number of elements pointed to by `data`.
6892     */
6893    uintptr_t datalen;
6894 } LDKCVec_TxOutZ;
6895
6896 /**
6897  * The contents of CResult_TransactionNoneZ
6898  */
6899 typedef union LDKCResult_TransactionNoneZPtr {
6900    /**
6901     * A pointer to the contents in the success state.
6902     * Reading from this pointer when `result_ok` is not set is undefined.
6903     */
6904    struct LDKTransaction *result;
6905    /**
6906     * Note that this value is always NULL, as there are no contents in the Err variant
6907     */
6908    void *err;
6909 } LDKCResult_TransactionNoneZPtr;
6910
6911 /**
6912  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6913  * containing a crate::c_types::Transaction on success and a () on failure.
6914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6915  */
6916 typedef struct LDKCResult_TransactionNoneZ {
6917    /**
6918     * The contents of this CResult_TransactionNoneZ, accessible via either
6919     * `err` or `result` depending on the state of `result_ok`.
6920     */
6921    union LDKCResult_TransactionNoneZPtr contents;
6922    /**
6923     * Whether this CResult_TransactionNoneZ represents a success state.
6924     */
6925    bool result_ok;
6926 } LDKCResult_TransactionNoneZ;
6927
6928 /**
6929  * The contents of CResult_NoneErrorZ
6930  */
6931 typedef union LDKCResult_NoneErrorZPtr {
6932    /**
6933     * Note that this value is always NULL, as there are no contents in the OK variant
6934     */
6935    void *result;
6936    /**
6937     * A pointer to the contents in the error state.
6938     * Reading from this pointer when `result_ok` is set is undefined.
6939     */
6940    enum LDKIOError *err;
6941 } LDKCResult_NoneErrorZPtr;
6942
6943 /**
6944  * A CResult_NoneErrorZ represents the result of a fallible operation,
6945  * containing a () on success and a crate::c_types::IOError on failure.
6946  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6947  */
6948 typedef struct LDKCResult_NoneErrorZ {
6949    /**
6950     * The contents of this CResult_NoneErrorZ, accessible via either
6951     * `err` or `result` depending on the state of `result_ok`.
6952     */
6953    union LDKCResult_NoneErrorZPtr contents;
6954    /**
6955     * Whether this CResult_NoneErrorZ represents a success state.
6956     */
6957    bool result_ok;
6958 } LDKCResult_NoneErrorZ;
6959
6960 /**
6961  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6962  * This corresponds to std::vector in C++
6963  */
6964 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6965    /**
6966     * The elements in the array.
6967     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6968     */
6969    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6970    /**
6971     * The number of elements pointed to by `data`.
6972     */
6973    uintptr_t datalen;
6974 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6975
6976 /**
6977  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6978  */
6979 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6980    /**
6981     * A pointer to the contents in the success state.
6982     * Reading from this pointer when `result_ok` is not set is undefined.
6983     */
6984    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6985    /**
6986     * A pointer to the contents in the error state.
6987     * Reading from this pointer when `result_ok` is set is undefined.
6988     */
6989    enum LDKIOError *err;
6990 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6991
6992 /**
6993  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6994  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6995  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6996  */
6997 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6998    /**
6999     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7000     * `err` or `result` depending on the state of `result_ok`.
7001     */
7002    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7003    /**
7004     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7005     */
7006    bool result_ok;
7007 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7008
7009 /**
7010  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
7011  * too-high values)
7012  */
7013 typedef enum LDKAPIError_Tag {
7014    /**
7015     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
7016     * are documented, but generally indicates some precondition of a function was violated.
7017     */
7018    LDKAPIError_APIMisuseError,
7019    /**
7020     * Due to a high feerate, we were unable to complete the request.
7021     * For example, this may be returned if the feerate implies we cannot open a channel at the
7022     * requested value, but opening a larger channel would succeed.
7023     */
7024    LDKAPIError_FeeRateTooHigh,
7025    /**
7026     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
7027     * too-many-hops, etc).
7028     */
7029    LDKAPIError_RouteError,
7030    /**
7031     * We were unable to complete the request as the Channel required to do so is unable to
7032     * complete the request (or was not found). This can take many forms, including disconnected
7033     * peer, channel at capacity, channel shutting down, etc.
7034     */
7035    LDKAPIError_ChannelUnavailable,
7036    /**
7037     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
7038     * attempted action to fail.
7039     */
7040    LDKAPIError_MonitorUpdateFailed,
7041    /**
7042     * Must be last for serialization purposes
7043     */
7044    LDKAPIError_Sentinel,
7045 } LDKAPIError_Tag;
7046
7047 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
7048    /**
7049     * A human-readable error message
7050     */
7051    struct LDKStr err;
7052 } LDKAPIError_LDKAPIMisuseError_Body;
7053
7054 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7055    /**
7056     * A human-readable error message
7057     */
7058    struct LDKStr err;
7059    /**
7060     * The feerate which was too high.
7061     */
7062    uint32_t feerate;
7063 } LDKAPIError_LDKFeeRateTooHigh_Body;
7064
7065 typedef struct LDKAPIError_LDKRouteError_Body {
7066    /**
7067     * A human-readable error message
7068     */
7069    struct LDKStr err;
7070 } LDKAPIError_LDKRouteError_Body;
7071
7072 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7073    /**
7074     * A human-readable error message
7075     */
7076    struct LDKStr err;
7077 } LDKAPIError_LDKChannelUnavailable_Body;
7078
7079 typedef struct MUST_USE_STRUCT LDKAPIError {
7080    LDKAPIError_Tag tag;
7081    union {
7082       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7083       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7084       LDKAPIError_LDKRouteError_Body route_error;
7085       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7086    };
7087 } LDKAPIError;
7088
7089 /**
7090  * The contents of CResult_NoneAPIErrorZ
7091  */
7092 typedef union LDKCResult_NoneAPIErrorZPtr {
7093    /**
7094     * Note that this value is always NULL, as there are no contents in the OK variant
7095     */
7096    void *result;
7097    /**
7098     * A pointer to the contents in the error state.
7099     * Reading from this pointer when `result_ok` is set is undefined.
7100     */
7101    struct LDKAPIError *err;
7102 } LDKCResult_NoneAPIErrorZPtr;
7103
7104 /**
7105  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7106  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7107  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7108  */
7109 typedef struct LDKCResult_NoneAPIErrorZ {
7110    /**
7111     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7112     * `err` or `result` depending on the state of `result_ok`.
7113     */
7114    union LDKCResult_NoneAPIErrorZPtr contents;
7115    /**
7116     * Whether this CResult_NoneAPIErrorZ represents a success state.
7117     */
7118    bool result_ok;
7119 } LDKCResult_NoneAPIErrorZ;
7120
7121 /**
7122  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7123  * This corresponds to std::vector in C++
7124  */
7125 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7126    /**
7127     * The elements in the array.
7128     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7129     */
7130    struct LDKCResult_NoneAPIErrorZ *data;
7131    /**
7132     * The number of elements pointed to by `data`.
7133     */
7134    uintptr_t datalen;
7135 } LDKCVec_CResult_NoneAPIErrorZZ;
7136
7137 /**
7138  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7139  * This corresponds to std::vector in C++
7140  */
7141 typedef struct LDKCVec_APIErrorZ {
7142    /**
7143     * The elements in the array.
7144     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7145     */
7146    struct LDKAPIError *data;
7147    /**
7148     * The number of elements pointed to by `data`.
7149     */
7150    uintptr_t datalen;
7151 } LDKCVec_APIErrorZ;
7152
7153 /**
7154  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7155  * Err() type describing which state the payment is in, see the description of individual enum
7156  * states for more.
7157  */
7158 typedef enum LDKPaymentSendFailure_Tag {
7159    /**
7160     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7161     * send the payment at all. No channel state has been changed or messages sent to peers, and
7162     * once you've changed the parameter at error, you can freely retry the payment in full.
7163     */
7164    LDKPaymentSendFailure_ParameterError,
7165    /**
7166     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7167     * from attempting to send the payment at all. No channel state has been changed or messages
7168     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7169     * payment in full.
7170     *
7171     * The results here are ordered the same as the paths in the route object which was passed to
7172     * send_payment.
7173     */
7174    LDKPaymentSendFailure_PathParameterError,
7175    /**
7176     * All paths which were attempted failed to send, with no channel state change taking place.
7177     * You can freely retry the payment in full (though you probably want to do so over different
7178     * paths than the ones selected).
7179     */
7180    LDKPaymentSendFailure_AllFailedRetrySafe,
7181    /**
7182     * Some paths which were attempted failed to send, though possibly not all. At least some
7183     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7184     * in over-/re-payment.
7185     *
7186     * The results here are ordered the same as the paths in the route object which was passed to
7187     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7188     * retried (though there is currently no API with which to do so).
7189     *
7190     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7191     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7192     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7193     * with the latest update_id.
7194     */
7195    LDKPaymentSendFailure_PartialFailure,
7196    /**
7197     * Must be last for serialization purposes
7198     */
7199    LDKPaymentSendFailure_Sentinel,
7200 } LDKPaymentSendFailure_Tag;
7201
7202 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7203    LDKPaymentSendFailure_Tag tag;
7204    union {
7205       struct {
7206          struct LDKAPIError parameter_error;
7207       };
7208       struct {
7209          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7210       };
7211       struct {
7212          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7213       };
7214       struct {
7215          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
7216       };
7217    };
7218 } LDKPaymentSendFailure;
7219
7220 /**
7221  * The contents of CResult_NonePaymentSendFailureZ
7222  */
7223 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7224    /**
7225     * Note that this value is always NULL, as there are no contents in the OK variant
7226     */
7227    void *result;
7228    /**
7229     * A pointer to the contents in the error state.
7230     * Reading from this pointer when `result_ok` is set is undefined.
7231     */
7232    struct LDKPaymentSendFailure *err;
7233 } LDKCResult_NonePaymentSendFailureZPtr;
7234
7235 /**
7236  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7237  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7238  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7239  */
7240 typedef struct LDKCResult_NonePaymentSendFailureZ {
7241    /**
7242     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7243     * `err` or `result` depending on the state of `result_ok`.
7244     */
7245    union LDKCResult_NonePaymentSendFailureZPtr contents;
7246    /**
7247     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7248     */
7249    bool result_ok;
7250 } LDKCResult_NonePaymentSendFailureZ;
7251
7252 /**
7253  * A tuple of 2 elements. See the individual fields for the types contained.
7254  */
7255 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7256    /**
7257     * The element at position 0
7258     */
7259    struct LDKThirtyTwoBytes a;
7260    /**
7261     * The element at position 1
7262     */
7263    struct LDKThirtyTwoBytes b;
7264 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7265
7266 /**
7267  * The contents of CResult_PaymentSecretAPIErrorZ
7268  */
7269 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7270    /**
7271     * A pointer to the contents in the success state.
7272     * Reading from this pointer when `result_ok` is not set is undefined.
7273     */
7274    struct LDKThirtyTwoBytes *result;
7275    /**
7276     * A pointer to the contents in the error state.
7277     * Reading from this pointer when `result_ok` is set is undefined.
7278     */
7279    struct LDKAPIError *err;
7280 } LDKCResult_PaymentSecretAPIErrorZPtr;
7281
7282 /**
7283  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7284  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7285  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7286  */
7287 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7288    /**
7289     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7290     * `err` or `result` depending on the state of `result_ok`.
7291     */
7292    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7293    /**
7294     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7295     */
7296    bool result_ok;
7297 } LDKCResult_PaymentSecretAPIErrorZ;
7298
7299 /**
7300  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7301  * This corresponds to std::vector in C++
7302  */
7303 typedef struct LDKCVec_ChannelMonitorZ {
7304    /**
7305     * The elements in the array.
7306     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7307     */
7308    struct LDKChannelMonitor *data;
7309    /**
7310     * The number of elements pointed to by `data`.
7311     */
7312    uintptr_t datalen;
7313 } LDKCVec_ChannelMonitorZ;
7314
7315 /**
7316  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7317  * blocks are connected and disconnected.
7318  *
7319  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7320  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7321  * channel state changes and HTLCs are resolved. See method documentation for specific
7322  * requirements.
7323  *
7324  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7325  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7326  * without taking any further action such as persisting the current state.
7327  *
7328  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7329  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7330  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7331  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7332  * multiple instances.
7333  *
7334  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7335  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7336  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
7337  */
7338 typedef struct LDKWatch {
7339    /**
7340     * An opaque pointer which is passed to your function implementations as an argument.
7341     * This has no meaning in the LDK, and can be NULL or any other value.
7342     */
7343    void *this_arg;
7344    /**
7345     * Watches a channel identified by `funding_txo` using `monitor`.
7346     *
7347     * Implementations are responsible for watching the chain for the funding transaction along
7348     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7349     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7350     *
7351     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7352     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7353     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7354     */
7355    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7356    /**
7357     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7358     *
7359     * Implementations must call [`update_monitor`] with the given update. See
7360     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7361     *
7362     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7363     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7364     */
7365    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7366    /**
7367     * Returns any monitor events since the last call. Subsequent calls must only return new
7368     * events.
7369     */
7370    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
7371    /**
7372     * Frees any resources associated with this object given its this_arg pointer.
7373     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7374     */
7375    void (*free)(void *this_arg);
7376 } LDKWatch;
7377
7378 /**
7379  * An interface to send a transaction to the Bitcoin network.
7380  */
7381 typedef struct LDKBroadcasterInterface {
7382    /**
7383     * An opaque pointer which is passed to your function implementations as an argument.
7384     * This has no meaning in the LDK, and can be NULL or any other value.
7385     */
7386    void *this_arg;
7387    /**
7388     * Sends a transaction out to (hopefully) be mined.
7389     */
7390    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7391    /**
7392     * Frees any resources associated with this object given its this_arg pointer.
7393     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7394     */
7395    void (*free)(void *this_arg);
7396 } LDKBroadcasterInterface;
7397
7398 /**
7399  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7400  * own the memory pointed to by data.
7401  */
7402 typedef struct LDKu8slice {
7403    /**
7404     * A pointer to the byte buffer
7405     */
7406    const uint8_t *data;
7407    /**
7408     * The number of bytes pointed to by `data`.
7409     */
7410    uintptr_t datalen;
7411 } LDKu8slice;
7412
7413 /**
7414  * A trait to describe an object which can get user secrets and key material.
7415  */
7416 typedef struct LDKKeysInterface {
7417    /**
7418     * An opaque pointer which is passed to your function implementations as an argument.
7419     * This has no meaning in the LDK, and can be NULL or any other value.
7420     */
7421    void *this_arg;
7422    /**
7423     * Get node secret key (aka node_id or network_key).
7424     *
7425     * This method must return the same value each time it is called.
7426     */
7427    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
7428    /**
7429     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7430     *
7431     * This method should return a different value each time it is called, to avoid linking
7432     * on-chain funds across channels as controlled to the same user.
7433     */
7434    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7435    /**
7436     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
7437     * a channel.
7438     *
7439     * This method should return a different value each time it is called, to avoid linking
7440     * on-chain funds across channels as controlled to the same user.
7441     */
7442    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
7443    /**
7444     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7445     * restarted with some stale data!
7446     *
7447     * This method must return a different value each time it is called.
7448     */
7449    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7450    /**
7451     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7452     * onion packets and for temporary channel IDs. There is no requirement that these be
7453     * persisted anywhere, though they must be unique across restarts.
7454     *
7455     * This method must return a different value each time it is called.
7456     */
7457    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7458    /**
7459     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7460     * This is only called during deserialization of other objects which contain
7461     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7462     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7463     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7464     * you've read all of the provided bytes to ensure no corruption occurred.
7465     */
7466    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7467    /**
7468     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
7469     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
7470     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7471     * blindly signing the hash.
7472     */
7473    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
7474    /**
7475     * Frees any resources associated with this object given its this_arg pointer.
7476     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7477     */
7478    void (*free)(void *this_arg);
7479 } LDKKeysInterface;
7480
7481 /**
7482  * A trait which should be implemented to provide feerate information on a number of time
7483  * horizons.
7484  *
7485  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7486  * called from inside the library in response to chain events, P2P events, or timer events).
7487  */
7488 typedef struct LDKFeeEstimator {
7489    /**
7490     * An opaque pointer which is passed to your function implementations as an argument.
7491     * This has no meaning in the LDK, and can be NULL or any other value.
7492     */
7493    void *this_arg;
7494    /**
7495     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7496     *
7497     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
7498     * don't put us below 1 satoshi-per-byte).
7499     *
7500     * This translates to:
7501     *  * satoshis-per-byte * 250
7502     *  * ceil(satoshis-per-kbyte / 4)
7503     */
7504    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7505    /**
7506     * Frees any resources associated with this object given its this_arg pointer.
7507     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7508     */
7509    void (*free)(void *this_arg);
7510 } LDKFeeEstimator;
7511
7512 /**
7513  * A trait encapsulating the operations required of a logger
7514  */
7515 typedef struct LDKLogger {
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     * Logs the `Record`
7523     */
7524    void (*log)(const void *this_arg, const char *record);
7525    /**
7526     * Frees any resources associated with this object given its this_arg pointer.
7527     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7528     */
7529    void (*free)(void *this_arg);
7530 } LDKLogger;
7531
7532
7533
7534 /**
7535  * Manager which keeps track of a number of channels and sends messages to the appropriate
7536  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7537  *
7538  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7539  * to individual Channels.
7540  *
7541  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7542  * all peers during write/read (though does not modify this instance, only the instance being
7543  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7544  * called funding_transaction_generated for outbound channels).
7545  *
7546  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7547  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7548  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7549  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7550  * the serialization process). If the deserialized version is out-of-date compared to the
7551  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7552  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7553  *
7554  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7555  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7556  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7557  * block_connected() to step towards your best block) upon deserialization before using the
7558  * object!
7559  *
7560  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7561  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7562  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7563  * offline for a full minute. In order to track this, you must call
7564  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7565  *
7566  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7567  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7568  * essentially you should default to using a SimpleRefChannelManager, and use a
7569  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7570  * you're using lightning-net-tokio.
7571  */
7572 typedef struct MUST_USE_STRUCT LDKChannelManager {
7573    /**
7574     * A pointer to the opaque Rust object.
7575     * Nearly everywhere, inner must be non-null, however in places where
7576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7577     */
7578    LDKnativeChannelManager *inner;
7579    /**
7580     * Indicates that this is the only struct which contains the same pointer.
7581     * Rust functions which take ownership of an object provided via an argument require
7582     * this to be true and invalidate the object pointed to by inner.
7583     */
7584    bool is_owned;
7585 } LDKChannelManager;
7586
7587 /**
7588  * A tuple of 2 elements. See the individual fields for the types contained.
7589  */
7590 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7591    /**
7592     * The element at position 0
7593     */
7594    struct LDKThirtyTwoBytes a;
7595    /**
7596     * The element at position 1
7597     */
7598    struct LDKChannelManager b;
7599 } LDKC2Tuple_BlockHashChannelManagerZ;
7600
7601 /**
7602  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7603  */
7604 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7605    /**
7606     * A pointer to the contents in the success state.
7607     * Reading from this pointer when `result_ok` is not set is undefined.
7608     */
7609    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7610    /**
7611     * A pointer to the contents in the error state.
7612     * Reading from this pointer when `result_ok` is set is undefined.
7613     */
7614    struct LDKDecodeError *err;
7615 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7616
7617 /**
7618  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7619  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7620  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7621  */
7622 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7623    /**
7624     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7625     * `err` or `result` depending on the state of `result_ok`.
7626     */
7627    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7628    /**
7629     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7630     */
7631    bool result_ok;
7632 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7633
7634 /**
7635  * A trait indicating an object may generate message send events
7636  */
7637 typedef struct LDKMessageSendEventsProvider {
7638    /**
7639     * An opaque pointer which is passed to your function implementations as an argument.
7640     * This has no meaning in the LDK, and can be NULL or any other value.
7641     */
7642    void *this_arg;
7643    /**
7644     * Gets the list of pending events which were generated by previous actions, clearing the list
7645     * in the process.
7646     */
7647    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7648    /**
7649     * Frees any resources associated with this object given its this_arg pointer.
7650     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7651     */
7652    void (*free)(void *this_arg);
7653 } LDKMessageSendEventsProvider;
7654
7655 /**
7656  * A trait implemented for objects handling events from [`EventsProvider`].
7657  */
7658 typedef struct LDKEventHandler {
7659    /**
7660     * An opaque pointer which is passed to your function implementations as an argument.
7661     * This has no meaning in the LDK, and can be NULL or any other value.
7662     */
7663    void *this_arg;
7664    /**
7665     * Handles the given [`Event`].
7666     *
7667     * See [`EventsProvider`] for details that must be considered when implementing this method.
7668     */
7669    void (*handle_event)(const void *this_arg, struct LDKEvent event);
7670    /**
7671     * Frees any resources associated with this object given its this_arg pointer.
7672     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7673     */
7674    void (*free)(void *this_arg);
7675 } LDKEventHandler;
7676
7677 /**
7678  * A trait indicating an object may generate events.
7679  *
7680  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
7681  *
7682  * # Requirements
7683  *
7684  * See [`process_pending_events`] for requirements around event processing.
7685  *
7686  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
7687  * event since the last invocation. The handler must either act upon the event immediately
7688  * or preserve it for later handling.
7689  *
7690  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
7691  * consult the provider's documentation on the implication of processing events and how a handler
7692  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
7693  * [`ChainMonitor::process_pending_events`]).
7694  *
7695  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
7696  * own type(s).
7697  *
7698  * [`process_pending_events`]: Self::process_pending_events
7699  * [`handle_event`]: EventHandler::handle_event
7700  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
7701  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
7702  */
7703 typedef struct LDKEventsProvider {
7704    /**
7705     * An opaque pointer which is passed to your function implementations as an argument.
7706     * This has no meaning in the LDK, and can be NULL or any other value.
7707     */
7708    void *this_arg;
7709    /**
7710     * Processes any events generated since the last call using the given event handler.
7711     *
7712     * Subsequent calls must only process new events. However, handlers must be capable of handling
7713     * duplicate events across process restarts. This may occur if the provider was recovered from
7714     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
7715     */
7716    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
7717    /**
7718     * Frees any resources associated with this object given its this_arg pointer.
7719     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7720     */
7721    void (*free)(void *this_arg);
7722 } LDKEventsProvider;
7723
7724
7725
7726 /**
7727  * Configuration we set when applicable.
7728  *
7729  * Default::default() provides sane defaults.
7730  */
7731 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7732    /**
7733     * A pointer to the opaque Rust object.
7734     * Nearly everywhere, inner must be non-null, however in places where
7735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7736     */
7737    LDKnativeChannelHandshakeConfig *inner;
7738    /**
7739     * Indicates that this is the only struct which contains the same pointer.
7740     * Rust functions which take ownership of an object provided via an argument require
7741     * this to be true and invalidate the object pointed to by inner.
7742     */
7743    bool is_owned;
7744 } LDKChannelHandshakeConfig;
7745
7746
7747
7748 /**
7749  * Optional channel limits which are applied during channel creation.
7750  *
7751  * These limits are only applied to our counterparty's limits, not our own.
7752  *
7753  * Use 0/<type>::max_value() as appropriate to skip checking.
7754  *
7755  * Provides sane defaults for most configurations.
7756  *
7757  * Most additional limits are disabled except those with which specify a default in individual
7758  * field documentation. Note that this may result in barely-usable channels, but since they
7759  * are applied mostly only to incoming channels that's not much of a problem.
7760  */
7761 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7762    /**
7763     * A pointer to the opaque Rust object.
7764     * Nearly everywhere, inner must be non-null, however in places where
7765     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7766     */
7767    LDKnativeChannelHandshakeLimits *inner;
7768    /**
7769     * Indicates that this is the only struct which contains the same pointer.
7770     * Rust functions which take ownership of an object provided via an argument require
7771     * this to be true and invalidate the object pointed to by inner.
7772     */
7773    bool is_owned;
7774 } LDKChannelHandshakeLimits;
7775
7776
7777
7778 /**
7779  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7780  *
7781  * Default::default() provides sane defaults for most configurations
7782  * (but currently with 0 relay fees!)
7783  */
7784 typedef struct MUST_USE_STRUCT LDKUserConfig {
7785    /**
7786     * A pointer to the opaque Rust object.
7787     * Nearly everywhere, inner must be non-null, however in places where
7788     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7789     */
7790    LDKnativeUserConfig *inner;
7791    /**
7792     * Indicates that this is the only struct which contains the same pointer.
7793     * Rust functions which take ownership of an object provided via an argument require
7794     * this to be true and invalidate the object pointed to by inner.
7795     */
7796    bool is_owned;
7797 } LDKUserConfig;
7798
7799 /**
7800  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7801  * UTXOs.
7802  */
7803 typedef struct LDKAccess {
7804    /**
7805     * An opaque pointer which is passed to your function implementations as an argument.
7806     * This has no meaning in the LDK, and can be NULL or any other value.
7807     */
7808    void *this_arg;
7809    /**
7810     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7811     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7812     * is unknown.
7813     *
7814     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7815     */
7816    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7817    /**
7818     * Frees any resources associated with this object given its this_arg pointer.
7819     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7820     */
7821    void (*free)(void *this_arg);
7822 } LDKAccess;
7823
7824 /**
7825  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7826  * chain.
7827  *
7828  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7829  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7830  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7831  * when needed.
7832  */
7833 typedef struct LDKListen {
7834    /**
7835     * An opaque pointer which is passed to your function implementations as an argument.
7836     * This has no meaning in the LDK, and can be NULL or any other value.
7837     */
7838    void *this_arg;
7839    /**
7840     * Notifies the listener that a block was added at the given height.
7841     */
7842    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7843    /**
7844     * Notifies the listener that a block was removed at the given height.
7845     */
7846    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7847    /**
7848     * Frees any resources associated with this object given its this_arg pointer.
7849     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7850     */
7851    void (*free)(void *this_arg);
7852 } LDKListen;
7853
7854 /**
7855  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7856  * unconfirmed during a chain reorganization.
7857  *
7858  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7859  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7860  * related to registered transactions and outputs. Upon notification, it would pass along the
7861  * matching transactions using this interface.
7862  *
7863  * # Use
7864  *
7865  * The intended use is as follows:
7866  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7867  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7868  *   that has been reorganized out of the chain.
7869  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7870  *
7871  * # Order
7872  *
7873  * Clients must call these methods in chain order. Specifically:
7874  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7875  *   block.
7876  * - Dependent transactions within the same block must be given in topological order, possibly in
7877  *   separate calls.
7878  * - Unconfirmed transactions must be given after the original confirmations and before any
7879  *   reconfirmation.
7880  *
7881  * See individual method documentation for further details.
7882  *
7883  * [`transactions_confirmed`]: Self::transactions_confirmed
7884  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7885  * [`best_block_updated`]: Self::best_block_updated
7886  * [`get_relevant_txids`]: Self::get_relevant_txids
7887  */
7888 typedef struct LDKConfirm {
7889    /**
7890     * An opaque pointer which is passed to your function implementations as an argument.
7891     * This has no meaning in the LDK, and can be NULL or any other value.
7892     */
7893    void *this_arg;
7894    /**
7895     * Processes transactions confirmed in a block with a given header and height.
7896     *
7897     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7898     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7899     * appearing in the same block do not need to be included in the same call; instead, multiple
7900     * calls with additional transactions may be made so long as they are made in [chain order].
7901     *
7902     * May be called before or after [`best_block_updated`] for the corresponding block. However,
7903     * in the event of a chain reorganization, it must not be called with a `header` that is no
7904     * longer in the chain as of the last call to [`best_block_updated`].
7905     *
7906     * [chain order]: Confirm#Order
7907     * [`best_block_updated`]: Self::best_block_updated
7908     */
7909    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7910    /**
7911     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
7912     *
7913     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
7914     * reorganized out of the best chain. Once called, the given transaction should not be returned
7915     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
7916     *
7917     * [`get_relevant_txids`]: Self::get_relevant_txids
7918     * [`transactions_confirmed`]: Self::transactions_confirmed
7919     */
7920    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
7921    /**
7922     * Processes an update to the best header connected at the given height.
7923     *
7924     * Should be called when a new header is available but may be skipped for intermediary blocks
7925     * if they become available at the same time.
7926     */
7927    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7928    /**
7929     * Returns transactions that should be monitored for reorganization out of the chain.
7930     *
7931     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
7932     * confirmations to be safe from a chain reorganization. Should not include any transactions
7933     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
7934     *
7935     * May be called to determine the subset of transactions that must still be monitored for
7936     * reorganization. Will be idempotent between calls but may change as a result of calls to the
7937     * other interface methods. Thus, this is useful to determine which transactions may need to be
7938     * given to [`transaction_unconfirmed`].
7939     *
7940     * [`transactions_confirmed`]: Self::transactions_confirmed
7941     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7942     */
7943    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
7944    /**
7945     * Frees any resources associated with this object given its this_arg pointer.
7946     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7947     */
7948    void (*free)(void *this_arg);
7949 } LDKConfirm;
7950
7951
7952
7953 /**
7954  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
7955  *
7956  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
7957  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
7958  * the return value of [`Filter::register_output`].
7959  *
7960  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
7961  * may have been spent there. See [`Filter::register_output`] for details.
7962  *
7963  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7964  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
7965  */
7966 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
7967    /**
7968     * A pointer to the opaque Rust object.
7969     * Nearly everywhere, inner must be non-null, however in places where
7970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7971     */
7972    LDKnativeWatchedOutput *inner;
7973    /**
7974     * Indicates that this is the only struct which contains the same pointer.
7975     * Rust functions which take ownership of an object provided via an argument require
7976     * this to be true and invalidate the object pointed to by inner.
7977     */
7978    bool is_owned;
7979 } LDKWatchedOutput;
7980
7981 /**
7982  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
7983  * channels.
7984  *
7985  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
7986  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
7987  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
7988  * receiving full blocks from a chain source, any further filtering is unnecessary.
7989  *
7990  * After an output has been registered, subsequent block retrievals from the chain source must not
7991  * exclude any transactions matching the new criteria nor any in-block descendants of such
7992  * transactions.
7993  *
7994  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
7995  * should not block on I/O. Implementations should instead queue the newly monitored data to be
7996  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
7997  * invocation that has called the `Filter` must return [`TemporaryFailure`].
7998  *
7999  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8000  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8001  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8002  */
8003 typedef struct LDKFilter {
8004    /**
8005     * An opaque pointer which is passed to your function implementations as an argument.
8006     * This has no meaning in the LDK, and can be NULL or any other value.
8007     */
8008    void *this_arg;
8009    /**
8010     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8011     * a spending condition.
8012     */
8013    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8014    /**
8015     * Registers interest in spends of a transaction output.
8016     *
8017     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8018     * output that is found in the corresponding block along with its index.
8019     *
8020     * This return value is useful for Electrum clients in order to supply in-block descendant
8021     * transactions which otherwise were not included. This is not necessary for other clients if
8022     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8023     * full block).
8024     */
8025    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8026    /**
8027     * Frees any resources associated with this object given its this_arg pointer.
8028     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8029     */
8030    void (*free)(void *this_arg);
8031 } LDKFilter;
8032
8033 /**
8034  * `Persist` defines behavior for persisting channel monitors: this could mean
8035  * writing once to disk, and/or uploading to one or more backup services.
8036  *
8037  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8038  * to disk/backups. And, on every update, you **must** persist either the
8039  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8040  * of situations such as revoking a transaction, then crashing before this
8041  * revocation can be persisted, then unintentionally broadcasting a revoked
8042  * transaction and losing money. This is a risk because previous channel states
8043  * are toxic, so it's important that whatever channel state is persisted is
8044  * kept up-to-date.
8045  */
8046 typedef struct LDKPersist {
8047    /**
8048     * An opaque pointer which is passed to your function implementations as an argument.
8049     * This has no meaning in the LDK, and can be NULL or any other value.
8050     */
8051    void *this_arg;
8052    /**
8053     * Persist a new channel's data. The data can be stored any way you want, but
8054     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8055     * it is up to you to maintain a correct mapping between the outpoint and the
8056     * stored channel data). Note that you **must** persist every new monitor to
8057     * disk. See the `Persist` trait documentation for more details.
8058     *
8059     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8060     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8061     */
8062    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8063    /**
8064     * Update one channel's data. The provided `ChannelMonitor` has already
8065     * applied the given update.
8066     *
8067     * Note that on every update, you **must** persist either the
8068     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8069     * the `Persist` trait documentation for more details.
8070     *
8071     * If an implementer chooses to persist the updates only, they need to make
8072     * sure that all the updates are applied to the `ChannelMonitors` *before*
8073     * the set of channel monitors is given to the `ChannelManager`
8074     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8075     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8076     * persisted, then there is no need to persist individual updates.
8077     *
8078     * Note that there could be a performance tradeoff between persisting complete
8079     * channel monitors on every update vs. persisting only updates and applying
8080     * them in batches. The size of each monitor grows `O(number of state updates)`
8081     * whereas updates are small and `O(1)`.
8082     *
8083     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8084     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8085     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8086     */
8087    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);
8088    /**
8089     * Frees any resources associated with this object given its this_arg pointer.
8090     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8091     */
8092    void (*free)(void *this_arg);
8093 } LDKPersist;
8094
8095
8096
8097 /**
8098  * An implementation of [`chain::Watch`] for monitoring channels.
8099  *
8100  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8101  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8102  * or used independently to monitor channels remotely. See the [module-level documentation] for
8103  * details.
8104  *
8105  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8106  * [module-level documentation]: crate::chain::chainmonitor
8107  */
8108 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8109    /**
8110     * A pointer to the opaque Rust object.
8111     * Nearly everywhere, inner must be non-null, however in places where
8112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8113     */
8114    LDKnativeChainMonitor *inner;
8115    /**
8116     * Indicates that this is the only struct which contains the same pointer.
8117     * Rust functions which take ownership of an object provided via an argument require
8118     * this to be true and invalidate the object pointed to by inner.
8119     */
8120    bool is_owned;
8121 } LDKChainMonitor;
8122
8123
8124
8125 /**
8126  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8127  * and derives keys from that.
8128  *
8129  * Your node_id is seed/0'
8130  * ChannelMonitor closes may use seed/1'
8131  * Cooperative closes may use seed/2'
8132  * The two close keys may be needed to claim on-chain funds!
8133  */
8134 typedef struct MUST_USE_STRUCT LDKKeysManager {
8135    /**
8136     * A pointer to the opaque Rust object.
8137     * Nearly everywhere, inner must be non-null, however in places where
8138     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8139     */
8140    LDKnativeKeysManager *inner;
8141    /**
8142     * Indicates that this is the only struct which contains the same pointer.
8143     * Rust functions which take ownership of an object provided via an argument require
8144     * this to be true and invalidate the object pointed to by inner.
8145     */
8146    bool is_owned;
8147 } LDKKeysManager;
8148
8149
8150
8151 /**
8152  * Chain-related parameters used to construct a new `ChannelManager`.
8153  *
8154  * Typically, the block-specific parameters are derived from the best block hash for the network,
8155  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8156  * are not needed when deserializing a previously constructed `ChannelManager`.
8157  */
8158 typedef struct MUST_USE_STRUCT LDKChainParameters {
8159    /**
8160     * A pointer to the opaque Rust object.
8161     * Nearly everywhere, inner must be non-null, however in places where
8162     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8163     */
8164    LDKnativeChainParameters *inner;
8165    /**
8166     * Indicates that this is the only struct which contains the same pointer.
8167     * Rust functions which take ownership of an object provided via an argument require
8168     * this to be true and invalidate the object pointed to by inner.
8169     */
8170    bool is_owned;
8171 } LDKChainParameters;
8172
8173
8174
8175 /**
8176  * The best known block as identified by its hash and height.
8177  */
8178 typedef struct MUST_USE_STRUCT LDKBestBlock {
8179    /**
8180     * A pointer to the opaque Rust object.
8181     * Nearly everywhere, inner must be non-null, however in places where
8182     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8183     */
8184    LDKnativeBestBlock *inner;
8185    /**
8186     * Indicates that this is the only struct which contains the same pointer.
8187     * Rust functions which take ownership of an object provided via an argument require
8188     * this to be true and invalidate the object pointed to by inner.
8189     */
8190    bool is_owned;
8191 } LDKBestBlock;
8192
8193 /**
8194  * A 3-byte byte array.
8195  */
8196 typedef struct LDKThreeBytes {
8197    /**
8198     * The three bytes
8199     */
8200    uint8_t data[3];
8201 } LDKThreeBytes;
8202
8203 /**
8204  * A trait to describe an object which can receive channel messages.
8205  *
8206  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8207  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8208  */
8209 typedef struct LDKChannelMessageHandler {
8210    /**
8211     * An opaque pointer which is passed to your function implementations as an argument.
8212     * This has no meaning in the LDK, and can be NULL or any other value.
8213     */
8214    void *this_arg;
8215    /**
8216     * Handle an incoming open_channel message from the given peer.
8217     */
8218    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8219    /**
8220     * Handle an incoming accept_channel message from the given peer.
8221     */
8222    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8223    /**
8224     * Handle an incoming funding_created message from the given peer.
8225     */
8226    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8227    /**
8228     * Handle an incoming funding_signed message from the given peer.
8229     */
8230    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8231    /**
8232     * Handle an incoming funding_locked message from the given peer.
8233     */
8234    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8235    /**
8236     * Handle an incoming shutdown message from the given peer.
8237     */
8238    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);
8239    /**
8240     * Handle an incoming closing_signed message from the given peer.
8241     */
8242    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8243    /**
8244     * Handle an incoming update_add_htlc message from the given peer.
8245     */
8246    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8247    /**
8248     * Handle an incoming update_fulfill_htlc message from the given peer.
8249     */
8250    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8251    /**
8252     * Handle an incoming update_fail_htlc message from the given peer.
8253     */
8254    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8255    /**
8256     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8257     */
8258    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8259    /**
8260     * Handle an incoming commitment_signed message from the given peer.
8261     */
8262    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8263    /**
8264     * Handle an incoming revoke_and_ack message from the given peer.
8265     */
8266    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8267    /**
8268     * Handle an incoming update_fee message from the given peer.
8269     */
8270    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8271    /**
8272     * Handle an incoming announcement_signatures message from the given peer.
8273     */
8274    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8275    /**
8276     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8277     * is believed to be possible in the future (eg they're sending us messages we don't
8278     * understand or indicate they require unknown feature bits), no_connection_possible is set
8279     * and any outstanding channels should be failed.
8280     */
8281    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8282    /**
8283     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8284     */
8285    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8286    /**
8287     * Handle an incoming channel_reestablish message from the given peer.
8288     */
8289    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8290    /**
8291     * Handle an incoming channel update from the given peer.
8292     */
8293    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8294    /**
8295     * Handle an incoming error message from the given peer.
8296     */
8297    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8298    /**
8299     * Implementation of MessageSendEventsProvider for this object.
8300     */
8301    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8302    /**
8303     * Frees any resources associated with this object given its this_arg pointer.
8304     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8305     */
8306    void (*free)(void *this_arg);
8307 } LDKChannelMessageHandler;
8308
8309
8310
8311 /**
8312  * Arguments for the creation of a ChannelManager that are not deserialized.
8313  *
8314  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8315  * is:
8316  * 1) Deserialize all stored ChannelMonitors.
8317  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8318  *    <(BlockHash, ChannelManager)>::read(reader, args)
8319  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8320  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8321  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8322  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8323  *    ChannelMonitor::get_funding_txo().
8324  * 4) Reconnect blocks on your ChannelMonitors.
8325  * 5) Disconnect/connect blocks on the ChannelManager.
8326  * 6) Move the ChannelMonitors into your local chain::Watch.
8327  *
8328  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8329  * call any other methods on the newly-deserialized ChannelManager.
8330  *
8331  * Note that because some channels may be closed during deserialization, it is critical that you
8332  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8333  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8334  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8335  * not force-close the same channels but consider them live), you may end up revoking a state for
8336  * which you've already broadcasted the transaction.
8337  */
8338 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8339    /**
8340     * A pointer to the opaque Rust object.
8341     * Nearly everywhere, inner must be non-null, however in places where
8342     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8343     */
8344    LDKnativeChannelManagerReadArgs *inner;
8345    /**
8346     * Indicates that this is the only struct which contains the same pointer.
8347     * Rust functions which take ownership of an object provided via an argument require
8348     * this to be true and invalidate the object pointed to by inner.
8349     */
8350    bool is_owned;
8351 } LDKChannelManagerReadArgs;
8352
8353
8354
8355 /**
8356  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8357  * This is used to convince the recipient that the channel is at a certain commitment
8358  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8359  * and even later commitments may have been revoked.
8360  */
8361 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8362    /**
8363     * A pointer to the opaque Rust object.
8364     * Nearly everywhere, inner must be non-null, however in places where
8365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8366     */
8367    LDKnativeDataLossProtect *inner;
8368    /**
8369     * Indicates that this is the only struct which contains the same pointer.
8370     * Rust functions which take ownership of an object provided via an argument require
8371     * this to be true and invalidate the object pointed to by inner.
8372     */
8373    bool is_owned;
8374 } LDKDataLossProtect;
8375
8376 /**
8377  * A trait to describe an object which can receive routing messages.
8378  *
8379  * # Implementor DoS Warnings
8380  *
8381  * For `gossip_queries` messages there are potential DoS vectors when handling
8382  * inbound queries. Implementors using an on-disk network graph should be aware of
8383  * repeated disk I/O for queries accessing different parts of the network graph.
8384  */
8385 typedef struct LDKRoutingMessageHandler {
8386    /**
8387     * An opaque pointer which is passed to your function implementations as an argument.
8388     * This has no meaning in the LDK, and can be NULL or any other value.
8389     */
8390    void *this_arg;
8391    /**
8392     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8393     * false or returning an Err otherwise.
8394     */
8395    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8396    /**
8397     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8398     * or returning an Err otherwise.
8399     */
8400    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8401    /**
8402     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8403     * false or returning an Err otherwise.
8404     */
8405    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8406    /**
8407     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8408     */
8409    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8410    /**
8411     * Gets a subset of the channel announcements and updates required to dump our routing table
8412     * to a remote node, starting at the short_channel_id indicated by starting_point and
8413     * including the batch_amount entries immediately higher in numerical value than starting_point.
8414     */
8415    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8416    /**
8417     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8418     * starting at the node *after* the provided publickey and including batch_amount entries
8419     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8420     * If None is provided for starting_point, we start at the first node.
8421     */
8422    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8423    /**
8424     * Called when a connection is established with a peer. This can be used to
8425     * perform routing table synchronization using a strategy defined by the
8426     * implementor.
8427     */
8428    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8429    /**
8430     * Handles the reply of a query we initiated to learn about channels
8431     * for a given range of blocks. We can expect to receive one or more
8432     * replies to a single query.
8433     */
8434    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8435    /**
8436     * Handles the reply of a query we initiated asking for routing gossip
8437     * messages for a list of channels. We should receive this message when
8438     * a node has completed its best effort to send us the pertaining routing
8439     * gossip messages.
8440     */
8441    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8442    /**
8443     * Handles when a peer asks us to send a list of short_channel_ids
8444     * for the requested range of blocks.
8445     */
8446    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8447    /**
8448     * Handles when a peer asks us to send routing gossip messages for a
8449     * list of short_channel_ids.
8450     */
8451    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8452    /**
8453     * Implementation of MessageSendEventsProvider for this object.
8454     */
8455    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8456    /**
8457     * Frees any resources associated with this object given its this_arg pointer.
8458     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8459     */
8460    void (*free)(void *this_arg);
8461 } LDKRoutingMessageHandler;
8462
8463
8464
8465 /**
8466  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8467  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8468  */
8469 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8470    /**
8471     * A pointer to the opaque Rust object.
8472     * Nearly everywhere, inner must be non-null, however in places where
8473     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8474     */
8475    LDKnativeIgnoringMessageHandler *inner;
8476    /**
8477     * Indicates that this is the only struct which contains the same pointer.
8478     * Rust functions which take ownership of an object provided via an argument require
8479     * this to be true and invalidate the object pointed to by inner.
8480     */
8481    bool is_owned;
8482 } LDKIgnoringMessageHandler;
8483
8484
8485
8486 /**
8487  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8488  * You can provide one of these as the route_handler in a MessageHandler.
8489  */
8490 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8491    /**
8492     * A pointer to the opaque Rust object.
8493     * Nearly everywhere, inner must be non-null, however in places where
8494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8495     */
8496    LDKnativeErroringMessageHandler *inner;
8497    /**
8498     * Indicates that this is the only struct which contains the same pointer.
8499     * Rust functions which take ownership of an object provided via an argument require
8500     * this to be true and invalidate the object pointed to by inner.
8501     */
8502    bool is_owned;
8503 } LDKErroringMessageHandler;
8504
8505
8506
8507 /**
8508  * Provides references to trait impls which handle different types of messages.
8509  */
8510 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8511    /**
8512     * A pointer to the opaque Rust object.
8513     * Nearly everywhere, inner must be non-null, however in places where
8514     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8515     */
8516    LDKnativeMessageHandler *inner;
8517    /**
8518     * Indicates that this is the only struct which contains the same pointer.
8519     * Rust functions which take ownership of an object provided via an argument require
8520     * this to be true and invalidate the object pointed to by inner.
8521     */
8522    bool is_owned;
8523 } LDKMessageHandler;
8524
8525 /**
8526  * Provides an object which can be used to send data to and which uniquely identifies a connection
8527  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8528  * implement Hash to meet the PeerManager API.
8529  *
8530  * For efficiency, Clone should be relatively cheap for this type.
8531  *
8532  * You probably want to just extend an int and put a file descriptor in a struct and implement
8533  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8534  * be careful to ensure you don't have races whereby you might register a new connection with an
8535  * fd which is the same as a previous one which has yet to be removed via
8536  * PeerManager::socket_disconnected().
8537  */
8538 typedef struct LDKSocketDescriptor {
8539    /**
8540     * An opaque pointer which is passed to your function implementations as an argument.
8541     * This has no meaning in the LDK, and can be NULL or any other value.
8542     */
8543    void *this_arg;
8544    /**
8545     * Attempts to send some data from the given slice to the peer.
8546     *
8547     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8548     * Note that in the disconnected case, socket_disconnected must still fire and further write
8549     * attempts may occur until that time.
8550     *
8551     * If the returned size is smaller than data.len(), a write_available event must
8552     * trigger the next time more data can be written. Additionally, until the a send_data event
8553     * completes fully, no further read_events should trigger on the same peer!
8554     *
8555     * If a read_event on this descriptor had previously returned true (indicating that read
8556     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8557     * indicating that read events on this descriptor should resume. A resume_read of false does
8558     * *not* imply that further read events should be paused.
8559     */
8560    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8561    /**
8562     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8563     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8564     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8565     * though races may occur whereby disconnect_socket is called after a call to
8566     * socket_disconnected but prior to socket_disconnected returning.
8567     */
8568    void (*disconnect_socket)(void *this_arg);
8569    /**
8570     * Checks if two objects are equal given this object's this_arg pointer and another object.
8571     */
8572    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8573    /**
8574     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8575     * This is used, for example, for inclusion of this object in a hash map.
8576     */
8577    uint64_t (*hash)(const void *this_arg);
8578    /**
8579     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8580     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8581     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8582     */
8583    void *(*clone)(const void *this_arg);
8584    /**
8585     * Frees any resources associated with this object given its this_arg pointer.
8586     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8587     */
8588    void (*free)(void *this_arg);
8589 } LDKSocketDescriptor;
8590
8591
8592
8593 /**
8594  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8595  * events into messages which it passes on to its MessageHandlers.
8596  *
8597  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8598  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8599  * essentially you should default to using a SimpleRefPeerManager, and use a
8600  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8601  * you're using lightning-net-tokio.
8602  */
8603 typedef struct MUST_USE_STRUCT LDKPeerManager {
8604    /**
8605     * A pointer to the opaque Rust object.
8606     * Nearly everywhere, inner must be non-null, however in places where
8607     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8608     */
8609    LDKnativePeerManager *inner;
8610    /**
8611     * Indicates that this is the only struct which contains the same pointer.
8612     * Rust functions which take ownership of an object provided via an argument require
8613     * this to be true and invalidate the object pointed to by inner.
8614     */
8615    bool is_owned;
8616 } LDKPeerManager;
8617
8618
8619
8620 /**
8621  * Static channel fields used to build transactions given per-commitment fields, organized by
8622  * broadcaster/countersignatory.
8623  *
8624  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8625  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8626  */
8627 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8628    /**
8629     * A pointer to the opaque Rust object.
8630     * Nearly everywhere, inner must be non-null, however in places where
8631     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8632     */
8633    LDKnativeDirectedChannelTransactionParameters *inner;
8634    /**
8635     * Indicates that this is the only struct which contains the same pointer.
8636     * Rust functions which take ownership of an object provided via an argument require
8637     * this to be true and invalidate the object pointed to by inner.
8638     */
8639    bool is_owned;
8640 } LDKDirectedChannelTransactionParameters;
8641
8642
8643
8644 /**
8645  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8646  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8647  * the C bindings, as it can be done directly in Rust code.
8648  */
8649 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8650    /**
8651     * A pointer to the opaque Rust object.
8652     * Nearly everywhere, inner must be non-null, however in places where
8653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8654     */
8655    LDKnativeLockedNetworkGraph *inner;
8656    /**
8657     * Indicates that this is the only struct which contains the same pointer.
8658     * Rust functions which take ownership of an object provided via an argument require
8659     * this to be true and invalidate the object pointed to by inner.
8660     */
8661    bool is_owned;
8662 } LDKLockedNetworkGraph;
8663
8664
8665
8666 /**
8667  * Receives and validates network updates from peers,
8668  * stores authentic and relevant data as a network graph.
8669  * This network graph is then used for routing payments.
8670  * Provides interface to help with initial routing sync by
8671  * serving historical announcements.
8672  */
8673 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8674    /**
8675     * A pointer to the opaque Rust object.
8676     * Nearly everywhere, inner must be non-null, however in places where
8677     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8678     */
8679    LDKnativeNetGraphMsgHandler *inner;
8680    /**
8681     * Indicates that this is the only struct which contains the same pointer.
8682     * Rust functions which take ownership of an object provided via an argument require
8683     * this to be true and invalidate the object pointed to by inner.
8684     */
8685    bool is_owned;
8686 } LDKNetGraphMsgHandler;
8687
8688
8689
8690 /**
8691  * FilesystemPersister persists channel data on disk, where each channel's
8692  * data is stored in a file named after its funding outpoint.
8693  *
8694  * Warning: this module does the best it can with calls to persist data, but it
8695  * can only guarantee that the data is passed to the drive. It is up to the
8696  * drive manufacturers to do the actual persistence properly, which they often
8697  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8698  * user to validate their entire storage stack, to ensure the writes are
8699  * persistent.
8700  * Corollary: especially when dealing with larger amounts of money, it is best
8701  * practice to have multiple channel data backups and not rely only on one
8702  * FilesystemPersister.
8703  */
8704 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8705    /**
8706     * A pointer to the opaque Rust object.
8707     * Nearly everywhere, inner must be non-null, however in places where
8708     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8709     */
8710    LDKnativeFilesystemPersister *inner;
8711    /**
8712     * Indicates that this is the only struct which contains the same pointer.
8713     * Rust functions which take ownership of an object provided via an argument require
8714     * this to be true and invalidate the object pointed to by inner.
8715     */
8716    bool is_owned;
8717 } LDKFilesystemPersister;
8718
8719
8720
8721 /**
8722  * Data of the `RawInvoice` that is encoded in the data part
8723  */
8724 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8725    /**
8726     * A pointer to the opaque Rust object.
8727     * Nearly everywhere, inner must be non-null, however in places where
8728     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8729     */
8730    LDKnativeRawDataPart *inner;
8731    /**
8732     * Indicates that this is the only struct which contains the same pointer.
8733     * Rust functions which take ownership of an object provided via an argument require
8734     * this to be true and invalidate the object pointed to by inner.
8735     */
8736    bool is_owned;
8737 } LDKRawDataPart;
8738
8739
8740
8741 /**
8742  * SHA-256 hash
8743  */
8744 typedef struct MUST_USE_STRUCT LDKSha256 {
8745    /**
8746     * A pointer to the opaque Rust object.
8747     * Nearly everywhere, inner must be non-null, however in places where
8748     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8749     */
8750    LDKnativeSha256 *inner;
8751    /**
8752     * Indicates that this is the only struct which contains the same pointer.
8753     * Rust functions which take ownership of an object provided via an argument require
8754     * this to be true and invalidate the object pointed to by inner.
8755     */
8756    bool is_owned;
8757 } LDKSha256;
8758
8759
8760
8761 /**
8762  * `min_final_cltv_expiry` to use for the last HTLC in the route
8763  */
8764 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8765    /**
8766     * A pointer to the opaque Rust object.
8767     * Nearly everywhere, inner must be non-null, however in places where
8768     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8769     */
8770    LDKnativeMinFinalCltvExpiry *inner;
8771    /**
8772     * Indicates that this is the only struct which contains the same pointer.
8773     * Rust functions which take ownership of an object provided via an argument require
8774     * this to be true and invalidate the object pointed to by inner.
8775     */
8776    bool is_owned;
8777 } LDKMinFinalCltvExpiry;
8778
8779 /**
8780  * Integer in the range `0..32`
8781  */
8782 typedef struct LDKu5 {
8783    uint8_t _0;
8784 } LDKu5;
8785
8786 /**
8787  * A 20-byte byte array.
8788  */
8789 typedef struct LDKTwentyBytes {
8790    /**
8791     * The twenty bytes
8792     */
8793    uint8_t data[20];
8794 } LDKTwentyBytes;
8795
8796 /**
8797  * Fallback address in case no LN payment is possible
8798  */
8799 typedef enum LDKFallback_Tag {
8800    LDKFallback_SegWitProgram,
8801    LDKFallback_PubKeyHash,
8802    LDKFallback_ScriptHash,
8803    /**
8804     * Must be last for serialization purposes
8805     */
8806    LDKFallback_Sentinel,
8807 } LDKFallback_Tag;
8808
8809 typedef struct LDKFallback_LDKSegWitProgram_Body {
8810    struct LDKu5 version;
8811    struct LDKCVec_u8Z program;
8812 } LDKFallback_LDKSegWitProgram_Body;
8813
8814 typedef struct MUST_USE_STRUCT LDKFallback {
8815    LDKFallback_Tag tag;
8816    union {
8817       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8818       struct {
8819          struct LDKTwentyBytes pub_key_hash;
8820       };
8821       struct {
8822          struct LDKTwentyBytes script_hash;
8823       };
8824    };
8825 } LDKFallback;
8826
8827 extern const uintptr_t MAX_BUF_SIZE;
8828
8829 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8830
8831 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8832
8833 extern const uint32_t ANTI_REORG_DELAY;
8834
8835 extern const uint16_t BREAKDOWN_TIMEOUT;
8836
8837 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8838
8839 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8840
8841 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8842
8843 extern const uint8_t TAG_PAYMENT_HASH;
8844
8845 extern const uint8_t TAG_DESCRIPTION;
8846
8847 extern const uint8_t TAG_PAYEE_PUB_KEY;
8848
8849 extern const uint8_t TAG_DESCRIPTION_HASH;
8850
8851 extern const uint8_t TAG_EXPIRY_TIME;
8852
8853 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
8854
8855 extern const uint8_t TAG_FALLBACK;
8856
8857 extern const uint8_t TAG_ROUTE;
8858
8859 extern const uint8_t TAG_PAYMENT_SECRET;
8860
8861 extern const uint8_t TAG_FEATURES;
8862
8863 struct LDKStr _ldk_get_compiled_version(void);
8864
8865 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
8866
8867 /**
8868  * Frees the data buffer, if data_is_owned is set and datalen > 0.
8869  */
8870 void Transaction_free(struct LDKTransaction _res);
8871
8872 /**
8873  * Frees the data pointed to by script_pubkey.
8874  */
8875 void TxOut_free(struct LDKTxOut _res);
8876
8877 /**
8878  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
8879  */
8880 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
8881
8882 /**
8883  * Frees the data buffer, if chars_is_owned is set and len > 0.
8884  */
8885 void Str_free(struct LDKStr _res);
8886
8887 /**
8888  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
8889  */
8890 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
8891
8892 /**
8893  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
8894  */
8895 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
8896
8897 /**
8898  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
8899  */
8900 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
8901
8902 /**
8903  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
8904  * but with all dynamically-allocated buffers duplicated in new buffers.
8905  */
8906 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
8907
8908 /**
8909  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
8910  */
8911 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
8912
8913 /**
8914  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
8915  */
8916 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
8917
8918 /**
8919  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
8920  */
8921 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
8922
8923 /**
8924  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
8925  * but with all dynamically-allocated buffers duplicated in new buffers.
8926  */
8927 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
8928
8929 /**
8930  * Creates a new CResult_SecretKeyErrorZ in the success state.
8931  */
8932 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
8933
8934 /**
8935  * Creates a new CResult_SecretKeyErrorZ in the error state.
8936  */
8937 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
8938
8939 /**
8940  * Frees any resources used by the CResult_SecretKeyErrorZ.
8941  */
8942 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
8943
8944 /**
8945  * Creates a new CResult_PublicKeyErrorZ in the success state.
8946  */
8947 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
8948
8949 /**
8950  * Creates a new CResult_PublicKeyErrorZ in the error state.
8951  */
8952 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
8953
8954 /**
8955  * Frees any resources used by the CResult_PublicKeyErrorZ.
8956  */
8957 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
8958
8959 /**
8960  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
8961  */
8962 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
8963
8964 /**
8965  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
8966  */
8967 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
8968
8969 /**
8970  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
8971  */
8972 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
8973
8974 /**
8975  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
8976  * but with all dynamically-allocated buffers duplicated in new buffers.
8977  */
8978 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
8979
8980 /**
8981  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
8982  */
8983 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
8984
8985 /**
8986  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
8987  */
8988 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
8989
8990 /**
8991  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
8992  */
8993 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
8994
8995 /**
8996  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
8997  * but with all dynamically-allocated buffers duplicated in new buffers.
8998  */
8999 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9000
9001 /**
9002  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9003  */
9004 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9005
9006 /**
9007  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9008  */
9009 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9010
9011 /**
9012  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9013  */
9014 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9015
9016 /**
9017  * Constructs a new COption_u32Z containing a u32
9018  */
9019 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9020
9021 /**
9022  * Constructs a new COption_u32Z containing nothing
9023  */
9024 struct LDKCOption_u32Z COption_u32Z_none(void);
9025
9026 /**
9027  * Frees any resources associated with the u32, if we are in the Some state
9028  */
9029 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9030
9031 /**
9032  * Creates a new COption_u32Z which has the same data as `orig`
9033  * but with all dynamically-allocated buffers duplicated in new buffers.
9034  */
9035 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9036
9037 /**
9038  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9039  */
9040 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9041
9042 /**
9043  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9044  */
9045 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9046
9047 /**
9048  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9049  */
9050 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9051
9052 /**
9053  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9054  * but with all dynamically-allocated buffers duplicated in new buffers.
9055  */
9056 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9057
9058 /**
9059  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9060  */
9061 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9062
9063 /**
9064  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9065  */
9066 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9067
9068 /**
9069  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9070  */
9071 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9072
9073 /**
9074  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9075  * but with all dynamically-allocated buffers duplicated in new buffers.
9076  */
9077 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9078
9079 /**
9080  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9081  */
9082 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9083
9084 /**
9085  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9086  */
9087 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9088
9089 /**
9090  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9091  */
9092 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9093
9094 /**
9095  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9096  * but with all dynamically-allocated buffers duplicated in new buffers.
9097  */
9098 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9099
9100 /**
9101  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9102  */
9103 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9104
9105 /**
9106  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9107  */
9108 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9109
9110 /**
9111  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9112  */
9113 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9114
9115 /**
9116  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9117  */
9118 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9119
9120 /**
9121  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9122  * but with all dynamically-allocated buffers duplicated in new buffers.
9123  */
9124 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9125
9126 /**
9127  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9128  */
9129 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9130
9131 /**
9132  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9133  */
9134 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9135
9136 /**
9137  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9138  */
9139 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9140
9141 /**
9142  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9143  * but with all dynamically-allocated buffers duplicated in new buffers.
9144  */
9145 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9146
9147 /**
9148  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9149  */
9150 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9151
9152 /**
9153  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9154  */
9155 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9156
9157 /**
9158  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9159  */
9160 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9161
9162 /**
9163  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9164  * but with all dynamically-allocated buffers duplicated in new buffers.
9165  */
9166 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9167
9168 /**
9169  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9170  */
9171 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9172
9173 /**
9174  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9175  */
9176 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9177
9178 /**
9179  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9180  */
9181 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9182
9183 /**
9184  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9185  */
9186 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9187
9188 /**
9189  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9190  */
9191 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9192
9193 /**
9194  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9195  */
9196 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9197
9198 /**
9199  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9200  * but with all dynamically-allocated buffers duplicated in new buffers.
9201  */
9202 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9203
9204 /**
9205  * Creates a new CResult_SiPrefixNoneZ in the success state.
9206  */
9207 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
9208
9209 /**
9210  * Creates a new CResult_SiPrefixNoneZ in the error state.
9211  */
9212 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
9213
9214 /**
9215  * Frees any resources used by the CResult_SiPrefixNoneZ.
9216  */
9217 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
9218
9219 /**
9220  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
9221  * but with all dynamically-allocated buffers duplicated in new buffers.
9222  */
9223 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
9224
9225 /**
9226  * Creates a new CResult_InvoiceNoneZ in the success state.
9227  */
9228 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
9229
9230 /**
9231  * Creates a new CResult_InvoiceNoneZ in the error state.
9232  */
9233 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
9234
9235 /**
9236  * Frees any resources used by the CResult_InvoiceNoneZ.
9237  */
9238 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
9239
9240 /**
9241  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
9242  * but with all dynamically-allocated buffers duplicated in new buffers.
9243  */
9244 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
9245
9246 /**
9247  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
9248  */
9249 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
9250
9251 /**
9252  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
9253  */
9254 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
9255
9256 /**
9257  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
9258  */
9259 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
9260
9261 /**
9262  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
9263  * but with all dynamically-allocated buffers duplicated in new buffers.
9264  */
9265 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
9266
9267 /**
9268  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9269  */
9270 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9271
9272 /**
9273  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9274  */
9275 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
9276
9277 /**
9278  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9279  */
9280 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
9281
9282 /**
9283  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
9284  */
9285 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
9286
9287 /**
9288  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
9289  */
9290 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
9291
9292 /**
9293  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
9294  */
9295 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
9296
9297 /**
9298  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9299  */
9300 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9301
9302 /**
9303  * Constructs a new COption_u64Z containing a u64
9304  */
9305 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9306
9307 /**
9308  * Constructs a new COption_u64Z containing nothing
9309  */
9310 struct LDKCOption_u64Z COption_u64Z_none(void);
9311
9312 /**
9313  * Frees any resources associated with the u64, if we are in the Some state
9314  */
9315 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9316
9317 /**
9318  * Creates a new COption_u64Z which has the same data as `orig`
9319  * but with all dynamically-allocated buffers duplicated in new buffers.
9320  */
9321 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9322
9323 /**
9324  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9325  */
9326 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
9327
9328 /**
9329  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9330  */
9331 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
9332
9333 /**
9334  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9335  */
9336 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
9337
9338 /**
9339  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9340  * but with all dynamically-allocated buffers duplicated in new buffers.
9341  */
9342 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
9343
9344 /**
9345  * Creates a new CResult_NoneSemanticErrorZ in the success state.
9346  */
9347 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
9348
9349 /**
9350  * Creates a new CResult_NoneSemanticErrorZ in the error state.
9351  */
9352 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
9353
9354 /**
9355  * Frees any resources used by the CResult_NoneSemanticErrorZ.
9356  */
9357 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
9358
9359 /**
9360  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
9361  * but with all dynamically-allocated buffers duplicated in new buffers.
9362  */
9363 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
9364
9365 /**
9366  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
9367  */
9368 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
9369
9370 /**
9371  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
9372  */
9373 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
9374
9375 /**
9376  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
9377  */
9378 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
9379
9380 /**
9381  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
9382  * but with all dynamically-allocated buffers duplicated in new buffers.
9383  */
9384 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
9385
9386 /**
9387  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
9388  */
9389 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
9390
9391 /**
9392  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
9393  */
9394 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
9395
9396 /**
9397  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
9398  */
9399 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
9400
9401 /**
9402  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9403  * but with all dynamically-allocated buffers duplicated in new buffers.
9404  */
9405 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
9406
9407 /**
9408  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
9409  */
9410 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
9411
9412 /**
9413  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
9414  */
9415 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
9416
9417 /**
9418  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
9419  */
9420 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
9421
9422 /**
9423  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
9424  * but with all dynamically-allocated buffers duplicated in new buffers.
9425  */
9426 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
9427
9428 /**
9429  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9430  */
9431 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9432
9433 /**
9434  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
9435  */
9436 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
9437
9438 /**
9439  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
9440  */
9441 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
9442
9443 /**
9444  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
9445  */
9446 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
9447
9448 /**
9449  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
9450  * but with all dynamically-allocated buffers duplicated in new buffers.
9451  */
9452 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
9453
9454 /**
9455  * Creates a new CResult_StringErrorZ in the success state.
9456  */
9457 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
9458
9459 /**
9460  * Creates a new CResult_StringErrorZ in the error state.
9461  */
9462 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
9463
9464 /**
9465  * Frees any resources used by the CResult_StringErrorZ.
9466  */
9467 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
9468
9469 /**
9470  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9471  */
9472 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
9473
9474 /**
9475  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9476  */
9477 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9478
9479 /**
9480  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9481  */
9482 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
9483
9484 /**
9485  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9486  * but with all dynamically-allocated buffers duplicated in new buffers.
9487  */
9488 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
9489
9490 /**
9491  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9492  */
9493 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
9494
9495 /**
9496  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9497  */
9498 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9499
9500 /**
9501  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9502  */
9503 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
9504
9505 /**
9506  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9507  * but with all dynamically-allocated buffers duplicated in new buffers.
9508  */
9509 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
9510
9511 /**
9512  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
9513  */
9514 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
9515
9516 /**
9517  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
9518  */
9519 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
9520
9521 /**
9522  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
9523  */
9524 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
9525
9526 /**
9527  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
9528  * but with all dynamically-allocated buffers duplicated in new buffers.
9529  */
9530 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
9531
9532 /**
9533  * Creates a new tuple which has the same data as `orig`
9534  * but with all dynamically-allocated buffers duplicated in new buffers.
9535  */
9536 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
9537
9538 /**
9539  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9540  */
9541 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
9542
9543 /**
9544  * Frees any resources used by the C2Tuple_OutPointScriptZ.
9545  */
9546 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
9547
9548 /**
9549  * Creates a new tuple which has the same data as `orig`
9550  * but with all dynamically-allocated buffers duplicated in new buffers.
9551  */
9552 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
9553
9554 /**
9555  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
9556  */
9557 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
9558
9559 /**
9560  * Frees any resources used by the C2Tuple_u32ScriptZ.
9561  */
9562 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
9563
9564 /**
9565  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9566  */
9567 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
9568
9569 /**
9570  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9571  */
9572 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
9573
9574 /**
9575  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9576  */
9577 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
9578
9579 /**
9580  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9581  */
9582 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
9583
9584 /**
9585  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9586  */
9587 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9588
9589 /**
9590  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9591  */
9592 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
9593
9594 /**
9595  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9596  */
9597 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
9598
9599 /**
9600  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9601  */
9602 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9603
9604 /**
9605  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9606  */
9607 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9608
9609 /**
9610  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9611  */
9612 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9613
9614 /**
9615  * Creates a new tuple which has the same data as `orig`
9616  * but with all dynamically-allocated buffers duplicated in new buffers.
9617  */
9618 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
9619
9620 /**
9621  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
9622  */
9623 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
9624
9625 /**
9626  * Frees any resources used by the C2Tuple_u32TxOutZ.
9627  */
9628 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
9629
9630 /**
9631  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9632  */
9633 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
9634
9635 /**
9636  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9637  */
9638 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
9639
9640 /**
9641  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9642  */
9643 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
9644
9645 /**
9646  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9647  */
9648 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
9649
9650 /**
9651  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9652  */
9653 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9654
9655 /**
9656  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9657  */
9658 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9659
9660 /**
9661  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9662  */
9663 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9664
9665 /**
9666  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9667  */
9668 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9669
9670 /**
9671  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9672  * but with all dynamically-allocated buffers duplicated in new buffers.
9673  */
9674 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9675
9676 /**
9677  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9678  */
9679 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9680
9681 /**
9682  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9683  */
9684 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9685
9686 /**
9687  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9688  */
9689 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
9690
9691 /**
9692  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9693  */
9694 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
9695
9696 /**
9697  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9698  */
9699 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
9700
9701 /**
9702  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9703  */
9704 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9705
9706 /**
9707  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9708  */
9709 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9710
9711 /**
9712  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9713  */
9714 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9715
9716 /**
9717  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9718  */
9719 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9720
9721 /**
9722  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9723  */
9724 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9725
9726 /**
9727  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9728  * but with all dynamically-allocated buffers duplicated in new buffers.
9729  */
9730 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9731
9732 /**
9733  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9734  */
9735 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9736
9737 /**
9738  * Creates a new CResult_RouteLightningErrorZ in the success state.
9739  */
9740 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9741
9742 /**
9743  * Creates a new CResult_RouteLightningErrorZ in the error state.
9744  */
9745 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9746
9747 /**
9748  * Frees any resources used by the CResult_RouteLightningErrorZ.
9749  */
9750 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9751
9752 /**
9753  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9754  * but with all dynamically-allocated buffers duplicated in new buffers.
9755  */
9756 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9757
9758 /**
9759  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9760  */
9761 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9762
9763 /**
9764  * Creates a new CResult_boolLightningErrorZ in the success state.
9765  */
9766 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
9767
9768 /**
9769  * Creates a new CResult_boolLightningErrorZ in the error state.
9770  */
9771 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
9772
9773 /**
9774  * Frees any resources used by the CResult_boolLightningErrorZ.
9775  */
9776 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
9777
9778 /**
9779  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9780  * but with all dynamically-allocated buffers duplicated in new buffers.
9781  */
9782 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
9783
9784 /**
9785  * Creates a new tuple which has the same data as `orig`
9786  * but with all dynamically-allocated buffers duplicated in new buffers.
9787  */
9788 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
9789
9790 /**
9791  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9792  */
9793 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
9794
9795 /**
9796  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9797  */
9798 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
9799
9800 /**
9801  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9802  */
9803 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
9804
9805 /**
9806  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9807  */
9808 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
9809
9810 /**
9811  * Creates a new CResult_NoneLightningErrorZ in the success state.
9812  */
9813 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
9814
9815 /**
9816  * Creates a new CResult_NoneLightningErrorZ in the error state.
9817  */
9818 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
9819
9820 /**
9821  * Frees any resources used by the CResult_NoneLightningErrorZ.
9822  */
9823 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
9824
9825 /**
9826  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9827  * but with all dynamically-allocated buffers duplicated in new buffers.
9828  */
9829 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
9830
9831 /**
9832  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9833  */
9834 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
9835
9836 /**
9837  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9838  */
9839 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
9840
9841 /**
9842  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9843  */
9844 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9845
9846 /**
9847  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9848  */
9849 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
9850
9851 /**
9852  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9853  * but with all dynamically-allocated buffers duplicated in new buffers.
9854  */
9855 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
9856
9857 /**
9858  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
9859  */
9860 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
9861
9862 /**
9863  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
9864  */
9865 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
9866
9867 /**
9868  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
9869  */
9870 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
9871
9872 /**
9873  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9874  * but with all dynamically-allocated buffers duplicated in new buffers.
9875  */
9876 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
9877
9878 /**
9879  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
9880  */
9881 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
9882
9883 /**
9884  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
9885  */
9886 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9887
9888 /**
9889  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
9890  */
9891 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
9892
9893 /**
9894  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9895  * but with all dynamically-allocated buffers duplicated in new buffers.
9896  */
9897 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
9898
9899 /**
9900  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9901  */
9902 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9903
9904 /**
9905  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9906  */
9907 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9908
9909 /**
9910  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9911  */
9912 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9913
9914 /**
9915  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9916  * but with all dynamically-allocated buffers duplicated in new buffers.
9917  */
9918 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9919
9920 /**
9921  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9922  */
9923 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9924
9925 /**
9926  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9927  */
9928 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9929
9930 /**
9931  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9932  */
9933 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9934
9935 /**
9936  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9937  */
9938 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9939
9940 /**
9941  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9942  */
9943 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
9944
9945 /**
9946  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9947  */
9948 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9949
9950 /**
9951  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9952  */
9953 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
9954
9955 /**
9956  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9957  * but with all dynamically-allocated buffers duplicated in new buffers.
9958  */
9959 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9960
9961 /**
9962  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9963  */
9964 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
9965
9966 /**
9967  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9968  */
9969 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9970
9971 /**
9972  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9973  */
9974 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
9975
9976 /**
9977  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9978  * but with all dynamically-allocated buffers duplicated in new buffers.
9979  */
9980 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9981
9982 /**
9983  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9984  */
9985 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
9986
9987 /**
9988  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9989  */
9990 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
9991
9992 /**
9993  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9994  */
9995 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
9996
9997 /**
9998  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9999  * but with all dynamically-allocated buffers duplicated in new buffers.
10000  */
10001 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10002
10003 /**
10004  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10005  */
10006 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
10007
10008 /**
10009  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10010  */
10011 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10012
10013 /**
10014  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10015  */
10016 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10017
10018 /**
10019  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10020  */
10021 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10022
10023 /**
10024  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10025  * but with all dynamically-allocated buffers duplicated in new buffers.
10026  */
10027 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10028
10029 /**
10030  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10031  */
10032 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10033
10034 /**
10035  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10036  */
10037 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10038
10039 /**
10040  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10041  */
10042 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10043
10044 /**
10045  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10046  */
10047 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10048
10049 /**
10050  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10051  * but with all dynamically-allocated buffers duplicated in new buffers.
10052  */
10053 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10054
10055 /**
10056  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10057  */
10058 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10059
10060 /**
10061  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10062  */
10063 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10064
10065 /**
10066  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10067  */
10068 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10069
10070 /**
10071  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10072  * but with all dynamically-allocated buffers duplicated in new buffers.
10073  */
10074 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10075
10076 /**
10077  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
10078  */
10079 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
10080
10081 /**
10082  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
10083  */
10084 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10085
10086 /**
10087  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
10088  */
10089 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
10090
10091 /**
10092  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
10093  */
10094 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
10095
10096 /**
10097  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
10098  */
10099 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10100
10101 /**
10102  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
10103  */
10104 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
10105
10106 /**
10107  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10108  */
10109 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10110
10111 /**
10112  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10113  */
10114 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10115
10116 /**
10117  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10118  */
10119 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10120
10121 /**
10122  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10123  */
10124 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10125
10126 /**
10127  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10128  */
10129 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10130
10131 /**
10132  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10133  */
10134 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10135
10136 /**
10137  * Creates a new CResult_NetAddressu8Z in the success state.
10138  */
10139 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10140
10141 /**
10142  * Creates a new CResult_NetAddressu8Z in the error state.
10143  */
10144 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10145
10146 /**
10147  * Frees any resources used by the CResult_NetAddressu8Z.
10148  */
10149 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10150
10151 /**
10152  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10153  * but with all dynamically-allocated buffers duplicated in new buffers.
10154  */
10155 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10156
10157 /**
10158  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10159  */
10160 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10161
10162 /**
10163  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10164  */
10165 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10166
10167 /**
10168  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10169  */
10170 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10171
10172 /**
10173  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10174  * but with all dynamically-allocated buffers duplicated in new buffers.
10175  */
10176 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10177
10178 /**
10179  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10180  */
10181 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
10182
10183 /**
10184  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10185  */
10186 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
10187
10188 /**
10189  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10190  */
10191 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
10192
10193 /**
10194  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10195  * but with all dynamically-allocated buffers duplicated in new buffers.
10196  */
10197 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
10198
10199 /**
10200  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10201  */
10202 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10203
10204 /**
10205  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10206  */
10207 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10208
10209 /**
10210  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10211  */
10212 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10213
10214 /**
10215  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10216  */
10217 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10218
10219 /**
10220  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10221  */
10222 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10223
10224 /**
10225  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10226  */
10227 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10228
10229 /**
10230  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10231  */
10232 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10233
10234 /**
10235  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10236  * but with all dynamically-allocated buffers duplicated in new buffers.
10237  */
10238 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10239
10240 /**
10241  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10242  */
10243 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10244
10245 /**
10246  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10247  */
10248 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10249
10250 /**
10251  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10252  */
10253 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10254
10255 /**
10256  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10257  * but with all dynamically-allocated buffers duplicated in new buffers.
10258  */
10259 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10260
10261 /**
10262  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10263  */
10264 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10265
10266 /**
10267  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10268  */
10269 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10270
10271 /**
10272  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10273  */
10274 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10275
10276 /**
10277  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10278  * but with all dynamically-allocated buffers duplicated in new buffers.
10279  */
10280 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10281
10282 /**
10283  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10284  */
10285 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10286
10287 /**
10288  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10289  */
10290 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10291
10292 /**
10293  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10294  */
10295 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10296
10297 /**
10298  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10299  * but with all dynamically-allocated buffers duplicated in new buffers.
10300  */
10301 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10302
10303 /**
10304  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10305  */
10306 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10307
10308 /**
10309  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10310  */
10311 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10312
10313 /**
10314  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10315  */
10316 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10317
10318 /**
10319  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10320  * but with all dynamically-allocated buffers duplicated in new buffers.
10321  */
10322 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10323
10324 /**
10325  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10326  */
10327 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10328
10329 /**
10330  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10331  */
10332 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10333
10334 /**
10335  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10336  */
10337 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10338
10339 /**
10340  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10341  * but with all dynamically-allocated buffers duplicated in new buffers.
10342  */
10343 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10344
10345 /**
10346  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10347  */
10348 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10349
10350 /**
10351  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10352  */
10353 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10354
10355 /**
10356  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10357  */
10358 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10359
10360 /**
10361  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10362  * but with all dynamically-allocated buffers duplicated in new buffers.
10363  */
10364 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10365
10366 /**
10367  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10368  */
10369 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10370
10371 /**
10372  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10373  */
10374 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10375
10376 /**
10377  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10378  */
10379 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
10380
10381 /**
10382  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10383  * but with all dynamically-allocated buffers duplicated in new buffers.
10384  */
10385 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
10386
10387 /**
10388  * Creates a new CResult_InitDecodeErrorZ in the success state.
10389  */
10390 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
10391
10392 /**
10393  * Creates a new CResult_InitDecodeErrorZ in the error state.
10394  */
10395 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
10396
10397 /**
10398  * Frees any resources used by the CResult_InitDecodeErrorZ.
10399  */
10400 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
10401
10402 /**
10403  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10404  * but with all dynamically-allocated buffers duplicated in new buffers.
10405  */
10406 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
10407
10408 /**
10409  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10410  */
10411 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
10412
10413 /**
10414  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10415  */
10416 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
10417
10418 /**
10419  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10420  */
10421 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
10422
10423 /**
10424  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10425  * but with all dynamically-allocated buffers duplicated in new buffers.
10426  */
10427 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
10428
10429 /**
10430  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10431  */
10432 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
10433
10434 /**
10435  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10436  */
10437 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
10438
10439 /**
10440  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10441  */
10442 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
10443
10444 /**
10445  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10446  * but with all dynamically-allocated buffers duplicated in new buffers.
10447  */
10448 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
10449
10450 /**
10451  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10452  */
10453 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
10454
10455 /**
10456  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10457  */
10458 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
10459
10460 /**
10461  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10462  */
10463 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
10464
10465 /**
10466  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10467  * but with all dynamically-allocated buffers duplicated in new buffers.
10468  */
10469 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
10470
10471 /**
10472  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10473  */
10474 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
10475
10476 /**
10477  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10478  */
10479 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10480
10481 /**
10482  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10483  */
10484 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
10485
10486 /**
10487  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10488  * but with all dynamically-allocated buffers duplicated in new buffers.
10489  */
10490 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
10491
10492 /**
10493  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10494  */
10495 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
10496
10497 /**
10498  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10499  */
10500 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10501
10502 /**
10503  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10504  */
10505 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
10506
10507 /**
10508  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10509  * but with all dynamically-allocated buffers duplicated in new buffers.
10510  */
10511 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
10512
10513 /**
10514  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10515  */
10516 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
10517
10518 /**
10519  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10520  */
10521 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
10522
10523 /**
10524  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10525  */
10526 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
10527
10528 /**
10529  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10530  * but with all dynamically-allocated buffers duplicated in new buffers.
10531  */
10532 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
10533
10534 /**
10535  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10536  */
10537 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
10538
10539 /**
10540  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10541  */
10542 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10543
10544 /**
10545  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10546  */
10547 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
10548
10549 /**
10550  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10551  * but with all dynamically-allocated buffers duplicated in new buffers.
10552  */
10553 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
10554
10555 /**
10556  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10557  */
10558 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
10559
10560 /**
10561  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10562  */
10563 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10564
10565 /**
10566  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10567  */
10568 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
10569
10570 /**
10571  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10572  * but with all dynamically-allocated buffers duplicated in new buffers.
10573  */
10574 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
10575
10576 /**
10577  * Creates a new CResult_PingDecodeErrorZ in the success state.
10578  */
10579 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
10580
10581 /**
10582  * Creates a new CResult_PingDecodeErrorZ in the error state.
10583  */
10584 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
10585
10586 /**
10587  * Frees any resources used by the CResult_PingDecodeErrorZ.
10588  */
10589 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
10590
10591 /**
10592  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10593  * but with all dynamically-allocated buffers duplicated in new buffers.
10594  */
10595 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
10596
10597 /**
10598  * Creates a new CResult_PongDecodeErrorZ in the success state.
10599  */
10600 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
10601
10602 /**
10603  * Creates a new CResult_PongDecodeErrorZ in the error state.
10604  */
10605 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
10606
10607 /**
10608  * Frees any resources used by the CResult_PongDecodeErrorZ.
10609  */
10610 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
10611
10612 /**
10613  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10614  * but with all dynamically-allocated buffers duplicated in new buffers.
10615  */
10616 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
10617
10618 /**
10619  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10620  */
10621 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
10622
10623 /**
10624  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10625  */
10626 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10627
10628 /**
10629  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10630  */
10631 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
10632
10633 /**
10634  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10635  * but with all dynamically-allocated buffers duplicated in new buffers.
10636  */
10637 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10638
10639 /**
10640  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10641  */
10642 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
10643
10644 /**
10645  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10646  */
10647 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10648
10649 /**
10650  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10651  */
10652 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
10653
10654 /**
10655  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10656  * but with all dynamically-allocated buffers duplicated in new buffers.
10657  */
10658 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10659
10660 /**
10661  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10662  */
10663 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
10664
10665 /**
10666  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10667  */
10668 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10669
10670 /**
10671  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10672  */
10673 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
10674
10675 /**
10676  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10677  * but with all dynamically-allocated buffers duplicated in new buffers.
10678  */
10679 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10680
10681 /**
10682  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10683  */
10684 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
10685
10686 /**
10687  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10688  */
10689 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10690
10691 /**
10692  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10693  */
10694 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
10695
10696 /**
10697  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10698  * but with all dynamically-allocated buffers duplicated in new buffers.
10699  */
10700 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10701
10702 /**
10703  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10704  */
10705 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
10706
10707 /**
10708  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10709  */
10710 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
10711
10712 /**
10713  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10714  */
10715 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
10716
10717 /**
10718  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10719  * but with all dynamically-allocated buffers duplicated in new buffers.
10720  */
10721 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
10722
10723 /**
10724  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10725  */
10726 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
10727
10728 /**
10729  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10730  */
10731 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10732
10733 /**
10734  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10735  */
10736 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
10737
10738 /**
10739  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10740  * but with all dynamically-allocated buffers duplicated in new buffers.
10741  */
10742 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10743
10744 /**
10745  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10746  */
10747 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
10748
10749 /**
10750  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10751  */
10752 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10753
10754 /**
10755  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10756  */
10757 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
10758
10759 /**
10760  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10761  * but with all dynamically-allocated buffers duplicated in new buffers.
10762  */
10763 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10764
10765 /**
10766  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10767  */
10768 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
10769
10770 /**
10771  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10772  */
10773 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
10774
10775 /**
10776  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10777  */
10778 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
10779
10780 /**
10781  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10782  * but with all dynamically-allocated buffers duplicated in new buffers.
10783  */
10784 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
10785
10786 /**
10787  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10788  */
10789 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
10790
10791 /**
10792  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10793  */
10794 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
10795
10796 /**
10797  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10798  */
10799 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
10800
10801 /**
10802  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10803  * but with all dynamically-allocated buffers duplicated in new buffers.
10804  */
10805 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
10806
10807 /**
10808  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10809  */
10810 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
10811
10812 /**
10813  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10814  */
10815 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10816
10817 /**
10818  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10819  */
10820 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
10821
10822 /**
10823  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10824  * but with all dynamically-allocated buffers duplicated in new buffers.
10825  */
10826 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10827
10828 /**
10829  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10830  */
10831 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
10832
10833 /**
10834  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10835  */
10836 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10837
10838 /**
10839  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10840  */
10841 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
10842
10843 /**
10844  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10845  * but with all dynamically-allocated buffers duplicated in new buffers.
10846  */
10847 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10848
10849 /**
10850  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10851  */
10852 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
10853
10854 /**
10855  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10856  */
10857 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
10858
10859 /**
10860  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10861  */
10862 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
10863
10864 /**
10865  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10866  * but with all dynamically-allocated buffers duplicated in new buffers.
10867  */
10868 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
10869
10870 /**
10871  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10872  */
10873 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
10874
10875 /**
10876  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10877  */
10878 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
10879
10880 /**
10881  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
10882  */
10883 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
10884
10885 /**
10886  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
10887  * but with all dynamically-allocated buffers duplicated in new buffers.
10888  */
10889 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
10890
10891 /**
10892  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10893  */
10894 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10895
10896 /**
10897  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10898  */
10899 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10900
10901 /**
10902  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10903  */
10904 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10905
10906 /**
10907  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10908  * but with all dynamically-allocated buffers duplicated in new buffers.
10909  */
10910 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10911
10912 /**
10913  * Creates a new tuple which has the same data as `orig`
10914  * but with all dynamically-allocated buffers duplicated in new buffers.
10915  */
10916 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10917
10918 /**
10919  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10920  */
10921 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10922
10923 /**
10924  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10925  */
10926 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10927
10928 /**
10929  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10930  */
10931 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10932
10933 /**
10934  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10935  */
10936 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10937
10938 /**
10939  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10940  */
10941 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10942
10943 /**
10944  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10945  * but with all dynamically-allocated buffers duplicated in new buffers.
10946  */
10947 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10948
10949 /**
10950  * Creates a new CResult_SignatureNoneZ in the success state.
10951  */
10952 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10953
10954 /**
10955  * Creates a new CResult_SignatureNoneZ in the error state.
10956  */
10957 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10958
10959 /**
10960  * Frees any resources used by the CResult_SignatureNoneZ.
10961  */
10962 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10963
10964 /**
10965  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10966  * but with all dynamically-allocated buffers duplicated in new buffers.
10967  */
10968 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10969
10970 /**
10971  * Creates a new CResult_SignDecodeErrorZ in the success state.
10972  */
10973 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10974
10975 /**
10976  * Creates a new CResult_SignDecodeErrorZ in the error state.
10977  */
10978 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10979
10980 /**
10981  * Frees any resources used by the CResult_SignDecodeErrorZ.
10982  */
10983 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10984
10985 /**
10986  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10987  * but with all dynamically-allocated buffers duplicated in new buffers.
10988  */
10989 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10990
10991 /**
10992  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
10993  */
10994 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
10995
10996 /**
10997  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
10998  */
10999 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
11000
11001 /**
11002  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
11003  */
11004 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
11005
11006 /**
11007  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
11008  * but with all dynamically-allocated buffers duplicated in new buffers.
11009  */
11010 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
11011
11012 /**
11013  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11014  */
11015 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
11016
11017 /**
11018  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
11019  */
11020 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
11021
11022 /**
11023  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
11024  */
11025 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
11026
11027 /**
11028  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
11029  */
11030 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
11031
11032 /**
11033  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
11034  * but with all dynamically-allocated buffers duplicated in new buffers.
11035  */
11036 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
11037
11038 /**
11039  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
11040  */
11041 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
11042
11043 /**
11044  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
11045  */
11046 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
11047
11048 /**
11049  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
11050  */
11051 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
11052
11053 /**
11054  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
11055  * but with all dynamically-allocated buffers duplicated in new buffers.
11056  */
11057 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
11058
11059 /**
11060  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11061  */
11062 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
11063
11064 /**
11065  * Creates a new CResult_TransactionNoneZ in the success state.
11066  */
11067 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
11068
11069 /**
11070  * Creates a new CResult_TransactionNoneZ in the error state.
11071  */
11072 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
11073
11074 /**
11075  * Frees any resources used by the CResult_TransactionNoneZ.
11076  */
11077 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
11078
11079 /**
11080  * Creates a new CResult_NoneErrorZ in the success state.
11081  */
11082 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11083
11084 /**
11085  * Creates a new CResult_NoneErrorZ in the error state.
11086  */
11087 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
11088
11089 /**
11090  * Frees any resources used by the CResult_NoneErrorZ.
11091  */
11092 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
11093
11094 /**
11095  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11096  */
11097 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
11098
11099 /**
11100  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
11101  */
11102 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
11103
11104 /**
11105  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
11106  */
11107 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
11108
11109 /**
11110  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
11111  */
11112 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
11113
11114 /**
11115  * Creates a new CResult_NoneAPIErrorZ in the success state.
11116  */
11117 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
11118
11119 /**
11120  * Creates a new CResult_NoneAPIErrorZ in the error state.
11121  */
11122 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
11123
11124 /**
11125  * Frees any resources used by the CResult_NoneAPIErrorZ.
11126  */
11127 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11128
11129 /**
11130  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11131  * but with all dynamically-allocated buffers duplicated in new buffers.
11132  */
11133 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11134
11135 /**
11136  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11137  */
11138 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11139
11140 /**
11141  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11142  */
11143 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11144
11145 /**
11146  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11147  */
11148 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11149
11150 /**
11151  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11152  */
11153 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11154
11155 /**
11156  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11157  */
11158 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11159
11160 /**
11161  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11162  * but with all dynamically-allocated buffers duplicated in new buffers.
11163  */
11164 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11165
11166 /**
11167  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11168  */
11169 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11170
11171 /**
11172  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11173  */
11174 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11175
11176 /**
11177  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11178  */
11179 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11180
11181 /**
11182  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11183  */
11184 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11185
11186 /**
11187  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11188  */
11189 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11190
11191 /**
11192  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11193  */
11194 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11195
11196 /**
11197  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11198  */
11199 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11200
11201 /**
11202  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11203  */
11204 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11205
11206 /**
11207  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11208  */
11209 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11210
11211 /**
11212  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11213  */
11214 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11215
11216 /**
11217  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11218  */
11219 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11220
11221 /**
11222  * Frees any resources used by the Event
11223  */
11224 void Event_free(struct LDKEvent this_ptr);
11225
11226 /**
11227  * Creates a copy of the Event
11228  */
11229 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11230
11231 /**
11232  * Serialize the Event object into a byte array which can be read by Event_read
11233  */
11234 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11235
11236 /**
11237  * Frees any resources used by the MessageSendEvent
11238  */
11239 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11240
11241 /**
11242  * Creates a copy of the MessageSendEvent
11243  */
11244 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11245
11246 /**
11247  * Calls the free function if one is set
11248  */
11249 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11250
11251 /**
11252  * Calls the free function if one is set
11253  */
11254 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11255
11256 /**
11257  * Calls the free function if one is set
11258  */
11259 void EventHandler_free(struct LDKEventHandler this_ptr);
11260
11261 /**
11262  * Frees any resources used by the APIError
11263  */
11264 void APIError_free(struct LDKAPIError this_ptr);
11265
11266 /**
11267  * Creates a copy of the APIError
11268  */
11269 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11270
11271 /**
11272  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11273  * 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.
11274  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11275  */
11276 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11277
11278 /**
11279  * Recovers the PublicKey of the signer of the message given the message and the signature.
11280  */
11281 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11282
11283 /**
11284  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11285  * and the PublicKey.
11286  */
11287 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11288
11289 /**
11290  * Creates a copy of the Level
11291  */
11292 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11293
11294 /**
11295  * Checks if two Levels contain equal inner contents.
11296  * This ignores pointers and is_owned flags and looks at the values in fields.
11297  */
11298 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11299
11300 /**
11301  * Checks if two Levels contain equal inner contents.
11302  */
11303 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11304
11305 /**
11306  * Returns the most verbose logging level.
11307  */
11308 MUST_USE_RES enum LDKLevel Level_max(void);
11309
11310 /**
11311  * Calls the free function if one is set
11312  */
11313 void Logger_free(struct LDKLogger this_ptr);
11314
11315 /**
11316  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11317  */
11318 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11319
11320 /**
11321  * Confirmations we will wait for before considering the channel locked in.
11322  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11323  * equivalent limit applied to outbound channels).
11324  *
11325  * Default value: 6.
11326  */
11327 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11328
11329 /**
11330  * Confirmations we will wait for before considering the channel locked in.
11331  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11332  * equivalent limit applied to outbound channels).
11333  *
11334  * Default value: 6.
11335  */
11336 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11337
11338 /**
11339  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11340  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11341  * transaction).
11342  *
11343  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11344  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11345  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11346  * possibly with time in between to RBF the spending transaction).
11347  *
11348  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11349  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11350  * our channel.
11351  *
11352  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11353  * can tweak config to ask for more security, not less.
11354  */
11355 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11356
11357 /**
11358  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11359  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11360  * transaction).
11361  *
11362  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11363  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11364  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11365  * possibly with time in between to RBF the spending transaction).
11366  *
11367  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11368  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11369  * our channel.
11370  *
11371  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11372  * can tweak config to ask for more security, not less.
11373  */
11374 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11375
11376 /**
11377  * Set to the smallest value HTLC we will accept to process.
11378  *
11379  * This value is sent to our counterparty on channel-open and we close the channel any time
11380  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11381  *
11382  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11383  * by the protocol.
11384  */
11385 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11386
11387 /**
11388  * Set to the smallest value HTLC we will accept to process.
11389  *
11390  * This value is sent to our counterparty on channel-open and we close the channel any time
11391  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11392  *
11393  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11394  * by the protocol.
11395  */
11396 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11397
11398 /**
11399  * Constructs a new ChannelHandshakeConfig given each field
11400  */
11401 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);
11402
11403 /**
11404  * Creates a copy of the ChannelHandshakeConfig
11405  */
11406 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11407
11408 /**
11409  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11410  */
11411 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11412
11413 /**
11414  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11415  */
11416 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11417
11418 /**
11419  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11420  * only applies to inbound channels.
11421  *
11422  * Default value: 0.
11423  */
11424 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11425
11426 /**
11427  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11428  * only applies to inbound channels.
11429  *
11430  * Default value: 0.
11431  */
11432 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11433
11434 /**
11435  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11436  * you to limit the maximum minimum-size they can require.
11437  *
11438  * Default value: u64::max_value.
11439  */
11440 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11441
11442 /**
11443  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11444  * you to limit the maximum minimum-size they can require.
11445  *
11446  * Default value: u64::max_value.
11447  */
11448 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11449
11450 /**
11451  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11452  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11453  *
11454  * Default value: 0.
11455  */
11456 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11457
11458 /**
11459  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11460  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11461  *
11462  * Default value: 0.
11463  */
11464 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11465
11466 /**
11467  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11468  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11469  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11470  *
11471  * Default value: u64::max_value.
11472  */
11473 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11474
11475 /**
11476  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11477  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11478  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11479  *
11480  * Default value: u64::max_value.
11481  */
11482 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11483
11484 /**
11485  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11486  * time. This allows you to set a minimum such value.
11487  *
11488  * Default value: 0.
11489  */
11490 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11491
11492 /**
11493  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11494  * time. This allows you to set a minimum such value.
11495  *
11496  * Default value: 0.
11497  */
11498 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11499
11500 /**
11501  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11502  * certain number of blocks, specified by the node which is not the funder (as the funder can
11503  * assume they aren't going to double-spend themselves).
11504  * This config allows you to set a limit on the maximum amount of time to wait.
11505  *
11506  * Default value: 144, or roughly one day and only applies to outbound channels.
11507  */
11508 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11509
11510 /**
11511  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11512  * certain number of blocks, specified by the node which is not the funder (as the funder can
11513  * assume they aren't going to double-spend themselves).
11514  * This config allows you to set a limit on the maximum amount of time to wait.
11515  *
11516  * Default value: 144, or roughly one day and only applies to outbound channels.
11517  */
11518 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11519
11520 /**
11521  * Set to force the incoming channel to match our announced channel preference in
11522  * ChannelConfig.
11523  *
11524  * Default value: true, to make the default that no announced channels are possible (which is
11525  * appropriate for any nodes which are not online very reliably).
11526  */
11527 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11528
11529 /**
11530  * Set to force the incoming channel to match our announced channel preference in
11531  * ChannelConfig.
11532  *
11533  * Default value: true, to make the default that no announced channels are possible (which is
11534  * appropriate for any nodes which are not online very reliably).
11535  */
11536 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11537
11538 /**
11539  * Set to the amount of time we're willing to wait to claim money back to us.
11540  *
11541  * Not checking this value would be a security issue, as our peer would be able to set it to
11542  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11543  *
11544  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11545  * reduce the loss of having useless locked funds (if your peer accepts)
11546  */
11547 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11548
11549 /**
11550  * Set to the amount of time we're willing to wait to claim money back to us.
11551  *
11552  * Not checking this value would be a security issue, as our peer would be able to set it to
11553  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11554  *
11555  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11556  * reduce the loss of having useless locked funds (if your peer accepts)
11557  */
11558 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11559
11560 /**
11561  * Constructs a new ChannelHandshakeLimits given each field
11562  */
11563 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);
11564
11565 /**
11566  * Creates a copy of the ChannelHandshakeLimits
11567  */
11568 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11569
11570 /**
11571  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11572  */
11573 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11574
11575 /**
11576  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11577  */
11578 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11579
11580 /**
11581  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11582  * This may be allowed to change at runtime in a later update, however doing so must result in
11583  * update messages sent to notify all nodes of our updated relay fee.
11584  *
11585  * Default value: 0.
11586  */
11587 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11588
11589 /**
11590  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11591  * This may be allowed to change at runtime in a later update, however doing so must result in
11592  * update messages sent to notify all nodes of our updated relay fee.
11593  *
11594  * Default value: 0.
11595  */
11596 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11597
11598 /**
11599  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11600  * the channel this config applies to.
11601  *
11602  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11603  * HTLC balance when a channel appears on-chain whereas
11604  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11605  * (non-HTLC-encumbered) balance.
11606  *
11607  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11608  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11609  * commitment transaction at least once per this many blocks (minus some margin to allow us
11610  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11611  * the spending transaction).
11612  *
11613  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11614  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11615  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11616  *
11617  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11618  */
11619 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11620
11621 /**
11622  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11623  * the channel this config applies to.
11624  *
11625  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11626  * HTLC balance when a channel appears on-chain whereas
11627  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11628  * (non-HTLC-encumbered) balance.
11629  *
11630  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11631  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11632  * commitment transaction at least once per this many blocks (minus some margin to allow us
11633  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11634  * the spending transaction).
11635  *
11636  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11637  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11638  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11639  *
11640  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11641  */
11642 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11643
11644 /**
11645  * Set to announce the channel publicly and notify all nodes that they can route via this
11646  * channel.
11647  *
11648  * This should only be set to true for nodes which expect to be online reliably.
11649  *
11650  * As the node which funds a channel picks this value this will only apply for new outbound
11651  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11652  *
11653  * This cannot be changed after the initial channel handshake.
11654  *
11655  * Default value: false.
11656  */
11657 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11658
11659 /**
11660  * Set to announce the channel publicly and notify all nodes that they can route via this
11661  * channel.
11662  *
11663  * This should only be set to true for nodes which expect to be online reliably.
11664  *
11665  * As the node which funds a channel picks this value this will only apply for new outbound
11666  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11667  *
11668  * This cannot be changed after the initial channel handshake.
11669  *
11670  * Default value: false.
11671  */
11672 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11673
11674 /**
11675  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11676  * supports it, they will then enforce the mutual-close output to us matches what we provided
11677  * at intialization, preventing us from closing to an alternate pubkey.
11678  *
11679  * This is set to true by default to provide a slight increase in security, though ultimately
11680  * any attacker who is able to take control of a channel can just as easily send the funds via
11681  * lightning payments, so we never require that our counterparties support this option.
11682  *
11683  * This cannot be changed after a channel has been initialized.
11684  *
11685  * Default value: true.
11686  */
11687 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11688
11689 /**
11690  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11691  * supports it, they will then enforce the mutual-close output to us matches what we provided
11692  * at intialization, preventing us from closing to an alternate pubkey.
11693  *
11694  * This is set to true by default to provide a slight increase in security, though ultimately
11695  * any attacker who is able to take control of a channel can just as easily send the funds via
11696  * lightning payments, so we never require that our counterparties support this option.
11697  *
11698  * This cannot be changed after a channel has been initialized.
11699  *
11700  * Default value: true.
11701  */
11702 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11703
11704 /**
11705  * Constructs a new ChannelConfig given each field
11706  */
11707 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);
11708
11709 /**
11710  * Creates a copy of the ChannelConfig
11711  */
11712 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
11713
11714 /**
11715  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
11716  */
11717 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
11718
11719 /**
11720  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
11721  */
11722 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
11723
11724 /**
11725  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
11726  */
11727 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
11728
11729 /**
11730  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
11731  */
11732 void UserConfig_free(struct LDKUserConfig this_obj);
11733
11734 /**
11735  * Channel config that we propose to our counterparty.
11736  */
11737 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11738
11739 /**
11740  * Channel config that we propose to our counterparty.
11741  */
11742 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
11743
11744 /**
11745  * Limits applied to our counterparty's proposed channel config settings.
11746  */
11747 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11748
11749 /**
11750  * Limits applied to our counterparty's proposed channel config settings.
11751  */
11752 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
11753
11754 /**
11755  * Channel config which affects behavior during channel lifetime.
11756  */
11757 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11758
11759 /**
11760  * Channel config which affects behavior during channel lifetime.
11761  */
11762 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
11763
11764 /**
11765  * Constructs a new UserConfig given each field
11766  */
11767 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);
11768
11769 /**
11770  * Creates a copy of the UserConfig
11771  */
11772 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
11773
11774 /**
11775  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
11776  */
11777 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
11778
11779 /**
11780  * Creates a copy of the AccessError
11781  */
11782 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
11783
11784 /**
11785  * Calls the free function if one is set
11786  */
11787 void Access_free(struct LDKAccess this_ptr);
11788
11789 /**
11790  * Calls the free function if one is set
11791  */
11792 void Listen_free(struct LDKListen this_ptr);
11793
11794 /**
11795  * Calls the free function if one is set
11796  */
11797 void Confirm_free(struct LDKConfirm this_ptr);
11798
11799 /**
11800  * Calls the free function if one is set
11801  */
11802 void Watch_free(struct LDKWatch this_ptr);
11803
11804 /**
11805  * Calls the free function if one is set
11806  */
11807 void Filter_free(struct LDKFilter this_ptr);
11808
11809 /**
11810  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
11811  */
11812 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
11813
11814 /**
11815  * First block where the transaction output may have been spent.
11816  */
11817 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11818
11819 /**
11820  * First block where the transaction output may have been spent.
11821  */
11822 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11823
11824 /**
11825  * Outpoint identifying the transaction output.
11826  */
11827 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11828
11829 /**
11830  * Outpoint identifying the transaction output.
11831  */
11832 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11833
11834 /**
11835  * Spending condition of the transaction output.
11836  */
11837 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11838
11839 /**
11840  * Spending condition of the transaction output.
11841  */
11842 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11843
11844 /**
11845  * Constructs a new WatchedOutput given each field
11846  */
11847 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
11848
11849 /**
11850  * Calls the free function if one is set
11851  */
11852 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
11853
11854 /**
11855  * Creates a copy of the ConfirmationTarget
11856  */
11857 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
11858
11859 /**
11860  * Calls the free function if one is set
11861  */
11862 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
11863
11864 /**
11865  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
11866  */
11867 void ChainMonitor_free(struct LDKChainMonitor this_obj);
11868
11869 /**
11870  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
11871  *
11872  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
11873  * will call back to it indicating transactions and outputs of interest. This allows clients to
11874  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
11875  * always need to fetch full blocks absent another means for determining which blocks contain
11876  * transactions relevant to the watched channels.
11877  */
11878 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
11879
11880 /**
11881  * Constructs a new Listen which calls the relevant methods on this_arg.
11882  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11883  */
11884 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11885
11886 /**
11887  * Constructs a new Confirm which calls the relevant methods on this_arg.
11888  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
11889  */
11890 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11891
11892 /**
11893  * Constructs a new Watch which calls the relevant methods on this_arg.
11894  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
11895  */
11896 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11897
11898 /**
11899  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11900  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11901  */
11902 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11903
11904 /**
11905  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
11906  */
11907 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
11908
11909 /**
11910  * The sequence number of this update. Updates *must* be replayed in-order according to this
11911  * sequence number (and updates may panic if they are not). The update_id values are strictly
11912  * increasing and increase by one for each new update, with one exception specified below.
11913  *
11914  * This sequence number is also used to track up to which points updates which returned
11915  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11916  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11917  *
11918  * The only instance where update_id values are not strictly increasing is the case where we
11919  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11920  * its docs for more details.
11921  */
11922 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
11923
11924 /**
11925  * The sequence number of this update. Updates *must* be replayed in-order according to this
11926  * sequence number (and updates may panic if they are not). The update_id values are strictly
11927  * increasing and increase by one for each new update, with one exception specified below.
11928  *
11929  * This sequence number is also used to track up to which points updates which returned
11930  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11931  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11932  *
11933  * The only instance where update_id values are not strictly increasing is the case where we
11934  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11935  * its docs for more details.
11936  */
11937 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
11938
11939 /**
11940  * Creates a copy of the ChannelMonitorUpdate
11941  */
11942 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
11943
11944 /**
11945  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
11946  */
11947 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
11948
11949 /**
11950  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
11951  */
11952 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
11953
11954 /**
11955  * Creates a copy of the ChannelMonitorUpdateErr
11956  */
11957 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
11958
11959 /**
11960  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
11961  */
11962 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
11963
11964 /**
11965  * Creates a copy of the MonitorUpdateError
11966  */
11967 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
11968
11969 /**
11970  * Frees any resources used by the MonitorEvent
11971  */
11972 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
11973
11974 /**
11975  * Creates a copy of the MonitorEvent
11976  */
11977 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
11978
11979 /**
11980  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
11981  */
11982 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
11983
11984 /**
11985  * Creates a copy of the HTLCUpdate
11986  */
11987 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
11988
11989 /**
11990  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
11991  */
11992 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
11993
11994 /**
11995  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
11996  */
11997 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
11998
11999 /**
12000  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12001  */
12002 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12003
12004 /**
12005  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12006  */
12007 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12008
12009 /**
12010  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12011  * itself.
12012  *
12013  * panics if the given update is not the next update by update_id.
12014  */
12015 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);
12016
12017 /**
12018  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12019  * ChannelMonitor.
12020  */
12021 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12022
12023 /**
12024  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12025  */
12026 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12027
12028 /**
12029  * Gets a list of txids, with their output scripts (in the order they appear in the
12030  * transaction), which we must learn about spends of via block_connected().
12031  */
12032 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12033
12034 /**
12035  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12036  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12037  * have been registered.
12038  */
12039 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12040
12041 /**
12042  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12043  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12044  */
12045 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12046
12047 /**
12048  * Gets the list of pending events which were generated by previous actions, clearing the list
12049  * in the process.
12050  *
12051  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12052  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12053  * no internal locking in ChannelMonitors.
12054  */
12055 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12056
12057 /**
12058  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12059  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12060  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12061  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12062  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12063  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12064  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12065  * out-of-band the other node operator to coordinate with him if option is available to you.
12066  * In any-case, choice is up to the user.
12067  */
12068 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);
12069
12070 /**
12071  * Processes transactions in a newly connected block, which may result in any of the following:
12072  * - update the monitor's state against resolved HTLCs
12073  * - punish the counterparty in the case of seeing a revoked commitment transaction
12074  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12075  * - detect settled outputs for later spending
12076  * - schedule and bump any in-flight claims
12077  *
12078  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12079  * [`get_outputs_to_watch`].
12080  *
12081  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12082  */
12083 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);
12084
12085 /**
12086  * Determines if the disconnected block contained any transactions of interest and updates
12087  * appropriately.
12088  */
12089 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);
12090
12091 /**
12092  * Processes transactions confirmed in a block with the given header and height, returning new
12093  * outputs to watch. See [`block_connected`] for details.
12094  *
12095  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12096  * blocks. See [`chain::Confirm`] for calling expectations.
12097  *
12098  * [`block_connected`]: Self::block_connected
12099  */
12100 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);
12101
12102 /**
12103  * Processes a transaction that was reorganized out of the chain.
12104  *
12105  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12106  * than blocks. See [`chain::Confirm`] for calling expectations.
12107  *
12108  * [`block_disconnected`]: Self::block_disconnected
12109  */
12110 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);
12111
12112 /**
12113  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12114  * [`block_connected`] for details.
12115  *
12116  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12117  * blocks. See [`chain::Confirm`] for calling expectations.
12118  *
12119  * [`block_connected`]: Self::block_connected
12120  */
12121 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);
12122
12123 /**
12124  * Returns the set of txids that should be monitored for re-organization out of the chain.
12125  */
12126 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12127
12128 /**
12129  * Calls the free function if one is set
12130  */
12131 void Persist_free(struct LDKPersist this_ptr);
12132
12133 /**
12134  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12135  */
12136 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12137
12138 /**
12139  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12140  */
12141 void OutPoint_free(struct LDKOutPoint this_obj);
12142
12143 /**
12144  * The referenced transaction's txid.
12145  */
12146 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12147
12148 /**
12149  * The referenced transaction's txid.
12150  */
12151 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12152
12153 /**
12154  * The index of the referenced output in its transaction's vout.
12155  */
12156 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12157
12158 /**
12159  * The index of the referenced output in its transaction's vout.
12160  */
12161 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12162
12163 /**
12164  * Constructs a new OutPoint given each field
12165  */
12166 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12167
12168 /**
12169  * Creates a copy of the OutPoint
12170  */
12171 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12172
12173 /**
12174  * Checks if two OutPoints contain equal inner contents.
12175  * This ignores pointers and is_owned flags and looks at the values in fields.
12176  * Two objects with NULL inner values will be considered "equal" here.
12177  */
12178 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12179
12180 /**
12181  * Checks if two OutPoints contain equal inner contents.
12182  */
12183 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12184
12185 /**
12186  * Convert an `OutPoint` to a lightning channel id.
12187  */
12188 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12189
12190 /**
12191  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12192  */
12193 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12194
12195 /**
12196  * Read a OutPoint from a byte array, created by OutPoint_write
12197  */
12198 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12199
12200 /**
12201  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12202  */
12203 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12204
12205 /**
12206  * The outpoint which is spendable
12207  */
12208 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12209
12210 /**
12211  * The outpoint which is spendable
12212  */
12213 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12214
12215 /**
12216  * Per commitment point to derive delayed_payment_key by key holder
12217  */
12218 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12219
12220 /**
12221  * Per commitment point to derive delayed_payment_key by key holder
12222  */
12223 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12224
12225 /**
12226  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12227  * the witness_script.
12228  */
12229 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12230
12231 /**
12232  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12233  * the witness_script.
12234  */
12235 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12236
12237 /**
12238  * The output which is referenced by the given outpoint
12239  */
12240 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12241
12242 /**
12243  * The revocation point specific to the commitment transaction which was broadcast. Used to
12244  * derive the witnessScript for this output.
12245  */
12246 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12247
12248 /**
12249  * The revocation point specific to the commitment transaction which was broadcast. Used to
12250  * derive the witnessScript for this output.
12251  */
12252 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12253
12254 /**
12255  * Arbitrary identification information returned by a call to
12256  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12257  * the channel to spend the output.
12258  */
12259 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12260
12261 /**
12262  * Arbitrary identification information returned by a call to
12263  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12264  * the channel to spend the output.
12265  */
12266 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12267
12268 /**
12269  * The value of the channel which this output originated from, possibly indirectly.
12270  */
12271 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12272
12273 /**
12274  * The value of the channel which this output originated from, possibly indirectly.
12275  */
12276 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12277
12278 /**
12279  * Constructs a new DelayedPaymentOutputDescriptor given each field
12280  */
12281 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);
12282
12283 /**
12284  * Creates a copy of the DelayedPaymentOutputDescriptor
12285  */
12286 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12287
12288 /**
12289  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12290  */
12291 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12292
12293 /**
12294  * The outpoint which is spendable
12295  */
12296 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12297
12298 /**
12299  * The outpoint which is spendable
12300  */
12301 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12302
12303 /**
12304  * The output which is referenced by the given outpoint
12305  */
12306 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12307
12308 /**
12309  * Arbitrary identification information returned by a call to
12310  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12311  * the channel to spend the output.
12312  */
12313 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12314
12315 /**
12316  * Arbitrary identification information returned by a call to
12317  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12318  * the channel to spend the output.
12319  */
12320 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12321
12322 /**
12323  * The value of the channel which this transactions spends.
12324  */
12325 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12326
12327 /**
12328  * The value of the channel which this transactions spends.
12329  */
12330 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12331
12332 /**
12333  * Constructs a new StaticPaymentOutputDescriptor given each field
12334  */
12335 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);
12336
12337 /**
12338  * Creates a copy of the StaticPaymentOutputDescriptor
12339  */
12340 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12341
12342 /**
12343  * Frees any resources used by the SpendableOutputDescriptor
12344  */
12345 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12346
12347 /**
12348  * Creates a copy of the SpendableOutputDescriptor
12349  */
12350 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12351
12352 /**
12353  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12354  */
12355 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12356
12357 /**
12358  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12359  */
12360 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12361
12362 /**
12363  * Calls the free function if one is set
12364  */
12365 void BaseSign_free(struct LDKBaseSign this_ptr);
12366
12367 /**
12368  * Creates a copy of a Sign
12369  */
12370 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12371
12372 /**
12373  * Calls the free function if one is set
12374  */
12375 void Sign_free(struct LDKSign this_ptr);
12376
12377 /**
12378  * Calls the free function if one is set
12379  */
12380 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12381
12382 /**
12383  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12384  */
12385 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12386
12387 /**
12388  * Private key of anchor tx
12389  */
12390 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12391
12392 /**
12393  * Private key of anchor tx
12394  */
12395 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12396
12397 /**
12398  * Holder secret key for blinded revocation pubkey
12399  */
12400 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12401
12402 /**
12403  * Holder secret key for blinded revocation pubkey
12404  */
12405 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12406
12407 /**
12408  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12409  */
12410 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12411
12412 /**
12413  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12414  */
12415 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12416
12417 /**
12418  * Holder secret key used in HTLC tx
12419  */
12420 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12421
12422 /**
12423  * Holder secret key used in HTLC tx
12424  */
12425 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12426
12427 /**
12428  * Holder htlc secret key used in commitment tx htlc outputs
12429  */
12430 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12431
12432 /**
12433  * Holder htlc secret key used in commitment tx htlc outputs
12434  */
12435 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12436
12437 /**
12438  * Commitment seed
12439  */
12440 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12441
12442 /**
12443  * Commitment seed
12444  */
12445 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12446
12447 /**
12448  * Creates a copy of the InMemorySigner
12449  */
12450 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12451
12452 /**
12453  * Create a new InMemorySigner
12454  */
12455 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);
12456
12457 /**
12458  * Counterparty pubkeys.
12459  * Will panic if ready_channel wasn't called.
12460  */
12461 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12462
12463 /**
12464  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12465  * transactions, ie the amount of time that we have to wait to recover our funds if we
12466  * broadcast a transaction.
12467  * Will panic if ready_channel wasn't called.
12468  */
12469 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12470
12471 /**
12472  * The contest_delay value specified by us and applied on transactions broadcastable
12473  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12474  * if they broadcast a transaction.
12475  * Will panic if ready_channel wasn't called.
12476  */
12477 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12478
12479 /**
12480  * Whether the holder is the initiator
12481  * Will panic if ready_channel wasn't called.
12482  */
12483 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12484
12485 /**
12486  * Funding outpoint
12487  * Will panic if ready_channel wasn't called.
12488  */
12489 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12490
12491 /**
12492  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12493  * building transactions.
12494  *
12495  * Will panic if ready_channel wasn't called.
12496  */
12497 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12498
12499 /**
12500  * Sign the single input of spend_tx at index `input_idx` which spends the output
12501  * described by descriptor, returning the witness stack for the input.
12502  *
12503  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12504  * or is not spending the outpoint described by `descriptor.outpoint`.
12505  */
12506 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);
12507
12508 /**
12509  * Sign the single input of spend_tx at index `input_idx` which spends the output
12510  * described by descriptor, returning the witness stack for the input.
12511  *
12512  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12513  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12514  * sequence set to `descriptor.to_self_delay`.
12515  */
12516 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);
12517
12518 /**
12519  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12520  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12521  */
12522 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12523
12524 /**
12525  * Constructs a new Sign which calls the relevant methods on this_arg.
12526  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12527  */
12528 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12529
12530 /**
12531  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12532  */
12533 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12534
12535 /**
12536  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12537  */
12538 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12539
12540 /**
12541  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12542  */
12543 void KeysManager_free(struct LDKKeysManager this_obj);
12544
12545 /**
12546  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12547  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12548  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12549  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12550  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12551  * simply use the current time (with very high precision).
12552  *
12553  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12554  * obviously, starting_time should be unique every time you reload the library - it is only
12555  * used to generate new ephemeral key data (which will be stored by the individual channel if
12556  * necessary).
12557  *
12558  * Note that the seed is required to recover certain on-chain funds independent of
12559  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12560  * channel, and some on-chain during-closing funds.
12561  *
12562  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12563  * versions. Once the library is more fully supported, the docs will be updated to include a
12564  * detailed description of the guarantee.
12565  */
12566 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12567
12568 /**
12569  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12570  *
12571  * Key derivation parameters are accessible through a per-channel secrets
12572  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12573  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12574  */
12575 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]);
12576
12577 /**
12578  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12579  * output to the given change destination (if sufficient change value remains). The
12580  * transaction will have a feerate, at least, of the given value.
12581  *
12582  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12583  * if a descriptor was duplicated.
12584  *
12585  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12586  *
12587  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12588  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12589  */
12590 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);
12591
12592 /**
12593  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12594  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12595  */
12596 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12597
12598 /**
12599  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12600  */
12601 void ChannelManager_free(struct LDKChannelManager this_obj);
12602
12603 /**
12604  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12605  */
12606 void ChainParameters_free(struct LDKChainParameters this_obj);
12607
12608 /**
12609  * The network for determining the `chain_hash` in Lightning messages.
12610  */
12611 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12612
12613 /**
12614  * The network for determining the `chain_hash` in Lightning messages.
12615  */
12616 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12617
12618 /**
12619  * The hash and height of the latest block successfully connected.
12620  *
12621  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12622  */
12623 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12624
12625 /**
12626  * The hash and height of the latest block successfully connected.
12627  *
12628  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12629  */
12630 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12631
12632 /**
12633  * Constructs a new ChainParameters given each field
12634  */
12635 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12636
12637 /**
12638  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12639  */
12640 void BestBlock_free(struct LDKBestBlock this_obj);
12641
12642 /**
12643  * Creates a copy of the BestBlock
12644  */
12645 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12646
12647 /**
12648  * Returns the best block from the genesis of the given network.
12649  */
12650 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12651
12652 /**
12653  * Returns the best block as identified by the given block hash and height.
12654  */
12655 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12656
12657 /**
12658  * Returns the best block hash.
12659  */
12660 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12661
12662 /**
12663  * Returns the best block height.
12664  */
12665 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12666
12667 /**
12668  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12669  */
12670 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12671
12672 /**
12673  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12674  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12675  * Note that this means this value is *not* persistent - it can change once during the
12676  * lifetime of the channel.
12677  */
12678 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12679
12680 /**
12681  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12682  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12683  * Note that this means this value is *not* persistent - it can change once during the
12684  * lifetime of the channel.
12685  */
12686 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12687
12688 /**
12689  * The Channel's funding transaction output, if we've negotiated the funding transaction with
12690  * our counterparty already.
12691  *
12692  * Note that, if this has been set, `channel_id` will be equivalent to
12693  * `funding_txo.unwrap().to_channel_id()`.
12694  */
12695 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12696
12697 /**
12698  * The Channel's funding transaction output, if we've negotiated the funding transaction with
12699  * our counterparty already.
12700  *
12701  * Note that, if this has been set, `channel_id` will be equivalent to
12702  * `funding_txo.unwrap().to_channel_id()`.
12703  */
12704 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12705
12706 /**
12707  * The position of the funding transaction in the chain. None if the funding transaction has
12708  * not yet been confirmed and the channel fully opened.
12709  */
12710 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12711
12712 /**
12713  * The position of the funding transaction in the chain. None if the funding transaction has
12714  * not yet been confirmed and the channel fully opened.
12715  */
12716 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
12717
12718 /**
12719  * The node_id of our counterparty
12720  */
12721 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12722
12723 /**
12724  * The node_id of our counterparty
12725  */
12726 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12727
12728 /**
12729  * The Features the channel counterparty provided upon last connection.
12730  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12731  * many routing-relevant features are present in the init context.
12732  */
12733 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12734
12735 /**
12736  * The Features the channel counterparty provided upon last connection.
12737  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12738  * many routing-relevant features are present in the init context.
12739  */
12740 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
12741
12742 /**
12743  * The value, in satoshis, of this channel as appears in the funding output
12744  */
12745 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12746
12747 /**
12748  * The value, in satoshis, of this channel as appears in the funding output
12749  */
12750 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12751
12752 /**
12753  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12754  */
12755 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12756
12757 /**
12758  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12759  */
12760 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12761
12762 /**
12763  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12764  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12765  * available for inclusion in new outbound HTLCs). This further does not include any pending
12766  * outgoing HTLCs which are awaiting some other resolution to be sent.
12767  */
12768 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12769
12770 /**
12771  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12772  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12773  * available for inclusion in new outbound HTLCs). This further does not include any pending
12774  * outgoing HTLCs which are awaiting some other resolution to be sent.
12775  */
12776 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12777
12778 /**
12779  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12780  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12781  * available for inclusion in new inbound HTLCs).
12782  * Note that there are some corner cases not fully handled here, so the actual available
12783  * inbound capacity may be slightly higher than this.
12784  */
12785 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12786
12787 /**
12788  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12789  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12790  * available for inclusion in new inbound HTLCs).
12791  * Note that there are some corner cases not fully handled here, so the actual available
12792  * inbound capacity may be slightly higher than this.
12793  */
12794 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12795
12796 /**
12797  * True if the channel was initiated (and thus funded) by us.
12798  */
12799 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12800
12801 /**
12802  * True if the channel was initiated (and thus funded) by us.
12803  */
12804 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12805
12806 /**
12807  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
12808  * channel is not currently being shut down. `funding_locked` message exchange implies the
12809  * required confirmation count has been reached (and we were connected to the peer at some
12810  * point after the funding transaction received enough confirmations).
12811  */
12812 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12813
12814 /**
12815  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
12816  * channel is not currently being shut down. `funding_locked` message exchange implies the
12817  * required confirmation count has been reached (and we were connected to the peer at some
12818  * point after the funding transaction received enough confirmations).
12819  */
12820 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12821
12822 /**
12823  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12824  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
12825  * channel is not currently negotiating a shutdown.
12826  *
12827  * This is a strict superset of `is_funding_locked`.
12828  */
12829 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12830
12831 /**
12832  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12833  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
12834  * channel is not currently negotiating a shutdown.
12835  *
12836  * This is a strict superset of `is_funding_locked`.
12837  */
12838 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12839
12840 /**
12841  * True if this channel is (or will be) publicly-announced.
12842  */
12843 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12844
12845 /**
12846  * True if this channel is (or will be) publicly-announced.
12847  */
12848 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12849
12850 /**
12851  * Creates a copy of the ChannelDetails
12852  */
12853 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
12854
12855 /**
12856  * Frees any resources used by the PaymentSendFailure
12857  */
12858 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
12859
12860 /**
12861  * Creates a copy of the PaymentSendFailure
12862  */
12863 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
12864
12865 /**
12866  * Constructs a new ChannelManager to hold several channels and route between them.
12867  *
12868  * This is the main \"logic hub\" for all channel-related actions, and implements
12869  * ChannelMessageHandler.
12870  *
12871  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
12872  *
12873  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
12874  *
12875  * Users need to notify the new ChannelManager when a new block is connected or
12876  * disconnected using its `block_connected` and `block_disconnected` methods, starting
12877  * from after `params.latest_hash`.
12878  */
12879 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);
12880
12881 /**
12882  * Gets the current configuration applied to all new channels,  as
12883  */
12884 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
12885
12886 /**
12887  * Creates a new outbound channel to the given remote node and with the given value.
12888  *
12889  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
12890  * tracking of which events correspond with which create_channel call. Note that the
12891  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
12892  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
12893  * otherwise ignored.
12894  *
12895  * If successful, will generate a SendOpenChannel message event, so you should probably poll
12896  * PeerManager::process_events afterwards.
12897  *
12898  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
12899  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
12900  */
12901 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);
12902
12903 /**
12904  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
12905  * more information.
12906  */
12907 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12908
12909 /**
12910  * Gets the list of usable channels, in random order. Useful as an argument to
12911  * get_route to ensure non-announced channels are used.
12912  *
12913  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
12914  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
12915  * are.
12916  */
12917 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12918
12919 /**
12920  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
12921  * will be accepted on the given channel, and after additional timeout/the closing of all
12922  * pending HTLCs, the channel will be closed on chain.
12923  *
12924  * May generate a SendShutdown message event on success, which should be relayed.
12925  */
12926 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12927
12928 /**
12929  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
12930  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
12931  */
12932 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12933
12934 /**
12935  * Force close all channels, immediately broadcasting the latest local commitment transaction
12936  * for each to the chain and rejecting new HTLCs on each.
12937  */
12938 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12939
12940 /**
12941  * Sends a payment along a given route.
12942  *
12943  * Value parameters are provided via the last hop in route, see documentation for RouteHop
12944  * fields for more info.
12945  *
12946  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
12947  * payment), we don't do anything to stop you! We always try to ensure that if the provided
12948  * next hop knows the preimage to payment_hash they can claim an additional amount as
12949  * specified in the last hop in the route! Thus, you should probably do your own
12950  * payment_preimage tracking (which you should already be doing as they represent \"proof of
12951  * payment\") and prevent double-sends yourself.
12952  *
12953  * May generate SendHTLCs message(s) event on success, which should be relayed.
12954  *
12955  * Each path may have a different return value, and PaymentSendValue may return a Vec with
12956  * each entry matching the corresponding-index entry in the route paths, see
12957  * PaymentSendFailure for more info.
12958  *
12959  * In general, a path may raise:
12960  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
12961  *    node public key) is specified.
12962  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
12963  *    (including due to previous monitor update failure or new permanent monitor update
12964  *    failure).
12965  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
12966  *    relevant updates.
12967  *
12968  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
12969  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
12970  * different route unless you intend to pay twice!
12971  *
12972  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
12973  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
12974  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
12975  * must not contain multiple paths as multi-path payments require a recipient-provided
12976  * payment_secret.
12977  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
12978  * bit set (either as required or as available). If multiple paths are present in the Route,
12979  * we assume the invoice had the basic_mpp feature set.
12980  */
12981 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);
12982
12983 /**
12984  * Call this upon creation of a funding transaction for the given channel.
12985  *
12986  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
12987  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
12988  *
12989  * Panics if a funding transaction has already been provided for this channel.
12990  *
12991  * May panic if the output found in the funding transaction is duplicative with some other
12992  * channel (note that this should be trivially prevented by using unique funding transaction
12993  * keys per-channel).
12994  *
12995  * Do NOT broadcast the funding transaction yourself. When we have safely received our
12996  * counterparty's signature the funding transaction will automatically be broadcast via the
12997  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
12998  *
12999  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13000  * not currently support replacing a funding transaction on an existing channel. Instead,
13001  * create a new channel with a conflicting funding transaction.
13002  *
13003  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13004  */
13005 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);
13006
13007 /**
13008  * Regenerates channel_announcements and generates a signed node_announcement from the given
13009  * arguments, providing them in corresponding events via
13010  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13011  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13012  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13013  * our network addresses.
13014  *
13015  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13016  * node to humans. They carry no in-protocol meaning.
13017  *
13018  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13019  * accepts incoming connections. These will be included in the node_announcement, publicly
13020  * tying these addresses together and to this node. If you wish to preserve user privacy,
13021  * addresses should likely contain only Tor Onion addresses.
13022  *
13023  * Panics if `addresses` is absurdly large (more than 500).
13024  *
13025  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13026  */
13027 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13028
13029 /**
13030  * Processes HTLCs which are pending waiting on random forward delay.
13031  *
13032  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13033  * Will likely generate further events.
13034  */
13035 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13036
13037 /**
13038  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13039  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13040  * to inform the network about the uselessness of these channels.
13041  *
13042  * This method handles all the details, and must be called roughly once per minute.
13043  *
13044  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13045  */
13046 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13047
13048 /**
13049  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13050  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13051  * along the path (including in our own channel on which we received it).
13052  * Returns false if no payment was found to fail backwards, true if the process of failing the
13053  * HTLC backwards has been started.
13054  */
13055 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13056
13057 /**
13058  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13059  * generating message events for the net layer to claim the payment, if possible. Thus, you
13060  * should probably kick the net layer to go send messages if this returns true!
13061  *
13062  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13063  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13064  * event matches your expectation. If you fail to do so and call this method, you may provide
13065  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13066  *
13067  * May panic if called except in response to a PaymentReceived event.
13068  *
13069  * [`create_inbound_payment`]: Self::create_inbound_payment
13070  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13071  */
13072 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13073
13074 /**
13075  * Gets the node_id held by this ChannelManager
13076  */
13077 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13078
13079 /**
13080  * Restores a single, given channel to normal operation after a
13081  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13082  * operation.
13083  *
13084  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13085  * fully committed in every copy of the given channels' ChannelMonitors.
13086  *
13087  * Note that there is no effect to calling with a highest_applied_update_id other than the
13088  * current latest ChannelMonitorUpdate and one call to this function after multiple
13089  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13090  * exists largely only to prevent races between this and concurrent update_monitor calls.
13091  *
13092  * Thus, the anticipated use is, at a high level:
13093  *  1) You register a chain::Watch with this ChannelManager,
13094  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13095  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13096  *     any time it cannot do so instantly,
13097  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13098  *  4) once all remote copies are updated, you call this function with the update_id that
13099  *     completed, and once it is the latest the Channel will be re-enabled.
13100  */
13101 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);
13102
13103 /**
13104  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13105  * to pay us.
13106  *
13107  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13108  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13109  *
13110  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13111  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13112  * passed directly to [`claim_funds`].
13113  *
13114  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13115  *
13116  * [`claim_funds`]: Self::claim_funds
13117  * [`PaymentReceived`]: events::Event::PaymentReceived
13118  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13119  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13120  */
13121 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);
13122
13123 /**
13124  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13125  * stored external to LDK.
13126  *
13127  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13128  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13129  * the `min_value_msat` provided here, if one is provided.
13130  *
13131  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13132  * method may return an Err if another payment with the same payment_hash is still pending.
13133  *
13134  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
13135  * allow tracking of which events correspond with which calls to this and
13136  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13137  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13138  * with invoice metadata stored elsewhere.
13139  *
13140  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13141  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13142  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13143  * sender \"proof-of-payment\" unless they have paid the required amount.
13144  *
13145  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13146  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13147  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13148  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13149  * invoices when no timeout is set.
13150  *
13151  * Note that we use block header time to time-out pending inbound payments (with some margin
13152  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13153  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13154  * If you need exact expiry semantics, you should enforce them upon receipt of
13155  * [`PaymentReceived`].
13156  *
13157  * Pending inbound payments are stored in memory and in serialized versions of this
13158  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13159  * space is limited, you may wish to rate-limit inbound payment creation.
13160  *
13161  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13162  *
13163  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13164  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13165  *
13166  * [`create_inbound_payment`]: Self::create_inbound_payment
13167  * [`PaymentReceived`]: events::Event::PaymentReceived
13168  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
13169  */
13170 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);
13171
13172 /**
13173  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13174  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13175  */
13176 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13177
13178 /**
13179  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13180  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13181  */
13182 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13183
13184 /**
13185  * Constructs a new Listen which calls the relevant methods on this_arg.
13186  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13187  */
13188 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13189
13190 /**
13191  * Constructs a new Confirm which calls the relevant methods on this_arg.
13192  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13193  */
13194 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13195
13196 /**
13197  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13198  * indicating whether persistence is necessary. Only one listener on
13199  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13200  * up.
13201  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13202  */
13203 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13204
13205 /**
13206  * Blocks until ChannelManager needs to be persisted. Only one listener on
13207  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13208  * up.
13209  */
13210 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13211
13212 /**
13213  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13214  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13215  */
13216 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13217
13218 /**
13219  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13220  */
13221 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13222
13223 /**
13224  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13225  */
13226 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13227
13228 /**
13229  * The keys provider which will give us relevant keys. Some keys will be loaded during
13230  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13231  * signing data.
13232  */
13233 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13234
13235 /**
13236  * The keys provider which will give us relevant keys. Some keys will be loaded during
13237  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13238  * signing data.
13239  */
13240 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13241
13242 /**
13243  * The fee_estimator for use in the ChannelManager in the future.
13244  *
13245  * No calls to the FeeEstimator will be made during deserialization.
13246  */
13247 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13248
13249 /**
13250  * The fee_estimator for use in the ChannelManager in the future.
13251  *
13252  * No calls to the FeeEstimator will be made during deserialization.
13253  */
13254 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13255
13256 /**
13257  * The chain::Watch for use in the ChannelManager in the future.
13258  *
13259  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13260  * you have deserialized ChannelMonitors separately and will add them to your
13261  * chain::Watch after deserializing this ChannelManager.
13262  */
13263 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13264
13265 /**
13266  * The chain::Watch for use in the ChannelManager in the future.
13267  *
13268  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13269  * you have deserialized ChannelMonitors separately and will add them to your
13270  * chain::Watch after deserializing this ChannelManager.
13271  */
13272 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13273
13274 /**
13275  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13276  * used to broadcast the latest local commitment transactions of channels which must be
13277  * force-closed during deserialization.
13278  */
13279 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13280
13281 /**
13282  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13283  * used to broadcast the latest local commitment transactions of channels which must be
13284  * force-closed during deserialization.
13285  */
13286 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13287
13288 /**
13289  * The Logger for use in the ChannelManager and which may be used to log information during
13290  * deserialization.
13291  */
13292 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13293
13294 /**
13295  * The Logger for use in the ChannelManager and which may be used to log information during
13296  * deserialization.
13297  */
13298 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13299
13300 /**
13301  * Default settings used for new channels. Any existing channels will continue to use the
13302  * runtime settings which were stored when the ChannelManager was serialized.
13303  */
13304 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13305
13306 /**
13307  * Default settings used for new channels. Any existing channels will continue to use the
13308  * runtime settings which were stored when the ChannelManager was serialized.
13309  */
13310 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13311
13312 /**
13313  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13314  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13315  * populate a HashMap directly from C.
13316  */
13317 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);
13318
13319 /**
13320  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13321  */
13322 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13323
13324 /**
13325  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13326  */
13327 void DecodeError_free(struct LDKDecodeError this_obj);
13328
13329 /**
13330  * Creates a copy of the DecodeError
13331  */
13332 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13333
13334 /**
13335  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13336  */
13337 void Init_free(struct LDKInit this_obj);
13338
13339 /**
13340  * The relevant features which the sender supports
13341  */
13342 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13343
13344 /**
13345  * The relevant features which the sender supports
13346  */
13347 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13348
13349 /**
13350  * Constructs a new Init given each field
13351  */
13352 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13353
13354 /**
13355  * Creates a copy of the Init
13356  */
13357 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13358
13359 /**
13360  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13361  */
13362 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13363
13364 /**
13365  * The channel ID involved in the error
13366  */
13367 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13368
13369 /**
13370  * The channel ID involved in the error
13371  */
13372 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13373
13374 /**
13375  * A possibly human-readable error description.
13376  * The string should be sanitized before it is used (e.g. emitted to logs
13377  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13378  * vulnerability in the terminal emulator or the logging subsystem.
13379  */
13380 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13381
13382 /**
13383  * A possibly human-readable error description.
13384  * The string should be sanitized before it is used (e.g. emitted to logs
13385  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13386  * vulnerability in the terminal emulator or the logging subsystem.
13387  */
13388 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13389
13390 /**
13391  * Constructs a new ErrorMessage given each field
13392  */
13393 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13394
13395 /**
13396  * Creates a copy of the ErrorMessage
13397  */
13398 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13399
13400 /**
13401  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13402  */
13403 void Ping_free(struct LDKPing this_obj);
13404
13405 /**
13406  * The desired response length
13407  */
13408 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13409
13410 /**
13411  * The desired response length
13412  */
13413 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13414
13415 /**
13416  * The ping packet size.
13417  * This field is not sent on the wire. byteslen zeros are sent.
13418  */
13419 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13420
13421 /**
13422  * The ping packet size.
13423  * This field is not sent on the wire. byteslen zeros are sent.
13424  */
13425 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13426
13427 /**
13428  * Constructs a new Ping given each field
13429  */
13430 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13431
13432 /**
13433  * Creates a copy of the Ping
13434  */
13435 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13436
13437 /**
13438  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13439  */
13440 void Pong_free(struct LDKPong this_obj);
13441
13442 /**
13443  * The pong packet size.
13444  * This field is not sent on the wire. byteslen zeros are sent.
13445  */
13446 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13447
13448 /**
13449  * The pong packet size.
13450  * This field is not sent on the wire. byteslen zeros are sent.
13451  */
13452 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13453
13454 /**
13455  * Constructs a new Pong given each field
13456  */
13457 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13458
13459 /**
13460  * Creates a copy of the Pong
13461  */
13462 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13463
13464 /**
13465  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13466  */
13467 void OpenChannel_free(struct LDKOpenChannel this_obj);
13468
13469 /**
13470  * The genesis hash of the blockchain where the channel is to be opened
13471  */
13472 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13473
13474 /**
13475  * The genesis hash of the blockchain where the channel is to be opened
13476  */
13477 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13478
13479 /**
13480  * A temporary channel ID, until the funding outpoint is announced
13481  */
13482 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13483
13484 /**
13485  * A temporary channel ID, until the funding outpoint is announced
13486  */
13487 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13488
13489 /**
13490  * The channel value
13491  */
13492 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13493
13494 /**
13495  * The channel value
13496  */
13497 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13498
13499 /**
13500  * The amount to push to the counterparty as part of the open, in milli-satoshi
13501  */
13502 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13503
13504 /**
13505  * The amount to push to the counterparty as part of the open, in milli-satoshi
13506  */
13507 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13508
13509 /**
13510  * The threshold below which outputs on transactions broadcast by sender will be omitted
13511  */
13512 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13513
13514 /**
13515  * The threshold below which outputs on transactions broadcast by sender will be omitted
13516  */
13517 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13518
13519 /**
13520  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13521  */
13522 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13523
13524 /**
13525  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13526  */
13527 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13528
13529 /**
13530  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13531  */
13532 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13533
13534 /**
13535  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13536  */
13537 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13538
13539 /**
13540  * The minimum HTLC size incoming to sender, in milli-satoshi
13541  */
13542 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13543
13544 /**
13545  * The minimum HTLC size incoming to sender, in milli-satoshi
13546  */
13547 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13548
13549 /**
13550  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13551  */
13552 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13553
13554 /**
13555  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13556  */
13557 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13558
13559 /**
13560  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13561  */
13562 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13563
13564 /**
13565  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13566  */
13567 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13568
13569 /**
13570  * The maximum number of inbound HTLCs towards sender
13571  */
13572 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13573
13574 /**
13575  * The maximum number of inbound HTLCs towards sender
13576  */
13577 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13578
13579 /**
13580  * The sender's key controlling the funding transaction
13581  */
13582 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13583
13584 /**
13585  * The sender's key controlling the funding transaction
13586  */
13587 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13588
13589 /**
13590  * Used to derive a revocation key for transactions broadcast by counterparty
13591  */
13592 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13593
13594 /**
13595  * Used to derive a revocation key for transactions broadcast by counterparty
13596  */
13597 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13598
13599 /**
13600  * A payment key to sender for transactions broadcast by counterparty
13601  */
13602 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13603
13604 /**
13605  * A payment key to sender for transactions broadcast by counterparty
13606  */
13607 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13608
13609 /**
13610  * Used to derive a payment key to sender for transactions broadcast by sender
13611  */
13612 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13613
13614 /**
13615  * Used to derive a payment key to sender for transactions broadcast by sender
13616  */
13617 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13618
13619 /**
13620  * Used to derive an HTLC payment key to sender
13621  */
13622 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13623
13624 /**
13625  * Used to derive an HTLC payment key to sender
13626  */
13627 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13628
13629 /**
13630  * The first to-be-broadcast-by-sender transaction's per commitment point
13631  */
13632 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13633
13634 /**
13635  * The first to-be-broadcast-by-sender transaction's per commitment point
13636  */
13637 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13638
13639 /**
13640  * Channel flags
13641  */
13642 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13643
13644 /**
13645  * Channel flags
13646  */
13647 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13648
13649 /**
13650  * Creates a copy of the OpenChannel
13651  */
13652 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13653
13654 /**
13655  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13656  */
13657 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13658
13659 /**
13660  * A temporary channel ID, until the funding outpoint is announced
13661  */
13662 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13663
13664 /**
13665  * A temporary channel ID, until the funding outpoint is announced
13666  */
13667 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13668
13669 /**
13670  * The threshold below which outputs on transactions broadcast by sender will be omitted
13671  */
13672 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13673
13674 /**
13675  * The threshold below which outputs on transactions broadcast by sender will be omitted
13676  */
13677 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13678
13679 /**
13680  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13681  */
13682 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13683
13684 /**
13685  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13686  */
13687 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13688
13689 /**
13690  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13691  */
13692 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13693
13694 /**
13695  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13696  */
13697 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13698
13699 /**
13700  * The minimum HTLC size incoming to sender, in milli-satoshi
13701  */
13702 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13703
13704 /**
13705  * The minimum HTLC size incoming to sender, in milli-satoshi
13706  */
13707 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13708
13709 /**
13710  * Minimum depth of the funding transaction before the channel is considered open
13711  */
13712 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13713
13714 /**
13715  * Minimum depth of the funding transaction before the channel is considered open
13716  */
13717 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
13718
13719 /**
13720  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13721  */
13722 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13723
13724 /**
13725  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13726  */
13727 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13728
13729 /**
13730  * The maximum number of inbound HTLCs towards sender
13731  */
13732 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13733
13734 /**
13735  * The maximum number of inbound HTLCs towards sender
13736  */
13737 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13738
13739 /**
13740  * The sender's key controlling the funding transaction
13741  */
13742 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13743
13744 /**
13745  * The sender's key controlling the funding transaction
13746  */
13747 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13748
13749 /**
13750  * Used to derive a revocation key for transactions broadcast by counterparty
13751  */
13752 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13753
13754 /**
13755  * Used to derive a revocation key for transactions broadcast by counterparty
13756  */
13757 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13758
13759 /**
13760  * A payment key to sender for transactions broadcast by counterparty
13761  */
13762 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13763
13764 /**
13765  * A payment key to sender for transactions broadcast by counterparty
13766  */
13767 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13768
13769 /**
13770  * Used to derive a payment key to sender for transactions broadcast by sender
13771  */
13772 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13773
13774 /**
13775  * Used to derive a payment key to sender for transactions broadcast by sender
13776  */
13777 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13778
13779 /**
13780  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13781  */
13782 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13783
13784 /**
13785  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13786  */
13787 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13788
13789 /**
13790  * The first to-be-broadcast-by-sender transaction's per commitment point
13791  */
13792 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13793
13794 /**
13795  * The first to-be-broadcast-by-sender transaction's per commitment point
13796  */
13797 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13798
13799 /**
13800  * Creates a copy of the AcceptChannel
13801  */
13802 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
13803
13804 /**
13805  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
13806  */
13807 void FundingCreated_free(struct LDKFundingCreated this_obj);
13808
13809 /**
13810  * A temporary channel ID, until the funding is established
13811  */
13812 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13813
13814 /**
13815  * A temporary channel ID, until the funding is established
13816  */
13817 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13818
13819 /**
13820  * The funding transaction ID
13821  */
13822 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13823
13824 /**
13825  * The funding transaction ID
13826  */
13827 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13828
13829 /**
13830  * The specific output index funding this channel
13831  */
13832 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13833
13834 /**
13835  * The specific output index funding this channel
13836  */
13837 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
13838
13839 /**
13840  * The signature of the channel initiator (funder) on the funding transaction
13841  */
13842 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13843
13844 /**
13845  * The signature of the channel initiator (funder) on the funding transaction
13846  */
13847 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
13848
13849 /**
13850  * Constructs a new FundingCreated given each field
13851  */
13852 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);
13853
13854 /**
13855  * Creates a copy of the FundingCreated
13856  */
13857 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
13858
13859 /**
13860  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
13861  */
13862 void FundingSigned_free(struct LDKFundingSigned this_obj);
13863
13864 /**
13865  * The channel ID
13866  */
13867 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
13868
13869 /**
13870  * The channel ID
13871  */
13872 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13873
13874 /**
13875  * The signature of the channel acceptor (fundee) on the funding transaction
13876  */
13877 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
13878
13879 /**
13880  * The signature of the channel acceptor (fundee) on the funding transaction
13881  */
13882 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13883
13884 /**
13885  * Constructs a new FundingSigned given each field
13886  */
13887 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
13888
13889 /**
13890  * Creates a copy of the FundingSigned
13891  */
13892 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
13893
13894 /**
13895  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
13896  */
13897 void FundingLocked_free(struct LDKFundingLocked this_obj);
13898
13899 /**
13900  * The channel ID
13901  */
13902 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
13903
13904 /**
13905  * The channel ID
13906  */
13907 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13908
13909 /**
13910  * The per-commitment point of the second commitment transaction
13911  */
13912 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
13913
13914 /**
13915  * The per-commitment point of the second commitment transaction
13916  */
13917 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13918
13919 /**
13920  * Constructs a new FundingLocked given each field
13921  */
13922 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
13923
13924 /**
13925  * Creates a copy of the FundingLocked
13926  */
13927 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
13928
13929 /**
13930  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
13931  */
13932 void Shutdown_free(struct LDKShutdown this_obj);
13933
13934 /**
13935  * The channel ID
13936  */
13937 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
13938
13939 /**
13940  * The channel ID
13941  */
13942 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13943
13944 /**
13945  * The destination of this peer's funds on closing.
13946  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13947  */
13948 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
13949
13950 /**
13951  * The destination of this peer's funds on closing.
13952  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13953  */
13954 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13955
13956 /**
13957  * Constructs a new Shutdown given each field
13958  */
13959 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
13960
13961 /**
13962  * Creates a copy of the Shutdown
13963  */
13964 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
13965
13966 /**
13967  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
13968  */
13969 void ClosingSigned_free(struct LDKClosingSigned this_obj);
13970
13971 /**
13972  * The channel ID
13973  */
13974 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
13975
13976 /**
13977  * The channel ID
13978  */
13979 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13980
13981 /**
13982  * The proposed total fee for the closing transaction
13983  */
13984 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13985
13986 /**
13987  * The proposed total fee for the closing transaction
13988  */
13989 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
13990
13991 /**
13992  * A signature on the closing transaction
13993  */
13994 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13995
13996 /**
13997  * A signature on the closing transaction
13998  */
13999 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14000
14001 /**
14002  * Constructs a new ClosingSigned given each field
14003  */
14004 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14005
14006 /**
14007  * Creates a copy of the ClosingSigned
14008  */
14009 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14010
14011 /**
14012  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14013  */
14014 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14015
14016 /**
14017  * The channel ID
14018  */
14019 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14020
14021 /**
14022  * The channel ID
14023  */
14024 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14025
14026 /**
14027  * The HTLC ID
14028  */
14029 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14030
14031 /**
14032  * The HTLC ID
14033  */
14034 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14035
14036 /**
14037  * The HTLC value in milli-satoshi
14038  */
14039 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14040
14041 /**
14042  * The HTLC value in milli-satoshi
14043  */
14044 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14045
14046 /**
14047  * The payment hash, the pre-image of which controls HTLC redemption
14048  */
14049 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14050
14051 /**
14052  * The payment hash, the pre-image of which controls HTLC redemption
14053  */
14054 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14055
14056 /**
14057  * The expiry height of the HTLC
14058  */
14059 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14060
14061 /**
14062  * The expiry height of the HTLC
14063  */
14064 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14065
14066 /**
14067  * Creates a copy of the UpdateAddHTLC
14068  */
14069 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14070
14071 /**
14072  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14073  */
14074 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14075
14076 /**
14077  * The channel ID
14078  */
14079 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14080
14081 /**
14082  * The channel ID
14083  */
14084 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14085
14086 /**
14087  * The HTLC ID
14088  */
14089 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14090
14091 /**
14092  * The HTLC ID
14093  */
14094 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14095
14096 /**
14097  * The pre-image of the payment hash, allowing HTLC redemption
14098  */
14099 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14100
14101 /**
14102  * The pre-image of the payment hash, allowing HTLC redemption
14103  */
14104 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14105
14106 /**
14107  * Constructs a new UpdateFulfillHTLC given each field
14108  */
14109 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14110
14111 /**
14112  * Creates a copy of the UpdateFulfillHTLC
14113  */
14114 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14115
14116 /**
14117  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14118  */
14119 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14120
14121 /**
14122  * The channel ID
14123  */
14124 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14125
14126 /**
14127  * The channel ID
14128  */
14129 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14130
14131 /**
14132  * The HTLC ID
14133  */
14134 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14135
14136 /**
14137  * The HTLC ID
14138  */
14139 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14140
14141 /**
14142  * Creates a copy of the UpdateFailHTLC
14143  */
14144 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14145
14146 /**
14147  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14148  */
14149 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14150
14151 /**
14152  * The channel ID
14153  */
14154 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14155
14156 /**
14157  * The channel ID
14158  */
14159 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14160
14161 /**
14162  * The HTLC ID
14163  */
14164 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14165
14166 /**
14167  * The HTLC ID
14168  */
14169 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14170
14171 /**
14172  * The failure code
14173  */
14174 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14175
14176 /**
14177  * The failure code
14178  */
14179 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14180
14181 /**
14182  * Creates a copy of the UpdateFailMalformedHTLC
14183  */
14184 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14185
14186 /**
14187  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14188  */
14189 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14190
14191 /**
14192  * The channel ID
14193  */
14194 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14195
14196 /**
14197  * The channel ID
14198  */
14199 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14200
14201 /**
14202  * A signature on the commitment transaction
14203  */
14204 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14205
14206 /**
14207  * A signature on the commitment transaction
14208  */
14209 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14210
14211 /**
14212  * Signatures on the HTLC transactions
14213  */
14214 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14215
14216 /**
14217  * Constructs a new CommitmentSigned given each field
14218  */
14219 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14220
14221 /**
14222  * Creates a copy of the CommitmentSigned
14223  */
14224 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14225
14226 /**
14227  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14228  */
14229 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14230
14231 /**
14232  * The channel ID
14233  */
14234 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14235
14236 /**
14237  * The channel ID
14238  */
14239 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14240
14241 /**
14242  * The secret corresponding to the per-commitment point
14243  */
14244 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14245
14246 /**
14247  * The secret corresponding to the per-commitment point
14248  */
14249 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14250
14251 /**
14252  * The next sender-broadcast commitment transaction's per-commitment point
14253  */
14254 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14255
14256 /**
14257  * The next sender-broadcast commitment transaction's per-commitment point
14258  */
14259 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14260
14261 /**
14262  * Constructs a new RevokeAndACK given each field
14263  */
14264 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);
14265
14266 /**
14267  * Creates a copy of the RevokeAndACK
14268  */
14269 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14270
14271 /**
14272  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14273  */
14274 void UpdateFee_free(struct LDKUpdateFee this_obj);
14275
14276 /**
14277  * The channel ID
14278  */
14279 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14280
14281 /**
14282  * The channel ID
14283  */
14284 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14285
14286 /**
14287  * Fee rate per 1000-weight of the transaction
14288  */
14289 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14290
14291 /**
14292  * Fee rate per 1000-weight of the transaction
14293  */
14294 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14295
14296 /**
14297  * Constructs a new UpdateFee given each field
14298  */
14299 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14300
14301 /**
14302  * Creates a copy of the UpdateFee
14303  */
14304 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14305
14306 /**
14307  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14308  */
14309 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14310
14311 /**
14312  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14313  * belonging to the recipient
14314  */
14315 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14316
14317 /**
14318  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14319  * belonging to the recipient
14320  */
14321 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14322
14323 /**
14324  * The sender's per-commitment point for their current commitment transaction
14325  */
14326 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14327
14328 /**
14329  * The sender's per-commitment point for their current commitment transaction
14330  */
14331 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14332
14333 /**
14334  * Constructs a new DataLossProtect given each field
14335  */
14336 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14337
14338 /**
14339  * Creates a copy of the DataLossProtect
14340  */
14341 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14342
14343 /**
14344  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14345  */
14346 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14347
14348 /**
14349  * The channel ID
14350  */
14351 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14352
14353 /**
14354  * The channel ID
14355  */
14356 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14357
14358 /**
14359  * The next commitment number for the sender
14360  */
14361 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14362
14363 /**
14364  * The next commitment number for the sender
14365  */
14366 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14367
14368 /**
14369  * The next commitment number for the recipient
14370  */
14371 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14372
14373 /**
14374  * The next commitment number for the recipient
14375  */
14376 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14377
14378 /**
14379  * Creates a copy of the ChannelReestablish
14380  */
14381 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14382
14383 /**
14384  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14385  */
14386 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14387
14388 /**
14389  * The channel ID
14390  */
14391 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14392
14393 /**
14394  * The channel ID
14395  */
14396 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14397
14398 /**
14399  * The short channel ID
14400  */
14401 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14402
14403 /**
14404  * The short channel ID
14405  */
14406 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14407
14408 /**
14409  * A signature by the node key
14410  */
14411 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14412
14413 /**
14414  * A signature by the node key
14415  */
14416 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14417
14418 /**
14419  * A signature by the funding key
14420  */
14421 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14422
14423 /**
14424  * A signature by the funding key
14425  */
14426 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14427
14428 /**
14429  * Constructs a new AnnouncementSignatures given each field
14430  */
14431 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);
14432
14433 /**
14434  * Creates a copy of the AnnouncementSignatures
14435  */
14436 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14437
14438 /**
14439  * Frees any resources used by the NetAddress
14440  */
14441 void NetAddress_free(struct LDKNetAddress this_ptr);
14442
14443 /**
14444  * Creates a copy of the NetAddress
14445  */
14446 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14447
14448 /**
14449  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14450  */
14451 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14452
14453 /**
14454  * Read a Result from a byte array, created by Result_write
14455  */
14456 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14457
14458 /**
14459  * Read a NetAddress from a byte array, created by NetAddress_write
14460  */
14461 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
14462
14463 /**
14464  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14465  */
14466 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14467
14468 /**
14469  * The advertised features
14470  */
14471 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14472
14473 /**
14474  * The advertised features
14475  */
14476 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14477
14478 /**
14479  * A strictly monotonic announcement counter, with gaps allowed
14480  */
14481 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14482
14483 /**
14484  * A strictly monotonic announcement counter, with gaps allowed
14485  */
14486 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14487
14488 /**
14489  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14490  * to this node).
14491  */
14492 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14493
14494 /**
14495  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14496  * to this node).
14497  */
14498 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14499
14500 /**
14501  * An RGB color for UI purposes
14502  */
14503 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14504
14505 /**
14506  * An RGB color for UI purposes
14507  */
14508 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14509
14510 /**
14511  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14512  * of uniqueness.
14513  */
14514 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14515
14516 /**
14517  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14518  * of uniqueness.
14519  */
14520 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14521
14522 /**
14523  * List of addresses on which this node is reachable
14524  */
14525 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14526
14527 /**
14528  * Creates a copy of the UnsignedNodeAnnouncement
14529  */
14530 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14531
14532 /**
14533  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14534  */
14535 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14536
14537 /**
14538  * The signature by the node key
14539  */
14540 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14541
14542 /**
14543  * The signature by the node key
14544  */
14545 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14546
14547 /**
14548  * The actual content of the announcement
14549  */
14550 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14551
14552 /**
14553  * The actual content of the announcement
14554  */
14555 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14556
14557 /**
14558  * Constructs a new NodeAnnouncement given each field
14559  */
14560 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14561
14562 /**
14563  * Creates a copy of the NodeAnnouncement
14564  */
14565 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14566
14567 /**
14568  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14569  */
14570 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14571
14572 /**
14573  * The advertised channel features
14574  */
14575 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14576
14577 /**
14578  * The advertised channel features
14579  */
14580 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14581
14582 /**
14583  * The genesis hash of the blockchain where the channel is to be opened
14584  */
14585 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14586
14587 /**
14588  * The genesis hash of the blockchain where the channel is to be opened
14589  */
14590 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14591
14592 /**
14593  * The short channel ID
14594  */
14595 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14596
14597 /**
14598  * The short channel ID
14599  */
14600 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14601
14602 /**
14603  * One of the two node_ids which are endpoints of this channel
14604  */
14605 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14606
14607 /**
14608  * One of the two node_ids which are endpoints of this channel
14609  */
14610 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14611
14612 /**
14613  * The other of the two node_ids which are endpoints of this channel
14614  */
14615 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14616
14617 /**
14618  * The other of the two node_ids which are endpoints of this channel
14619  */
14620 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14621
14622 /**
14623  * The funding key for the first node
14624  */
14625 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14626
14627 /**
14628  * The funding key for the first node
14629  */
14630 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14631
14632 /**
14633  * The funding key for the second node
14634  */
14635 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14636
14637 /**
14638  * The funding key for the second node
14639  */
14640 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14641
14642 /**
14643  * Creates a copy of the UnsignedChannelAnnouncement
14644  */
14645 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14646
14647 /**
14648  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14649  */
14650 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14651
14652 /**
14653  * Authentication of the announcement by the first public node
14654  */
14655 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14656
14657 /**
14658  * Authentication of the announcement by the first public node
14659  */
14660 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14661
14662 /**
14663  * Authentication of the announcement by the second public node
14664  */
14665 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14666
14667 /**
14668  * Authentication of the announcement by the second public node
14669  */
14670 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14671
14672 /**
14673  * Proof of funding UTXO ownership by the first public node
14674  */
14675 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14676
14677 /**
14678  * Proof of funding UTXO ownership by the first public node
14679  */
14680 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14681
14682 /**
14683  * Proof of funding UTXO ownership by the second public node
14684  */
14685 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14686
14687 /**
14688  * Proof of funding UTXO ownership by the second public node
14689  */
14690 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14691
14692 /**
14693  * The actual announcement
14694  */
14695 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14696
14697 /**
14698  * The actual announcement
14699  */
14700 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
14701
14702 /**
14703  * Constructs a new ChannelAnnouncement given each field
14704  */
14705 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);
14706
14707 /**
14708  * Creates a copy of the ChannelAnnouncement
14709  */
14710 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
14711
14712 /**
14713  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
14714  */
14715 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
14716
14717 /**
14718  * The genesis hash of the blockchain where the channel is to be opened
14719  */
14720 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
14721
14722 /**
14723  * The genesis hash of the blockchain where the channel is to be opened
14724  */
14725 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14726
14727 /**
14728  * The short channel ID
14729  */
14730 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14731
14732 /**
14733  * The short channel ID
14734  */
14735 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14736
14737 /**
14738  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14739  */
14740 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14741
14742 /**
14743  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14744  */
14745 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14746
14747 /**
14748  * Channel flags
14749  */
14750 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14751
14752 /**
14753  * Channel flags
14754  */
14755 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
14756
14757 /**
14758  * The number of blocks such that if:
14759  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14760  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14761  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14762  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14763  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14764  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14765  * constructing the route.
14766  */
14767 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14768
14769 /**
14770  * The number of blocks such that if:
14771  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14772  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14773  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14774  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14775  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14776  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14777  * constructing the route.
14778  */
14779 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
14780
14781 /**
14782  * The minimum HTLC size incoming to sender, in milli-satoshi
14783  */
14784 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14785
14786 /**
14787  * The minimum HTLC size incoming to sender, in milli-satoshi
14788  */
14789 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14790
14791 /**
14792  * The base HTLC fee charged by sender, in milli-satoshi
14793  */
14794 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14795
14796 /**
14797  * The base HTLC fee charged by sender, in milli-satoshi
14798  */
14799 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14800
14801 /**
14802  * The amount to fee multiplier, in micro-satoshi
14803  */
14804 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14805
14806 /**
14807  * The amount to fee multiplier, in micro-satoshi
14808  */
14809 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14810
14811 /**
14812  * Creates a copy of the UnsignedChannelUpdate
14813  */
14814 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
14815
14816 /**
14817  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
14818  */
14819 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
14820
14821 /**
14822  * A signature of the channel update
14823  */
14824 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14825
14826 /**
14827  * A signature of the channel update
14828  */
14829 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
14830
14831 /**
14832  * The actual channel update
14833  */
14834 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14835
14836 /**
14837  * The actual channel update
14838  */
14839 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
14840
14841 /**
14842  * Constructs a new ChannelUpdate given each field
14843  */
14844 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
14845
14846 /**
14847  * Creates a copy of the ChannelUpdate
14848  */
14849 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
14850
14851 /**
14852  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
14853  */
14854 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
14855
14856 /**
14857  * The genesis hash of the blockchain being queried
14858  */
14859 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
14860
14861 /**
14862  * The genesis hash of the blockchain being queried
14863  */
14864 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14865
14866 /**
14867  * The height of the first block for the channel UTXOs being queried
14868  */
14869 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14870
14871 /**
14872  * The height of the first block for the channel UTXOs being queried
14873  */
14874 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14875
14876 /**
14877  * The number of blocks to include in the query results
14878  */
14879 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14880
14881 /**
14882  * The number of blocks to include in the query results
14883  */
14884 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14885
14886 /**
14887  * Constructs a new QueryChannelRange given each field
14888  */
14889 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
14890
14891 /**
14892  * Creates a copy of the QueryChannelRange
14893  */
14894 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
14895
14896 /**
14897  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
14898  */
14899 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
14900
14901 /**
14902  * The genesis hash of the blockchain being queried
14903  */
14904 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
14905
14906 /**
14907  * The genesis hash of the blockchain being queried
14908  */
14909 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14910
14911 /**
14912  * The height of the first block in the range of the reply
14913  */
14914 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14915
14916 /**
14917  * The height of the first block in the range of the reply
14918  */
14919 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14920
14921 /**
14922  * The number of blocks included in the range of the reply
14923  */
14924 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14925
14926 /**
14927  * The number of blocks included in the range of the reply
14928  */
14929 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14930
14931 /**
14932  * True when this is the final reply for a query
14933  */
14934 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14935
14936 /**
14937  * True when this is the final reply for a query
14938  */
14939 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
14940
14941 /**
14942  * The short_channel_ids in the channel range
14943  */
14944 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14945
14946 /**
14947  * Constructs a new ReplyChannelRange given each field
14948  */
14949 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);
14950
14951 /**
14952  * Creates a copy of the ReplyChannelRange
14953  */
14954 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
14955
14956 /**
14957  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
14958  */
14959 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
14960
14961 /**
14962  * The genesis hash of the blockchain being queried
14963  */
14964 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
14965
14966 /**
14967  * The genesis hash of the blockchain being queried
14968  */
14969 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14970
14971 /**
14972  * The short_channel_ids that are being queried
14973  */
14974 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14975
14976 /**
14977  * Constructs a new QueryShortChannelIds given each field
14978  */
14979 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
14980
14981 /**
14982  * Creates a copy of the QueryShortChannelIds
14983  */
14984 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
14985
14986 /**
14987  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
14988  */
14989 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
14990
14991 /**
14992  * The genesis hash of the blockchain that was queried
14993  */
14994 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
14995
14996 /**
14997  * The genesis hash of the blockchain that was queried
14998  */
14999 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15000
15001 /**
15002  * Indicates if the query recipient maintains up-to-date channel
15003  * information for the chain_hash
15004  */
15005 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15006
15007 /**
15008  * Indicates if the query recipient maintains up-to-date channel
15009  * information for the chain_hash
15010  */
15011 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15012
15013 /**
15014  * Constructs a new ReplyShortChannelIdsEnd given each field
15015  */
15016 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15017
15018 /**
15019  * Creates a copy of the ReplyShortChannelIdsEnd
15020  */
15021 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15022
15023 /**
15024  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15025  */
15026 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15027
15028 /**
15029  * The genesis hash of the blockchain for channel and node information
15030  */
15031 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15032
15033 /**
15034  * The genesis hash of the blockchain for channel and node information
15035  */
15036 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15037
15038 /**
15039  * The starting unix timestamp
15040  */
15041 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15042
15043 /**
15044  * The starting unix timestamp
15045  */
15046 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15047
15048 /**
15049  * The range of information in seconds
15050  */
15051 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15052
15053 /**
15054  * The range of information in seconds
15055  */
15056 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15057
15058 /**
15059  * Constructs a new GossipTimestampFilter given each field
15060  */
15061 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15062
15063 /**
15064  * Creates a copy of the GossipTimestampFilter
15065  */
15066 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15067
15068 /**
15069  * Frees any resources used by the ErrorAction
15070  */
15071 void ErrorAction_free(struct LDKErrorAction this_ptr);
15072
15073 /**
15074  * Creates a copy of the ErrorAction
15075  */
15076 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15077
15078 /**
15079  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15080  */
15081 void LightningError_free(struct LDKLightningError this_obj);
15082
15083 /**
15084  * A human-readable message describing the error
15085  */
15086 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15087
15088 /**
15089  * A human-readable message describing the error
15090  */
15091 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15092
15093 /**
15094  * The action which should be taken against the offending peer.
15095  */
15096 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15097
15098 /**
15099  * The action which should be taken against the offending peer.
15100  */
15101 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15102
15103 /**
15104  * Constructs a new LightningError given each field
15105  */
15106 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15107
15108 /**
15109  * Creates a copy of the LightningError
15110  */
15111 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15112
15113 /**
15114  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15115  */
15116 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15117
15118 /**
15119  * update_add_htlc messages which should be sent
15120  */
15121 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15122
15123 /**
15124  * update_fulfill_htlc messages which should be sent
15125  */
15126 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15127
15128 /**
15129  * update_fail_htlc messages which should be sent
15130  */
15131 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15132
15133 /**
15134  * update_fail_malformed_htlc messages which should be sent
15135  */
15136 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15137
15138 /**
15139  * An update_fee message which should be sent
15140  */
15141 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15142
15143 /**
15144  * An update_fee message which should be sent
15145  */
15146 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15147
15148 /**
15149  * Finally, the commitment_signed message which should be sent
15150  */
15151 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15152
15153 /**
15154  * Finally, the commitment_signed message which should be sent
15155  */
15156 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15157
15158 /**
15159  * Constructs a new CommitmentUpdate given each field
15160  */
15161 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);
15162
15163 /**
15164  * Creates a copy of the CommitmentUpdate
15165  */
15166 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15167
15168 /**
15169  * Frees any resources used by the HTLCFailChannelUpdate
15170  */
15171 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15172
15173 /**
15174  * Creates a copy of the HTLCFailChannelUpdate
15175  */
15176 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15177
15178 /**
15179  * Calls the free function if one is set
15180  */
15181 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15182
15183 /**
15184  * Calls the free function if one is set
15185  */
15186 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15187
15188 /**
15189  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15190  */
15191 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15192
15193 /**
15194  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15195  */
15196 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15197
15198 /**
15199  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15200  */
15201 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15202
15203 /**
15204  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15205  */
15206 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15207
15208 /**
15209  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15210  */
15211 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15212
15213 /**
15214  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15215  */
15216 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15217
15218 /**
15219  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15220  */
15221 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15222
15223 /**
15224  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15225  */
15226 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15227
15228 /**
15229  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15230  */
15231 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15232
15233 /**
15234  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15235  */
15236 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15237
15238 /**
15239  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15240  */
15241 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15242
15243 /**
15244  * Read a FundingCreated from a byte array, created by FundingCreated_write
15245  */
15246 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15247
15248 /**
15249  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15250  */
15251 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15252
15253 /**
15254  * Read a FundingSigned from a byte array, created by FundingSigned_write
15255  */
15256 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15257
15258 /**
15259  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15260  */
15261 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15262
15263 /**
15264  * Read a FundingLocked from a byte array, created by FundingLocked_write
15265  */
15266 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15267
15268 /**
15269  * Serialize the Init object into a byte array which can be read by Init_read
15270  */
15271 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15272
15273 /**
15274  * Read a Init from a byte array, created by Init_write
15275  */
15276 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15277
15278 /**
15279  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15280  */
15281 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15282
15283 /**
15284  * Read a OpenChannel from a byte array, created by OpenChannel_write
15285  */
15286 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15287
15288 /**
15289  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15290  */
15291 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15292
15293 /**
15294  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15295  */
15296 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15297
15298 /**
15299  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15300  */
15301 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15302
15303 /**
15304  * Read a Shutdown from a byte array, created by Shutdown_write
15305  */
15306 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15307
15308 /**
15309  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15310  */
15311 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15312
15313 /**
15314  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15315  */
15316 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15317
15318 /**
15319  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15320  */
15321 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15322
15323 /**
15324  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15325  */
15326 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15327
15328 /**
15329  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15330  */
15331 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15332
15333 /**
15334  * Read a UpdateFee from a byte array, created by UpdateFee_write
15335  */
15336 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15337
15338 /**
15339  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15340  */
15341 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15342
15343 /**
15344  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15345  */
15346 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15347
15348 /**
15349  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15350  */
15351 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15352
15353 /**
15354  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15355  */
15356 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15357
15358 /**
15359  * Serialize the Ping object into a byte array which can be read by Ping_read
15360  */
15361 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15362
15363 /**
15364  * Read a Ping from a byte array, created by Ping_write
15365  */
15366 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15367
15368 /**
15369  * Serialize the Pong object into a byte array which can be read by Pong_read
15370  */
15371 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15372
15373 /**
15374  * Read a Pong from a byte array, created by Pong_write
15375  */
15376 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15377
15378 /**
15379  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15380  */
15381 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15382
15383 /**
15384  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15385  */
15386 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15387
15388 /**
15389  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15390  */
15391 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15392
15393 /**
15394  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15395  */
15396 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15397
15398 /**
15399  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15400  */
15401 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15402
15403 /**
15404  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15405  */
15406 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15407
15408 /**
15409  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15410  */
15411 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15412
15413 /**
15414  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15415  */
15416 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15417
15418 /**
15419  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15420  */
15421 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15422
15423 /**
15424  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15425  */
15426 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15427
15428 /**
15429  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15430  */
15431 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15432
15433 /**
15434  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15435  */
15436 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15437
15438 /**
15439  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15440  */
15441 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15442
15443 /**
15444  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15445  */
15446 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15447
15448 /**
15449  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15450  */
15451 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15452
15453 /**
15454  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15455  */
15456 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15457
15458 /**
15459  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15460  */
15461 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15462
15463 /**
15464  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15465  */
15466 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15467
15468 /**
15469  *\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
15470  */
15471 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15472
15473 /**
15474  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15475  */
15476 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15477
15478 /**
15479  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15480  */
15481 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15482
15483 /**
15484  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15485  */
15486 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15487
15488 /**
15489  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15490  */
15491 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15492
15493 /**
15494  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15495  */
15496 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15497
15498 /**
15499  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15500  */
15501 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15502
15503 /**
15504  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15505  */
15506 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15507
15508 /**
15509  * Constructs a new IgnoringMessageHandler given each field
15510  */
15511 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15512
15513 /**
15514  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15515  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15516  */
15517 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15518
15519 /**
15520  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15521  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15522  */
15523 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15524
15525 /**
15526  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15527  */
15528 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15529
15530 /**
15531  * Constructs a new ErroringMessageHandler
15532  */
15533 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15534
15535 /**
15536  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15537  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15538  */
15539 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15540
15541 /**
15542  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15543  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15544  */
15545 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15546
15547 /**
15548  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15549  */
15550 void MessageHandler_free(struct LDKMessageHandler this_obj);
15551
15552 /**
15553  * A message handler which handles messages specific to channels. Usually this is just a
15554  * ChannelManager object or a ErroringMessageHandler.
15555  */
15556 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15557
15558 /**
15559  * A message handler which handles messages specific to channels. Usually this is just a
15560  * ChannelManager object or a ErroringMessageHandler.
15561  */
15562 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15563
15564 /**
15565  * A message handler which handles messages updating our knowledge of the network channel
15566  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15567  */
15568 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15569
15570 /**
15571  * A message handler which handles messages updating our knowledge of the network channel
15572  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15573  */
15574 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15575
15576 /**
15577  * Constructs a new MessageHandler given each field
15578  */
15579 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15580
15581 /**
15582  * Creates a copy of a SocketDescriptor
15583  */
15584 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15585
15586 /**
15587  * Calls the free function if one is set
15588  */
15589 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15590
15591 /**
15592  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15593  */
15594 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15595
15596 /**
15597  * Used to indicate that we probably can't make any future connections to this peer, implying
15598  * we should go ahead and force-close any channels we have with it.
15599  */
15600 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15601
15602 /**
15603  * Used to indicate that we probably can't make any future connections to this peer, implying
15604  * we should go ahead and force-close any channels we have with it.
15605  */
15606 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15607
15608 /**
15609  * Constructs a new PeerHandleError given each field
15610  */
15611 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15612
15613 /**
15614  * Creates a copy of the PeerHandleError
15615  */
15616 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15617
15618 /**
15619  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15620  */
15621 void PeerManager_free(struct LDKPeerManager this_obj);
15622
15623 /**
15624  * Constructs a new PeerManager with the given message handlers and node_id secret key
15625  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15626  * cryptographically secure random bytes.
15627  */
15628 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);
15629
15630 /**
15631  * Get the list of node ids for peers which have completed the initial handshake.
15632  *
15633  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15634  * new_outbound_connection, however entries will only appear once the initial handshake has
15635  * completed and we are sure the remote peer has the private key for the given node_id.
15636  */
15637 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15638
15639 /**
15640  * Indicates a new outbound connection has been established to a node with the given node_id.
15641  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15642  * descriptor but must disconnect the connection immediately.
15643  *
15644  * Returns a small number of bytes to send to the remote node (currently always 50).
15645  *
15646  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15647  * socket_disconnected().
15648  */
15649 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);
15650
15651 /**
15652  * Indicates a new inbound connection has been established.
15653  *
15654  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15655  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15656  * call socket_disconnected for the new descriptor but must disconnect the connection
15657  * immediately.
15658  *
15659  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15660  * socket_disconnected called.
15661  */
15662 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15663
15664 /**
15665  * Indicates that there is room to write data to the given socket descriptor.
15666  *
15667  * May return an Err to indicate that the connection should be closed.
15668  *
15669  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15670  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15671  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15672  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15673  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15674  * new_\\*_connection event.
15675  */
15676 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15677
15678 /**
15679  * Indicates that data was read from the given socket descriptor.
15680  *
15681  * May return an Err to indicate that the connection should be closed.
15682  *
15683  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15684  * Thus, however, you almost certainly want to call process_events() after any read_event to
15685  * generate send_data calls to handle responses.
15686  *
15687  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
15688  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
15689  *
15690  * Panics if the descriptor was not previously registered in a new_*_connection event.
15691  */
15692 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);
15693
15694 /**
15695  * Checks for any events generated by our handlers and processes them. Includes sending most
15696  * response messages as well as messages generated by calls to handler functions directly (eg
15697  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
15698  */
15699 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
15700
15701 /**
15702  * Indicates that the given socket descriptor's connection is now closed.
15703  *
15704  * This must only be called if the socket has been disconnected by the peer or your own
15705  * decision to disconnect it and must NOT be called in any case where other parts of this
15706  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
15707  * the peer.
15708  *
15709  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
15710  */
15711 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15712
15713 /**
15714  * Disconnect a peer given its node id.
15715  *
15716  * Set no_connection_possible to true to prevent any further connection with this peer,
15717  * force-closing any channels we have with it.
15718  *
15719  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
15720  * so be careful about reentrancy issues.
15721  */
15722 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
15723
15724 /**
15725  * This function should be called roughly once every 30 seconds.
15726  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
15727  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
15728  */
15729 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
15730
15731 /**
15732  * Build the commitment secret from the seed and the commitment number
15733  */
15734 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
15735
15736 /**
15737  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
15738  * from the base secret and the per_commitment_point.
15739  *
15740  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15741  * generated (ie our own).
15742  */
15743 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
15744
15745 /**
15746  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
15747  * from the base point and the per_commitment_key. This is the public equivalent of
15748  * derive_private_key - using only public keys to derive a public key instead of private keys.
15749  *
15750  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15751  * generated (ie our own).
15752  */
15753 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
15754
15755 /**
15756  * Derives a per-commitment-transaction revocation key from its constituent parts.
15757  *
15758  * Only the cheating participant owns a valid witness to propagate a revoked
15759  * commitment transaction, thus per_commitment_secret always come from cheater
15760  * and revocation_base_secret always come from punisher, which is the broadcaster
15761  * of the transaction spending with this key knowledge.
15762  *
15763  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15764  * generated (ie our own).
15765  */
15766 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
15767
15768 /**
15769  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
15770  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
15771  * public key instead of private keys.
15772  *
15773  * Only the cheating participant owns a valid witness to propagate a revoked
15774  * commitment transaction, thus per_commitment_point always come from cheater
15775  * and revocation_base_point always come from punisher, which is the broadcaster
15776  * of the transaction spending with this key knowledge.
15777  *
15778  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15779  * generated (ie our own).
15780  */
15781 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
15782
15783 /**
15784  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
15785  */
15786 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
15787
15788 /**
15789  * The broadcaster's per-commitment public key which was used to derive the other keys.
15790  */
15791 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15792
15793 /**
15794  * The broadcaster's per-commitment public key which was used to derive the other keys.
15795  */
15796 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15797
15798 /**
15799  * The revocation key which is used to allow the broadcaster of the commitment
15800  * transaction to provide their counterparty the ability to punish them if they broadcast
15801  * an old state.
15802  */
15803 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15804
15805 /**
15806  * The revocation key which is used to allow the broadcaster of the commitment
15807  * transaction to provide their counterparty the ability to punish them if they broadcast
15808  * an old state.
15809  */
15810 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15811
15812 /**
15813  * Broadcaster's HTLC Key
15814  */
15815 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15816
15817 /**
15818  * Broadcaster's HTLC Key
15819  */
15820 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15821
15822 /**
15823  * Countersignatory's HTLC Key
15824  */
15825 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15826
15827 /**
15828  * Countersignatory's HTLC Key
15829  */
15830 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15831
15832 /**
15833  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15834  */
15835 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15836
15837 /**
15838  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15839  */
15840 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15841
15842 /**
15843  * Constructs a new TxCreationKeys given each field
15844  */
15845 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);
15846
15847 /**
15848  * Creates a copy of the TxCreationKeys
15849  */
15850 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
15851
15852 /**
15853  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
15854  */
15855 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
15856
15857 /**
15858  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
15859  */
15860 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
15861
15862 /**
15863  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
15864  */
15865 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
15866
15867 /**
15868  * The public key which is used to sign all commitment transactions, as it appears in the
15869  * on-chain channel lock-in 2-of-2 multisig output.
15870  */
15871 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15872
15873 /**
15874  * The public key which is used to sign all commitment transactions, as it appears in the
15875  * on-chain channel lock-in 2-of-2 multisig output.
15876  */
15877 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15878
15879 /**
15880  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15881  * revocation keys. This is combined with the per-commitment-secret generated by the
15882  * counterparty to create a secret which the counterparty can reveal to revoke previous
15883  * states.
15884  */
15885 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15886
15887 /**
15888  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15889  * revocation keys. This is combined with the per-commitment-secret generated by the
15890  * counterparty to create a secret which the counterparty can reveal to revoke previous
15891  * states.
15892  */
15893 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15894
15895 /**
15896  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15897  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15898  * static across every commitment transaction.
15899  */
15900 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15901
15902 /**
15903  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15904  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15905  * static across every commitment transaction.
15906  */
15907 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15908
15909 /**
15910  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15911  * public key which receives non-HTLC-encumbered funds which are only available for spending
15912  * after some delay (or can be claimed via the revocation path).
15913  */
15914 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15915
15916 /**
15917  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15918  * public key which receives non-HTLC-encumbered funds which are only available for spending
15919  * after some delay (or can be claimed via the revocation path).
15920  */
15921 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15922
15923 /**
15924  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15925  * which is used to encumber HTLC-in-flight outputs.
15926  */
15927 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15928
15929 /**
15930  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15931  * which is used to encumber HTLC-in-flight outputs.
15932  */
15933 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15934
15935 /**
15936  * Constructs a new ChannelPublicKeys given each field
15937  */
15938 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);
15939
15940 /**
15941  * Creates a copy of the ChannelPublicKeys
15942  */
15943 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
15944
15945 /**
15946  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
15947  */
15948 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
15949
15950 /**
15951  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
15952  */
15953 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
15954
15955 /**
15956  * Create per-state keys from channel base points and the per-commitment point.
15957  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15958  */
15959 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);
15960
15961 /**
15962  * Generate per-state keys from channel static keys.
15963  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15964  */
15965 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);
15966
15967 /**
15968  * A script either spendable by the revocation
15969  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
15970  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
15971  */
15972 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
15973
15974 /**
15975  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
15976  */
15977 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
15978
15979 /**
15980  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15981  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15982  * need to compare this value to whether the commitment transaction in question is that of
15983  * the counterparty or our own.
15984  */
15985 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15986
15987 /**
15988  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15989  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15990  * need to compare this value to whether the commitment transaction in question is that of
15991  * the counterparty or our own.
15992  */
15993 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
15994
15995 /**
15996  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15997  * this divided by 1000.
15998  */
15999 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16000
16001 /**
16002  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16003  * this divided by 1000.
16004  */
16005 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16006
16007 /**
16008  * The CLTV lock-time at which this HTLC expires.
16009  */
16010 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16011
16012 /**
16013  * The CLTV lock-time at which this HTLC expires.
16014  */
16015 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16016
16017 /**
16018  * The hash of the preimage which unlocks this HTLC.
16019  */
16020 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16021
16022 /**
16023  * The hash of the preimage which unlocks this HTLC.
16024  */
16025 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16026
16027 /**
16028  * The position within the commitment transactions' outputs. This may be None if the value is
16029  * below the dust limit (in which case no output appears in the commitment transaction and the
16030  * value is spent to additional transaction fees).
16031  */
16032 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16033
16034 /**
16035  * The position within the commitment transactions' outputs. This may be None if the value is
16036  * below the dust limit (in which case no output appears in the commitment transaction and the
16037  * value is spent to additional transaction fees).
16038  */
16039 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16040
16041 /**
16042  * Constructs a new HTLCOutputInCommitment given each field
16043  */
16044 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);
16045
16046 /**
16047  * Creates a copy of the HTLCOutputInCommitment
16048  */
16049 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16050
16051 /**
16052  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16053  */
16054 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16055
16056 /**
16057  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16058  */
16059 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16060
16061 /**
16062  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16063  * does not need to have its previous_output_index filled.
16064  */
16065 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16066
16067 /**
16068  * Gets the redeemscript for a funding output from the two funding public keys.
16069  * Note that the order of funding public keys does not matter.
16070  */
16071 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16072
16073 /**
16074  * panics if htlc.transaction_output_index.is_none()!
16075  */
16076 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);
16077
16078 /**
16079  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16080  */
16081 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16082
16083 /**
16084  * Holder public keys
16085  */
16086 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16087
16088 /**
16089  * Holder public keys
16090  */
16091 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16092
16093 /**
16094  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16095  */
16096 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16097
16098 /**
16099  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16100  */
16101 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16102
16103 /**
16104  * Whether the holder is the initiator of this channel.
16105  * This is an input to the commitment number obscure factor computation.
16106  */
16107 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16108
16109 /**
16110  * Whether the holder is the initiator of this channel.
16111  * This is an input to the commitment number obscure factor computation.
16112  */
16113 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16114
16115 /**
16116  * The late-bound counterparty channel transaction parameters.
16117  * These parameters are populated at the point in the protocol where the counterparty provides them.
16118  */
16119 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16120
16121 /**
16122  * The late-bound counterparty channel transaction parameters.
16123  * These parameters are populated at the point in the protocol where the counterparty provides them.
16124  */
16125 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16126
16127 /**
16128  * The late-bound funding outpoint
16129  */
16130 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16131
16132 /**
16133  * The late-bound funding outpoint
16134  */
16135 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16136
16137 /**
16138  * Constructs a new ChannelTransactionParameters given each field
16139  */
16140 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);
16141
16142 /**
16143  * Creates a copy of the ChannelTransactionParameters
16144  */
16145 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16146
16147 /**
16148  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16149  */
16150 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16151
16152 /**
16153  * Counter-party public keys
16154  */
16155 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16156
16157 /**
16158  * Counter-party public keys
16159  */
16160 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16161
16162 /**
16163  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16164  */
16165 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16166
16167 /**
16168  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16169  */
16170 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16171
16172 /**
16173  * Constructs a new CounterpartyChannelTransactionParameters given each field
16174  */
16175 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
16176
16177 /**
16178  * Creates a copy of the CounterpartyChannelTransactionParameters
16179  */
16180 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16181
16182 /**
16183  * Whether the late bound parameters are populated.
16184  */
16185 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16186
16187 /**
16188  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16189  * given that the holder is the broadcaster.
16190  *
16191  * self.is_populated() must be true before calling this function.
16192  */
16193 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16194
16195 /**
16196  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16197  * given that the counterparty is the broadcaster.
16198  *
16199  * self.is_populated() must be true before calling this function.
16200  */
16201 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16202
16203 /**
16204  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16205  */
16206 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16207
16208 /**
16209  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16210  */
16211 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16212
16213 /**
16214  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16215  */
16216 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16217
16218 /**
16219  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16220  */
16221 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16222
16223 /**
16224  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16225  */
16226 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16227
16228 /**
16229  * Get the channel pubkeys for the broadcaster
16230  */
16231 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16232
16233 /**
16234  * Get the channel pubkeys for the countersignatory
16235  */
16236 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16237
16238 /**
16239  * Get the contest delay applicable to the transactions.
16240  * Note that the contest delay was selected by the countersignatory.
16241  */
16242 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16243
16244 /**
16245  * Whether the channel is outbound from the broadcaster.
16246  *
16247  * The boolean representing the side that initiated the channel is
16248  * an input to the commitment number obscure factor computation.
16249  */
16250 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16251
16252 /**
16253  * The funding outpoint
16254  */
16255 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16256
16257 /**
16258  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16259  */
16260 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16261
16262 /**
16263  * Our counterparty's signature for the transaction
16264  */
16265 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16266
16267 /**
16268  * Our counterparty's signature for the transaction
16269  */
16270 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16271
16272 /**
16273  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16274  */
16275 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16276
16277 /**
16278  * Creates a copy of the HolderCommitmentTransaction
16279  */
16280 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16281
16282 /**
16283  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16284  */
16285 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16286
16287 /**
16288  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16289  */
16290 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16291
16292 /**
16293  * Create a new holder transaction with the given counterparty signatures.
16294  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16295  */
16296 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);
16297
16298 /**
16299  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16300  */
16301 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16302
16303 /**
16304  * The commitment transaction
16305  */
16306 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16307
16308 /**
16309  * The commitment transaction
16310  */
16311 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16312
16313 /**
16314  * The txid for the commitment transaction.
16315  *
16316  * This is provided as a performance optimization, instead of calling transaction.txid()
16317  * multiple times.
16318  */
16319 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16320
16321 /**
16322  * The txid for the commitment transaction.
16323  *
16324  * This is provided as a performance optimization, instead of calling transaction.txid()
16325  * multiple times.
16326  */
16327 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16328
16329 /**
16330  * Constructs a new BuiltCommitmentTransaction given each field
16331  */
16332 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16333
16334 /**
16335  * Creates a copy of the BuiltCommitmentTransaction
16336  */
16337 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16338
16339 /**
16340  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16341  */
16342 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16343
16344 /**
16345  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16346  */
16347 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16348
16349 /**
16350  * Get the SIGHASH_ALL sighash value of the transaction.
16351  *
16352  * This can be used to verify a signature.
16353  */
16354 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);
16355
16356 /**
16357  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16358  * because we are about to broadcast a holder transaction.
16359  */
16360 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);
16361
16362 /**
16363  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16364  */
16365 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16366
16367 /**
16368  * Creates a copy of the CommitmentTransaction
16369  */
16370 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16371
16372 /**
16373  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16374  */
16375 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16376
16377 /**
16378  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16379  */
16380 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16381
16382 /**
16383  * The backwards-counting commitment number
16384  */
16385 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16386
16387 /**
16388  * The value to be sent to the broadcaster
16389  */
16390 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16391
16392 /**
16393  * The value to be sent to the counterparty
16394  */
16395 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16396
16397 /**
16398  * The feerate paid per 1000-weight-unit in this commitment transaction.
16399  */
16400 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16401
16402 /**
16403  * Trust our pre-built transaction and derived transaction creation public keys.
16404  *
16405  * Applies a wrapper which allows access to these fields.
16406  *
16407  * This should only be used if you fully trust the builder of this object.  It should not
16408  *\tbe used by an external signer - instead use the verify function.
16409  */
16410 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16411
16412 /**
16413  * Verify our pre-built transaction and derived transaction creation public keys.
16414  *
16415  * Applies a wrapper which allows access to these fields.
16416  *
16417  * An external validating signer must call this method before signing
16418  * or using the built transaction.
16419  */
16420 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);
16421
16422 /**
16423  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16424  */
16425 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16426
16427 /**
16428  * The transaction ID of the built Bitcoin transaction
16429  */
16430 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16431
16432 /**
16433  * The pre-built Bitcoin commitment transaction
16434  */
16435 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16436
16437 /**
16438  * The pre-calculated transaction creation public keys.
16439  */
16440 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16441
16442 /**
16443  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16444  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16445  *
16446  * The returned Vec has one entry for each HTLC, and in the same order.
16447  */
16448 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);
16449
16450 /**
16451  * Get the transaction number obscure factor
16452  */
16453 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16454
16455 /**
16456  * Checks if two InitFeaturess contain equal inner contents.
16457  * This ignores pointers and is_owned flags and looks at the values in fields.
16458  * Two objects with NULL inner values will be considered "equal" here.
16459  */
16460 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
16461
16462 /**
16463  * Checks if two NodeFeaturess contain equal inner contents.
16464  * This ignores pointers and is_owned flags and looks at the values in fields.
16465  * Two objects with NULL inner values will be considered "equal" here.
16466  */
16467 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
16468
16469 /**
16470  * Checks if two ChannelFeaturess contain equal inner contents.
16471  * This ignores pointers and is_owned flags and looks at the values in fields.
16472  * Two objects with NULL inner values will be considered "equal" here.
16473  */
16474 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
16475
16476 /**
16477  * Checks if two InvoiceFeaturess contain equal inner contents.
16478  * This ignores pointers and is_owned flags and looks at the values in fields.
16479  * Two objects with NULL inner values will be considered "equal" here.
16480  */
16481 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
16482
16483 /**
16484  * Creates a copy of the InitFeatures
16485  */
16486 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16487
16488 /**
16489  * Creates a copy of the NodeFeatures
16490  */
16491 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16492
16493 /**
16494  * Creates a copy of the ChannelFeatures
16495  */
16496 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16497
16498 /**
16499  * Creates a copy of the InvoiceFeatures
16500  */
16501 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16502
16503 /**
16504  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16505  */
16506 void InitFeatures_free(struct LDKInitFeatures this_obj);
16507
16508 /**
16509  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16510  */
16511 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16512
16513 /**
16514  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16515  */
16516 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16517
16518 /**
16519  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16520  */
16521 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16522
16523 /**
16524  * Create a blank Features with no features set
16525  */
16526 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16527
16528 /**
16529  * Creates a Features with the bits set which are known by the implementation
16530  */
16531 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16532
16533 /**
16534  * Create a blank Features with no features set
16535  */
16536 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16537
16538 /**
16539  * Creates a Features with the bits set which are known by the implementation
16540  */
16541 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16542
16543 /**
16544  * Create a blank Features with no features set
16545  */
16546 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16547
16548 /**
16549  * Creates a Features with the bits set which are known by the implementation
16550  */
16551 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16552
16553 /**
16554  * Create a blank Features with no features set
16555  */
16556 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16557
16558 /**
16559  * Creates a Features with the bits set which are known by the implementation
16560  */
16561 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16562
16563 /**
16564  * Returns whether the `payment_secret` feature is supported.
16565  */
16566 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
16567
16568 /**
16569  * Returns whether the `payment_secret` feature is supported.
16570  */
16571 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
16572
16573 /**
16574  * Returns whether the `payment_secret` feature is supported.
16575  */
16576 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
16577
16578 /**
16579  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16580  */
16581 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16582
16583 /**
16584  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16585  */
16586 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16587
16588 /**
16589  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16590  */
16591 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16592
16593 /**
16594  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16595  */
16596 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16597
16598 /**
16599  * Read a InitFeatures from a byte array, created by InitFeatures_write
16600  */
16601 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16602
16603 /**
16604  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16605  */
16606 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16607
16608 /**
16609  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16610  */
16611 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16612
16613 /**
16614  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16615  */
16616 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16617
16618 /**
16619  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16620  */
16621 void RouteHop_free(struct LDKRouteHop this_obj);
16622
16623 /**
16624  * The node_id of the node at this hop.
16625  */
16626 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16627
16628 /**
16629  * The node_id of the node at this hop.
16630  */
16631 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16632
16633 /**
16634  * The node_announcement features of the node at this hop. For the last hop, these may be
16635  * amended to match the features present in the invoice this node generated.
16636  */
16637 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16638
16639 /**
16640  * The node_announcement features of the node at this hop. For the last hop, these may be
16641  * amended to match the features present in the invoice this node generated.
16642  */
16643 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16644
16645 /**
16646  * The channel that should be used from the previous hop to reach this node.
16647  */
16648 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16649
16650 /**
16651  * The channel that should be used from the previous hop to reach this node.
16652  */
16653 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16654
16655 /**
16656  * The channel_announcement features of the channel that should be used from the previous hop
16657  * to reach this node.
16658  */
16659 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16660
16661 /**
16662  * The channel_announcement features of the channel that should be used from the previous hop
16663  * to reach this node.
16664  */
16665 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16666
16667 /**
16668  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16669  * For the last hop, this should be the full value of the payment (might be more than
16670  * requested if we had to match htlc_minimum_msat).
16671  */
16672 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16673
16674 /**
16675  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16676  * For the last hop, this should be the full value of the payment (might be more than
16677  * requested if we had to match htlc_minimum_msat).
16678  */
16679 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16680
16681 /**
16682  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16683  * expected at the destination, in excess of the current block height.
16684  */
16685 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16686
16687 /**
16688  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16689  * expected at the destination, in excess of the current block height.
16690  */
16691 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
16692
16693 /**
16694  * Constructs a new RouteHop given each field
16695  */
16696 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);
16697
16698 /**
16699  * Creates a copy of the RouteHop
16700  */
16701 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
16702
16703 /**
16704  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
16705  */
16706 void Route_free(struct LDKRoute this_obj);
16707
16708 /**
16709  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
16710  * last RouteHop in each path must be the same.
16711  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
16712  * destination. Thus, this must always be at least length one. While the maximum length of any
16713  * given path is variable, keeping the length of any path to less than 20 should currently
16714  * ensure it is viable.
16715  */
16716 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
16717
16718 /**
16719  * Constructs a new Route given each field
16720  */
16721 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
16722
16723 /**
16724  * Creates a copy of the Route
16725  */
16726 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
16727
16728 /**
16729  * Serialize the Route object into a byte array which can be read by Route_read
16730  */
16731 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
16732
16733 /**
16734  * Read a Route from a byte array, created by Route_write
16735  */
16736 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
16737
16738 /**
16739  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
16740  */
16741 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
16742
16743 /**
16744  * The node_id of the non-target end of the route
16745  */
16746 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16747
16748 /**
16749  * The node_id of the non-target end of the route
16750  */
16751 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16752
16753 /**
16754  * The short_channel_id of this channel
16755  */
16756 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16757
16758 /**
16759  * The short_channel_id of this channel
16760  */
16761 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
16762
16763 /**
16764  * The fees which must be paid to use this channel
16765  */
16766 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16767
16768 /**
16769  * The fees which must be paid to use this channel
16770  */
16771 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16772
16773 /**
16774  * The difference in CLTV values between this node and the next node.
16775  */
16776 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16777
16778 /**
16779  * The difference in CLTV values between this node and the next node.
16780  */
16781 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
16782
16783 /**
16784  * The minimum value, in msat, which must be relayed to the next hop.
16785  */
16786 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16787
16788 /**
16789  * The minimum value, in msat, which must be relayed to the next hop.
16790  */
16791 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16792
16793 /**
16794  * The maximum value in msat available for routing with a single HTLC.
16795  */
16796 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16797
16798 /**
16799  * The maximum value in msat available for routing with a single HTLC.
16800  */
16801 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16802
16803 /**
16804  * Constructs a new RouteHintHop given each field
16805  */
16806 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);
16807
16808 /**
16809  * Checks if two RouteHintHops contain equal inner contents.
16810  * This ignores pointers and is_owned flags and looks at the values in fields.
16811  * Two objects with NULL inner values will be considered "equal" here.
16812  */
16813 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
16814
16815 /**
16816  * Creates a copy of the RouteHintHop
16817  */
16818 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
16819
16820 /**
16821  * Gets a route from us (payer) to the given target node (payee).
16822  *
16823  * If the payee provided features in their invoice, they should be provided via payee_features.
16824  * Without this, MPP will only be used if the payee's features are available in the network graph.
16825  *
16826  * Extra routing hops between known nodes and the target will be used if they are included in
16827  * last_hops.
16828  *
16829  * If some channels aren't announced, it may be useful to fill in a first_hops with the
16830  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
16831  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
16832  * in first_hops will be used.
16833  *
16834  * Panics if first_hops contains channels without short_channel_ids
16835  * (ChannelManager::list_usable_channels will never include such channels).
16836  *
16837  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
16838  * equal), however the enabled/disabled bit on such channels as well as the
16839  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
16840  */
16841 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);
16842
16843 /**
16844  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
16845  */
16846 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
16847
16848 /**
16849  * Creates a copy of the NetworkGraph
16850  */
16851 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
16852
16853 /**
16854  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
16855  */
16856 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
16857
16858 /**
16859  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
16860  */
16861 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
16862
16863 /**
16864  * Creates a new tracker of the actual state of the network of channels and nodes,
16865  * assuming a fresh network graph.
16866  * Chain monitor is used to make sure announced channels exist on-chain,
16867  * channel data is correct, and that the announcement is signed with
16868  * channel owners' keys.
16869  */
16870 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
16871
16872 /**
16873  * Creates a new tracker of the actual state of the network of channels and nodes,
16874  * assuming an existing Network Graph.
16875  */
16876 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
16877
16878 /**
16879  * Adds a provider used to check new announcements. Does not affect
16880  * existing announcements unless they are updated.
16881  * Add, update or remove the provider would replace the current one.
16882  */
16883 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
16884
16885 /**
16886  * Take a read lock on the network_graph and return it in the C-bindings
16887  * newtype helper. This is likely only useful when called via the C
16888  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
16889  * yourself.
16890  */
16891 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16892
16893 /**
16894  * Get a reference to the NetworkGraph which this read-lock contains.
16895  */
16896 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
16897
16898 /**
16899  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
16900  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
16901  */
16902 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16903
16904 /**
16905  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16906  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16907  */
16908 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16909
16910 /**
16911  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
16912  */
16913 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
16914
16915 /**
16916  * When the last update to the channel direction was issued.
16917  * Value is opaque, as set in the announcement.
16918  */
16919 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16920
16921 /**
16922  * When the last update to the channel direction was issued.
16923  * Value is opaque, as set in the announcement.
16924  */
16925 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
16926
16927 /**
16928  * Whether the channel can be currently used for payments (in this one direction).
16929  */
16930 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16931
16932 /**
16933  * Whether the channel can be currently used for payments (in this one direction).
16934  */
16935 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
16936
16937 /**
16938  * The difference in CLTV values that you must have when routing through this channel.
16939  */
16940 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16941
16942 /**
16943  * The difference in CLTV values that you must have when routing through this channel.
16944  */
16945 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
16946
16947 /**
16948  * The minimum value, which must be relayed to the next hop via the channel
16949  */
16950 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16951
16952 /**
16953  * The minimum value, which must be relayed to the next hop via the channel
16954  */
16955 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
16956
16957 /**
16958  * The maximum value which may be relayed to the next hop via the channel.
16959  */
16960 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16961
16962 /**
16963  * The maximum value which may be relayed to the next hop via the channel.
16964  */
16965 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16966
16967 /**
16968  * Fees charged when the channel is used for routing
16969  */
16970 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16971
16972 /**
16973  * Fees charged when the channel is used for routing
16974  */
16975 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16976
16977 /**
16978  * Most recent update for the channel received from the network
16979  * Mostly redundant with the data we store in fields explicitly.
16980  * Everything else is useful only for sending out for initial routing sync.
16981  * Not stored if contains excess data to prevent DoS.
16982  */
16983 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16984
16985 /**
16986  * Most recent update for the channel received from the network
16987  * Mostly redundant with the data we store in fields explicitly.
16988  * Everything else is useful only for sending out for initial routing sync.
16989  * Not stored if contains excess data to prevent DoS.
16990  */
16991 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
16992
16993 /**
16994  * Constructs a new DirectionalChannelInfo given each field
16995  */
16996 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);
16997
16998 /**
16999  * Creates a copy of the DirectionalChannelInfo
17000  */
17001 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17002
17003 /**
17004  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17005  */
17006 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17007
17008 /**
17009  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17010  */
17011 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17012
17013 /**
17014  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17015  */
17016 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17017
17018 /**
17019  * Protocol features of a channel communicated during its announcement
17020  */
17021 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17022
17023 /**
17024  * Protocol features of a channel communicated during its announcement
17025  */
17026 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17027
17028 /**
17029  * Source node of the first direction of a channel
17030  */
17031 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17032
17033 /**
17034  * Source node of the first direction of a channel
17035  */
17036 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17037
17038 /**
17039  * Details about the first direction of a channel
17040  */
17041 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17042
17043 /**
17044  * Details about the first direction of a channel
17045  */
17046 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17047
17048 /**
17049  * Source node of the second direction of a channel
17050  */
17051 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17052
17053 /**
17054  * Source node of the second direction of a channel
17055  */
17056 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17057
17058 /**
17059  * Details about the second direction of a channel
17060  */
17061 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17062
17063 /**
17064  * Details about the second direction of a channel
17065  */
17066 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17067
17068 /**
17069  * The channel capacity as seen on-chain, if chain lookup is available.
17070  */
17071 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17072
17073 /**
17074  * The channel capacity as seen on-chain, if chain lookup is available.
17075  */
17076 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17077
17078 /**
17079  * An initial announcement of the channel
17080  * Mostly redundant with the data we store in fields explicitly.
17081  * Everything else is useful only for sending out for initial routing sync.
17082  * Not stored if contains excess data to prevent DoS.
17083  */
17084 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17085
17086 /**
17087  * An initial announcement of the channel
17088  * Mostly redundant with the data we store in fields explicitly.
17089  * Everything else is useful only for sending out for initial routing sync.
17090  * Not stored if contains excess data to prevent DoS.
17091  */
17092 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17093
17094 /**
17095  * Constructs a new ChannelInfo given each field
17096  */
17097 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);
17098
17099 /**
17100  * Creates a copy of the ChannelInfo
17101  */
17102 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17103
17104 /**
17105  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17106  */
17107 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17108
17109 /**
17110  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17111  */
17112 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17113
17114 /**
17115  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
17116  */
17117 void RoutingFees_free(struct LDKRoutingFees this_obj);
17118
17119 /**
17120  * Flat routing fee in satoshis
17121  */
17122 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17123
17124 /**
17125  * Flat routing fee in satoshis
17126  */
17127 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17128
17129 /**
17130  * Liquidity-based routing fee in millionths of a routed amount.
17131  * In other words, 10000 is 1%.
17132  */
17133 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17134
17135 /**
17136  * Liquidity-based routing fee in millionths of a routed amount.
17137  * In other words, 10000 is 1%.
17138  */
17139 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17140
17141 /**
17142  * Constructs a new RoutingFees given each field
17143  */
17144 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
17145
17146 /**
17147  * Checks if two RoutingFeess contain equal inner contents.
17148  * This ignores pointers and is_owned flags and looks at the values in fields.
17149  * Two objects with NULL inner values will be considered "equal" here.
17150  */
17151 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
17152
17153 /**
17154  * Creates a copy of the RoutingFees
17155  */
17156 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
17157
17158 /**
17159  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
17160  */
17161 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
17162
17163 /**
17164  * Read a RoutingFees from a byte array, created by RoutingFees_write
17165  */
17166 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
17167
17168 /**
17169  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
17170  */
17171 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
17172
17173 /**
17174  * Protocol features the node announced support for
17175  */
17176 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17177
17178 /**
17179  * Protocol features the node announced support for
17180  */
17181 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17182
17183 /**
17184  * When the last known update to the node state was issued.
17185  * Value is opaque, as set in the announcement.
17186  */
17187 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17188
17189 /**
17190  * When the last known update to the node state was issued.
17191  * Value is opaque, as set in the announcement.
17192  */
17193 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
17194
17195 /**
17196  * Color assigned to the node
17197  */
17198 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
17199
17200 /**
17201  * Color assigned to the node
17202  */
17203 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17204
17205 /**
17206  * Moniker assigned to the node.
17207  * May be invalid or malicious (eg control chars),
17208  * should not be exposed to the user.
17209  */
17210 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
17211
17212 /**
17213  * Moniker assigned to the node.
17214  * May be invalid or malicious (eg control chars),
17215  * should not be exposed to the user.
17216  */
17217 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17218
17219 /**
17220  * Internet-level addresses via which one can connect to the node
17221  */
17222 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17223
17224 /**
17225  * An initial announcement of the node
17226  * Mostly redundant with the data we store in fields explicitly.
17227  * Everything else is useful only for sending out for initial routing sync.
17228  * Not stored if contains excess data to prevent DoS.
17229  */
17230 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17231
17232 /**
17233  * An initial announcement of the node
17234  * Mostly redundant with the data we store in fields explicitly.
17235  * Everything else is useful only for sending out for initial routing sync.
17236  * Not stored if contains excess data to prevent DoS.
17237  */
17238 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17239
17240 /**
17241  * Constructs a new NodeAnnouncementInfo given each field
17242  */
17243 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);
17244
17245 /**
17246  * Creates a copy of the NodeAnnouncementInfo
17247  */
17248 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17249
17250 /**
17251  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17252  */
17253 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17254
17255 /**
17256  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17257  */
17258 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17259
17260 /**
17261  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17262  */
17263 void NodeInfo_free(struct LDKNodeInfo this_obj);
17264
17265 /**
17266  * All valid channels a node has announced
17267  */
17268 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17269
17270 /**
17271  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17272  * The two fields (flat and proportional fee) are independent,
17273  * meaning they don't have to refer to the same channel.
17274  */
17275 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17276
17277 /**
17278  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17279  * The two fields (flat and proportional fee) are independent,
17280  * meaning they don't have to refer to the same channel.
17281  */
17282 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17283
17284 /**
17285  * More information about a node from node_announcement.
17286  * Optional because we store a Node entry after learning about it from
17287  * a channel announcement, but before receiving a node announcement.
17288  */
17289 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17290
17291 /**
17292  * More information about a node from node_announcement.
17293  * Optional because we store a Node entry after learning about it from
17294  * a channel announcement, but before receiving a node announcement.
17295  */
17296 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17297
17298 /**
17299  * Constructs a new NodeInfo given each field
17300  */
17301 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17302
17303 /**
17304  * Creates a copy of the NodeInfo
17305  */
17306 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17307
17308 /**
17309  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17310  */
17311 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17312
17313 /**
17314  * Read a NodeInfo from a byte array, created by NodeInfo_write
17315  */
17316 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17317
17318 /**
17319  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17320  */
17321 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17322
17323 /**
17324  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17325  */
17326 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17327
17328 /**
17329  * Creates a new, empty, network graph.
17330  */
17331 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17332
17333 /**
17334  * For an already known node (from channel announcements), update its stored properties from a
17335  * given node announcement.
17336  *
17337  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17338  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17339  * routing messages from a source using a protocol other than the lightning P2P protocol.
17340  */
17341 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17342
17343 /**
17344  * For an already known node (from channel announcements), update its stored properties from a
17345  * given node announcement without verifying the associated signatures. Because we aren't
17346  * given the associated signatures here we cannot relay the node announcement to any of our
17347  * peers.
17348  */
17349 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17350
17351 /**
17352  * Store or update channel info from a channel announcement.
17353  *
17354  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17355  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17356  * routing messages from a source using a protocol other than the lightning P2P protocol.
17357  *
17358  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17359  * the corresponding UTXO exists on chain and is correctly-formatted.
17360  */
17361 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);
17362
17363 /**
17364  * Store or update channel info from a channel announcement without verifying the associated
17365  * signatures. Because we aren't given the associated signatures here we cannot relay the
17366  * channel announcement to any of our peers.
17367  *
17368  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17369  * the corresponding UTXO exists on chain and is correctly-formatted.
17370  */
17371 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);
17372
17373 /**
17374  * Close a channel if a corresponding HTLC fail was sent.
17375  * If permanent, removes a channel from the local storage.
17376  * May cause the removal of nodes too, if this was their last channel.
17377  * If not permanent, makes channels unavailable for routing.
17378  */
17379 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17380
17381 /**
17382  * For an already known (from announcement) channel, update info about one of the directions
17383  * of the channel.
17384  *
17385  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17386  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17387  * routing messages from a source using a protocol other than the lightning P2P protocol.
17388  */
17389 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17390
17391 /**
17392  * For an already known (from announcement) channel, update info about one of the directions
17393  * of the channel without verifying the associated signatures. Because we aren't given the
17394  * associated signatures here we cannot relay the channel update to any of our peers.
17395  */
17396 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17397
17398 /**
17399  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17400  */
17401 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17402
17403 /**
17404  * Initialize a new FilesystemPersister and set the path to the individual channels'
17405  * files.
17406  */
17407 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17408
17409 /**
17410  * Get the directory which was provided when this persister was initialized.
17411  */
17412 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17413
17414 /**
17415  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17416  * initialization, within a file called \"manager\".
17417  */
17418 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17419
17420 /**
17421  * Read `ChannelMonitor`s from disk.
17422  */
17423 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17424
17425 /**
17426  * Constructs a new Persist which calls the relevant methods on this_arg.
17427  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17428  */
17429 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17430
17431 /**
17432  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17433  *
17434  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17435  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17436  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17437  * since this check is fast we recommend to do it anyway.
17438  *
17439  * If this function fails this is considered a bug. Please open an issue describing your
17440  * platform and stating your current system time.
17441  *
17442  * # Panics
17443  * If the check fails this function panics. By calling this function on startup you ensure that
17444  * this wont happen at an arbitrary later point in time.
17445  */
17446 void check_platform(void);
17447
17448 /**
17449  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17450  */
17451 void Invoice_free(struct LDKInvoice this_obj);
17452
17453 /**
17454  * Checks if two Invoices contain equal inner contents.
17455  * This ignores pointers and is_owned flags and looks at the values in fields.
17456  * Two objects with NULL inner values will be considered "equal" here.
17457  */
17458 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
17459
17460 /**
17461  * Creates a copy of the Invoice
17462  */
17463 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17464
17465 /**
17466  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17467  */
17468 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17469
17470 /**
17471  * Checks if two SignedRawInvoices contain equal inner contents.
17472  * This ignores pointers and is_owned flags and looks at the values in fields.
17473  * Two objects with NULL inner values will be considered "equal" here.
17474  */
17475 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
17476
17477 /**
17478  * Creates a copy of the SignedRawInvoice
17479  */
17480 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17481
17482 /**
17483  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17484  */
17485 void RawInvoice_free(struct LDKRawInvoice this_obj);
17486
17487 /**
17488  * data part
17489  */
17490 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17491
17492 /**
17493  * data part
17494  */
17495 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17496
17497 /**
17498  * Checks if two RawInvoices contain equal inner contents.
17499  * This ignores pointers and is_owned flags and looks at the values in fields.
17500  * Two objects with NULL inner values will be considered "equal" here.
17501  */
17502 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
17503
17504 /**
17505  * Creates a copy of the RawInvoice
17506  */
17507 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17508
17509 /**
17510  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17511  */
17512 void RawDataPart_free(struct LDKRawDataPart this_obj);
17513
17514 /**
17515  * generation time of the invoice
17516  */
17517 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17518
17519 /**
17520  * generation time of the invoice
17521  */
17522 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17523
17524 /**
17525  * Checks if two RawDataParts contain equal inner contents.
17526  * This ignores pointers and is_owned flags and looks at the values in fields.
17527  * Two objects with NULL inner values will be considered "equal" here.
17528  */
17529 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
17530
17531 /**
17532  * Creates a copy of the RawDataPart
17533  */
17534 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17535
17536 /**
17537  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17538  */
17539 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17540
17541 /**
17542  * Checks if two PositiveTimestamps contain equal inner contents.
17543  * This ignores pointers and is_owned flags and looks at the values in fields.
17544  * Two objects with NULL inner values will be considered "equal" here.
17545  */
17546 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
17547
17548 /**
17549  * Creates a copy of the PositiveTimestamp
17550  */
17551 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17552
17553 /**
17554  * Creates a copy of the SiPrefix
17555  */
17556 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17557
17558 /**
17559  * Checks if two SiPrefixs contain equal inner contents.
17560  * This ignores pointers and is_owned flags and looks at the values in fields.
17561  */
17562 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
17563
17564 /**
17565  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17566  * This is effectively 10^12 * the prefix multiplier
17567  */
17568 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17569
17570 /**
17571  * Creates a copy of the Currency
17572  */
17573 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17574
17575 /**
17576  * Checks if two Currencys contain equal inner contents.
17577  * This ignores pointers and is_owned flags and looks at the values in fields.
17578  */
17579 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
17580
17581 /**
17582  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17583  */
17584 void Sha256_free(struct LDKSha256 this_obj);
17585
17586 /**
17587  * Checks if two Sha256s contain equal inner contents.
17588  * This ignores pointers and is_owned flags and looks at the values in fields.
17589  * Two objects with NULL inner values will be considered "equal" here.
17590  */
17591 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
17592
17593 /**
17594  * Creates a copy of the Sha256
17595  */
17596 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17597
17598 /**
17599  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17600  */
17601 void Description_free(struct LDKDescription this_obj);
17602
17603 /**
17604  * Checks if two Descriptions contain equal inner contents.
17605  * This ignores pointers and is_owned flags and looks at the values in fields.
17606  * Two objects with NULL inner values will be considered "equal" here.
17607  */
17608 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
17609
17610 /**
17611  * Creates a copy of the Description
17612  */
17613 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17614
17615 /**
17616  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17617  */
17618 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17619
17620 /**
17621  * Checks if two PayeePubKeys contain equal inner contents.
17622  * This ignores pointers and is_owned flags and looks at the values in fields.
17623  * Two objects with NULL inner values will be considered "equal" here.
17624  */
17625 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
17626
17627 /**
17628  * Creates a copy of the PayeePubKey
17629  */
17630 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17631
17632 /**
17633  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17634  */
17635 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17636
17637 /**
17638  * Checks if two ExpiryTimes contain equal inner contents.
17639  * This ignores pointers and is_owned flags and looks at the values in fields.
17640  * Two objects with NULL inner values will be considered "equal" here.
17641  */
17642 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
17643
17644 /**
17645  * Creates a copy of the ExpiryTime
17646  */
17647 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
17648
17649 /**
17650  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
17651  */
17652 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
17653
17654 /**
17655  * Checks if two MinFinalCltvExpirys contain equal inner contents.
17656  * This ignores pointers and is_owned flags and looks at the values in fields.
17657  * Two objects with NULL inner values will be considered "equal" here.
17658  */
17659 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
17660
17661 /**
17662  * Creates a copy of the MinFinalCltvExpiry
17663  */
17664 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
17665
17666 /**
17667  * Frees any resources used by the Fallback
17668  */
17669 void Fallback_free(struct LDKFallback this_ptr);
17670
17671 /**
17672  * Creates a copy of the Fallback
17673  */
17674 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
17675
17676 /**
17677  * Checks if two Fallbacks contain equal inner contents.
17678  * This ignores pointers and is_owned flags and looks at the values in fields.
17679  */
17680 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
17681
17682 /**
17683  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
17684  */
17685 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
17686
17687 /**
17688  * Checks if two InvoiceSignatures contain equal inner contents.
17689  * This ignores pointers and is_owned flags and looks at the values in fields.
17690  * Two objects with NULL inner values will be considered "equal" here.
17691  */
17692 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
17693
17694 /**
17695  * Creates a copy of the InvoiceSignature
17696  */
17697 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
17698
17699 /**
17700  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17701  */
17702 void RouteHint_free(struct LDKRouteHint this_obj);
17703
17704 /**
17705  * Checks if two RouteHints contain equal inner contents.
17706  * This ignores pointers and is_owned flags and looks at the values in fields.
17707  * Two objects with NULL inner values will be considered "equal" here.
17708  */
17709 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
17710
17711 /**
17712  * Creates a copy of the RouteHint
17713  */
17714 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17715
17716 /**
17717  * Disassembles the `SignedRawInvoice` into its three parts:
17718  *  1. raw invoice
17719  *  2. hash of the raw invoice
17720  *  3. signature
17721  */
17722 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
17723
17724 /**
17725  * The `RawInvoice` which was signed.
17726  */
17727 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17728
17729 /**
17730  * The hash of the `RawInvoice` that was signed.
17731  */
17732 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
17733
17734 /**
17735  * InvoiceSignature for the invoice.
17736  */
17737 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17738
17739 /**
17740  * Recovers the public key used for signing the invoice from the recoverable signature.
17741  */
17742 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17743
17744 /**
17745  * Checks if the signature is valid for the included payee public key or if none exists if it's
17746  * valid for the recovered signature (which should always be true?).
17747  */
17748 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17749
17750 /**
17751  * Calculate the hash of the encoded `RawInvoice`
17752  */
17753 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17754
17755 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17756
17757 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17758
17759 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17760
17761 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17762
17763 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17764
17765 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17766
17767 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17768
17769 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17770
17771 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17772
17773 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17774
17775 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17776
17777 /**
17778  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
17779  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17780  * `CreationError::TimestampOutOfBounds`.
17781  */
17782 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
17783
17784 /**
17785  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
17786  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17787  * `CreationError::TimestampOutOfBounds`.
17788  */
17789 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
17790
17791 /**
17792  * Returns the UNIX timestamp representing the stored time
17793  */
17794 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17795
17796 /**
17797  * Returns a reference to the internal `SystemTime` time representation
17798  */
17799 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17800
17801 /**
17802  * Transform the `Invoice` into it's unchecked version
17803  */
17804 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
17805
17806 /**
17807  * Check that the invoice is signed correctly and that key recovery works
17808  */
17809 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
17810
17811 /**
17812  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
17813  * ```
17814  * use lightning_invoice::*;
17815  *
17816  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
17817  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
17818  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
17819  * \tky03ylcqca784w\";
17820  *
17821  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
17822  *
17823  * assert!(Invoice::from_signed(signed).is_ok());
17824  * ```
17825  */
17826 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
17827
17828 /**
17829  * Returns the `Invoice`'s timestamp (should equal it's creation time)
17830  */
17831 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
17832
17833 /**
17834  * Returns the hash to which we will receive the preimage on completion of the payment
17835  */
17836 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
17837
17838 /**
17839  * Get the payee's public key if one was included in the invoice
17840  */
17841 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17842
17843 /**
17844  * Get the payment secret if one was included in the invoice
17845  */
17846 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
17847
17848 /**
17849  * Get the invoice features if they were included in the invoice
17850  */
17851 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
17852
17853 /**
17854  * Recover the payee's public key (only to be used if none was included in the invoice)
17855  */
17856 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17857
17858 /**
17859  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
17860  */
17861 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
17862
17863 /**
17864  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
17865  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
17866  */
17867 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
17868
17869 /**
17870  * Returns a list of all routes included in the invoice
17871  */
17872 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
17873
17874 /**
17875  * Returns the currency for which the invoice was issued
17876  */
17877 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
17878
17879 /**
17880  * Returns the amount if specified in the invoice as pico <currency>.
17881  */
17882 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
17883
17884 /**
17885  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
17886  * returns `CreationError::DescriptionTooLong` otherwise
17887  *
17888  * Please note that single characters may use more than one byte due to UTF8 encoding.
17889  */
17890 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
17891
17892 /**
17893  * Returns the underlying description `String`
17894  */
17895 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
17896
17897 /**
17898  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
17899  * overflow on adding the `EpiryTime` to it then this function will return a
17900  * `CreationError::ExpiryTimeOutOfBounds`.
17901  */
17902 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
17903
17904 /**
17905  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
17906  * would overflow on adding the `EpiryTime` to it then this function will return a
17907  * `CreationError::ExpiryTimeOutOfBounds`.
17908  */
17909 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
17910
17911 /**
17912  * Returns the expiry time in seconds
17913  */
17914 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17915
17916 /**
17917  * Returns a reference to the underlying `Duration` (=expiry time)
17918  */
17919 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17920
17921 /**
17922  * Create a new (partial) route from a list of hops
17923  */
17924 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
17925
17926 /**
17927  * Returrn the underlying vector of hops
17928  */
17929 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
17930
17931 /**
17932  * Creates a copy of the CreationError
17933  */
17934 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
17935
17936 /**
17937  * Checks if two CreationErrors contain equal inner contents.
17938  * This ignores pointers and is_owned flags and looks at the values in fields.
17939  */
17940 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
17941
17942 /**
17943  * Get the string representation of a CreationError object
17944  */
17945 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
17946
17947 /**
17948  * Creates a copy of the SemanticError
17949  */
17950 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
17951
17952 /**
17953  * Checks if two SemanticErrors contain equal inner contents.
17954  * This ignores pointers and is_owned flags and looks at the values in fields.
17955  */
17956 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
17957
17958 /**
17959  * Get the string representation of a SemanticError object
17960  */
17961 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
17962
17963 /**
17964  * Frees any resources used by the SignOrCreationError
17965  */
17966 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
17967
17968 /**
17969  * Creates a copy of the SignOrCreationError
17970  */
17971 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
17972
17973 /**
17974  * Checks if two SignOrCreationErrors contain equal inner contents.
17975  * This ignores pointers and is_owned flags and looks at the values in fields.
17976  */
17977 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
17978
17979 /**
17980  * Get the string representation of a SignOrCreationError object
17981  */
17982 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
17983
17984 /**
17985  * Utility to construct an invoice. Generally, unless you want to do something like a custom
17986  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
17987  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
17988  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
17989  * that the payment secret is valid when the invoice is paid.
17990  */
17991 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);
17992
17993 /**
17994  * Read a SiPrefix object from a string
17995  */
17996 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
17997
17998 /**
17999  * Read a Invoice object from a string
18000  */
18001 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18002
18003 /**
18004  * Read a SignedRawInvoice object from a string
18005  */
18006 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18007
18008 /**
18009  * Get the string representation of a Invoice object
18010  */
18011 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18012
18013 /**
18014  * Get the string representation of a SignedRawInvoice object
18015  */
18016 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18017
18018 /**
18019  * Get the string representation of a Currency object
18020  */
18021 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18022
18023 /**
18024  * Get the string representation of a SiPrefix object
18025  */
18026 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18027
18028 #endif /* LDK_C_BINDINGS_H */
18029
18030 #include <ldk_ver.h>