Merge pull request #19 from TheBlueMatt/2021-04-invoice-incl
[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
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 recovery id doesn't fit the signature/pub key
333     */
334    LDKSemanticError_InvalidRecoveryId,
335    /**
336     * The invoice's signature is invalid
337     */
338    LDKSemanticError_InvalidSignature,
339    /**
340     * Must be last for serialization purposes
341     */
342    LDKSemanticError_Sentinel,
343 } LDKSemanticError;
344
345 /**
346  * SI prefixes for the human readable part
347  */
348 typedef enum LDKSiPrefix {
349    /**
350     * 10^-3
351     */
352    LDKSiPrefix_Milli,
353    /**
354     * 10^-6
355     */
356    LDKSiPrefix_Micro,
357    /**
358     * 10^-9
359     */
360    LDKSiPrefix_Nano,
361    /**
362     * 10^-12
363     */
364    LDKSiPrefix_Pico,
365    /**
366     * Must be last for serialization purposes
367     */
368    LDKSiPrefix_Sentinel,
369 } LDKSiPrefix;
370
371 /**
372  * A serialized transaction, in (pointer, length) form.
373  *
374  * This type optionally owns its own memory, and thus the semantics around access change based on
375  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
376  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
377  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
378  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
379  * you would be invalid.
380  *
381  * Note that, while it may change in the future, because transactions on the Rust side are stored
382  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
383  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
384  * `data_is_owned` either set or unset at your discretion.
385  */
386 typedef struct LDKTransaction {
387    /**
388     * The serialized transaction data.
389     *
390     * This is non-const for your convenience, an object passed to Rust is never written to.
391     */
392    uint8_t *data;
393    /**
394     * The length of the serialized transaction
395     */
396    uintptr_t datalen;
397    /**
398     * Whether the data pointed to by `data` should be freed or not.
399     */
400    bool data_is_owned;
401 } LDKTransaction;
402
403 /**
404  * A dynamically-allocated array of u8s of arbitrary size.
405  * This corresponds to std::vector in C++
406  */
407 typedef struct LDKCVec_u8Z {
408    /**
409     * The elements in the array.
410     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
411     */
412    uint8_t *data;
413    /**
414     * The number of elements pointed to by `data`.
415     */
416    uintptr_t datalen;
417 } LDKCVec_u8Z;
418
419 /**
420  * A transaction output including a scriptPubKey and value.
421  * This type *does* own its own memory, so must be free'd appropriately.
422  */
423 typedef struct LDKTxOut {
424    /**
425     * The script_pubkey in this output
426     */
427    struct LDKCVec_u8Z script_pubkey;
428    /**
429     * The value, in satoshis, of this output
430     */
431    uint64_t value;
432 } LDKTxOut;
433
434 /**
435  * A Rust str object, ie a reference to a UTF8-valid string.
436  * This is *not* null-terminated so cannot be used directly as a C string!
437  */
438 typedef struct LDKStr {
439    /**
440     * A pointer to the string's bytes, in UTF8 encoding
441     */
442    const uint8_t *chars;
443    /**
444     * The number of bytes (not characters!) pointed to by `chars`
445     */
446    uintptr_t len;
447    /**
448     * Whether the data pointed to by `chars` should be freed or not.
449     */
450    bool chars_is_owned;
451 } LDKStr;
452
453
454
455 /**
456  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
457  * with our counterparty.
458  */
459 typedef struct MUST_USE_STRUCT LDKChannelConfig {
460    /**
461     * A pointer to the opaque Rust object.
462     * Nearly everywhere, inner must be non-null, however in places where
463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
464     */
465    LDKnativeChannelConfig *inner;
466    /**
467     * Indicates that this is the only struct which contains the same pointer.
468     * Rust functions which take ownership of an object provided via an argument require
469     * this to be true and invalidate the object pointed to by inner.
470     */
471    bool is_owned;
472 } LDKChannelConfig;
473
474
475
476 /**
477  * An error in decoding a message or struct.
478  */
479 typedef struct MUST_USE_STRUCT LDKDecodeError {
480    /**
481     * A pointer to the opaque Rust object.
482     * Nearly everywhere, inner must be non-null, however in places where
483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
484     */
485    LDKnativeDecodeError *inner;
486    /**
487     * Indicates that this is the only struct which contains the same pointer.
488     * Rust functions which take ownership of an object provided via an argument require
489     * this to be true and invalidate the object pointed to by inner.
490     */
491    bool is_owned;
492 } LDKDecodeError;
493
494 /**
495  * The contents of CResult_ChannelConfigDecodeErrorZ
496  */
497 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
498    /**
499     * A pointer to the contents in the success state.
500     * Reading from this pointer when `result_ok` is not set is undefined.
501     */
502    struct LDKChannelConfig *result;
503    /**
504     * A pointer to the contents in the error state.
505     * Reading from this pointer when `result_ok` is set is undefined.
506     */
507    struct LDKDecodeError *err;
508 } LDKCResult_ChannelConfigDecodeErrorZPtr;
509
510 /**
511  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
512  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
513  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
514  */
515 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
516    /**
517     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
518     * `err` or `result` depending on the state of `result_ok`.
519     */
520    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
521    /**
522     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
523     */
524    bool result_ok;
525 } LDKCResult_ChannelConfigDecodeErrorZ;
526
527
528
529 /**
530  * A reference to a transaction output.
531  *
532  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
533  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
534  */
535 typedef struct MUST_USE_STRUCT LDKOutPoint {
536    /**
537     * A pointer to the opaque Rust object.
538     * Nearly everywhere, inner must be non-null, however in places where
539     * the Rust equivalent takes an Option, it may be set to null to indicate None.
540     */
541    LDKnativeOutPoint *inner;
542    /**
543     * Indicates that this is the only struct which contains the same pointer.
544     * Rust functions which take ownership of an object provided via an argument require
545     * this to be true and invalidate the object pointed to by inner.
546     */
547    bool is_owned;
548 } LDKOutPoint;
549
550 /**
551  * The contents of CResult_OutPointDecodeErrorZ
552  */
553 typedef union LDKCResult_OutPointDecodeErrorZPtr {
554    /**
555     * A pointer to the contents in the success state.
556     * Reading from this pointer when `result_ok` is not set is undefined.
557     */
558    struct LDKOutPoint *result;
559    /**
560     * A pointer to the contents in the error state.
561     * Reading from this pointer when `result_ok` is set is undefined.
562     */
563    struct LDKDecodeError *err;
564 } LDKCResult_OutPointDecodeErrorZPtr;
565
566 /**
567  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
568  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
570  */
571 typedef struct LDKCResult_OutPointDecodeErrorZ {
572    /**
573     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
574     * `err` or `result` depending on the state of `result_ok`.
575     */
576    union LDKCResult_OutPointDecodeErrorZPtr contents;
577    /**
578     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
579     */
580    bool result_ok;
581 } LDKCResult_OutPointDecodeErrorZ;
582
583 /**
584  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
585  */
586 typedef struct LDKSecretKey {
587    /**
588     * The bytes of the secret key
589     */
590    uint8_t bytes[32];
591 } LDKSecretKey;
592
593 /**
594  * The contents of CResult_SecretKeyErrorZ
595  */
596 typedef union LDKCResult_SecretKeyErrorZPtr {
597    /**
598     * A pointer to the contents in the success state.
599     * Reading from this pointer when `result_ok` is not set is undefined.
600     */
601    struct LDKSecretKey *result;
602    /**
603     * A pointer to the contents in the error state.
604     * Reading from this pointer when `result_ok` is set is undefined.
605     */
606    enum LDKSecp256k1Error *err;
607 } LDKCResult_SecretKeyErrorZPtr;
608
609 /**
610  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
611  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
612  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
613  */
614 typedef struct LDKCResult_SecretKeyErrorZ {
615    /**
616     * The contents of this CResult_SecretKeyErrorZ, accessible via either
617     * `err` or `result` depending on the state of `result_ok`.
618     */
619    union LDKCResult_SecretKeyErrorZPtr contents;
620    /**
621     * Whether this CResult_SecretKeyErrorZ represents a success state.
622     */
623    bool result_ok;
624 } LDKCResult_SecretKeyErrorZ;
625
626 /**
627  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
628  */
629 typedef struct LDKPublicKey {
630    /**
631     * The bytes of the public key
632     */
633    uint8_t compressed_form[33];
634 } LDKPublicKey;
635
636 /**
637  * The contents of CResult_PublicKeyErrorZ
638  */
639 typedef union LDKCResult_PublicKeyErrorZPtr {
640    /**
641     * A pointer to the contents in the success state.
642     * Reading from this pointer when `result_ok` is not set is undefined.
643     */
644    struct LDKPublicKey *result;
645    /**
646     * A pointer to the contents in the error state.
647     * Reading from this pointer when `result_ok` is set is undefined.
648     */
649    enum LDKSecp256k1Error *err;
650 } LDKCResult_PublicKeyErrorZPtr;
651
652 /**
653  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
654  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
656  */
657 typedef struct LDKCResult_PublicKeyErrorZ {
658    /**
659     * The contents of this CResult_PublicKeyErrorZ, accessible via either
660     * `err` or `result` depending on the state of `result_ok`.
661     */
662    union LDKCResult_PublicKeyErrorZPtr contents;
663    /**
664     * Whether this CResult_PublicKeyErrorZ represents a success state.
665     */
666    bool result_ok;
667 } LDKCResult_PublicKeyErrorZ;
668
669
670
671 /**
672  * The set of public keys which are used in the creation of one commitment transaction.
673  * These are derived from the channel base keys and per-commitment data.
674  *
675  * A broadcaster key is provided from potential broadcaster of the computed transaction.
676  * A countersignatory key is coming from a protocol participant unable to broadcast the
677  * transaction.
678  *
679  * These keys are assumed to be good, either because the code derived them from
680  * channel basepoints via the new function, or they were obtained via
681  * CommitmentTransaction.trust().keys() because we trusted the source of the
682  * pre-calculated keys.
683  */
684 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
685    /**
686     * A pointer to the opaque Rust object.
687     * Nearly everywhere, inner must be non-null, however in places where
688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
689     */
690    LDKnativeTxCreationKeys *inner;
691    /**
692     * Indicates that this is the only struct which contains the same pointer.
693     * Rust functions which take ownership of an object provided via an argument require
694     * this to be true and invalidate the object pointed to by inner.
695     */
696    bool is_owned;
697 } LDKTxCreationKeys;
698
699 /**
700  * The contents of CResult_TxCreationKeysDecodeErrorZ
701  */
702 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
703    /**
704     * A pointer to the contents in the success state.
705     * Reading from this pointer when `result_ok` is not set is undefined.
706     */
707    struct LDKTxCreationKeys *result;
708    /**
709     * A pointer to the contents in the error state.
710     * Reading from this pointer when `result_ok` is set is undefined.
711     */
712    struct LDKDecodeError *err;
713 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
714
715 /**
716  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
717  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
719  */
720 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
721    /**
722     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
723     * `err` or `result` depending on the state of `result_ok`.
724     */
725    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
726    /**
727     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
728     */
729    bool result_ok;
730 } LDKCResult_TxCreationKeysDecodeErrorZ;
731
732
733
734 /**
735  * One counterparty's public keys which do not change over the life of a channel.
736  */
737 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
738    /**
739     * A pointer to the opaque Rust object.
740     * Nearly everywhere, inner must be non-null, however in places where
741     * the Rust equivalent takes an Option, it may be set to null to indicate None.
742     */
743    LDKnativeChannelPublicKeys *inner;
744    /**
745     * Indicates that this is the only struct which contains the same pointer.
746     * Rust functions which take ownership of an object provided via an argument require
747     * this to be true and invalidate the object pointed to by inner.
748     */
749    bool is_owned;
750 } LDKChannelPublicKeys;
751
752 /**
753  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
754  */
755 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
756    /**
757     * A pointer to the contents in the success state.
758     * Reading from this pointer when `result_ok` is not set is undefined.
759     */
760    struct LDKChannelPublicKeys *result;
761    /**
762     * A pointer to the contents in the error state.
763     * Reading from this pointer when `result_ok` is set is undefined.
764     */
765    struct LDKDecodeError *err;
766 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
767
768 /**
769  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
770  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
771  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
772  */
773 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
774    /**
775     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
776     * `err` or `result` depending on the state of `result_ok`.
777     */
778    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
779    /**
780     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
781     */
782    bool result_ok;
783 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
784
785 /**
786  * The contents of CResult_TxCreationKeysErrorZ
787  */
788 typedef union LDKCResult_TxCreationKeysErrorZPtr {
789    /**
790     * A pointer to the contents in the success state.
791     * Reading from this pointer when `result_ok` is not set is undefined.
792     */
793    struct LDKTxCreationKeys *result;
794    /**
795     * A pointer to the contents in the error state.
796     * Reading from this pointer when `result_ok` is set is undefined.
797     */
798    enum LDKSecp256k1Error *err;
799 } LDKCResult_TxCreationKeysErrorZPtr;
800
801 /**
802  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
803  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
804  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
805  */
806 typedef struct LDKCResult_TxCreationKeysErrorZ {
807    /**
808     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
809     * `err` or `result` depending on the state of `result_ok`.
810     */
811    union LDKCResult_TxCreationKeysErrorZPtr contents;
812    /**
813     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
814     */
815    bool result_ok;
816 } LDKCResult_TxCreationKeysErrorZ;
817
818 /**
819  * An enum which can either contain a u32 or not
820  */
821 typedef enum LDKCOption_u32Z_Tag {
822    /**
823     * When we're in this state, this COption_u32Z contains a u32
824     */
825    LDKCOption_u32Z_Some,
826    /**
827     * When we're in this state, this COption_u32Z contains nothing
828     */
829    LDKCOption_u32Z_None,
830    /**
831     * Must be last for serialization purposes
832     */
833    LDKCOption_u32Z_Sentinel,
834 } LDKCOption_u32Z_Tag;
835
836 typedef struct LDKCOption_u32Z {
837    LDKCOption_u32Z_Tag tag;
838    union {
839       struct {
840          uint32_t some;
841       };
842    };
843 } LDKCOption_u32Z;
844
845
846
847 /**
848  * Information about an HTLC as it appears in a commitment transaction
849  */
850 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
851    /**
852     * A pointer to the opaque Rust object.
853     * Nearly everywhere, inner must be non-null, however in places where
854     * the Rust equivalent takes an Option, it may be set to null to indicate None.
855     */
856    LDKnativeHTLCOutputInCommitment *inner;
857    /**
858     * Indicates that this is the only struct which contains the same pointer.
859     * Rust functions which take ownership of an object provided via an argument require
860     * this to be true and invalidate the object pointed to by inner.
861     */
862    bool is_owned;
863 } LDKHTLCOutputInCommitment;
864
865 /**
866  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
867  */
868 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
869    /**
870     * A pointer to the contents in the success state.
871     * Reading from this pointer when `result_ok` is not set is undefined.
872     */
873    struct LDKHTLCOutputInCommitment *result;
874    /**
875     * A pointer to the contents in the error state.
876     * Reading from this pointer when `result_ok` is set is undefined.
877     */
878    struct LDKDecodeError *err;
879 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
880
881 /**
882  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
883  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
884  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
885  */
886 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
887    /**
888     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
889     * `err` or `result` depending on the state of `result_ok`.
890     */
891    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
892    /**
893     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
894     */
895    bool result_ok;
896 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
897
898
899
900 /**
901  * Late-bound per-channel counterparty data used to build transactions.
902  */
903 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
904    /**
905     * A pointer to the opaque Rust object.
906     * Nearly everywhere, inner must be non-null, however in places where
907     * the Rust equivalent takes an Option, it may be set to null to indicate None.
908     */
909    LDKnativeCounterpartyChannelTransactionParameters *inner;
910    /**
911     * Indicates that this is the only struct which contains the same pointer.
912     * Rust functions which take ownership of an object provided via an argument require
913     * this to be true and invalidate the object pointed to by inner.
914     */
915    bool is_owned;
916 } LDKCounterpartyChannelTransactionParameters;
917
918 /**
919  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
920  */
921 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
922    /**
923     * A pointer to the contents in the success state.
924     * Reading from this pointer when `result_ok` is not set is undefined.
925     */
926    struct LDKCounterpartyChannelTransactionParameters *result;
927    /**
928     * A pointer to the contents in the error state.
929     * Reading from this pointer when `result_ok` is set is undefined.
930     */
931    struct LDKDecodeError *err;
932 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
933
934 /**
935  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
936  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
938  */
939 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
940    /**
941     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
942     * `err` or `result` depending on the state of `result_ok`.
943     */
944    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
945    /**
946     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
947     */
948    bool result_ok;
949 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
950
951
952
953 /**
954  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
955  * The fields are organized by holder/counterparty.
956  *
957  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
958  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
959  */
960 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
961    /**
962     * A pointer to the opaque Rust object.
963     * Nearly everywhere, inner must be non-null, however in places where
964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
965     */
966    LDKnativeChannelTransactionParameters *inner;
967    /**
968     * Indicates that this is the only struct which contains the same pointer.
969     * Rust functions which take ownership of an object provided via an argument require
970     * this to be true and invalidate the object pointed to by inner.
971     */
972    bool is_owned;
973 } LDKChannelTransactionParameters;
974
975 /**
976  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
977  */
978 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
979    /**
980     * A pointer to the contents in the success state.
981     * Reading from this pointer when `result_ok` is not set is undefined.
982     */
983    struct LDKChannelTransactionParameters *result;
984    /**
985     * A pointer to the contents in the error state.
986     * Reading from this pointer when `result_ok` is set is undefined.
987     */
988    struct LDKDecodeError *err;
989 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
990
991 /**
992  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
993  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
994  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
995  */
996 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
997    /**
998     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
999     * `err` or `result` depending on the state of `result_ok`.
1000     */
1001    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1002    /**
1003     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1004     */
1005    bool result_ok;
1006 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1007
1008 /**
1009  * Represents a secp256k1 signature serialized as two 32-byte numbers
1010  */
1011 typedef struct LDKSignature {
1012    /**
1013     * The bytes of the signature in "compact" form
1014     */
1015    uint8_t compact_form[64];
1016 } LDKSignature;
1017
1018 /**
1019  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1020  * This corresponds to std::vector in C++
1021  */
1022 typedef struct LDKCVec_SignatureZ {
1023    /**
1024     * The elements in the array.
1025     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1026     */
1027    struct LDKSignature *data;
1028    /**
1029     * The number of elements pointed to by `data`.
1030     */
1031    uintptr_t datalen;
1032 } LDKCVec_SignatureZ;
1033
1034
1035
1036 /**
1037  * Information needed to build and sign a holder's commitment transaction.
1038  *
1039  * The transaction is only signed once we are ready to broadcast.
1040  */
1041 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1042    /**
1043     * A pointer to the opaque Rust object.
1044     * Nearly everywhere, inner must be non-null, however in places where
1045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1046     */
1047    LDKnativeHolderCommitmentTransaction *inner;
1048    /**
1049     * Indicates that this is the only struct which contains the same pointer.
1050     * Rust functions which take ownership of an object provided via an argument require
1051     * this to be true and invalidate the object pointed to by inner.
1052     */
1053    bool is_owned;
1054 } LDKHolderCommitmentTransaction;
1055
1056 /**
1057  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1058  */
1059 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1060    /**
1061     * A pointer to the contents in the success state.
1062     * Reading from this pointer when `result_ok` is not set is undefined.
1063     */
1064    struct LDKHolderCommitmentTransaction *result;
1065    /**
1066     * A pointer to the contents in the error state.
1067     * Reading from this pointer when `result_ok` is set is undefined.
1068     */
1069    struct LDKDecodeError *err;
1070 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1071
1072 /**
1073  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1074  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1076  */
1077 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1078    /**
1079     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1080     * `err` or `result` depending on the state of `result_ok`.
1081     */
1082    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1083    /**
1084     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1085     */
1086    bool result_ok;
1087 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1088
1089
1090
1091 /**
1092  * A pre-built Bitcoin commitment transaction and its txid.
1093  */
1094 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1095    /**
1096     * A pointer to the opaque Rust object.
1097     * Nearly everywhere, inner must be non-null, however in places where
1098     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1099     */
1100    LDKnativeBuiltCommitmentTransaction *inner;
1101    /**
1102     * Indicates that this is the only struct which contains the same pointer.
1103     * Rust functions which take ownership of an object provided via an argument require
1104     * this to be true and invalidate the object pointed to by inner.
1105     */
1106    bool is_owned;
1107 } LDKBuiltCommitmentTransaction;
1108
1109 /**
1110  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1111  */
1112 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1113    /**
1114     * A pointer to the contents in the success state.
1115     * Reading from this pointer when `result_ok` is not set is undefined.
1116     */
1117    struct LDKBuiltCommitmentTransaction *result;
1118    /**
1119     * A pointer to the contents in the error state.
1120     * Reading from this pointer when `result_ok` is set is undefined.
1121     */
1122    struct LDKDecodeError *err;
1123 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1124
1125 /**
1126  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1127  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1128  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1129  */
1130 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1131    /**
1132     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1133     * `err` or `result` depending on the state of `result_ok`.
1134     */
1135    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1136    /**
1137     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1138     */
1139    bool result_ok;
1140 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1141
1142
1143
1144 /**
1145  * This class tracks the per-transaction information needed to build a commitment transaction and to
1146  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1147  * and for transactions we sign for the counterparty.
1148  *
1149  * This class can be used inside a signer implementation to generate a signature given the relevant
1150  * secret key.
1151  */
1152 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1153    /**
1154     * A pointer to the opaque Rust object.
1155     * Nearly everywhere, inner must be non-null, however in places where
1156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1157     */
1158    LDKnativeCommitmentTransaction *inner;
1159    /**
1160     * Indicates that this is the only struct which contains the same pointer.
1161     * Rust functions which take ownership of an object provided via an argument require
1162     * this to be true and invalidate the object pointed to by inner.
1163     */
1164    bool is_owned;
1165 } LDKCommitmentTransaction;
1166
1167 /**
1168  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1169  */
1170 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1171    /**
1172     * A pointer to the contents in the success state.
1173     * Reading from this pointer when `result_ok` is not set is undefined.
1174     */
1175    struct LDKCommitmentTransaction *result;
1176    /**
1177     * A pointer to the contents in the error state.
1178     * Reading from this pointer when `result_ok` is set is undefined.
1179     */
1180    struct LDKDecodeError *err;
1181 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1182
1183 /**
1184  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1185  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1187  */
1188 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1189    /**
1190     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1191     * `err` or `result` depending on the state of `result_ok`.
1192     */
1193    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1194    /**
1195     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1196     */
1197    bool result_ok;
1198 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1199
1200
1201
1202 /**
1203  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1204  * transaction and the transaction creation keys) are trusted.
1205  *
1206  * See trust() and verify() functions on CommitmentTransaction.
1207  *
1208  * This structure implements Deref.
1209  */
1210 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1211    /**
1212     * A pointer to the opaque Rust object.
1213     * Nearly everywhere, inner must be non-null, however in places where
1214     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1215     */
1216    LDKnativeTrustedCommitmentTransaction *inner;
1217    /**
1218     * Indicates that this is the only struct which contains the same pointer.
1219     * Rust functions which take ownership of an object provided via an argument require
1220     * this to be true and invalidate the object pointed to by inner.
1221     */
1222    bool is_owned;
1223 } LDKTrustedCommitmentTransaction;
1224
1225 /**
1226  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1227  */
1228 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1229    /**
1230     * A pointer to the contents in the success state.
1231     * Reading from this pointer when `result_ok` is not set is undefined.
1232     */
1233    struct LDKTrustedCommitmentTransaction *result;
1234    /**
1235     * Note that this value is always NULL, as there are no contents in the Err variant
1236     */
1237    void *err;
1238 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1239
1240 /**
1241  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1242  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1243  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1244  */
1245 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1246    /**
1247     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1248     * `err` or `result` depending on the state of `result_ok`.
1249     */
1250    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1251    /**
1252     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1253     */
1254    bool result_ok;
1255 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1256
1257 /**
1258  * The contents of CResult_CVec_SignatureZNoneZ
1259  */
1260 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1261    /**
1262     * A pointer to the contents in the success state.
1263     * Reading from this pointer when `result_ok` is not set is undefined.
1264     */
1265    struct LDKCVec_SignatureZ *result;
1266    /**
1267     * Note that this value is always NULL, as there are no contents in the Err variant
1268     */
1269    void *err;
1270 } LDKCResult_CVec_SignatureZNoneZPtr;
1271
1272 /**
1273  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1274  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1275  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1276  */
1277 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1278    /**
1279     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1280     * `err` or `result` depending on the state of `result_ok`.
1281     */
1282    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1283    /**
1284     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1285     */
1286    bool result_ok;
1287 } LDKCResult_CVec_SignatureZNoneZ;
1288
1289 /**
1290  * The contents of CResult_SiPrefixNoneZ
1291  */
1292 typedef union LDKCResult_SiPrefixNoneZPtr {
1293    /**
1294     * A pointer to the contents in the success state.
1295     * Reading from this pointer when `result_ok` is not set is undefined.
1296     */
1297    enum LDKSiPrefix *result;
1298    /**
1299     * Note that this value is always NULL, as there are no contents in the Err variant
1300     */
1301    void *err;
1302 } LDKCResult_SiPrefixNoneZPtr;
1303
1304 /**
1305  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
1306  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
1307  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1308  */
1309 typedef struct LDKCResult_SiPrefixNoneZ {
1310    /**
1311     * The contents of this CResult_SiPrefixNoneZ, accessible via either
1312     * `err` or `result` depending on the state of `result_ok`.
1313     */
1314    union LDKCResult_SiPrefixNoneZPtr contents;
1315    /**
1316     * Whether this CResult_SiPrefixNoneZ represents a success state.
1317     */
1318    bool result_ok;
1319 } LDKCResult_SiPrefixNoneZ;
1320
1321
1322
1323 /**
1324  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
1325  *
1326  * There are three ways to construct an `Invoice`:
1327  *  1. using `InvoiceBuilder`
1328  *  2. using `Invoice::from_signed(SignedRawInvoice)`
1329  *  3. using `str::parse::<Invoice>(&str)`
1330  */
1331 typedef struct MUST_USE_STRUCT LDKInvoice {
1332    /**
1333     * A pointer to the opaque Rust object.
1334     * Nearly everywhere, inner must be non-null, however in places where
1335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1336     */
1337    LDKnativeInvoice *inner;
1338    /**
1339     * Indicates that this is the only struct which contains the same pointer.
1340     * Rust functions which take ownership of an object provided via an argument require
1341     * this to be true and invalidate the object pointed to by inner.
1342     */
1343    bool is_owned;
1344 } LDKInvoice;
1345
1346 /**
1347  * The contents of CResult_InvoiceNoneZ
1348  */
1349 typedef union LDKCResult_InvoiceNoneZPtr {
1350    /**
1351     * A pointer to the contents in the success state.
1352     * Reading from this pointer when `result_ok` is not set is undefined.
1353     */
1354    struct LDKInvoice *result;
1355    /**
1356     * Note that this value is always NULL, as there are no contents in the Err variant
1357     */
1358    void *err;
1359 } LDKCResult_InvoiceNoneZPtr;
1360
1361 /**
1362  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
1363  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
1364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1365  */
1366 typedef struct LDKCResult_InvoiceNoneZ {
1367    /**
1368     * The contents of this CResult_InvoiceNoneZ, accessible via either
1369     * `err` or `result` depending on the state of `result_ok`.
1370     */
1371    union LDKCResult_InvoiceNoneZPtr contents;
1372    /**
1373     * Whether this CResult_InvoiceNoneZ represents a success state.
1374     */
1375    bool result_ok;
1376 } LDKCResult_InvoiceNoneZ;
1377
1378
1379
1380 /**
1381  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
1382  * invalid.
1383  *
1384  * # Invariants
1385  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
1386  */
1387 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
1388    /**
1389     * A pointer to the opaque Rust object.
1390     * Nearly everywhere, inner must be non-null, however in places where
1391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1392     */
1393    LDKnativeSignedRawInvoice *inner;
1394    /**
1395     * Indicates that this is the only struct which contains the same pointer.
1396     * Rust functions which take ownership of an object provided via an argument require
1397     * this to be true and invalidate the object pointed to by inner.
1398     */
1399    bool is_owned;
1400 } LDKSignedRawInvoice;
1401
1402 /**
1403  * The contents of CResult_SignedRawInvoiceNoneZ
1404  */
1405 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
1406    /**
1407     * A pointer to the contents in the success state.
1408     * Reading from this pointer when `result_ok` is not set is undefined.
1409     */
1410    struct LDKSignedRawInvoice *result;
1411    /**
1412     * Note that this value is always NULL, as there are no contents in the Err variant
1413     */
1414    void *err;
1415 } LDKCResult_SignedRawInvoiceNoneZPtr;
1416
1417 /**
1418  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
1419  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
1420  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1421  */
1422 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
1423    /**
1424     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
1425     * `err` or `result` depending on the state of `result_ok`.
1426     */
1427    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
1428    /**
1429     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
1430     */
1431    bool result_ok;
1432 } LDKCResult_SignedRawInvoiceNoneZ;
1433
1434
1435
1436 /**
1437  * Represents an syntactically correct Invoice for a payment on the lightning network,
1438  * but without the signature information.
1439  * De- and encoding should not lead to information loss but may lead to different hashes.
1440  *
1441  * For methods without docs see the corresponding methods in `Invoice`.
1442  */
1443 typedef struct MUST_USE_STRUCT LDKRawInvoice {
1444    /**
1445     * A pointer to the opaque Rust object.
1446     * Nearly everywhere, inner must be non-null, however in places where
1447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1448     */
1449    LDKnativeRawInvoice *inner;
1450    /**
1451     * Indicates that this is the only struct which contains the same pointer.
1452     * Rust functions which take ownership of an object provided via an argument require
1453     * this to be true and invalidate the object pointed to by inner.
1454     */
1455    bool is_owned;
1456 } LDKRawInvoice;
1457
1458 /**
1459  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1460  * look up the corresponding function in rust-lightning's docs.
1461  */
1462 typedef struct LDKThirtyTwoBytes {
1463    /**
1464     * The thirty-two bytes
1465     */
1466    uint8_t data[32];
1467 } LDKThirtyTwoBytes;
1468
1469
1470
1471 /**
1472  * Recoverable signature
1473  */
1474 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
1475    /**
1476     * A pointer to the opaque Rust object.
1477     * Nearly everywhere, inner must be non-null, however in places where
1478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1479     */
1480    LDKnativeInvoiceSignature *inner;
1481    /**
1482     * Indicates that this is the only struct which contains the same pointer.
1483     * Rust functions which take ownership of an object provided via an argument require
1484     * this to be true and invalidate the object pointed to by inner.
1485     */
1486    bool is_owned;
1487 } LDKInvoiceSignature;
1488
1489 /**
1490  * A tuple of 3 elements. See the individual fields for the types contained.
1491  */
1492 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
1493    /**
1494     * The element at position 0
1495     */
1496    struct LDKRawInvoice a;
1497    /**
1498     * The element at position 1
1499     */
1500    struct LDKThirtyTwoBytes b;
1501    /**
1502     * The element at position 2
1503     */
1504    struct LDKInvoiceSignature c;
1505 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
1506
1507
1508
1509 /**
1510  * Payee public key
1511  */
1512 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
1513    /**
1514     * A pointer to the opaque Rust object.
1515     * Nearly everywhere, inner must be non-null, however in places where
1516     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1517     */
1518    LDKnativePayeePubKey *inner;
1519    /**
1520     * Indicates that this is the only struct which contains the same pointer.
1521     * Rust functions which take ownership of an object provided via an argument require
1522     * this to be true and invalidate the object pointed to by inner.
1523     */
1524    bool is_owned;
1525 } LDKPayeePubKey;
1526
1527 /**
1528  * The contents of CResult_PayeePubKeyErrorZ
1529  */
1530 typedef union LDKCResult_PayeePubKeyErrorZPtr {
1531    /**
1532     * A pointer to the contents in the success state.
1533     * Reading from this pointer when `result_ok` is not set is undefined.
1534     */
1535    struct LDKPayeePubKey *result;
1536    /**
1537     * A pointer to the contents in the error state.
1538     * Reading from this pointer when `result_ok` is set is undefined.
1539     */
1540    enum LDKSecp256k1Error *err;
1541 } LDKCResult_PayeePubKeyErrorZPtr;
1542
1543 /**
1544  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1545  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1547  */
1548 typedef struct LDKCResult_PayeePubKeyErrorZ {
1549    /**
1550     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1551     * `err` or `result` depending on the state of `result_ok`.
1552     */
1553    union LDKCResult_PayeePubKeyErrorZPtr contents;
1554    /**
1555     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
1556     */
1557    bool result_ok;
1558 } LDKCResult_PayeePubKeyErrorZ;
1559
1560
1561
1562 /**
1563  * Private routing information
1564  *
1565  * # Invariants
1566  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
1567  *
1568  */
1569 typedef struct MUST_USE_STRUCT LDKRouteHint {
1570    /**
1571     * A pointer to the opaque Rust object.
1572     * Nearly everywhere, inner must be non-null, however in places where
1573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1574     */
1575    LDKnativeRouteHint *inner;
1576    /**
1577     * Indicates that this is the only struct which contains the same pointer.
1578     * Rust functions which take ownership of an object provided via an argument require
1579     * this to be true and invalidate the object pointed to by inner.
1580     */
1581    bool is_owned;
1582 } LDKRouteHint;
1583
1584 /**
1585  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1586  * This corresponds to std::vector in C++
1587  */
1588 typedef struct LDKCVec_RouteHintZ {
1589    /**
1590     * The elements in the array.
1591     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1592     */
1593    struct LDKRouteHint *data;
1594    /**
1595     * The number of elements pointed to by `data`.
1596     */
1597    uintptr_t datalen;
1598 } LDKCVec_RouteHintZ;
1599
1600 /**
1601  * An enum which can either contain a u64 or not
1602  */
1603 typedef enum LDKCOption_u64Z_Tag {
1604    /**
1605     * When we're in this state, this COption_u64Z contains a u64
1606     */
1607    LDKCOption_u64Z_Some,
1608    /**
1609     * When we're in this state, this COption_u64Z contains nothing
1610     */
1611    LDKCOption_u64Z_None,
1612    /**
1613     * Must be last for serialization purposes
1614     */
1615    LDKCOption_u64Z_Sentinel,
1616 } LDKCOption_u64Z_Tag;
1617
1618 typedef struct LDKCOption_u64Z {
1619    LDKCOption_u64Z_Tag tag;
1620    union {
1621       struct {
1622          uint64_t some;
1623       };
1624    };
1625 } LDKCOption_u64Z;
1626
1627
1628
1629 /**
1630  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
1631  * timestamp is positive.
1632  *
1633  * # Invariants
1634  * The UNIX timestamp representing the stored time has to be positive and small enough so that
1635  * a `EpiryTime` can be added to it without an overflow.
1636  */
1637 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
1638    /**
1639     * A pointer to the opaque Rust object.
1640     * Nearly everywhere, inner must be non-null, however in places where
1641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1642     */
1643    LDKnativePositiveTimestamp *inner;
1644    /**
1645     * Indicates that this is the only struct which contains the same pointer.
1646     * Rust functions which take ownership of an object provided via an argument require
1647     * this to be true and invalidate the object pointed to by inner.
1648     */
1649    bool is_owned;
1650 } LDKPositiveTimestamp;
1651
1652 /**
1653  * The contents of CResult_PositiveTimestampCreationErrorZ
1654  */
1655 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
1656    /**
1657     * A pointer to the contents in the success state.
1658     * Reading from this pointer when `result_ok` is not set is undefined.
1659     */
1660    struct LDKPositiveTimestamp *result;
1661    /**
1662     * A pointer to the contents in the error state.
1663     * Reading from this pointer when `result_ok` is set is undefined.
1664     */
1665    enum LDKCreationError *err;
1666 } LDKCResult_PositiveTimestampCreationErrorZPtr;
1667
1668 /**
1669  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1670  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1672  */
1673 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
1674    /**
1675     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1676     * `err` or `result` depending on the state of `result_ok`.
1677     */
1678    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
1679    /**
1680     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1681     */
1682    bool result_ok;
1683 } LDKCResult_PositiveTimestampCreationErrorZ;
1684
1685 /**
1686  * The contents of CResult_NoneSemanticErrorZ
1687  */
1688 typedef union LDKCResult_NoneSemanticErrorZPtr {
1689    /**
1690     * Note that this value is always NULL, as there are no contents in the OK variant
1691     */
1692    void *result;
1693    /**
1694     * A pointer to the contents in the error state.
1695     * Reading from this pointer when `result_ok` is set is undefined.
1696     */
1697    enum LDKSemanticError *err;
1698 } LDKCResult_NoneSemanticErrorZPtr;
1699
1700 /**
1701  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1702  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1704  */
1705 typedef struct LDKCResult_NoneSemanticErrorZ {
1706    /**
1707     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
1708     * `err` or `result` depending on the state of `result_ok`.
1709     */
1710    union LDKCResult_NoneSemanticErrorZPtr contents;
1711    /**
1712     * Whether this CResult_NoneSemanticErrorZ represents a success state.
1713     */
1714    bool result_ok;
1715 } LDKCResult_NoneSemanticErrorZ;
1716
1717 /**
1718  * The contents of CResult_InvoiceSemanticErrorZ
1719  */
1720 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
1721    /**
1722     * A pointer to the contents in the success state.
1723     * Reading from this pointer when `result_ok` is not set is undefined.
1724     */
1725    struct LDKInvoice *result;
1726    /**
1727     * A pointer to the contents in the error state.
1728     * Reading from this pointer when `result_ok` is set is undefined.
1729     */
1730    enum LDKSemanticError *err;
1731 } LDKCResult_InvoiceSemanticErrorZPtr;
1732
1733 /**
1734  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1735  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1737  */
1738 typedef struct LDKCResult_InvoiceSemanticErrorZ {
1739    /**
1740     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1741     * `err` or `result` depending on the state of `result_ok`.
1742     */
1743    union LDKCResult_InvoiceSemanticErrorZPtr contents;
1744    /**
1745     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1746     */
1747    bool result_ok;
1748 } LDKCResult_InvoiceSemanticErrorZ;
1749
1750
1751
1752 /**
1753  * Description string
1754  *
1755  * # Invariants
1756  * The description can be at most 639 __bytes__ long
1757  */
1758 typedef struct MUST_USE_STRUCT LDKDescription {
1759    /**
1760     * A pointer to the opaque Rust object.
1761     * Nearly everywhere, inner must be non-null, however in places where
1762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1763     */
1764    LDKnativeDescription *inner;
1765    /**
1766     * Indicates that this is the only struct which contains the same pointer.
1767     * Rust functions which take ownership of an object provided via an argument require
1768     * this to be true and invalidate the object pointed to by inner.
1769     */
1770    bool is_owned;
1771 } LDKDescription;
1772
1773 /**
1774  * The contents of CResult_DescriptionCreationErrorZ
1775  */
1776 typedef union LDKCResult_DescriptionCreationErrorZPtr {
1777    /**
1778     * A pointer to the contents in the success state.
1779     * Reading from this pointer when `result_ok` is not set is undefined.
1780     */
1781    struct LDKDescription *result;
1782    /**
1783     * A pointer to the contents in the error state.
1784     * Reading from this pointer when `result_ok` is set is undefined.
1785     */
1786    enum LDKCreationError *err;
1787 } LDKCResult_DescriptionCreationErrorZPtr;
1788
1789 /**
1790  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1791  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1793  */
1794 typedef struct LDKCResult_DescriptionCreationErrorZ {
1795    /**
1796     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1797     * `err` or `result` depending on the state of `result_ok`.
1798     */
1799    union LDKCResult_DescriptionCreationErrorZPtr contents;
1800    /**
1801     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
1802     */
1803    bool result_ok;
1804 } LDKCResult_DescriptionCreationErrorZ;
1805
1806
1807
1808 /**
1809  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
1810  * expires
1811  *
1812  * # Invariants
1813  * The number of seconds this expiry time represents has to be in the range
1814  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
1815  * timestamp
1816  */
1817 typedef struct MUST_USE_STRUCT LDKExpiryTime {
1818    /**
1819     * A pointer to the opaque Rust object.
1820     * Nearly everywhere, inner must be non-null, however in places where
1821     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1822     */
1823    LDKnativeExpiryTime *inner;
1824    /**
1825     * Indicates that this is the only struct which contains the same pointer.
1826     * Rust functions which take ownership of an object provided via an argument require
1827     * this to be true and invalidate the object pointed to by inner.
1828     */
1829    bool is_owned;
1830 } LDKExpiryTime;
1831
1832 /**
1833  * The contents of CResult_ExpiryTimeCreationErrorZ
1834  */
1835 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
1836    /**
1837     * A pointer to the contents in the success state.
1838     * Reading from this pointer when `result_ok` is not set is undefined.
1839     */
1840    struct LDKExpiryTime *result;
1841    /**
1842     * A pointer to the contents in the error state.
1843     * Reading from this pointer when `result_ok` is set is undefined.
1844     */
1845    enum LDKCreationError *err;
1846 } LDKCResult_ExpiryTimeCreationErrorZPtr;
1847
1848 /**
1849  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
1850  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
1851  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1852  */
1853 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
1854    /**
1855     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
1856     * `err` or `result` depending on the state of `result_ok`.
1857     */
1858    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
1859    /**
1860     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
1861     */
1862    bool result_ok;
1863 } LDKCResult_ExpiryTimeCreationErrorZ;
1864
1865
1866
1867 /**
1868  * A channel descriptor which provides a last-hop route to get_route
1869  */
1870 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1871    /**
1872     * A pointer to the opaque Rust object.
1873     * Nearly everywhere, inner must be non-null, however in places where
1874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1875     */
1876    LDKnativeRouteHintHop *inner;
1877    /**
1878     * Indicates that this is the only struct which contains the same pointer.
1879     * Rust functions which take ownership of an object provided via an argument require
1880     * this to be true and invalidate the object pointed to by inner.
1881     */
1882    bool is_owned;
1883 } LDKRouteHintHop;
1884
1885 /**
1886  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1887  * This corresponds to std::vector in C++
1888  */
1889 typedef struct LDKCVec_RouteHintHopZ {
1890    /**
1891     * The elements in the array.
1892     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1893     */
1894    struct LDKRouteHintHop *data;
1895    /**
1896     * The number of elements pointed to by `data`.
1897     */
1898    uintptr_t datalen;
1899 } LDKCVec_RouteHintHopZ;
1900
1901 /**
1902  * The contents of CResult_RouteHintCreationErrorZ
1903  */
1904 typedef union LDKCResult_RouteHintCreationErrorZPtr {
1905    /**
1906     * A pointer to the contents in the success state.
1907     * Reading from this pointer when `result_ok` is not set is undefined.
1908     */
1909    struct LDKRouteHint *result;
1910    /**
1911     * A pointer to the contents in the error state.
1912     * Reading from this pointer when `result_ok` is set is undefined.
1913     */
1914    enum LDKCreationError *err;
1915 } LDKCResult_RouteHintCreationErrorZPtr;
1916
1917 /**
1918  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
1919  * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
1920  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1921  */
1922 typedef struct LDKCResult_RouteHintCreationErrorZ {
1923    /**
1924     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
1925     * `err` or `result` depending on the state of `result_ok`.
1926     */
1927    union LDKCResult_RouteHintCreationErrorZPtr contents;
1928    /**
1929     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
1930     */
1931    bool result_ok;
1932 } LDKCResult_RouteHintCreationErrorZ;
1933
1934 /**
1935  * The contents of CResult_StringErrorZ
1936  */
1937 typedef union LDKCResult_StringErrorZPtr {
1938    /**
1939     * A pointer to the contents in the success state.
1940     * Reading from this pointer when `result_ok` is not set is undefined.
1941     */
1942    struct LDKStr *result;
1943    /**
1944     * A pointer to the contents in the error state.
1945     * Reading from this pointer when `result_ok` is set is undefined.
1946     */
1947    enum LDKSecp256k1Error *err;
1948 } LDKCResult_StringErrorZPtr;
1949
1950 /**
1951  * A CResult_StringErrorZ represents the result of a fallible operation,
1952  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
1953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1954  */
1955 typedef struct LDKCResult_StringErrorZ {
1956    /**
1957     * The contents of this CResult_StringErrorZ, accessible via either
1958     * `err` or `result` depending on the state of `result_ok`.
1959     */
1960    union LDKCResult_StringErrorZPtr contents;
1961    /**
1962     * Whether this CResult_StringErrorZ represents a success state.
1963     */
1964    bool result_ok;
1965 } LDKCResult_StringErrorZ;
1966
1967
1968
1969 /**
1970  * An update generated by the underlying Channel itself which contains some new information the
1971  * ChannelMonitor should be made aware of.
1972  */
1973 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1974    /**
1975     * A pointer to the opaque Rust object.
1976     * Nearly everywhere, inner must be non-null, however in places where
1977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1978     */
1979    LDKnativeChannelMonitorUpdate *inner;
1980    /**
1981     * Indicates that this is the only struct which contains the same pointer.
1982     * Rust functions which take ownership of an object provided via an argument require
1983     * this to be true and invalidate the object pointed to by inner.
1984     */
1985    bool is_owned;
1986 } LDKChannelMonitorUpdate;
1987
1988 /**
1989  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1990  */
1991 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1992    /**
1993     * A pointer to the contents in the success state.
1994     * Reading from this pointer when `result_ok` is not set is undefined.
1995     */
1996    struct LDKChannelMonitorUpdate *result;
1997    /**
1998     * A pointer to the contents in the error state.
1999     * Reading from this pointer when `result_ok` is set is undefined.
2000     */
2001    struct LDKDecodeError *err;
2002 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
2003
2004 /**
2005  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2006  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2007  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2008  */
2009 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
2010    /**
2011     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2012     * `err` or `result` depending on the state of `result_ok`.
2013     */
2014    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
2015    /**
2016     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2017     */
2018    bool result_ok;
2019 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2020
2021
2022
2023 /**
2024  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2025  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2026  * preimage claim backward will lead to loss of funds.
2027  */
2028 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2029    /**
2030     * A pointer to the opaque Rust object.
2031     * Nearly everywhere, inner must be non-null, however in places where
2032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2033     */
2034    LDKnativeHTLCUpdate *inner;
2035    /**
2036     * Indicates that this is the only struct which contains the same pointer.
2037     * Rust functions which take ownership of an object provided via an argument require
2038     * this to be true and invalidate the object pointed to by inner.
2039     */
2040    bool is_owned;
2041 } LDKHTLCUpdate;
2042
2043 /**
2044  * The contents of CResult_HTLCUpdateDecodeErrorZ
2045  */
2046 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
2047    /**
2048     * A pointer to the contents in the success state.
2049     * Reading from this pointer when `result_ok` is not set is undefined.
2050     */
2051    struct LDKHTLCUpdate *result;
2052    /**
2053     * A pointer to the contents in the error state.
2054     * Reading from this pointer when `result_ok` is set is undefined.
2055     */
2056    struct LDKDecodeError *err;
2057 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
2058
2059 /**
2060  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2061  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2063  */
2064 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
2065    /**
2066     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2067     * `err` or `result` depending on the state of `result_ok`.
2068     */
2069    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
2070    /**
2071     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2072     */
2073    bool result_ok;
2074 } LDKCResult_HTLCUpdateDecodeErrorZ;
2075
2076
2077
2078 /**
2079  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
2080  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
2081  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
2082  * corrupted.
2083  * Contains a developer-readable error message.
2084  */
2085 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
2086    /**
2087     * A pointer to the opaque Rust object.
2088     * Nearly everywhere, inner must be non-null, however in places where
2089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2090     */
2091    LDKnativeMonitorUpdateError *inner;
2092    /**
2093     * Indicates that this is the only struct which contains the same pointer.
2094     * Rust functions which take ownership of an object provided via an argument require
2095     * this to be true and invalidate the object pointed to by inner.
2096     */
2097    bool is_owned;
2098 } LDKMonitorUpdateError;
2099
2100 /**
2101  * The contents of CResult_NoneMonitorUpdateErrorZ
2102  */
2103 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
2104    /**
2105     * Note that this value is always NULL, as there are no contents in the OK variant
2106     */
2107    void *result;
2108    /**
2109     * A pointer to the contents in the error state.
2110     * Reading from this pointer when `result_ok` is set is undefined.
2111     */
2112    struct LDKMonitorUpdateError *err;
2113 } LDKCResult_NoneMonitorUpdateErrorZPtr;
2114
2115 /**
2116  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2117  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2119  */
2120 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
2121    /**
2122     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2123     * `err` or `result` depending on the state of `result_ok`.
2124     */
2125    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
2126    /**
2127     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2128     */
2129    bool result_ok;
2130 } LDKCResult_NoneMonitorUpdateErrorZ;
2131
2132 /**
2133  * A tuple of 2 elements. See the individual fields for the types contained.
2134  */
2135 typedef struct LDKC2Tuple_OutPointScriptZ {
2136    /**
2137     * The element at position 0
2138     */
2139    struct LDKOutPoint a;
2140    /**
2141     * The element at position 1
2142     */
2143    struct LDKCVec_u8Z b;
2144 } LDKC2Tuple_OutPointScriptZ;
2145
2146 /**
2147  * A tuple of 2 elements. See the individual fields for the types contained.
2148  */
2149 typedef struct LDKC2Tuple_u32ScriptZ {
2150    /**
2151     * The element at position 0
2152     */
2153    uint32_t a;
2154    /**
2155     * The element at position 1
2156     */
2157    struct LDKCVec_u8Z b;
2158 } LDKC2Tuple_u32ScriptZ;
2159
2160 /**
2161  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2162  * This corresponds to std::vector in C++
2163  */
2164 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
2165    /**
2166     * The elements in the array.
2167     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2168     */
2169    struct LDKC2Tuple_u32ScriptZ *data;
2170    /**
2171     * The number of elements pointed to by `data`.
2172     */
2173    uintptr_t datalen;
2174 } LDKCVec_C2Tuple_u32ScriptZZ;
2175
2176 /**
2177  * A tuple of 2 elements. See the individual fields for the types contained.
2178  */
2179 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2180    /**
2181     * The element at position 0
2182     */
2183    struct LDKThirtyTwoBytes a;
2184    /**
2185     * The element at position 1
2186     */
2187    struct LDKCVec_C2Tuple_u32ScriptZZ b;
2188 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
2189
2190 /**
2191  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2192  * This corresponds to std::vector in C++
2193  */
2194 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2195    /**
2196     * The elements in the array.
2197     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2198     */
2199    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
2200    /**
2201     * The number of elements pointed to by `data`.
2202     */
2203    uintptr_t datalen;
2204 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
2205
2206 /**
2207  * An event to be processed by the ChannelManager.
2208  */
2209 typedef enum LDKMonitorEvent_Tag {
2210    /**
2211     * A monitor event containing an HTLCUpdate.
2212     */
2213    LDKMonitorEvent_HTLCEvent,
2214    /**
2215     * A monitor event that the Channel's commitment transaction was broadcasted.
2216     */
2217    LDKMonitorEvent_CommitmentTxBroadcasted,
2218    /**
2219     * Must be last for serialization purposes
2220     */
2221    LDKMonitorEvent_Sentinel,
2222 } LDKMonitorEvent_Tag;
2223
2224 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2225    LDKMonitorEvent_Tag tag;
2226    union {
2227       struct {
2228          struct LDKHTLCUpdate htlc_event;
2229       };
2230       struct {
2231          struct LDKOutPoint commitment_tx_broadcasted;
2232       };
2233    };
2234 } LDKMonitorEvent;
2235
2236 /**
2237  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2238  * This corresponds to std::vector in C++
2239  */
2240 typedef struct LDKCVec_MonitorEventZ {
2241    /**
2242     * The elements in the array.
2243     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2244     */
2245    struct LDKMonitorEvent *data;
2246    /**
2247     * The number of elements pointed to by `data`.
2248     */
2249    uintptr_t datalen;
2250 } LDKCVec_MonitorEventZ;
2251
2252
2253
2254 /**
2255  * Information about a spendable output to a P2WSH script. See
2256  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2257  */
2258 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2259    /**
2260     * A pointer to the opaque Rust object.
2261     * Nearly everywhere, inner must be non-null, however in places where
2262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2263     */
2264    LDKnativeDelayedPaymentOutputDescriptor *inner;
2265    /**
2266     * Indicates that this is the only struct which contains the same pointer.
2267     * Rust functions which take ownership of an object provided via an argument require
2268     * this to be true and invalidate the object pointed to by inner.
2269     */
2270    bool is_owned;
2271 } LDKDelayedPaymentOutputDescriptor;
2272
2273
2274
2275 /**
2276  * Information about a spendable output to our \"payment key\". See
2277  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2278  */
2279 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2280    /**
2281     * A pointer to the opaque Rust object.
2282     * Nearly everywhere, inner must be non-null, however in places where
2283     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2284     */
2285    LDKnativeStaticPaymentOutputDescriptor *inner;
2286    /**
2287     * Indicates that this is the only struct which contains the same pointer.
2288     * Rust functions which take ownership of an object provided via an argument require
2289     * this to be true and invalidate the object pointed to by inner.
2290     */
2291    bool is_owned;
2292 } LDKStaticPaymentOutputDescriptor;
2293
2294 /**
2295  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2296  * claim at any point in the future) an event is generated which you must track and be able to
2297  * spend on-chain. The information needed to do this is provided in this enum, including the
2298  * outpoint describing which txid and output index is available, the full output which exists at
2299  * that txid/index, and any keys or other information required to sign.
2300  */
2301 typedef enum LDKSpendableOutputDescriptor_Tag {
2302    /**
2303     * An output to a script which was provided via KeysInterface directly, either from
2304     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
2305     * spend it. No secret keys are provided as rust-lightning was never given any key.
2306     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2307     * on-chain using the payment preimage or after it has timed out.
2308     */
2309    LDKSpendableOutputDescriptor_StaticOutput,
2310    /**
2311     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2312     *
2313     * The witness in the spending input should be:
2314     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2315     *
2316     * Note that the nSequence field in the spending input must be set to to_self_delay
2317     * (which means the transaction is not broadcastable until at least to_self_delay
2318     * blocks after the outpoint confirms).
2319     *
2320     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2321     * it is an output from an old state which we broadcast (which should never happen).
2322     *
2323     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2324     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2325     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2326     * chan_utils::derive_private_key. The public key can be generated without the secret key
2327     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2328     * Sign::pubkeys().
2329     *
2330     * To derive the revocation_pubkey provided here (which is used in the witness
2331     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2332     * call to Sign::ready_channel) and the provided per_commitment point
2333     * to chan_utils::derive_public_revocation_key.
2334     *
2335     * The witness script which is hashed and included in the output script_pubkey may be
2336     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2337     * (derived as above), and the to_self_delay contained here to
2338     * chan_utils::get_revokeable_redeemscript.
2339     */
2340    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2341    /**
2342     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2343     * corresponds to the public key in Sign::pubkeys().payment_point).
2344     * The witness in the spending input, is, thus, simply:
2345     * <BIP 143 signature> <payment key>
2346     *
2347     * These are generally the result of our counterparty having broadcast the current state,
2348     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2349     */
2350    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2351    /**
2352     * Must be last for serialization purposes
2353     */
2354    LDKSpendableOutputDescriptor_Sentinel,
2355 } LDKSpendableOutputDescriptor_Tag;
2356
2357 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2358    /**
2359     * The outpoint which is spendable
2360     */
2361    struct LDKOutPoint outpoint;
2362    /**
2363     * The output which is referenced by the given outpoint.
2364     */
2365    struct LDKTxOut output;
2366 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2367
2368 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2369    LDKSpendableOutputDescriptor_Tag tag;
2370    union {
2371       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2372       struct {
2373          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2374       };
2375       struct {
2376          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2377       };
2378    };
2379 } LDKSpendableOutputDescriptor;
2380
2381 /**
2382  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2383  * This corresponds to std::vector in C++
2384  */
2385 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2386    /**
2387     * The elements in the array.
2388     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2389     */
2390    struct LDKSpendableOutputDescriptor *data;
2391    /**
2392     * The number of elements pointed to by `data`.
2393     */
2394    uintptr_t datalen;
2395 } LDKCVec_SpendableOutputDescriptorZ;
2396
2397 /**
2398  * An Event which you should probably take some action in response to.
2399  *
2400  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2401  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2402  * written as it makes no sense to respond to it after reconnecting to peers).
2403  */
2404 typedef enum LDKEvent_Tag {
2405    /**
2406     * Used to indicate that the client should generate a funding transaction with the given
2407     * parameters and then call ChannelManager::funding_transaction_generated.
2408     * Generated in ChannelManager message handling.
2409     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2410     * counterparty can steal your funds!
2411     */
2412    LDKEvent_FundingGenerationReady,
2413    /**
2414     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2415     * ChannelManager::claim_funds to get it....
2416     * Note that if the preimage is not known or the amount paid is incorrect, you should call
2417     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2418     * network congestion.
2419     * The amount paid should be considered 'incorrect' when it is less than or more than twice
2420     * the amount expected.
2421     * If you fail to call either ChannelManager::claim_funds or
2422     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2423     * automatically failed.
2424     */
2425    LDKEvent_PaymentReceived,
2426    /**
2427     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2428     * and we got back the payment preimage for it).
2429     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
2430     * deduplicate them by payment_preimage (which MUST be unique)!
2431     */
2432    LDKEvent_PaymentSent,
2433    /**
2434     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2435     * something. You may wish to retry with a different route.
2436     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
2437     * deduplicate them by payment_hash (which MUST be unique)!
2438     */
2439    LDKEvent_PaymentFailed,
2440    /**
2441     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2442     * time in the future.
2443     */
2444    LDKEvent_PendingHTLCsForwardable,
2445    /**
2446     * Used to indicate that an output was generated on-chain which you should know how to spend.
2447     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2448     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2449     * somewhere and spend them when you create on-chain transactions.
2450     */
2451    LDKEvent_SpendableOutputs,
2452    /**
2453     * Must be last for serialization purposes
2454     */
2455    LDKEvent_Sentinel,
2456 } LDKEvent_Tag;
2457
2458 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2459    /**
2460     * The random channel_id we picked which you'll need to pass into
2461     * ChannelManager::funding_transaction_generated.
2462     */
2463    struct LDKThirtyTwoBytes temporary_channel_id;
2464    /**
2465     * The value, in satoshis, that the output should have.
2466     */
2467    uint64_t channel_value_satoshis;
2468    /**
2469     * The script which should be used in the transaction output.
2470     */
2471    struct LDKCVec_u8Z output_script;
2472    /**
2473     * The value passed in to ChannelManager::create_channel
2474     */
2475    uint64_t user_channel_id;
2476 } LDKEvent_LDKFundingGenerationReady_Body;
2477
2478 typedef struct LDKEvent_LDKPaymentReceived_Body {
2479    /**
2480     * The hash for which the preimage should be handed to the ChannelManager.
2481     */
2482    struct LDKThirtyTwoBytes payment_hash;
2483    /**
2484     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2485     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2486     * [`ChannelManager::claim_funds`].
2487     *
2488     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2489     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2490     */
2491    struct LDKThirtyTwoBytes payment_preimage;
2492    /**
2493     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2494     * number of deanonymization attacks during the routing process.
2495     * It is provided here for your reference, however its accuracy is enforced directly by
2496     * [`ChannelManager`] using the values you previously provided to
2497     * [`ChannelManager::create_inbound_payment`] or
2498     * [`ChannelManager::create_inbound_payment_for_hash`].
2499     *
2500     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2501     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2502     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2503     */
2504    struct LDKThirtyTwoBytes payment_secret;
2505    /**
2506     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
2507     * compare this to the expected value before accepting the payment (as otherwise you are
2508     * providing proof-of-payment for less than the value you expected!).
2509     */
2510    uint64_t amt;
2511    /**
2512     * This is the `user_payment_id` which was provided to
2513     * [`ChannelManager::create_inbound_payment_for_hash`] or
2514     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
2515     * simply copied here. It may be used to correlate PaymentReceived events with invoice
2516     * metadata stored elsewhere.
2517     *
2518     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2519     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2520     */
2521    uint64_t user_payment_id;
2522 } LDKEvent_LDKPaymentReceived_Body;
2523
2524 typedef struct LDKEvent_LDKPaymentSent_Body {
2525    /**
2526     * The preimage to the hash given to ChannelManager::send_payment.
2527     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2528     * store it somehow!
2529     */
2530    struct LDKThirtyTwoBytes payment_preimage;
2531 } LDKEvent_LDKPaymentSent_Body;
2532
2533 typedef struct LDKEvent_LDKPaymentFailed_Body {
2534    /**
2535     * The hash which was given to ChannelManager::send_payment.
2536     */
2537    struct LDKThirtyTwoBytes payment_hash;
2538    /**
2539     * Indicates the payment was rejected for some reason by the recipient. This implies that
2540     * the payment has failed, not just the route in question. If this is not set, you may
2541     * retry the payment via a different route.
2542     */
2543    bool rejected_by_dest;
2544 } LDKEvent_LDKPaymentFailed_Body;
2545
2546 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2547    /**
2548     * The minimum amount of time that should be waited prior to calling
2549     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2550     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2551     * now + 5*time_forwardable).
2552     */
2553    uint64_t time_forwardable;
2554 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2555
2556 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2557    /**
2558     * The outputs which you should store as spendable by you.
2559     */
2560    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2561 } LDKEvent_LDKSpendableOutputs_Body;
2562
2563 typedef struct MUST_USE_STRUCT LDKEvent {
2564    LDKEvent_Tag tag;
2565    union {
2566       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2567       LDKEvent_LDKPaymentReceived_Body payment_received;
2568       LDKEvent_LDKPaymentSent_Body payment_sent;
2569       LDKEvent_LDKPaymentFailed_Body payment_failed;
2570       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2571       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2572    };
2573 } LDKEvent;
2574
2575 /**
2576  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2577  * This corresponds to std::vector in C++
2578  */
2579 typedef struct LDKCVec_EventZ {
2580    /**
2581     * The elements in the array.
2582     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2583     */
2584    struct LDKEvent *data;
2585    /**
2586     * The number of elements pointed to by `data`.
2587     */
2588    uintptr_t datalen;
2589 } LDKCVec_EventZ;
2590
2591 /**
2592  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2593  * This corresponds to std::vector in C++
2594  */
2595 typedef struct LDKCVec_TransactionZ {
2596    /**
2597     * The elements in the array.
2598     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2599     */
2600    struct LDKTransaction *data;
2601    /**
2602     * The number of elements pointed to by `data`.
2603     */
2604    uintptr_t datalen;
2605 } LDKCVec_TransactionZ;
2606
2607 /**
2608  * A tuple of 2 elements. See the individual fields for the types contained.
2609  */
2610 typedef struct LDKC2Tuple_usizeTransactionZ {
2611    /**
2612     * The element at position 0
2613     */
2614    uintptr_t a;
2615    /**
2616     * The element at position 1
2617     */
2618    struct LDKTransaction b;
2619 } LDKC2Tuple_usizeTransactionZ;
2620
2621 /**
2622  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2623  * This corresponds to std::vector in C++
2624  */
2625 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2626    /**
2627     * The elements in the array.
2628     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2629     */
2630    struct LDKC2Tuple_usizeTransactionZ *data;
2631    /**
2632     * The number of elements pointed to by `data`.
2633     */
2634    uintptr_t datalen;
2635 } LDKCVec_C2Tuple_usizeTransactionZZ;
2636
2637 /**
2638  * A tuple of 2 elements. See the individual fields for the types contained.
2639  */
2640 typedef struct LDKC2Tuple_u32TxOutZ {
2641    /**
2642     * The element at position 0
2643     */
2644    uint32_t a;
2645    /**
2646     * The element at position 1
2647     */
2648    struct LDKTxOut b;
2649 } LDKC2Tuple_u32TxOutZ;
2650
2651 /**
2652  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2653  * This corresponds to std::vector in C++
2654  */
2655 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
2656    /**
2657     * The elements in the array.
2658     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2659     */
2660    struct LDKC2Tuple_u32TxOutZ *data;
2661    /**
2662     * The number of elements pointed to by `data`.
2663     */
2664    uintptr_t datalen;
2665 } LDKCVec_C2Tuple_u32TxOutZZ;
2666
2667 /**
2668  * A tuple of 2 elements. See the individual fields for the types contained.
2669  */
2670 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2671    /**
2672     * The element at position 0
2673     */
2674    struct LDKThirtyTwoBytes a;
2675    /**
2676     * The element at position 1
2677     */
2678    struct LDKCVec_C2Tuple_u32TxOutZZ b;
2679 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
2680
2681 /**
2682  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2683  * This corresponds to std::vector in C++
2684  */
2685 typedef struct LDKCVec_TransactionOutputsZ {
2686    /**
2687     * The elements in the array.
2688     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2689     */
2690    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
2691    /**
2692     * The number of elements pointed to by `data`.
2693     */
2694    uintptr_t datalen;
2695 } LDKCVec_TransactionOutputsZ;
2696
2697 /**
2698  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2699  * This corresponds to std::vector in C++
2700  */
2701 typedef struct LDKCVec_TxidZ {
2702    /**
2703     * The elements in the array.
2704     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2705     */
2706    struct LDKThirtyTwoBytes *data;
2707    /**
2708     * The number of elements pointed to by `data`.
2709     */
2710    uintptr_t datalen;
2711 } LDKCVec_TxidZ;
2712
2713 /**
2714  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2715  */
2716 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2717    /**
2718     * Note that this value is always NULL, as there are no contents in the OK variant
2719     */
2720    void *result;
2721    /**
2722     * A pointer to the contents in the error state.
2723     * Reading from this pointer when `result_ok` is set is undefined.
2724     */
2725    enum LDKChannelMonitorUpdateErr *err;
2726 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2727
2728 /**
2729  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2730  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2731  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2732  */
2733 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2734    /**
2735     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2736     * `err` or `result` depending on the state of `result_ok`.
2737     */
2738    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2739    /**
2740     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2741     */
2742    bool result_ok;
2743 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2744
2745 /**
2746  * A tuple of 2 elements. See the individual fields for the types contained.
2747  */
2748 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2749    /**
2750     * The element at position 0
2751     */
2752    struct LDKSignature a;
2753    /**
2754     * The element at position 1
2755     */
2756    struct LDKCVec_SignatureZ b;
2757 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2758
2759 /**
2760  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2761  */
2762 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2763    /**
2764     * A pointer to the contents in the success state.
2765     * Reading from this pointer when `result_ok` is not set is undefined.
2766     */
2767    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2768    /**
2769     * Note that this value is always NULL, as there are no contents in the Err variant
2770     */
2771    void *err;
2772 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2773
2774 /**
2775  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2776  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2778  */
2779 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2780    /**
2781     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2782     * `err` or `result` depending on the state of `result_ok`.
2783     */
2784    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2785    /**
2786     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2787     */
2788    bool result_ok;
2789 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2790
2791 /**
2792  * The contents of CResult_SignatureNoneZ
2793  */
2794 typedef union LDKCResult_SignatureNoneZPtr {
2795    /**
2796     * A pointer to the contents in the success state.
2797     * Reading from this pointer when `result_ok` is not set is undefined.
2798     */
2799    struct LDKSignature *result;
2800    /**
2801     * Note that this value is always NULL, as there are no contents in the Err variant
2802     */
2803    void *err;
2804 } LDKCResult_SignatureNoneZPtr;
2805
2806 /**
2807  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2808  * containing a crate::c_types::Signature on success and a () on failure.
2809  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2810  */
2811 typedef struct LDKCResult_SignatureNoneZ {
2812    /**
2813     * The contents of this CResult_SignatureNoneZ, accessible via either
2814     * `err` or `result` depending on the state of `result_ok`.
2815     */
2816    union LDKCResult_SignatureNoneZPtr contents;
2817    /**
2818     * Whether this CResult_SignatureNoneZ represents a success state.
2819     */
2820    bool result_ok;
2821 } LDKCResult_SignatureNoneZ;
2822
2823
2824
2825 /**
2826  * The unsigned part of a channel_announcement
2827  */
2828 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2829    /**
2830     * A pointer to the opaque Rust object.
2831     * Nearly everywhere, inner must be non-null, however in places where
2832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2833     */
2834    LDKnativeUnsignedChannelAnnouncement *inner;
2835    /**
2836     * Indicates that this is the only struct which contains the same pointer.
2837     * Rust functions which take ownership of an object provided via an argument require
2838     * this to be true and invalidate the object pointed to by inner.
2839     */
2840    bool is_owned;
2841 } LDKUnsignedChannelAnnouncement;
2842
2843 /**
2844  * A trait to sign lightning channel transactions as described in BOLT 3.
2845  *
2846  * Signing services could be implemented on a hardware wallet. In this case,
2847  * the current Sign would be a front-end on top of a communication
2848  * channel connected to your secure device and lightning key material wouldn't
2849  * reside on a hot server. Nevertheless, a this deployment would still need
2850  * to trust the ChannelManager to avoid loss of funds as this latest component
2851  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2852  *
2853  * A more secure iteration would be to use hashlock (or payment points) to pair
2854  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2855  * at the price of more state and computation on the hardware wallet side. In the future,
2856  * we are looking forward to design such interface.
2857  *
2858  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2859  * to act, as liveness and breach reply correctness are always going to be hard requirements
2860  * of LN security model, orthogonal of key management issues.
2861  */
2862 typedef struct LDKBaseSign {
2863    /**
2864     * An opaque pointer which is passed to your function implementations as an argument.
2865     * This has no meaning in the LDK, and can be NULL or any other value.
2866     */
2867    void *this_arg;
2868    /**
2869     * Gets the per-commitment point for a specific commitment number
2870     *
2871     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2872     */
2873    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2874    /**
2875     * Gets the commitment secret for a specific commitment number as part of the revocation process
2876     *
2877     * An external signer implementation should error here if the commitment was already signed
2878     * and should refuse to sign it in the future.
2879     *
2880     * May be called more than once for the same index.
2881     *
2882     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2883     */
2884    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2885    /**
2886     * Gets the holder's channel public keys and basepoints
2887     */
2888    struct LDKChannelPublicKeys pubkeys;
2889    /**
2890     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2891     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2892     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2893     */
2894    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2895    /**
2896     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2897     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2898     * Sign object uniquely and lookup or re-derive its keys.
2899     */
2900    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2901    /**
2902     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2903     *
2904     * Note that if signing fails or is rejected, the channel will be force-closed.
2905     */
2906    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2907    /**
2908     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2909     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2910     * latest commitment_tx when we initiate a force-close.
2911     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2912     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2913     * the latest.
2914     * This may be called multiple times for the same transaction.
2915     *
2916     * An external signer implementation should check that the commitment has not been revoked.
2917     *
2918     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2919     */
2920    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2921    /**
2922     * Create a signature for the given input in a transaction spending an HTLC or commitment
2923     * transaction output when our counterparty broadcasts an old state.
2924     *
2925     * A justice transaction may claim multiples outputs at the same time if timelocks are
2926     * similar, but only a signature for the input at index `input` should be signed for here.
2927     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2928     * to an upcoming timelock expiration.
2929     *
2930     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2931     *
2932     * per_commitment_key is revocation secret which was provided by our counterparty when they
2933     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2934     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2935     * so).
2936     *
2937     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2938     * changing the format of the witness script (which is committed to in the BIP 143
2939     * signatures).
2940     */
2941    struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(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);
2942    /**
2943     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2944     * transaction, either offered or received.
2945     *
2946     * Such a transaction may claim multiples offered outputs at same time if we know the
2947     * preimage for each when we create it, but only the input at index `input` should be
2948     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2949     * needed with regards to an upcoming timelock expiration.
2950     *
2951     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2952     * outputs.
2953     *
2954     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2955     *
2956     * Per_commitment_point is the dynamic point corresponding to the channel state
2957     * detected onchain. It has been generated by our counterparty and is used to derive
2958     * channel state keys, which are then included in the witness script and committed to in the
2959     * BIP 143 signature.
2960     */
2961    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);
2962    /**
2963     * Create a signature for a (proposed) closing transaction.
2964     *
2965     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2966     * chosen to forgo their output as dust.
2967     */
2968    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2969    /**
2970     * Signs a channel announcement message with our funding key, proving it comes from one
2971     * of the channel participants.
2972     *
2973     * Note that if this fails or is rejected, the channel will not be publicly announced and
2974     * our counterparty may (though likely will not) close the channel on us for violating the
2975     * protocol.
2976     */
2977    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2978    /**
2979     * Set the counterparty static channel data, including basepoints,
2980     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2981     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2982     * they MUST NOT be allowed to change to different values once set.
2983     *
2984     * channel_parameters.is_populated() MUST be true.
2985     *
2986     * We bind holder_selected_contest_delay late here for API convenience.
2987     *
2988     * Will be called before any signatures are applied.
2989     */
2990    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2991    /**
2992     * Frees any resources associated with this object given its this_arg pointer.
2993     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2994     */
2995    void (*free)(void *this_arg);
2996 } LDKBaseSign;
2997
2998 /**
2999  * A cloneable signer.
3000  *
3001  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3002  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3003  * which implies Sized, into this derived trait.
3004  */
3005 typedef struct LDKSign {
3006    /**
3007     * An opaque pointer which is passed to your function implementations as an argument.
3008     * This has no meaning in the LDK, and can be NULL or any other value.
3009     */
3010    void *this_arg;
3011    /**
3012     * Implementation of BaseSign for this object.
3013     */
3014    struct LDKBaseSign BaseSign;
3015    /**
3016     * Creates a copy of the BaseSign, for a copy of this Sign.
3017     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3018     */
3019    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3020    /**
3021     * Serialize the object into a byte array
3022     */
3023    struct LDKCVec_u8Z (*write)(const void *this_arg);
3024    /**
3025     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3026     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3027     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3028     */
3029    void *(*clone)(const void *this_arg);
3030    /**
3031     * Frees any resources associated with this object given its this_arg pointer.
3032     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3033     */
3034    void (*free)(void *this_arg);
3035 } LDKSign;
3036
3037
3038
3039 /**
3040  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3041  * on-chain transactions to ensure no loss of funds occurs.
3042  *
3043  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3044  * information and are actively monitoring the chain.
3045  *
3046  * Pending Events or updated HTLCs which have not yet been read out by
3047  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3048  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3049  * gotten are fully handled before re-serializing the new state.
3050  *
3051  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3052  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3053  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3054  * returned block hash and the the current chain and then reconnecting blocks to get to the
3055  * best chain) upon deserializing the object!
3056  */
3057 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3058    /**
3059     * A pointer to the opaque Rust object.
3060     * Nearly everywhere, inner must be non-null, however in places where
3061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3062     */
3063    LDKnativeChannelMonitor *inner;
3064    /**
3065     * Indicates that this is the only struct which contains the same pointer.
3066     * Rust functions which take ownership of an object provided via an argument require
3067     * this to be true and invalidate the object pointed to by inner.
3068     */
3069    bool is_owned;
3070 } LDKChannelMonitor;
3071
3072 /**
3073  * A tuple of 2 elements. See the individual fields for the types contained.
3074  */
3075 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3076    /**
3077     * The element at position 0
3078     */
3079    struct LDKThirtyTwoBytes a;
3080    /**
3081     * The element at position 1
3082     */
3083    struct LDKChannelMonitor b;
3084 } LDKC2Tuple_BlockHashChannelMonitorZ;
3085
3086 /**
3087  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3088  */
3089 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3090    /**
3091     * A pointer to the contents in the success state.
3092     * Reading from this pointer when `result_ok` is not set is undefined.
3093     */
3094    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
3095    /**
3096     * A pointer to the contents in the error state.
3097     * Reading from this pointer when `result_ok` is set is undefined.
3098     */
3099    struct LDKDecodeError *err;
3100 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
3101
3102 /**
3103  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3104  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3106  */
3107 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3108    /**
3109     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3110     * `err` or `result` depending on the state of `result_ok`.
3111     */
3112    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
3113    /**
3114     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3115     */
3116    bool result_ok;
3117 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
3118
3119
3120
3121 /**
3122  * A hop in a route
3123  */
3124 typedef struct MUST_USE_STRUCT LDKRouteHop {
3125    /**
3126     * A pointer to the opaque Rust object.
3127     * Nearly everywhere, inner must be non-null, however in places where
3128     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3129     */
3130    LDKnativeRouteHop *inner;
3131    /**
3132     * Indicates that this is the only struct which contains the same pointer.
3133     * Rust functions which take ownership of an object provided via an argument require
3134     * this to be true and invalidate the object pointed to by inner.
3135     */
3136    bool is_owned;
3137 } LDKRouteHop;
3138
3139 /**
3140  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3141  * This corresponds to std::vector in C++
3142  */
3143 typedef struct LDKCVec_RouteHopZ {
3144    /**
3145     * The elements in the array.
3146     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3147     */
3148    struct LDKRouteHop *data;
3149    /**
3150     * The number of elements pointed to by `data`.
3151     */
3152    uintptr_t datalen;
3153 } LDKCVec_RouteHopZ;
3154
3155 /**
3156  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3157  * This corresponds to std::vector in C++
3158  */
3159 typedef struct LDKCVec_CVec_RouteHopZZ {
3160    /**
3161     * The elements in the array.
3162     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3163     */
3164    struct LDKCVec_RouteHopZ *data;
3165    /**
3166     * The number of elements pointed to by `data`.
3167     */
3168    uintptr_t datalen;
3169 } LDKCVec_CVec_RouteHopZZ;
3170
3171
3172
3173 /**
3174  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3175  * it can take multiple paths. Each path is composed of one or more hops through the network.
3176  */
3177 typedef struct MUST_USE_STRUCT LDKRoute {
3178    /**
3179     * A pointer to the opaque Rust object.
3180     * Nearly everywhere, inner must be non-null, however in places where
3181     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3182     */
3183    LDKnativeRoute *inner;
3184    /**
3185     * Indicates that this is the only struct which contains the same pointer.
3186     * Rust functions which take ownership of an object provided via an argument require
3187     * this to be true and invalidate the object pointed to by inner.
3188     */
3189    bool is_owned;
3190 } LDKRoute;
3191
3192 /**
3193  * The contents of CResult_RouteDecodeErrorZ
3194  */
3195 typedef union LDKCResult_RouteDecodeErrorZPtr {
3196    /**
3197     * A pointer to the contents in the success state.
3198     * Reading from this pointer when `result_ok` is not set is undefined.
3199     */
3200    struct LDKRoute *result;
3201    /**
3202     * A pointer to the contents in the error state.
3203     * Reading from this pointer when `result_ok` is set is undefined.
3204     */
3205    struct LDKDecodeError *err;
3206 } LDKCResult_RouteDecodeErrorZPtr;
3207
3208 /**
3209  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3210  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3212  */
3213 typedef struct LDKCResult_RouteDecodeErrorZ {
3214    /**
3215     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3216     * `err` or `result` depending on the state of `result_ok`.
3217     */
3218    union LDKCResult_RouteDecodeErrorZPtr contents;
3219    /**
3220     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3221     */
3222    bool result_ok;
3223 } LDKCResult_RouteDecodeErrorZ;
3224
3225
3226
3227 /**
3228  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
3229  */
3230 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3231    /**
3232     * A pointer to the opaque Rust object.
3233     * Nearly everywhere, inner must be non-null, however in places where
3234     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3235     */
3236    LDKnativeChannelDetails *inner;
3237    /**
3238     * Indicates that this is the only struct which contains the same pointer.
3239     * Rust functions which take ownership of an object provided via an argument require
3240     * this to be true and invalidate the object pointed to by inner.
3241     */
3242    bool is_owned;
3243 } LDKChannelDetails;
3244
3245 /**
3246  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3247  * This corresponds to std::vector in C++
3248  */
3249 typedef struct LDKCVec_ChannelDetailsZ {
3250    /**
3251     * The elements in the array.
3252     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3253     */
3254    struct LDKChannelDetails *data;
3255    /**
3256     * The number of elements pointed to by `data`.
3257     */
3258    uintptr_t datalen;
3259 } LDKCVec_ChannelDetailsZ;
3260
3261
3262
3263 /**
3264  * An Err type for failure to process messages.
3265  */
3266 typedef struct MUST_USE_STRUCT LDKLightningError {
3267    /**
3268     * A pointer to the opaque Rust object.
3269     * Nearly everywhere, inner must be non-null, however in places where
3270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3271     */
3272    LDKnativeLightningError *inner;
3273    /**
3274     * Indicates that this is the only struct which contains the same pointer.
3275     * Rust functions which take ownership of an object provided via an argument require
3276     * this to be true and invalidate the object pointed to by inner.
3277     */
3278    bool is_owned;
3279 } LDKLightningError;
3280
3281 /**
3282  * The contents of CResult_RouteLightningErrorZ
3283  */
3284 typedef union LDKCResult_RouteLightningErrorZPtr {
3285    /**
3286     * A pointer to the contents in the success state.
3287     * Reading from this pointer when `result_ok` is not set is undefined.
3288     */
3289    struct LDKRoute *result;
3290    /**
3291     * A pointer to the contents in the error state.
3292     * Reading from this pointer when `result_ok` is set is undefined.
3293     */
3294    struct LDKLightningError *err;
3295 } LDKCResult_RouteLightningErrorZPtr;
3296
3297 /**
3298  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3299  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3300  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3301  */
3302 typedef struct LDKCResult_RouteLightningErrorZ {
3303    /**
3304     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3305     * `err` or `result` depending on the state of `result_ok`.
3306     */
3307    union LDKCResult_RouteLightningErrorZPtr contents;
3308    /**
3309     * Whether this CResult_RouteLightningErrorZ represents a success state.
3310     */
3311    bool result_ok;
3312 } LDKCResult_RouteLightningErrorZ;
3313
3314
3315
3316 /**
3317  * An accept_channel message to be sent or received from a peer
3318  */
3319 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3320    /**
3321     * A pointer to the opaque Rust object.
3322     * Nearly everywhere, inner must be non-null, however in places where
3323     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3324     */
3325    LDKnativeAcceptChannel *inner;
3326    /**
3327     * Indicates that this is the only struct which contains the same pointer.
3328     * Rust functions which take ownership of an object provided via an argument require
3329     * this to be true and invalidate the object pointed to by inner.
3330     */
3331    bool is_owned;
3332 } LDKAcceptChannel;
3333
3334
3335
3336 /**
3337  * An open_channel message to be sent or received from a peer
3338  */
3339 typedef struct MUST_USE_STRUCT LDKOpenChannel {
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    LDKnativeOpenChannel *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 } LDKOpenChannel;
3353
3354
3355
3356 /**
3357  * A funding_created message to be sent or received from a peer
3358  */
3359 typedef struct MUST_USE_STRUCT LDKFundingCreated {
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    LDKnativeFundingCreated *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 } LDKFundingCreated;
3373
3374
3375
3376 /**
3377  * A funding_signed message to be sent or received from a peer
3378  */
3379 typedef struct MUST_USE_STRUCT LDKFundingSigned {
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    LDKnativeFundingSigned *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 } LDKFundingSigned;
3393
3394
3395
3396 /**
3397  * A funding_locked message to be sent or received from a peer
3398  */
3399 typedef struct MUST_USE_STRUCT LDKFundingLocked {
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    LDKnativeFundingLocked *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 } LDKFundingLocked;
3413
3414
3415
3416 /**
3417  * An announcement_signatures message to be sent or received from a peer
3418  */
3419 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
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    LDKnativeAnnouncementSignatures *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 } LDKAnnouncementSignatures;
3433
3434
3435
3436 /**
3437  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3438  * transaction updates if they were pending.
3439  */
3440 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3441    /**
3442     * A pointer to the opaque Rust object.
3443     * Nearly everywhere, inner must be non-null, however in places where
3444     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3445     */
3446    LDKnativeCommitmentUpdate *inner;
3447    /**
3448     * Indicates that this is the only struct which contains the same pointer.
3449     * Rust functions which take ownership of an object provided via an argument require
3450     * this to be true and invalidate the object pointed to by inner.
3451     */
3452    bool is_owned;
3453 } LDKCommitmentUpdate;
3454
3455
3456
3457 /**
3458  * A revoke_and_ack message to be sent or received from a peer
3459  */
3460 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
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    LDKnativeRevokeAndACK *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 } LDKRevokeAndACK;
3474
3475
3476
3477 /**
3478  * A closing_signed message to be sent or received from a peer
3479  */
3480 typedef struct MUST_USE_STRUCT LDKClosingSigned {
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    LDKnativeClosingSigned *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 } LDKClosingSigned;
3494
3495
3496
3497 /**
3498  * A shutdown message to be sent or received from a peer
3499  */
3500 typedef struct MUST_USE_STRUCT LDKShutdown {
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    LDKnativeShutdown *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 } LDKShutdown;
3514
3515
3516
3517 /**
3518  * A channel_reestablish message to be sent or received from a peer
3519  */
3520 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
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    LDKnativeChannelReestablish *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 } LDKChannelReestablish;
3534
3535
3536
3537 /**
3538  * A channel_announcement message to be sent or received from a peer
3539  */
3540 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
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    LDKnativeChannelAnnouncement *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 } LDKChannelAnnouncement;
3554
3555
3556
3557 /**
3558  * A channel_update message to be sent or received from a peer
3559  */
3560 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
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    LDKnativeChannelUpdate *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 } LDKChannelUpdate;
3574
3575
3576
3577 /**
3578  * A node_announcement message to be sent or received from a peer
3579  */
3580 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
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    LDKnativeNodeAnnouncement *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 } LDKNodeAnnouncement;
3594
3595
3596
3597 /**
3598  * An error message to be sent or received from a peer
3599  */
3600 typedef struct MUST_USE_STRUCT LDKErrorMessage {
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    LDKnativeErrorMessage *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 } LDKErrorMessage;
3614
3615 /**
3616  * Used to put an error message in a LightningError
3617  */
3618 typedef enum LDKErrorAction_Tag {
3619    /**
3620     * The peer took some action which made us think they were useless. Disconnect them.
3621     */
3622    LDKErrorAction_DisconnectPeer,
3623    /**
3624     * The peer did something harmless that we weren't able to process, just log and ignore
3625     */
3626    LDKErrorAction_IgnoreError,
3627    /**
3628     * The peer did something incorrect. Tell them.
3629     */
3630    LDKErrorAction_SendErrorMessage,
3631    /**
3632     * Must be last for serialization purposes
3633     */
3634    LDKErrorAction_Sentinel,
3635 } LDKErrorAction_Tag;
3636
3637 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3638    /**
3639     * An error message which we should make an effort to send before we disconnect.
3640     */
3641    struct LDKErrorMessage msg;
3642 } LDKErrorAction_LDKDisconnectPeer_Body;
3643
3644 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3645    /**
3646     * The message to send.
3647     */
3648    struct LDKErrorMessage msg;
3649 } LDKErrorAction_LDKSendErrorMessage_Body;
3650
3651 typedef struct MUST_USE_STRUCT LDKErrorAction {
3652    LDKErrorAction_Tag tag;
3653    union {
3654       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3655       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3656    };
3657 } LDKErrorAction;
3658
3659 /**
3660  * The information we received from a peer along the route of a payment we originated. This is
3661  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3662  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3663  */
3664 typedef enum LDKHTLCFailChannelUpdate_Tag {
3665    /**
3666     * We received an error which included a full ChannelUpdate message.
3667     */
3668    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
3669    /**
3670     * We received an error which indicated only that a channel has been closed
3671     */
3672    LDKHTLCFailChannelUpdate_ChannelClosed,
3673    /**
3674     * We received an error which indicated only that a node has failed
3675     */
3676    LDKHTLCFailChannelUpdate_NodeFailure,
3677    /**
3678     * Must be last for serialization purposes
3679     */
3680    LDKHTLCFailChannelUpdate_Sentinel,
3681 } LDKHTLCFailChannelUpdate_Tag;
3682
3683 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
3684    /**
3685     * The unwrapped message we received
3686     */
3687    struct LDKChannelUpdate msg;
3688 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
3689
3690 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
3691    /**
3692     * The short_channel_id which has now closed.
3693     */
3694    uint64_t short_channel_id;
3695    /**
3696     * when this true, this channel should be permanently removed from the
3697     * consideration. Otherwise, this channel can be restored as new channel_update is received
3698     */
3699    bool is_permanent;
3700 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
3701
3702 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
3703    /**
3704     * The node_id that has failed.
3705     */
3706    struct LDKPublicKey node_id;
3707    /**
3708     * when this true, node should be permanently removed from the
3709     * consideration. Otherwise, the channels connected to this node can be
3710     * restored as new channel_update is received
3711     */
3712    bool is_permanent;
3713 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
3714
3715 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
3716    LDKHTLCFailChannelUpdate_Tag tag;
3717    union {
3718       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3719       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
3720       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
3721    };
3722 } LDKHTLCFailChannelUpdate;
3723
3724
3725
3726 /**
3727  * A query_channel_range message is used to query a peer for channel
3728  * UTXOs in a range of blocks. The recipient of a query makes a best
3729  * effort to reply to the query using one or more reply_channel_range
3730  * messages.
3731  */
3732 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3733    /**
3734     * A pointer to the opaque Rust object.
3735     * Nearly everywhere, inner must be non-null, however in places where
3736     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3737     */
3738    LDKnativeQueryChannelRange *inner;
3739    /**
3740     * Indicates that this is the only struct which contains the same pointer.
3741     * Rust functions which take ownership of an object provided via an argument require
3742     * this to be true and invalidate the object pointed to by inner.
3743     */
3744    bool is_owned;
3745 } LDKQueryChannelRange;
3746
3747
3748
3749 /**
3750  * A query_short_channel_ids message is used to query a peer for
3751  * routing gossip messages related to one or more short_channel_ids.
3752  * The query recipient will reply with the latest, if available,
3753  * channel_announcement, channel_update and node_announcement messages
3754  * it maintains for the requested short_channel_ids followed by a
3755  * reply_short_channel_ids_end message. The short_channel_ids sent in
3756  * this query are encoded. We only support encoding_type=0 uncompressed
3757  * serialization and do not support encoding_type=1 zlib serialization.
3758  */
3759 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3760    /**
3761     * A pointer to the opaque Rust object.
3762     * Nearly everywhere, inner must be non-null, however in places where
3763     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3764     */
3765    LDKnativeQueryShortChannelIds *inner;
3766    /**
3767     * Indicates that this is the only struct which contains the same pointer.
3768     * Rust functions which take ownership of an object provided via an argument require
3769     * this to be true and invalidate the object pointed to by inner.
3770     */
3771    bool is_owned;
3772 } LDKQueryShortChannelIds;
3773
3774
3775
3776 /**
3777  * A reply_channel_range message is a reply to a query_channel_range
3778  * message. Multiple reply_channel_range messages can be sent in reply
3779  * to a single query_channel_range message. The query recipient makes a
3780  * best effort to respond based on their local network view which may
3781  * not be a perfect view of the network. The short_channel_ids in the
3782  * reply are encoded. We only support encoding_type=0 uncompressed
3783  * serialization and do not support encoding_type=1 zlib serialization.
3784  */
3785 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3786    /**
3787     * A pointer to the opaque Rust object.
3788     * Nearly everywhere, inner must be non-null, however in places where
3789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3790     */
3791    LDKnativeReplyChannelRange *inner;
3792    /**
3793     * Indicates that this is the only struct which contains the same pointer.
3794     * Rust functions which take ownership of an object provided via an argument require
3795     * this to be true and invalidate the object pointed to by inner.
3796     */
3797    bool is_owned;
3798 } LDKReplyChannelRange;
3799
3800 /**
3801  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3802  * broadcast to most peers).
3803  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3804  */
3805 typedef enum LDKMessageSendEvent_Tag {
3806    /**
3807     * Used to indicate that we've accepted a channel open and should send the accept_channel
3808     * message provided to the given peer.
3809     */
3810    LDKMessageSendEvent_SendAcceptChannel,
3811    /**
3812     * Used to indicate that we've initiated a channel open and should send the open_channel
3813     * message provided to the given peer.
3814     */
3815    LDKMessageSendEvent_SendOpenChannel,
3816    /**
3817     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3818     */
3819    LDKMessageSendEvent_SendFundingCreated,
3820    /**
3821     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3822     */
3823    LDKMessageSendEvent_SendFundingSigned,
3824    /**
3825     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3826     */
3827    LDKMessageSendEvent_SendFundingLocked,
3828    /**
3829     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3830     */
3831    LDKMessageSendEvent_SendAnnouncementSignatures,
3832    /**
3833     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3834     * message should be sent to the peer with the given node_id.
3835     */
3836    LDKMessageSendEvent_UpdateHTLCs,
3837    /**
3838     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3839     */
3840    LDKMessageSendEvent_SendRevokeAndACK,
3841    /**
3842     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3843     */
3844    LDKMessageSendEvent_SendClosingSigned,
3845    /**
3846     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3847     */
3848    LDKMessageSendEvent_SendShutdown,
3849    /**
3850     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3851     */
3852    LDKMessageSendEvent_SendChannelReestablish,
3853    /**
3854     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3855     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3856     *
3857     * Note that after doing so, you very likely (unless you did so very recently) want to call
3858     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3859     * This ensures that any nodes which see our channel_announcement also have a relevant
3860     * node_announcement, including relevant feature flags which may be important for routing
3861     * through or to us.
3862     */
3863    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3864    /**
3865     * Used to indicate that a node_announcement should be broadcast to all peers.
3866     */
3867    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3868    /**
3869     * Used to indicate that a channel_update should be broadcast to all peers.
3870     */
3871    LDKMessageSendEvent_BroadcastChannelUpdate,
3872    /**
3873     * Broadcast an error downstream to be handled
3874     */
3875    LDKMessageSendEvent_HandleError,
3876    /**
3877     * When a payment fails we may receive updates back from the hop where it failed. In such
3878     * cases this event is generated so that we can inform the network graph of this information.
3879     */
3880    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3881    /**
3882     * Query a peer for channels with funding transaction UTXOs in a block range.
3883     */
3884    LDKMessageSendEvent_SendChannelRangeQuery,
3885    /**
3886     * Request routing gossip messages from a peer for a list of channels identified by
3887     * their short_channel_ids.
3888     */
3889    LDKMessageSendEvent_SendShortIdsQuery,
3890    /**
3891     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3892     * emitted during processing of the query.
3893     */
3894    LDKMessageSendEvent_SendReplyChannelRange,
3895    /**
3896     * Must be last for serialization purposes
3897     */
3898    LDKMessageSendEvent_Sentinel,
3899 } LDKMessageSendEvent_Tag;
3900
3901 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3902    /**
3903     * The node_id of the node which should receive this message
3904     */
3905    struct LDKPublicKey node_id;
3906    /**
3907     * The message which should be sent.
3908     */
3909    struct LDKAcceptChannel msg;
3910 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3911
3912 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3913    /**
3914     * The node_id of the node which should receive this message
3915     */
3916    struct LDKPublicKey node_id;
3917    /**
3918     * The message which should be sent.
3919     */
3920    struct LDKOpenChannel msg;
3921 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3922
3923 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3924    /**
3925     * The node_id of the node which should receive this message
3926     */
3927    struct LDKPublicKey node_id;
3928    /**
3929     * The message which should be sent.
3930     */
3931    struct LDKFundingCreated msg;
3932 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3933
3934 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3935    /**
3936     * The node_id of the node which should receive this message
3937     */
3938    struct LDKPublicKey node_id;
3939    /**
3940     * The message which should be sent.
3941     */
3942    struct LDKFundingSigned msg;
3943 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3944
3945 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3946    /**
3947     * The node_id of the node which should receive these message(s)
3948     */
3949    struct LDKPublicKey node_id;
3950    /**
3951     * The funding_locked message which should be sent.
3952     */
3953    struct LDKFundingLocked msg;
3954 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3955
3956 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3957    /**
3958     * The node_id of the node which should receive these message(s)
3959     */
3960    struct LDKPublicKey node_id;
3961    /**
3962     * The announcement_signatures message which should be sent.
3963     */
3964    struct LDKAnnouncementSignatures msg;
3965 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3966
3967 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3968    /**
3969     * The node_id of the node which should receive these message(s)
3970     */
3971    struct LDKPublicKey node_id;
3972    /**
3973     * The update messages which should be sent. ALL messages in the struct should be sent!
3974     */
3975    struct LDKCommitmentUpdate updates;
3976 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3977
3978 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3979    /**
3980     * The node_id of the node which should receive this message
3981     */
3982    struct LDKPublicKey node_id;
3983    /**
3984     * The message which should be sent.
3985     */
3986    struct LDKRevokeAndACK msg;
3987 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3988
3989 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3990    /**
3991     * The node_id of the node which should receive this message
3992     */
3993    struct LDKPublicKey node_id;
3994    /**
3995     * The message which should be sent.
3996     */
3997    struct LDKClosingSigned msg;
3998 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3999
4000 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4001    /**
4002     * The node_id of the node which should receive this message
4003     */
4004    struct LDKPublicKey node_id;
4005    /**
4006     * The message which should be sent.
4007     */
4008    struct LDKShutdown msg;
4009 } LDKMessageSendEvent_LDKSendShutdown_Body;
4010
4011 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4012    /**
4013     * The node_id of the node which should receive this message
4014     */
4015    struct LDKPublicKey node_id;
4016    /**
4017     * The message which should be sent.
4018     */
4019    struct LDKChannelReestablish msg;
4020 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4021
4022 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4023    /**
4024     * The channel_announcement which should be sent.
4025     */
4026    struct LDKChannelAnnouncement msg;
4027    /**
4028     * The followup channel_update which should be sent.
4029     */
4030    struct LDKChannelUpdate update_msg;
4031 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4032
4033 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4034    /**
4035     * The node_announcement which should be sent.
4036     */
4037    struct LDKNodeAnnouncement msg;
4038 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4039
4040 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4041    /**
4042     * The channel_update which should be sent.
4043     */
4044    struct LDKChannelUpdate msg;
4045 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4046
4047 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4048    /**
4049     * The node_id of the node which should receive this message
4050     */
4051    struct LDKPublicKey node_id;
4052    /**
4053     * The action which should be taken.
4054     */
4055    struct LDKErrorAction action;
4056 } LDKMessageSendEvent_LDKHandleError_Body;
4057
4058 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
4059    /**
4060     * The channel/node update which should be sent to NetGraphMsgHandler
4061     */
4062    struct LDKHTLCFailChannelUpdate update;
4063 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
4064
4065 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4066    /**
4067     * The node_id of this message recipient
4068     */
4069    struct LDKPublicKey node_id;
4070    /**
4071     * The query_channel_range which should be sent.
4072     */
4073    struct LDKQueryChannelRange msg;
4074 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4075
4076 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4077    /**
4078     * The node_id of this message recipient
4079     */
4080    struct LDKPublicKey node_id;
4081    /**
4082     * The query_short_channel_ids which should be sent.
4083     */
4084    struct LDKQueryShortChannelIds msg;
4085 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4086
4087 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4088    /**
4089     * The node_id of this message recipient
4090     */
4091    struct LDKPublicKey node_id;
4092    /**
4093     * The reply_channel_range which should be sent.
4094     */
4095    struct LDKReplyChannelRange msg;
4096 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4097
4098 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4099    LDKMessageSendEvent_Tag tag;
4100    union {
4101       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4102       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4103       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4104       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4105       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4106       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4107       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4108       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4109       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4110       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4111       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4112       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4113       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4114       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4115       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4116       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
4117       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4118       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4119       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4120    };
4121 } LDKMessageSendEvent;
4122
4123 /**
4124  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4125  * This corresponds to std::vector in C++
4126  */
4127 typedef struct LDKCVec_MessageSendEventZ {
4128    /**
4129     * The elements in the array.
4130     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4131     */
4132    struct LDKMessageSendEvent *data;
4133    /**
4134     * The number of elements pointed to by `data`.
4135     */
4136    uintptr_t datalen;
4137 } LDKCVec_MessageSendEventZ;
4138
4139 /**
4140  * The contents of CResult_boolLightningErrorZ
4141  */
4142 typedef union LDKCResult_boolLightningErrorZPtr {
4143    /**
4144     * A pointer to the contents in the success state.
4145     * Reading from this pointer when `result_ok` is not set is undefined.
4146     */
4147    bool *result;
4148    /**
4149     * A pointer to the contents in the error state.
4150     * Reading from this pointer when `result_ok` is set is undefined.
4151     */
4152    struct LDKLightningError *err;
4153 } LDKCResult_boolLightningErrorZPtr;
4154
4155 /**
4156  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4157  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4158  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4159  */
4160 typedef struct LDKCResult_boolLightningErrorZ {
4161    /**
4162     * The contents of this CResult_boolLightningErrorZ, accessible via either
4163     * `err` or `result` depending on the state of `result_ok`.
4164     */
4165    union LDKCResult_boolLightningErrorZPtr contents;
4166    /**
4167     * Whether this CResult_boolLightningErrorZ represents a success state.
4168     */
4169    bool result_ok;
4170 } LDKCResult_boolLightningErrorZ;
4171
4172 /**
4173  * A tuple of 3 elements. See the individual fields for the types contained.
4174  */
4175 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4176    /**
4177     * The element at position 0
4178     */
4179    struct LDKChannelAnnouncement a;
4180    /**
4181     * The element at position 1
4182     */
4183    struct LDKChannelUpdate b;
4184    /**
4185     * The element at position 2
4186     */
4187    struct LDKChannelUpdate c;
4188 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4189
4190 /**
4191  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4192  * This corresponds to std::vector in C++
4193  */
4194 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4195    /**
4196     * The elements in the array.
4197     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4198     */
4199    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4200    /**
4201     * The number of elements pointed to by `data`.
4202     */
4203    uintptr_t datalen;
4204 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
4205
4206 /**
4207  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4208  * This corresponds to std::vector in C++
4209  */
4210 typedef struct LDKCVec_NodeAnnouncementZ {
4211    /**
4212     * The elements in the array.
4213     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4214     */
4215    struct LDKNodeAnnouncement *data;
4216    /**
4217     * The number of elements pointed to by `data`.
4218     */
4219    uintptr_t datalen;
4220 } LDKCVec_NodeAnnouncementZ;
4221
4222 /**
4223  * The contents of CResult_NoneLightningErrorZ
4224  */
4225 typedef union LDKCResult_NoneLightningErrorZPtr {
4226    /**
4227     * Note that this value is always NULL, as there are no contents in the OK variant
4228     */
4229    void *result;
4230    /**
4231     * A pointer to the contents in the error state.
4232     * Reading from this pointer when `result_ok` is set is undefined.
4233     */
4234    struct LDKLightningError *err;
4235 } LDKCResult_NoneLightningErrorZPtr;
4236
4237 /**
4238  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4239  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4241  */
4242 typedef struct LDKCResult_NoneLightningErrorZ {
4243    /**
4244     * The contents of this CResult_NoneLightningErrorZ, accessible via either
4245     * `err` or `result` depending on the state of `result_ok`.
4246     */
4247    union LDKCResult_NoneLightningErrorZPtr contents;
4248    /**
4249     * Whether this CResult_NoneLightningErrorZ represents a success state.
4250     */
4251    bool result_ok;
4252 } LDKCResult_NoneLightningErrorZ;
4253
4254 /**
4255  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4256  * This corresponds to std::vector in C++
4257  */
4258 typedef struct LDKCVec_PublicKeyZ {
4259    /**
4260     * The elements in the array.
4261     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4262     */
4263    struct LDKPublicKey *data;
4264    /**
4265     * The number of elements pointed to by `data`.
4266     */
4267    uintptr_t datalen;
4268 } LDKCVec_PublicKeyZ;
4269
4270
4271
4272 /**
4273  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
4274  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
4275  * descriptor.
4276  */
4277 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
4278    /**
4279     * A pointer to the opaque Rust object.
4280     * Nearly everywhere, inner must be non-null, however in places where
4281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4282     */
4283    LDKnativePeerHandleError *inner;
4284    /**
4285     * Indicates that this is the only struct which contains the same pointer.
4286     * Rust functions which take ownership of an object provided via an argument require
4287     * this to be true and invalidate the object pointed to by inner.
4288     */
4289    bool is_owned;
4290 } LDKPeerHandleError;
4291
4292 /**
4293  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
4294  */
4295 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
4296    /**
4297     * A pointer to the contents in the success state.
4298     * Reading from this pointer when `result_ok` is not set is undefined.
4299     */
4300    struct LDKCVec_u8Z *result;
4301    /**
4302     * A pointer to the contents in the error state.
4303     * Reading from this pointer when `result_ok` is set is undefined.
4304     */
4305    struct LDKPeerHandleError *err;
4306 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
4307
4308 /**
4309  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4310  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4311  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4312  */
4313 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
4314    /**
4315     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4316     * `err` or `result` depending on the state of `result_ok`.
4317     */
4318    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
4319    /**
4320     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4321     */
4322    bool result_ok;
4323 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
4324
4325 /**
4326  * The contents of CResult_NonePeerHandleErrorZ
4327  */
4328 typedef union LDKCResult_NonePeerHandleErrorZPtr {
4329    /**
4330     * Note that this value is always NULL, as there are no contents in the OK variant
4331     */
4332    void *result;
4333    /**
4334     * A pointer to the contents in the error state.
4335     * Reading from this pointer when `result_ok` is set is undefined.
4336     */
4337    struct LDKPeerHandleError *err;
4338 } LDKCResult_NonePeerHandleErrorZPtr;
4339
4340 /**
4341  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4342  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4344  */
4345 typedef struct LDKCResult_NonePeerHandleErrorZ {
4346    /**
4347     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4348     * `err` or `result` depending on the state of `result_ok`.
4349     */
4350    union LDKCResult_NonePeerHandleErrorZPtr contents;
4351    /**
4352     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
4353     */
4354    bool result_ok;
4355 } LDKCResult_NonePeerHandleErrorZ;
4356
4357 /**
4358  * The contents of CResult_boolPeerHandleErrorZ
4359  */
4360 typedef union LDKCResult_boolPeerHandleErrorZPtr {
4361    /**
4362     * A pointer to the contents in the success state.
4363     * Reading from this pointer when `result_ok` is not set is undefined.
4364     */
4365    bool *result;
4366    /**
4367     * A pointer to the contents in the error state.
4368     * Reading from this pointer when `result_ok` is set is undefined.
4369     */
4370    struct LDKPeerHandleError *err;
4371 } LDKCResult_boolPeerHandleErrorZPtr;
4372
4373 /**
4374  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4375  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4376  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4377  */
4378 typedef struct LDKCResult_boolPeerHandleErrorZ {
4379    /**
4380     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4381     * `err` or `result` depending on the state of `result_ok`.
4382     */
4383    union LDKCResult_boolPeerHandleErrorZPtr contents;
4384    /**
4385     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
4386     */
4387    bool result_ok;
4388 } LDKCResult_boolPeerHandleErrorZ;
4389
4390 /**
4391  * The contents of CResult_TxOutAccessErrorZ
4392  */
4393 typedef union LDKCResult_TxOutAccessErrorZPtr {
4394    /**
4395     * A pointer to the contents in the success state.
4396     * Reading from this pointer when `result_ok` is not set is undefined.
4397     */
4398    struct LDKTxOut *result;
4399    /**
4400     * A pointer to the contents in the error state.
4401     * Reading from this pointer when `result_ok` is set is undefined.
4402     */
4403    enum LDKAccessError *err;
4404 } LDKCResult_TxOutAccessErrorZPtr;
4405
4406 /**
4407  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4408  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4409  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410  */
4411 typedef struct LDKCResult_TxOutAccessErrorZ {
4412    /**
4413     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4414     * `err` or `result` depending on the state of `result_ok`.
4415     */
4416    union LDKCResult_TxOutAccessErrorZPtr contents;
4417    /**
4418     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4419     */
4420    bool result_ok;
4421 } LDKCResult_TxOutAccessErrorZ;
4422
4423 /**
4424  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4425  */
4426 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4427    /**
4428     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4429     */
4430    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4431    /**
4432     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4433     */
4434    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4435    /**
4436     * Must be last for serialization purposes
4437     */
4438    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4439 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4440
4441 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4442    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4443    union {
4444       struct {
4445          struct LDKC2Tuple_usizeTransactionZ some;
4446       };
4447    };
4448 } LDKCOption_C2Tuple_usizeTransactionZZ;
4449
4450
4451
4452 /**
4453  * Details about one direction of a channel. Received
4454  * within a channel update.
4455  */
4456 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
4457    /**
4458     * A pointer to the opaque Rust object.
4459     * Nearly everywhere, inner must be non-null, however in places where
4460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4461     */
4462    LDKnativeDirectionalChannelInfo *inner;
4463    /**
4464     * Indicates that this is the only struct which contains the same pointer.
4465     * Rust functions which take ownership of an object provided via an argument require
4466     * this to be true and invalidate the object pointed to by inner.
4467     */
4468    bool is_owned;
4469 } LDKDirectionalChannelInfo;
4470
4471 /**
4472  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4473  */
4474 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
4475    /**
4476     * A pointer to the contents in the success state.
4477     * Reading from this pointer when `result_ok` is not set is undefined.
4478     */
4479    struct LDKDirectionalChannelInfo *result;
4480    /**
4481     * A pointer to the contents in the error state.
4482     * Reading from this pointer when `result_ok` is set is undefined.
4483     */
4484    struct LDKDecodeError *err;
4485 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
4486
4487 /**
4488  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4489  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4491  */
4492 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
4493    /**
4494     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4495     * `err` or `result` depending on the state of `result_ok`.
4496     */
4497    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
4498    /**
4499     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4500     */
4501    bool result_ok;
4502 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
4503
4504
4505
4506 /**
4507  * Details about a channel (both directions).
4508  * Received within a channel announcement.
4509  */
4510 typedef struct MUST_USE_STRUCT LDKChannelInfo {
4511    /**
4512     * A pointer to the opaque Rust object.
4513     * Nearly everywhere, inner must be non-null, however in places where
4514     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4515     */
4516    LDKnativeChannelInfo *inner;
4517    /**
4518     * Indicates that this is the only struct which contains the same pointer.
4519     * Rust functions which take ownership of an object provided via an argument require
4520     * this to be true and invalidate the object pointed to by inner.
4521     */
4522    bool is_owned;
4523 } LDKChannelInfo;
4524
4525 /**
4526  * The contents of CResult_ChannelInfoDecodeErrorZ
4527  */
4528 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
4529    /**
4530     * A pointer to the contents in the success state.
4531     * Reading from this pointer when `result_ok` is not set is undefined.
4532     */
4533    struct LDKChannelInfo *result;
4534    /**
4535     * A pointer to the contents in the error state.
4536     * Reading from this pointer when `result_ok` is set is undefined.
4537     */
4538    struct LDKDecodeError *err;
4539 } LDKCResult_ChannelInfoDecodeErrorZPtr;
4540
4541 /**
4542  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4543  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4544  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4545  */
4546 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
4547    /**
4548     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4549     * `err` or `result` depending on the state of `result_ok`.
4550     */
4551    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
4552    /**
4553     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4554     */
4555    bool result_ok;
4556 } LDKCResult_ChannelInfoDecodeErrorZ;
4557
4558
4559
4560 /**
4561  * Fees for routing via a given channel or a node
4562  */
4563 typedef struct MUST_USE_STRUCT LDKRoutingFees {
4564    /**
4565     * A pointer to the opaque Rust object.
4566     * Nearly everywhere, inner must be non-null, however in places where
4567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4568     */
4569    LDKnativeRoutingFees *inner;
4570    /**
4571     * Indicates that this is the only struct which contains the same pointer.
4572     * Rust functions which take ownership of an object provided via an argument require
4573     * this to be true and invalidate the object pointed to by inner.
4574     */
4575    bool is_owned;
4576 } LDKRoutingFees;
4577
4578 /**
4579  * The contents of CResult_RoutingFeesDecodeErrorZ
4580  */
4581 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
4582    /**
4583     * A pointer to the contents in the success state.
4584     * Reading from this pointer when `result_ok` is not set is undefined.
4585     */
4586    struct LDKRoutingFees *result;
4587    /**
4588     * A pointer to the contents in the error state.
4589     * Reading from this pointer when `result_ok` is set is undefined.
4590     */
4591    struct LDKDecodeError *err;
4592 } LDKCResult_RoutingFeesDecodeErrorZPtr;
4593
4594 /**
4595  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4596  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4598  */
4599 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
4600    /**
4601     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4602     * `err` or `result` depending on the state of `result_ok`.
4603     */
4604    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
4605    /**
4606     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4607     */
4608    bool result_ok;
4609 } LDKCResult_RoutingFeesDecodeErrorZ;
4610
4611 /**
4612  * A 4-byte byte array.
4613  */
4614 typedef struct LDKFourBytes {
4615    /**
4616     * The four bytes
4617     */
4618    uint8_t data[4];
4619 } LDKFourBytes;
4620
4621 /**
4622  * A 16-byte byte array.
4623  */
4624 typedef struct LDKSixteenBytes {
4625    /**
4626     * The sixteen bytes
4627     */
4628    uint8_t data[16];
4629 } LDKSixteenBytes;
4630
4631 /**
4632  * A 10-byte byte array.
4633  */
4634 typedef struct LDKTenBytes {
4635    /**
4636     * The ten bytes
4637     */
4638    uint8_t data[10];
4639 } LDKTenBytes;
4640
4641 /**
4642  * An address which can be used to connect to a remote peer
4643  */
4644 typedef enum LDKNetAddress_Tag {
4645    /**
4646     * An IPv4 address/port on which the peer is listening.
4647     */
4648    LDKNetAddress_IPv4,
4649    /**
4650     * An IPv6 address/port on which the peer is listening.
4651     */
4652    LDKNetAddress_IPv6,
4653    /**
4654     * An old-style Tor onion address/port on which the peer is listening.
4655     */
4656    LDKNetAddress_OnionV2,
4657    /**
4658     * A new-style Tor onion address/port on which the peer is listening.
4659     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4660     * wrap as base32 and append \".onion\".
4661     */
4662    LDKNetAddress_OnionV3,
4663    /**
4664     * Must be last for serialization purposes
4665     */
4666    LDKNetAddress_Sentinel,
4667 } LDKNetAddress_Tag;
4668
4669 typedef struct LDKNetAddress_LDKIPv4_Body {
4670    /**
4671     * The 4-byte IPv4 address
4672     */
4673    struct LDKFourBytes addr;
4674    /**
4675     * The port on which the node is listening
4676     */
4677    uint16_t port;
4678 } LDKNetAddress_LDKIPv4_Body;
4679
4680 typedef struct LDKNetAddress_LDKIPv6_Body {
4681    /**
4682     * The 16-byte IPv6 address
4683     */
4684    struct LDKSixteenBytes addr;
4685    /**
4686     * The port on which the node is listening
4687     */
4688    uint16_t port;
4689 } LDKNetAddress_LDKIPv6_Body;
4690
4691 typedef struct LDKNetAddress_LDKOnionV2_Body {
4692    /**
4693     * The bytes (usually encoded in base32 with \".onion\" appended)
4694     */
4695    struct LDKTenBytes addr;
4696    /**
4697     * The port on which the node is listening
4698     */
4699    uint16_t port;
4700 } LDKNetAddress_LDKOnionV2_Body;
4701
4702 typedef struct LDKNetAddress_LDKOnionV3_Body {
4703    /**
4704     * The ed25519 long-term public key of the peer
4705     */
4706    struct LDKThirtyTwoBytes ed25519_pubkey;
4707    /**
4708     * The checksum of the pubkey and version, as included in the onion address
4709     */
4710    uint16_t checksum;
4711    /**
4712     * The version byte, as defined by the Tor Onion v3 spec.
4713     */
4714    uint8_t version;
4715    /**
4716     * The port on which the node is listening
4717     */
4718    uint16_t port;
4719 } LDKNetAddress_LDKOnionV3_Body;
4720
4721 typedef struct MUST_USE_STRUCT LDKNetAddress {
4722    LDKNetAddress_Tag tag;
4723    union {
4724       LDKNetAddress_LDKIPv4_Body i_pv4;
4725       LDKNetAddress_LDKIPv6_Body i_pv6;
4726       LDKNetAddress_LDKOnionV2_Body onion_v2;
4727       LDKNetAddress_LDKOnionV3_Body onion_v3;
4728    };
4729 } LDKNetAddress;
4730
4731 /**
4732  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4733  * This corresponds to std::vector in C++
4734  */
4735 typedef struct LDKCVec_NetAddressZ {
4736    /**
4737     * The elements in the array.
4738     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4739     */
4740    struct LDKNetAddress *data;
4741    /**
4742     * The number of elements pointed to by `data`.
4743     */
4744    uintptr_t datalen;
4745 } LDKCVec_NetAddressZ;
4746
4747
4748
4749 /**
4750  * Information received in the latest node_announcement from this node.
4751  */
4752 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4753    /**
4754     * A pointer to the opaque Rust object.
4755     * Nearly everywhere, inner must be non-null, however in places where
4756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4757     */
4758    LDKnativeNodeAnnouncementInfo *inner;
4759    /**
4760     * Indicates that this is the only struct which contains the same pointer.
4761     * Rust functions which take ownership of an object provided via an argument require
4762     * this to be true and invalidate the object pointed to by inner.
4763     */
4764    bool is_owned;
4765 } LDKNodeAnnouncementInfo;
4766
4767 /**
4768  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4769  */
4770 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4771    /**
4772     * A pointer to the contents in the success state.
4773     * Reading from this pointer when `result_ok` is not set is undefined.
4774     */
4775    struct LDKNodeAnnouncementInfo *result;
4776    /**
4777     * A pointer to the contents in the error state.
4778     * Reading from this pointer when `result_ok` is set is undefined.
4779     */
4780    struct LDKDecodeError *err;
4781 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4782
4783 /**
4784  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4785  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4787  */
4788 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4789    /**
4790     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4791     * `err` or `result` depending on the state of `result_ok`.
4792     */
4793    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4794    /**
4795     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4796     */
4797    bool result_ok;
4798 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4799
4800 /**
4801  * A dynamically-allocated array of u64s of arbitrary size.
4802  * This corresponds to std::vector in C++
4803  */
4804 typedef struct LDKCVec_u64Z {
4805    /**
4806     * The elements in the array.
4807     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4808     */
4809    uint64_t *data;
4810    /**
4811     * The number of elements pointed to by `data`.
4812     */
4813    uintptr_t datalen;
4814 } LDKCVec_u64Z;
4815
4816
4817
4818 /**
4819  * Details about a node in the network, known from the network announcement.
4820  */
4821 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4822    /**
4823     * A pointer to the opaque Rust object.
4824     * Nearly everywhere, inner must be non-null, however in places where
4825     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4826     */
4827    LDKnativeNodeInfo *inner;
4828    /**
4829     * Indicates that this is the only struct which contains the same pointer.
4830     * Rust functions which take ownership of an object provided via an argument require
4831     * this to be true and invalidate the object pointed to by inner.
4832     */
4833    bool is_owned;
4834 } LDKNodeInfo;
4835
4836 /**
4837  * The contents of CResult_NodeInfoDecodeErrorZ
4838  */
4839 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4840    /**
4841     * A pointer to the contents in the success state.
4842     * Reading from this pointer when `result_ok` is not set is undefined.
4843     */
4844    struct LDKNodeInfo *result;
4845    /**
4846     * A pointer to the contents in the error state.
4847     * Reading from this pointer when `result_ok` is set is undefined.
4848     */
4849    struct LDKDecodeError *err;
4850 } LDKCResult_NodeInfoDecodeErrorZPtr;
4851
4852 /**
4853  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4854  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4856  */
4857 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4858    /**
4859     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4860     * `err` or `result` depending on the state of `result_ok`.
4861     */
4862    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4863    /**
4864     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4865     */
4866    bool result_ok;
4867 } LDKCResult_NodeInfoDecodeErrorZ;
4868
4869
4870
4871 /**
4872  * Represents the network as nodes and channels between them
4873  */
4874 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4875    /**
4876     * A pointer to the opaque Rust object.
4877     * Nearly everywhere, inner must be non-null, however in places where
4878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4879     */
4880    LDKnativeNetworkGraph *inner;
4881    /**
4882     * Indicates that this is the only struct which contains the same pointer.
4883     * Rust functions which take ownership of an object provided via an argument require
4884     * this to be true and invalidate the object pointed to by inner.
4885     */
4886    bool is_owned;
4887 } LDKNetworkGraph;
4888
4889 /**
4890  * The contents of CResult_NetworkGraphDecodeErrorZ
4891  */
4892 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4893    /**
4894     * A pointer to the contents in the success state.
4895     * Reading from this pointer when `result_ok` is not set is undefined.
4896     */
4897    struct LDKNetworkGraph *result;
4898    /**
4899     * A pointer to the contents in the error state.
4900     * Reading from this pointer when `result_ok` is set is undefined.
4901     */
4902    struct LDKDecodeError *err;
4903 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4904
4905 /**
4906  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4907  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4909  */
4910 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4911    /**
4912     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4913     * `err` or `result` depending on the state of `result_ok`.
4914     */
4915    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4916    /**
4917     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4918     */
4919    bool result_ok;
4920 } LDKCResult_NetworkGraphDecodeErrorZ;
4921
4922
4923
4924 /**
4925  * Features used within an `init` message.
4926  */
4927 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4928    /**
4929     * A pointer to the opaque Rust object.
4930     * Nearly everywhere, inner must be non-null, however in places where
4931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4932     */
4933    LDKnativeInitFeatures *inner;
4934    /**
4935     * Indicates that this is the only struct which contains the same pointer.
4936     * Rust functions which take ownership of an object provided via an argument require
4937     * this to be true and invalidate the object pointed to by inner.
4938     */
4939    bool is_owned;
4940 } LDKInitFeatures;
4941
4942 /**
4943  * The contents of CResult_InitFeaturesDecodeErrorZ
4944  */
4945 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4946    /**
4947     * A pointer to the contents in the success state.
4948     * Reading from this pointer when `result_ok` is not set is undefined.
4949     */
4950    struct LDKInitFeatures *result;
4951    /**
4952     * A pointer to the contents in the error state.
4953     * Reading from this pointer when `result_ok` is set is undefined.
4954     */
4955    struct LDKDecodeError *err;
4956 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4957
4958 /**
4959  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4960  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4962  */
4963 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4964    /**
4965     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4966     * `err` or `result` depending on the state of `result_ok`.
4967     */
4968    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4969    /**
4970     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4971     */
4972    bool result_ok;
4973 } LDKCResult_InitFeaturesDecodeErrorZ;
4974
4975
4976
4977 /**
4978  * Features used within a `node_announcement` message.
4979  */
4980 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4981    /**
4982     * A pointer to the opaque Rust object.
4983     * Nearly everywhere, inner must be non-null, however in places where
4984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4985     */
4986    LDKnativeNodeFeatures *inner;
4987    /**
4988     * Indicates that this is the only struct which contains the same pointer.
4989     * Rust functions which take ownership of an object provided via an argument require
4990     * this to be true and invalidate the object pointed to by inner.
4991     */
4992    bool is_owned;
4993 } LDKNodeFeatures;
4994
4995 /**
4996  * The contents of CResult_NodeFeaturesDecodeErrorZ
4997  */
4998 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4999    /**
5000     * A pointer to the contents in the success state.
5001     * Reading from this pointer when `result_ok` is not set is undefined.
5002     */
5003    struct LDKNodeFeatures *result;
5004    /**
5005     * A pointer to the contents in the error state.
5006     * Reading from this pointer when `result_ok` is set is undefined.
5007     */
5008    struct LDKDecodeError *err;
5009 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5010
5011 /**
5012  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5013  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5014  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5015  */
5016 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5017    /**
5018     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5019     * `err` or `result` depending on the state of `result_ok`.
5020     */
5021    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5022    /**
5023     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5024     */
5025    bool result_ok;
5026 } LDKCResult_NodeFeaturesDecodeErrorZ;
5027
5028
5029
5030 /**
5031  * Features used within a `channel_announcement` message.
5032  */
5033 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5034    /**
5035     * A pointer to the opaque Rust object.
5036     * Nearly everywhere, inner must be non-null, however in places where
5037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5038     */
5039    LDKnativeChannelFeatures *inner;
5040    /**
5041     * Indicates that this is the only struct which contains the same pointer.
5042     * Rust functions which take ownership of an object provided via an argument require
5043     * this to be true and invalidate the object pointed to by inner.
5044     */
5045    bool is_owned;
5046 } LDKChannelFeatures;
5047
5048 /**
5049  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5050  */
5051 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5052    /**
5053     * A pointer to the contents in the success state.
5054     * Reading from this pointer when `result_ok` is not set is undefined.
5055     */
5056    struct LDKChannelFeatures *result;
5057    /**
5058     * A pointer to the contents in the error state.
5059     * Reading from this pointer when `result_ok` is set is undefined.
5060     */
5061    struct LDKDecodeError *err;
5062 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5063
5064 /**
5065  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5066  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5068  */
5069 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5070    /**
5071     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5072     * `err` or `result` depending on the state of `result_ok`.
5073     */
5074    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5075    /**
5076     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5077     */
5078    bool result_ok;
5079 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5080
5081
5082
5083 /**
5084  * Features used within an invoice.
5085  */
5086 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5087    /**
5088     * A pointer to the opaque Rust object.
5089     * Nearly everywhere, inner must be non-null, however in places where
5090     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5091     */
5092    LDKnativeInvoiceFeatures *inner;
5093    /**
5094     * Indicates that this is the only struct which contains the same pointer.
5095     * Rust functions which take ownership of an object provided via an argument require
5096     * this to be true and invalidate the object pointed to by inner.
5097     */
5098    bool is_owned;
5099 } LDKInvoiceFeatures;
5100
5101 /**
5102  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5103  */
5104 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5105    /**
5106     * A pointer to the contents in the success state.
5107     * Reading from this pointer when `result_ok` is not set is undefined.
5108     */
5109    struct LDKInvoiceFeatures *result;
5110    /**
5111     * A pointer to the contents in the error state.
5112     * Reading from this pointer when `result_ok` is set is undefined.
5113     */
5114    struct LDKDecodeError *err;
5115 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5116
5117 /**
5118  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5119  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121  */
5122 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5123    /**
5124     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5125     * `err` or `result` depending on the state of `result_ok`.
5126     */
5127    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5128    /**
5129     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5130     */
5131    bool result_ok;
5132 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5133
5134 /**
5135  * The contents of CResult_NetAddressu8Z
5136  */
5137 typedef union LDKCResult_NetAddressu8ZPtr {
5138    /**
5139     * A pointer to the contents in the success state.
5140     * Reading from this pointer when `result_ok` is not set is undefined.
5141     */
5142    struct LDKNetAddress *result;
5143    /**
5144     * A pointer to the contents in the error state.
5145     * Reading from this pointer when `result_ok` is set is undefined.
5146     */
5147    uint8_t *err;
5148 } LDKCResult_NetAddressu8ZPtr;
5149
5150 /**
5151  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5152  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5154  */
5155 typedef struct LDKCResult_NetAddressu8Z {
5156    /**
5157     * The contents of this CResult_NetAddressu8Z, accessible via either
5158     * `err` or `result` depending on the state of `result_ok`.
5159     */
5160    union LDKCResult_NetAddressu8ZPtr contents;
5161    /**
5162     * Whether this CResult_NetAddressu8Z represents a success state.
5163     */
5164    bool result_ok;
5165 } LDKCResult_NetAddressu8Z;
5166
5167 /**
5168  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5169  */
5170 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5171    /**
5172     * A pointer to the contents in the success state.
5173     * Reading from this pointer when `result_ok` is not set is undefined.
5174     */
5175    struct LDKCResult_NetAddressu8Z *result;
5176    /**
5177     * A pointer to the contents in the error state.
5178     * Reading from this pointer when `result_ok` is set is undefined.
5179     */
5180    struct LDKDecodeError *err;
5181 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5182
5183 /**
5184  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5185  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5187  */
5188 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5189    /**
5190     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5191     * `err` or `result` depending on the state of `result_ok`.
5192     */
5193    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5194    /**
5195     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5196     */
5197    bool result_ok;
5198 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5199
5200
5201
5202 /**
5203  * An update_add_htlc message to be sent or received from a peer
5204  */
5205 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
5206    /**
5207     * A pointer to the opaque Rust object.
5208     * Nearly everywhere, inner must be non-null, however in places where
5209     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5210     */
5211    LDKnativeUpdateAddHTLC *inner;
5212    /**
5213     * Indicates that this is the only struct which contains the same pointer.
5214     * Rust functions which take ownership of an object provided via an argument require
5215     * this to be true and invalidate the object pointed to by inner.
5216     */
5217    bool is_owned;
5218 } LDKUpdateAddHTLC;
5219
5220 /**
5221  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5222  * This corresponds to std::vector in C++
5223  */
5224 typedef struct LDKCVec_UpdateAddHTLCZ {
5225    /**
5226     * The elements in the array.
5227     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5228     */
5229    struct LDKUpdateAddHTLC *data;
5230    /**
5231     * The number of elements pointed to by `data`.
5232     */
5233    uintptr_t datalen;
5234 } LDKCVec_UpdateAddHTLCZ;
5235
5236
5237
5238 /**
5239  * An update_fulfill_htlc message to be sent or received from a peer
5240  */
5241 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5242    /**
5243     * A pointer to the opaque Rust object.
5244     * Nearly everywhere, inner must be non-null, however in places where
5245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5246     */
5247    LDKnativeUpdateFulfillHTLC *inner;
5248    /**
5249     * Indicates that this is the only struct which contains the same pointer.
5250     * Rust functions which take ownership of an object provided via an argument require
5251     * this to be true and invalidate the object pointed to by inner.
5252     */
5253    bool is_owned;
5254 } LDKUpdateFulfillHTLC;
5255
5256 /**
5257  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5258  * This corresponds to std::vector in C++
5259  */
5260 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5261    /**
5262     * The elements in the array.
5263     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5264     */
5265    struct LDKUpdateFulfillHTLC *data;
5266    /**
5267     * The number of elements pointed to by `data`.
5268     */
5269    uintptr_t datalen;
5270 } LDKCVec_UpdateFulfillHTLCZ;
5271
5272
5273
5274 /**
5275  * An update_fail_htlc message to be sent or received from a peer
5276  */
5277 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5278    /**
5279     * A pointer to the opaque Rust object.
5280     * Nearly everywhere, inner must be non-null, however in places where
5281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5282     */
5283    LDKnativeUpdateFailHTLC *inner;
5284    /**
5285     * Indicates that this is the only struct which contains the same pointer.
5286     * Rust functions which take ownership of an object provided via an argument require
5287     * this to be true and invalidate the object pointed to by inner.
5288     */
5289    bool is_owned;
5290 } LDKUpdateFailHTLC;
5291
5292 /**
5293  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5294  * This corresponds to std::vector in C++
5295  */
5296 typedef struct LDKCVec_UpdateFailHTLCZ {
5297    /**
5298     * The elements in the array.
5299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5300     */
5301    struct LDKUpdateFailHTLC *data;
5302    /**
5303     * The number of elements pointed to by `data`.
5304     */
5305    uintptr_t datalen;
5306 } LDKCVec_UpdateFailHTLCZ;
5307
5308
5309
5310 /**
5311  * An update_fail_malformed_htlc message to be sent or received from a peer
5312  */
5313 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5314    /**
5315     * A pointer to the opaque Rust object.
5316     * Nearly everywhere, inner must be non-null, however in places where
5317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5318     */
5319    LDKnativeUpdateFailMalformedHTLC *inner;
5320    /**
5321     * Indicates that this is the only struct which contains the same pointer.
5322     * Rust functions which take ownership of an object provided via an argument require
5323     * this to be true and invalidate the object pointed to by inner.
5324     */
5325    bool is_owned;
5326 } LDKUpdateFailMalformedHTLC;
5327
5328 /**
5329  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5330  * This corresponds to std::vector in C++
5331  */
5332 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5333    /**
5334     * The elements in the array.
5335     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5336     */
5337    struct LDKUpdateFailMalformedHTLC *data;
5338    /**
5339     * The number of elements pointed to by `data`.
5340     */
5341    uintptr_t datalen;
5342 } LDKCVec_UpdateFailMalformedHTLCZ;
5343
5344 /**
5345  * The contents of CResult_AcceptChannelDecodeErrorZ
5346  */
5347 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5348    /**
5349     * A pointer to the contents in the success state.
5350     * Reading from this pointer when `result_ok` is not set is undefined.
5351     */
5352    struct LDKAcceptChannel *result;
5353    /**
5354     * A pointer to the contents in the error state.
5355     * Reading from this pointer when `result_ok` is set is undefined.
5356     */
5357    struct LDKDecodeError *err;
5358 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5359
5360 /**
5361  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5362  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5364  */
5365 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5366    /**
5367     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5368     * `err` or `result` depending on the state of `result_ok`.
5369     */
5370    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5371    /**
5372     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5373     */
5374    bool result_ok;
5375 } LDKCResult_AcceptChannelDecodeErrorZ;
5376
5377 /**
5378  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5379  */
5380 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
5381    /**
5382     * A pointer to the contents in the success state.
5383     * Reading from this pointer when `result_ok` is not set is undefined.
5384     */
5385    struct LDKAnnouncementSignatures *result;
5386    /**
5387     * A pointer to the contents in the error state.
5388     * Reading from this pointer when `result_ok` is set is undefined.
5389     */
5390    struct LDKDecodeError *err;
5391 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
5392
5393 /**
5394  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5395  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5397  */
5398 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
5399    /**
5400     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5401     * `err` or `result` depending on the state of `result_ok`.
5402     */
5403    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5404    /**
5405     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5406     */
5407    bool result_ok;
5408 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5409
5410 /**
5411  * The contents of CResult_ChannelReestablishDecodeErrorZ
5412  */
5413 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
5414    /**
5415     * A pointer to the contents in the success state.
5416     * Reading from this pointer when `result_ok` is not set is undefined.
5417     */
5418    struct LDKChannelReestablish *result;
5419    /**
5420     * A pointer to the contents in the error state.
5421     * Reading from this pointer when `result_ok` is set is undefined.
5422     */
5423    struct LDKDecodeError *err;
5424 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
5425
5426 /**
5427  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5428  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5429  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5430  */
5431 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
5432    /**
5433     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5434     * `err` or `result` depending on the state of `result_ok`.
5435     */
5436    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5437    /**
5438     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5439     */
5440    bool result_ok;
5441 } LDKCResult_ChannelReestablishDecodeErrorZ;
5442
5443 /**
5444  * The contents of CResult_ClosingSignedDecodeErrorZ
5445  */
5446 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
5447    /**
5448     * A pointer to the contents in the success state.
5449     * Reading from this pointer when `result_ok` is not set is undefined.
5450     */
5451    struct LDKClosingSigned *result;
5452    /**
5453     * A pointer to the contents in the error state.
5454     * Reading from this pointer when `result_ok` is set is undefined.
5455     */
5456    struct LDKDecodeError *err;
5457 } LDKCResult_ClosingSignedDecodeErrorZPtr;
5458
5459 /**
5460  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5461  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5462  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5463  */
5464 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
5465    /**
5466     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5467     * `err` or `result` depending on the state of `result_ok`.
5468     */
5469    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5470    /**
5471     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5472     */
5473    bool result_ok;
5474 } LDKCResult_ClosingSignedDecodeErrorZ;
5475
5476
5477
5478 /**
5479  * A commitment_signed message to be sent or received from a peer
5480  */
5481 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5482    /**
5483     * A pointer to the opaque Rust object.
5484     * Nearly everywhere, inner must be non-null, however in places where
5485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5486     */
5487    LDKnativeCommitmentSigned *inner;
5488    /**
5489     * Indicates that this is the only struct which contains the same pointer.
5490     * Rust functions which take ownership of an object provided via an argument require
5491     * this to be true and invalidate the object pointed to by inner.
5492     */
5493    bool is_owned;
5494 } LDKCommitmentSigned;
5495
5496 /**
5497  * The contents of CResult_CommitmentSignedDecodeErrorZ
5498  */
5499 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
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 LDKCommitmentSigned *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_CommitmentSignedDecodeErrorZPtr;
5511
5512 /**
5513  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5514  * containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
5518    /**
5519     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5520     * `err` or `result` depending on the state of `result_ok`.
5521     */
5522    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5523    /**
5524     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5525     */
5526    bool result_ok;
5527 } LDKCResult_CommitmentSignedDecodeErrorZ;
5528
5529 /**
5530  * The contents of CResult_FundingCreatedDecodeErrorZ
5531  */
5532 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
5533    /**
5534     * A pointer to the contents in the success state.
5535     * Reading from this pointer when `result_ok` is not set is undefined.
5536     */
5537    struct LDKFundingCreated *result;
5538    /**
5539     * A pointer to the contents in the error state.
5540     * Reading from this pointer when `result_ok` is set is undefined.
5541     */
5542    struct LDKDecodeError *err;
5543 } LDKCResult_FundingCreatedDecodeErrorZPtr;
5544
5545 /**
5546  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5547  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5549  */
5550 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
5551    /**
5552     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5553     * `err` or `result` depending on the state of `result_ok`.
5554     */
5555    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5556    /**
5557     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5558     */
5559    bool result_ok;
5560 } LDKCResult_FundingCreatedDecodeErrorZ;
5561
5562 /**
5563  * The contents of CResult_FundingSignedDecodeErrorZ
5564  */
5565 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
5566    /**
5567     * A pointer to the contents in the success state.
5568     * Reading from this pointer when `result_ok` is not set is undefined.
5569     */
5570    struct LDKFundingSigned *result;
5571    /**
5572     * A pointer to the contents in the error state.
5573     * Reading from this pointer when `result_ok` is set is undefined.
5574     */
5575    struct LDKDecodeError *err;
5576 } LDKCResult_FundingSignedDecodeErrorZPtr;
5577
5578 /**
5579  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5580  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5582  */
5583 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
5584    /**
5585     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5586     * `err` or `result` depending on the state of `result_ok`.
5587     */
5588    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5589    /**
5590     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5591     */
5592    bool result_ok;
5593 } LDKCResult_FundingSignedDecodeErrorZ;
5594
5595 /**
5596  * The contents of CResult_FundingLockedDecodeErrorZ
5597  */
5598 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
5599    /**
5600     * A pointer to the contents in the success state.
5601     * Reading from this pointer when `result_ok` is not set is undefined.
5602     */
5603    struct LDKFundingLocked *result;
5604    /**
5605     * A pointer to the contents in the error state.
5606     * Reading from this pointer when `result_ok` is set is undefined.
5607     */
5608    struct LDKDecodeError *err;
5609 } LDKCResult_FundingLockedDecodeErrorZPtr;
5610
5611 /**
5612  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5613  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5615  */
5616 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
5617    /**
5618     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5619     * `err` or `result` depending on the state of `result_ok`.
5620     */
5621    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5622    /**
5623     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5624     */
5625    bool result_ok;
5626 } LDKCResult_FundingLockedDecodeErrorZ;
5627
5628
5629
5630 /**
5631  * An init message to be sent or received from a peer
5632  */
5633 typedef struct MUST_USE_STRUCT LDKInit {
5634    /**
5635     * A pointer to the opaque Rust object.
5636     * Nearly everywhere, inner must be non-null, however in places where
5637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5638     */
5639    LDKnativeInit *inner;
5640    /**
5641     * Indicates that this is the only struct which contains the same pointer.
5642     * Rust functions which take ownership of an object provided via an argument require
5643     * this to be true and invalidate the object pointed to by inner.
5644     */
5645    bool is_owned;
5646 } LDKInit;
5647
5648 /**
5649  * The contents of CResult_InitDecodeErrorZ
5650  */
5651 typedef union LDKCResult_InitDecodeErrorZPtr {
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 LDKInit *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_InitDecodeErrorZPtr;
5663
5664 /**
5665  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5666  * containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
5670    /**
5671     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5672     * `err` or `result` depending on the state of `result_ok`.
5673     */
5674    union LDKCResult_InitDecodeErrorZPtr contents;
5675    /**
5676     * Whether this CResult_InitDecodeErrorZ represents a success state.
5677     */
5678    bool result_ok;
5679 } LDKCResult_InitDecodeErrorZ;
5680
5681 /**
5682  * The contents of CResult_OpenChannelDecodeErrorZ
5683  */
5684 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
5685    /**
5686     * A pointer to the contents in the success state.
5687     * Reading from this pointer when `result_ok` is not set is undefined.
5688     */
5689    struct LDKOpenChannel *result;
5690    /**
5691     * A pointer to the contents in the error state.
5692     * Reading from this pointer when `result_ok` is set is undefined.
5693     */
5694    struct LDKDecodeError *err;
5695 } LDKCResult_OpenChannelDecodeErrorZPtr;
5696
5697 /**
5698  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5699  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5700  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5701  */
5702 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
5703    /**
5704     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5705     * `err` or `result` depending on the state of `result_ok`.
5706     */
5707    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5708    /**
5709     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5710     */
5711    bool result_ok;
5712 } LDKCResult_OpenChannelDecodeErrorZ;
5713
5714 /**
5715  * The contents of CResult_RevokeAndACKDecodeErrorZ
5716  */
5717 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
5718    /**
5719     * A pointer to the contents in the success state.
5720     * Reading from this pointer when `result_ok` is not set is undefined.
5721     */
5722    struct LDKRevokeAndACK *result;
5723    /**
5724     * A pointer to the contents in the error state.
5725     * Reading from this pointer when `result_ok` is set is undefined.
5726     */
5727    struct LDKDecodeError *err;
5728 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5729
5730 /**
5731  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5732  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5733  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5734  */
5735 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5736    /**
5737     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5738     * `err` or `result` depending on the state of `result_ok`.
5739     */
5740    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5741    /**
5742     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5743     */
5744    bool result_ok;
5745 } LDKCResult_RevokeAndACKDecodeErrorZ;
5746
5747 /**
5748  * The contents of CResult_ShutdownDecodeErrorZ
5749  */
5750 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5751    /**
5752     * A pointer to the contents in the success state.
5753     * Reading from this pointer when `result_ok` is not set is undefined.
5754     */
5755    struct LDKShutdown *result;
5756    /**
5757     * A pointer to the contents in the error state.
5758     * Reading from this pointer when `result_ok` is set is undefined.
5759     */
5760    struct LDKDecodeError *err;
5761 } LDKCResult_ShutdownDecodeErrorZPtr;
5762
5763 /**
5764  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5765  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5766  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5767  */
5768 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5769    /**
5770     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5771     * `err` or `result` depending on the state of `result_ok`.
5772     */
5773    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5774    /**
5775     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5776     */
5777    bool result_ok;
5778 } LDKCResult_ShutdownDecodeErrorZ;
5779
5780 /**
5781  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5782  */
5783 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5784    /**
5785     * A pointer to the contents in the success state.
5786     * Reading from this pointer when `result_ok` is not set is undefined.
5787     */
5788    struct LDKUpdateFailHTLC *result;
5789    /**
5790     * A pointer to the contents in the error state.
5791     * Reading from this pointer when `result_ok` is set is undefined.
5792     */
5793    struct LDKDecodeError *err;
5794 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5795
5796 /**
5797  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5798  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5799  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5800  */
5801 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5802    /**
5803     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5804     * `err` or `result` depending on the state of `result_ok`.
5805     */
5806    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5807    /**
5808     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5809     */
5810    bool result_ok;
5811 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5812
5813 /**
5814  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5815  */
5816 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5817    /**
5818     * A pointer to the contents in the success state.
5819     * Reading from this pointer when `result_ok` is not set is undefined.
5820     */
5821    struct LDKUpdateFailMalformedHTLC *result;
5822    /**
5823     * A pointer to the contents in the error state.
5824     * Reading from this pointer when `result_ok` is set is undefined.
5825     */
5826    struct LDKDecodeError *err;
5827 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5828
5829 /**
5830  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5831  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5832  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5833  */
5834 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5835    /**
5836     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5837     * `err` or `result` depending on the state of `result_ok`.
5838     */
5839    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5840    /**
5841     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5842     */
5843    bool result_ok;
5844 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5845
5846
5847
5848 /**
5849  * An update_fee message to be sent or received from a peer
5850  */
5851 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5852    /**
5853     * A pointer to the opaque Rust object.
5854     * Nearly everywhere, inner must be non-null, however in places where
5855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5856     */
5857    LDKnativeUpdateFee *inner;
5858    /**
5859     * Indicates that this is the only struct which contains the same pointer.
5860     * Rust functions which take ownership of an object provided via an argument require
5861     * this to be true and invalidate the object pointed to by inner.
5862     */
5863    bool is_owned;
5864 } LDKUpdateFee;
5865
5866 /**
5867  * The contents of CResult_UpdateFeeDecodeErrorZ
5868  */
5869 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
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 LDKUpdateFee *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_UpdateFeeDecodeErrorZPtr;
5881
5882 /**
5883  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5884  * containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
5888    /**
5889     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5890     * `err` or `result` depending on the state of `result_ok`.
5891     */
5892    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5893    /**
5894     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5895     */
5896    bool result_ok;
5897 } LDKCResult_UpdateFeeDecodeErrorZ;
5898
5899 /**
5900  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5901  */
5902 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5903    /**
5904     * A pointer to the contents in the success state.
5905     * Reading from this pointer when `result_ok` is not set is undefined.
5906     */
5907    struct LDKUpdateFulfillHTLC *result;
5908    /**
5909     * A pointer to the contents in the error state.
5910     * Reading from this pointer when `result_ok` is set is undefined.
5911     */
5912    struct LDKDecodeError *err;
5913 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5914
5915 /**
5916  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5917  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5919  */
5920 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5921    /**
5922     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5923     * `err` or `result` depending on the state of `result_ok`.
5924     */
5925    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5926    /**
5927     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5928     */
5929    bool result_ok;
5930 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5931
5932 /**
5933  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5934  */
5935 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5936    /**
5937     * A pointer to the contents in the success state.
5938     * Reading from this pointer when `result_ok` is not set is undefined.
5939     */
5940    struct LDKUpdateAddHTLC *result;
5941    /**
5942     * A pointer to the contents in the error state.
5943     * Reading from this pointer when `result_ok` is set is undefined.
5944     */
5945    struct LDKDecodeError *err;
5946 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5947
5948 /**
5949  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5950  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5951  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5952  */
5953 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5954    /**
5955     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5956     * `err` or `result` depending on the state of `result_ok`.
5957     */
5958    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5959    /**
5960     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5961     */
5962    bool result_ok;
5963 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5964
5965
5966
5967 /**
5968  * A ping message to be sent or received from a peer
5969  */
5970 typedef struct MUST_USE_STRUCT LDKPing {
5971    /**
5972     * A pointer to the opaque Rust object.
5973     * Nearly everywhere, inner must be non-null, however in places where
5974     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5975     */
5976    LDKnativePing *inner;
5977    /**
5978     * Indicates that this is the only struct which contains the same pointer.
5979     * Rust functions which take ownership of an object provided via an argument require
5980     * this to be true and invalidate the object pointed to by inner.
5981     */
5982    bool is_owned;
5983 } LDKPing;
5984
5985 /**
5986  * The contents of CResult_PingDecodeErrorZ
5987  */
5988 typedef union LDKCResult_PingDecodeErrorZPtr {
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 LDKPing *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_PingDecodeErrorZPtr;
6000
6001 /**
6002  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6003  * containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
6007    /**
6008     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6009     * `err` or `result` depending on the state of `result_ok`.
6010     */
6011    union LDKCResult_PingDecodeErrorZPtr contents;
6012    /**
6013     * Whether this CResult_PingDecodeErrorZ represents a success state.
6014     */
6015    bool result_ok;
6016 } LDKCResult_PingDecodeErrorZ;
6017
6018
6019
6020 /**
6021  * A pong message to be sent or received from a peer
6022  */
6023 typedef struct MUST_USE_STRUCT LDKPong {
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    LDKnativePong *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 } LDKPong;
6037
6038 /**
6039  * The contents of CResult_PongDecodeErrorZ
6040  */
6041 typedef union LDKCResult_PongDecodeErrorZPtr {
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 LDKPong *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_PongDecodeErrorZPtr;
6053
6054 /**
6055  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6056  * containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
6060    /**
6061     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6062     * `err` or `result` depending on the state of `result_ok`.
6063     */
6064    union LDKCResult_PongDecodeErrorZPtr contents;
6065    /**
6066     * Whether this CResult_PongDecodeErrorZ represents a success state.
6067     */
6068    bool result_ok;
6069 } LDKCResult_PongDecodeErrorZ;
6070
6071 /**
6072  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6073  */
6074 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6075    /**
6076     * A pointer to the contents in the success state.
6077     * Reading from this pointer when `result_ok` is not set is undefined.
6078     */
6079    struct LDKUnsignedChannelAnnouncement *result;
6080    /**
6081     * A pointer to the contents in the error state.
6082     * Reading from this pointer when `result_ok` is set is undefined.
6083     */
6084    struct LDKDecodeError *err;
6085 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
6086
6087 /**
6088  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6089  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6091  */
6092 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
6093    /**
6094     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6095     * `err` or `result` depending on the state of `result_ok`.
6096     */
6097    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6098    /**
6099     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6100     */
6101    bool result_ok;
6102 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6103
6104 /**
6105  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6106  */
6107 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
6108    /**
6109     * A pointer to the contents in the success state.
6110     * Reading from this pointer when `result_ok` is not set is undefined.
6111     */
6112    struct LDKChannelAnnouncement *result;
6113    /**
6114     * A pointer to the contents in the error state.
6115     * Reading from this pointer when `result_ok` is set is undefined.
6116     */
6117    struct LDKDecodeError *err;
6118 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
6119
6120 /**
6121  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6122  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6123  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6124  */
6125 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
6126    /**
6127     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6128     * `err` or `result` depending on the state of `result_ok`.
6129     */
6130    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6131    /**
6132     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6133     */
6134    bool result_ok;
6135 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6136
6137
6138
6139 /**
6140  * The unsigned part of a channel_update
6141  */
6142 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6143    /**
6144     * A pointer to the opaque Rust object.
6145     * Nearly everywhere, inner must be non-null, however in places where
6146     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6147     */
6148    LDKnativeUnsignedChannelUpdate *inner;
6149    /**
6150     * Indicates that this is the only struct which contains the same pointer.
6151     * Rust functions which take ownership of an object provided via an argument require
6152     * this to be true and invalidate the object pointed to by inner.
6153     */
6154    bool is_owned;
6155 } LDKUnsignedChannelUpdate;
6156
6157 /**
6158  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6159  */
6160 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
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 LDKUnsignedChannelUpdate *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_UnsignedChannelUpdateDecodeErrorZPtr;
6172
6173 /**
6174  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6175  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
6179    /**
6180     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6181     * `err` or `result` depending on the state of `result_ok`.
6182     */
6183    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6184    /**
6185     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6186     */
6187    bool result_ok;
6188 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6189
6190 /**
6191  * The contents of CResult_ChannelUpdateDecodeErrorZ
6192  */
6193 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
6194    /**
6195     * A pointer to the contents in the success state.
6196     * Reading from this pointer when `result_ok` is not set is undefined.
6197     */
6198    struct LDKChannelUpdate *result;
6199    /**
6200     * A pointer to the contents in the error state.
6201     * Reading from this pointer when `result_ok` is set is undefined.
6202     */
6203    struct LDKDecodeError *err;
6204 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
6205
6206 /**
6207  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6208  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6210  */
6211 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
6212    /**
6213     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6214     * `err` or `result` depending on the state of `result_ok`.
6215     */
6216    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6217    /**
6218     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6219     */
6220    bool result_ok;
6221 } LDKCResult_ChannelUpdateDecodeErrorZ;
6222
6223 /**
6224  * The contents of CResult_ErrorMessageDecodeErrorZ
6225  */
6226 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
6227    /**
6228     * A pointer to the contents in the success state.
6229     * Reading from this pointer when `result_ok` is not set is undefined.
6230     */
6231    struct LDKErrorMessage *result;
6232    /**
6233     * A pointer to the contents in the error state.
6234     * Reading from this pointer when `result_ok` is set is undefined.
6235     */
6236    struct LDKDecodeError *err;
6237 } LDKCResult_ErrorMessageDecodeErrorZPtr;
6238
6239 /**
6240  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6241  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
6242  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6243  */
6244 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
6245    /**
6246     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6247     * `err` or `result` depending on the state of `result_ok`.
6248     */
6249    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6250    /**
6251     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6252     */
6253    bool result_ok;
6254 } LDKCResult_ErrorMessageDecodeErrorZ;
6255
6256
6257
6258 /**
6259  * The unsigned part of a node_announcement
6260  */
6261 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6262    /**
6263     * A pointer to the opaque Rust object.
6264     * Nearly everywhere, inner must be non-null, however in places where
6265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6266     */
6267    LDKnativeUnsignedNodeAnnouncement *inner;
6268    /**
6269     * Indicates that this is the only struct which contains the same pointer.
6270     * Rust functions which take ownership of an object provided via an argument require
6271     * this to be true and invalidate the object pointed to by inner.
6272     */
6273    bool is_owned;
6274 } LDKUnsignedNodeAnnouncement;
6275
6276 /**
6277  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6278  */
6279 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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 LDKUnsignedNodeAnnouncement *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_UnsignedNodeAnnouncementDecodeErrorZPtr;
6291
6292 /**
6293  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6294  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_UnsignedNodeAnnouncementDecodeErrorZ {
6298    /**
6299     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6300     * `err` or `result` depending on the state of `result_ok`.
6301     */
6302    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6303    /**
6304     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6305     */
6306    bool result_ok;
6307 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6308
6309 /**
6310  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6311  */
6312 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
6313    /**
6314     * A pointer to the contents in the success state.
6315     * Reading from this pointer when `result_ok` is not set is undefined.
6316     */
6317    struct LDKNodeAnnouncement *result;
6318    /**
6319     * A pointer to the contents in the error state.
6320     * Reading from this pointer when `result_ok` is set is undefined.
6321     */
6322    struct LDKDecodeError *err;
6323 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
6324
6325 /**
6326  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6327  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6329  */
6330 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
6331    /**
6332     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6333     * `err` or `result` depending on the state of `result_ok`.
6334     */
6335    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6336    /**
6337     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6338     */
6339    bool result_ok;
6340 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6341
6342 /**
6343  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6344  */
6345 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
6346    /**
6347     * A pointer to the contents in the success state.
6348     * Reading from this pointer when `result_ok` is not set is undefined.
6349     */
6350    struct LDKQueryShortChannelIds *result;
6351    /**
6352     * A pointer to the contents in the error state.
6353     * Reading from this pointer when `result_ok` is set is undefined.
6354     */
6355    struct LDKDecodeError *err;
6356 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
6357
6358 /**
6359  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6360  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
6361  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6362  */
6363 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
6364    /**
6365     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6366     * `err` or `result` depending on the state of `result_ok`.
6367     */
6368    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6369    /**
6370     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6371     */
6372    bool result_ok;
6373 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6374
6375
6376
6377 /**
6378  * A reply_short_channel_ids_end message is sent as a reply to a
6379  * query_short_channel_ids message. The query recipient makes a best
6380  * effort to respond based on their local network view which may not be
6381  * a perfect view of the network.
6382  */
6383 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6384    /**
6385     * A pointer to the opaque Rust object.
6386     * Nearly everywhere, inner must be non-null, however in places where
6387     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6388     */
6389    LDKnativeReplyShortChannelIdsEnd *inner;
6390    /**
6391     * Indicates that this is the only struct which contains the same pointer.
6392     * Rust functions which take ownership of an object provided via an argument require
6393     * this to be true and invalidate the object pointed to by inner.
6394     */
6395    bool is_owned;
6396 } LDKReplyShortChannelIdsEnd;
6397
6398 /**
6399  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6400  */
6401 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6402    /**
6403     * A pointer to the contents in the success state.
6404     * Reading from this pointer when `result_ok` is not set is undefined.
6405     */
6406    struct LDKReplyShortChannelIdsEnd *result;
6407    /**
6408     * A pointer to the contents in the error state.
6409     * Reading from this pointer when `result_ok` is set is undefined.
6410     */
6411    struct LDKDecodeError *err;
6412 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6413
6414 /**
6415  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6416  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
6417  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6418  */
6419 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6420    /**
6421     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6422     * `err` or `result` depending on the state of `result_ok`.
6423     */
6424    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6425    /**
6426     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6427     */
6428    bool result_ok;
6429 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6430
6431 /**
6432  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6433  */
6434 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
6435    /**
6436     * A pointer to the contents in the success state.
6437     * Reading from this pointer when `result_ok` is not set is undefined.
6438     */
6439    struct LDKQueryChannelRange *result;
6440    /**
6441     * A pointer to the contents in the error state.
6442     * Reading from this pointer when `result_ok` is set is undefined.
6443     */
6444    struct LDKDecodeError *err;
6445 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
6446
6447 /**
6448  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6449  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6450  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6451  */
6452 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
6453    /**
6454     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6455     * `err` or `result` depending on the state of `result_ok`.
6456     */
6457    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6458    /**
6459     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6460     */
6461    bool result_ok;
6462 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6463
6464 /**
6465  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6466  */
6467 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
6468    /**
6469     * A pointer to the contents in the success state.
6470     * Reading from this pointer when `result_ok` is not set is undefined.
6471     */
6472    struct LDKReplyChannelRange *result;
6473    /**
6474     * A pointer to the contents in the error state.
6475     * Reading from this pointer when `result_ok` is set is undefined.
6476     */
6477    struct LDKDecodeError *err;
6478 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
6479
6480 /**
6481  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6482  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6483  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6484  */
6485 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
6486    /**
6487     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6488     * `err` or `result` depending on the state of `result_ok`.
6489     */
6490    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6491    /**
6492     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6493     */
6494    bool result_ok;
6495 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6496
6497
6498
6499 /**
6500  * A gossip_timestamp_filter message is used by a node to request
6501  * gossip relay for messages in the requested time range when the
6502  * gossip_queries feature has been negotiated.
6503  */
6504 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6505    /**
6506     * A pointer to the opaque Rust object.
6507     * Nearly everywhere, inner must be non-null, however in places where
6508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6509     */
6510    LDKnativeGossipTimestampFilter *inner;
6511    /**
6512     * Indicates that this is the only struct which contains the same pointer.
6513     * Rust functions which take ownership of an object provided via an argument require
6514     * this to be true and invalidate the object pointed to by inner.
6515     */
6516    bool is_owned;
6517 } LDKGossipTimestampFilter;
6518
6519 /**
6520  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6521  */
6522 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6523    /**
6524     * A pointer to the contents in the success state.
6525     * Reading from this pointer when `result_ok` is not set is undefined.
6526     */
6527    struct LDKGossipTimestampFilter *result;
6528    /**
6529     * A pointer to the contents in the error state.
6530     * Reading from this pointer when `result_ok` is set is undefined.
6531     */
6532    struct LDKDecodeError *err;
6533 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6534
6535 /**
6536  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6537  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
6538  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6539  */
6540 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6541    /**
6542     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6543     * `err` or `result` depending on the state of `result_ok`.
6544     */
6545    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6546    /**
6547     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6548     */
6549    bool result_ok;
6550 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6551
6552 /**
6553  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
6554  * may occur.
6555  */
6556 typedef enum LDKSignOrCreationError_Tag {
6557    /**
6558     * An error occurred during signing
6559     */
6560    LDKSignOrCreationError_SignError,
6561    /**
6562     * An error occurred while building the transaction
6563     */
6564    LDKSignOrCreationError_CreationError,
6565    /**
6566     * Must be last for serialization purposes
6567     */
6568    LDKSignOrCreationError_Sentinel,
6569 } LDKSignOrCreationError_Tag;
6570
6571 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
6572    LDKSignOrCreationError_Tag tag;
6573    union {
6574       struct {
6575          enum LDKCreationError creation_error;
6576       };
6577    };
6578 } LDKSignOrCreationError;
6579
6580 /**
6581  * The contents of CResult_InvoiceSignOrCreationErrorZ
6582  */
6583 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
6584    /**
6585     * A pointer to the contents in the success state.
6586     * Reading from this pointer when `result_ok` is not set is undefined.
6587     */
6588    struct LDKInvoice *result;
6589    /**
6590     * A pointer to the contents in the error state.
6591     * Reading from this pointer when `result_ok` is set is undefined.
6592     */
6593    struct LDKSignOrCreationError *err;
6594 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
6595
6596 /**
6597  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
6598  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
6599  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6600  */
6601 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
6602    /**
6603     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
6604     * `err` or `result` depending on the state of `result_ok`.
6605     */
6606    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
6607    /**
6608     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
6609     */
6610    bool result_ok;
6611 } LDKCResult_InvoiceSignOrCreationErrorZ;
6612
6613 /**
6614  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6615  */
6616 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6617    /**
6618     * A pointer to the contents in the success state.
6619     * Reading from this pointer when `result_ok` is not set is undefined.
6620     */
6621    struct LDKSpendableOutputDescriptor *result;
6622    /**
6623     * A pointer to the contents in the error state.
6624     * Reading from this pointer when `result_ok` is set is undefined.
6625     */
6626    struct LDKDecodeError *err;
6627 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6628
6629 /**
6630  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6631  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6633  */
6634 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6635    /**
6636     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6637     * `err` or `result` depending on the state of `result_ok`.
6638     */
6639    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6640    /**
6641     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6642     */
6643    bool result_ok;
6644 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6645
6646 /**
6647  * The contents of CResult_SignDecodeErrorZ
6648  */
6649 typedef union LDKCResult_SignDecodeErrorZPtr {
6650    /**
6651     * A pointer to the contents in the success state.
6652     * Reading from this pointer when `result_ok` is not set is undefined.
6653     */
6654    struct LDKSign *result;
6655    /**
6656     * A pointer to the contents in the error state.
6657     * Reading from this pointer when `result_ok` is set is undefined.
6658     */
6659    struct LDKDecodeError *err;
6660 } LDKCResult_SignDecodeErrorZPtr;
6661
6662 /**
6663  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6664  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6666  */
6667 typedef struct LDKCResult_SignDecodeErrorZ {
6668    /**
6669     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6670     * `err` or `result` depending on the state of `result_ok`.
6671     */
6672    union LDKCResult_SignDecodeErrorZPtr contents;
6673    /**
6674     * Whether this CResult_SignDecodeErrorZ represents a success state.
6675     */
6676    bool result_ok;
6677 } LDKCResult_SignDecodeErrorZ;
6678
6679 /**
6680  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6681  * allows recovering the exact public key which created the signature given the message.
6682  */
6683 typedef struct LDKRecoverableSignature {
6684    /**
6685     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6686     * recovery.
6687     */
6688    uint8_t serialized_form[68];
6689 } LDKRecoverableSignature;
6690
6691 /**
6692  * The contents of CResult_RecoverableSignatureNoneZ
6693  */
6694 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6695    /**
6696     * A pointer to the contents in the success state.
6697     * Reading from this pointer when `result_ok` is not set is undefined.
6698     */
6699    struct LDKRecoverableSignature *result;
6700    /**
6701     * Note that this value is always NULL, as there are no contents in the Err variant
6702     */
6703    void *err;
6704 } LDKCResult_RecoverableSignatureNoneZPtr;
6705
6706 /**
6707  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6708  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6710  */
6711 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6712    /**
6713     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6714     * `err` or `result` depending on the state of `result_ok`.
6715     */
6716    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6717    /**
6718     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6719     */
6720    bool result_ok;
6721 } LDKCResult_RecoverableSignatureNoneZ;
6722
6723 /**
6724  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6725  * This corresponds to std::vector in C++
6726  */
6727 typedef struct LDKCVec_CVec_u8ZZ {
6728    /**
6729     * The elements in the array.
6730     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6731     */
6732    struct LDKCVec_u8Z *data;
6733    /**
6734     * The number of elements pointed to by `data`.
6735     */
6736    uintptr_t datalen;
6737 } LDKCVec_CVec_u8ZZ;
6738
6739 /**
6740  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6741  */
6742 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6743    /**
6744     * A pointer to the contents in the success state.
6745     * Reading from this pointer when `result_ok` is not set is undefined.
6746     */
6747    struct LDKCVec_CVec_u8ZZ *result;
6748    /**
6749     * Note that this value is always NULL, as there are no contents in the Err variant
6750     */
6751    void *err;
6752 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6753
6754 /**
6755  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6756  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6757  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6758  */
6759 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6760    /**
6761     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6762     * `err` or `result` depending on the state of `result_ok`.
6763     */
6764    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6765    /**
6766     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6767     */
6768    bool result_ok;
6769 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6770
6771
6772
6773 /**
6774  * A simple implementation of Sign that just keeps the private keys in memory.
6775  *
6776  * This implementation performs no policy checks and is insufficient by itself as
6777  * a secure external signer.
6778  */
6779 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6780    /**
6781     * A pointer to the opaque Rust object.
6782     * Nearly everywhere, inner must be non-null, however in places where
6783     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6784     */
6785    LDKnativeInMemorySigner *inner;
6786    /**
6787     * Indicates that this is the only struct which contains the same pointer.
6788     * Rust functions which take ownership of an object provided via an argument require
6789     * this to be true and invalidate the object pointed to by inner.
6790     */
6791    bool is_owned;
6792 } LDKInMemorySigner;
6793
6794 /**
6795  * The contents of CResult_InMemorySignerDecodeErrorZ
6796  */
6797 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6798    /**
6799     * A pointer to the contents in the success state.
6800     * Reading from this pointer when `result_ok` is not set is undefined.
6801     */
6802    struct LDKInMemorySigner *result;
6803    /**
6804     * A pointer to the contents in the error state.
6805     * Reading from this pointer when `result_ok` is set is undefined.
6806     */
6807    struct LDKDecodeError *err;
6808 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6809
6810 /**
6811  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6812  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6813  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6814  */
6815 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6816    /**
6817     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6818     * `err` or `result` depending on the state of `result_ok`.
6819     */
6820    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6821    /**
6822     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6823     */
6824    bool result_ok;
6825 } LDKCResult_InMemorySignerDecodeErrorZ;
6826
6827 /**
6828  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6829  * This corresponds to std::vector in C++
6830  */
6831 typedef struct LDKCVec_TxOutZ {
6832    /**
6833     * The elements in the array.
6834     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6835     */
6836    struct LDKTxOut *data;
6837    /**
6838     * The number of elements pointed to by `data`.
6839     */
6840    uintptr_t datalen;
6841 } LDKCVec_TxOutZ;
6842
6843 /**
6844  * The contents of CResult_TransactionNoneZ
6845  */
6846 typedef union LDKCResult_TransactionNoneZPtr {
6847    /**
6848     * A pointer to the contents in the success state.
6849     * Reading from this pointer when `result_ok` is not set is undefined.
6850     */
6851    struct LDKTransaction *result;
6852    /**
6853     * Note that this value is always NULL, as there are no contents in the Err variant
6854     */
6855    void *err;
6856 } LDKCResult_TransactionNoneZPtr;
6857
6858 /**
6859  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6860  * containing a crate::c_types::Transaction on success and a () on failure.
6861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6862  */
6863 typedef struct LDKCResult_TransactionNoneZ {
6864    /**
6865     * The contents of this CResult_TransactionNoneZ, accessible via either
6866     * `err` or `result` depending on the state of `result_ok`.
6867     */
6868    union LDKCResult_TransactionNoneZPtr contents;
6869    /**
6870     * Whether this CResult_TransactionNoneZ represents a success state.
6871     */
6872    bool result_ok;
6873 } LDKCResult_TransactionNoneZ;
6874
6875 /**
6876  * The contents of CResult_NoneErrorZ
6877  */
6878 typedef union LDKCResult_NoneErrorZPtr {
6879    /**
6880     * Note that this value is always NULL, as there are no contents in the OK variant
6881     */
6882    void *result;
6883    /**
6884     * A pointer to the contents in the error state.
6885     * Reading from this pointer when `result_ok` is set is undefined.
6886     */
6887    enum LDKIOError *err;
6888 } LDKCResult_NoneErrorZPtr;
6889
6890 /**
6891  * A CResult_NoneErrorZ represents the result of a fallible operation,
6892  * containing a () on success and a crate::c_types::IOError on failure.
6893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6894  */
6895 typedef struct LDKCResult_NoneErrorZ {
6896    /**
6897     * The contents of this CResult_NoneErrorZ, accessible via either
6898     * `err` or `result` depending on the state of `result_ok`.
6899     */
6900    union LDKCResult_NoneErrorZPtr contents;
6901    /**
6902     * Whether this CResult_NoneErrorZ represents a success state.
6903     */
6904    bool result_ok;
6905 } LDKCResult_NoneErrorZ;
6906
6907 /**
6908  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6909  * This corresponds to std::vector in C++
6910  */
6911 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6912    /**
6913     * The elements in the array.
6914     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6915     */
6916    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6917    /**
6918     * The number of elements pointed to by `data`.
6919     */
6920    uintptr_t datalen;
6921 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6922
6923 /**
6924  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6925  */
6926 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6927    /**
6928     * A pointer to the contents in the success state.
6929     * Reading from this pointer when `result_ok` is not set is undefined.
6930     */
6931    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6932    /**
6933     * A pointer to the contents in the error state.
6934     * Reading from this pointer when `result_ok` is set is undefined.
6935     */
6936    enum LDKIOError *err;
6937 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6938
6939 /**
6940  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6941  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6943  */
6944 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6945    /**
6946     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6947     * `err` or `result` depending on the state of `result_ok`.
6948     */
6949    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6950    /**
6951     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6952     */
6953    bool result_ok;
6954 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6955
6956 /**
6957  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6958  * too-high values)
6959  */
6960 typedef enum LDKAPIError_Tag {
6961    /**
6962     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6963     * are documented, but generally indicates some precondition of a function was violated.
6964     */
6965    LDKAPIError_APIMisuseError,
6966    /**
6967     * Due to a high feerate, we were unable to complete the request.
6968     * For example, this may be returned if the feerate implies we cannot open a channel at the
6969     * requested value, but opening a larger channel would succeed.
6970     */
6971    LDKAPIError_FeeRateTooHigh,
6972    /**
6973     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6974     * too-many-hops, etc).
6975     */
6976    LDKAPIError_RouteError,
6977    /**
6978     * We were unable to complete the request as the Channel required to do so is unable to
6979     * complete the request (or was not found). This can take many forms, including disconnected
6980     * peer, channel at capacity, channel shutting down, etc.
6981     */
6982    LDKAPIError_ChannelUnavailable,
6983    /**
6984     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6985     * attempted action to fail.
6986     */
6987    LDKAPIError_MonitorUpdateFailed,
6988    /**
6989     * Must be last for serialization purposes
6990     */
6991    LDKAPIError_Sentinel,
6992 } LDKAPIError_Tag;
6993
6994 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6995    /**
6996     * A human-readable error message
6997     */
6998    struct LDKStr err;
6999 } LDKAPIError_LDKAPIMisuseError_Body;
7000
7001 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7002    /**
7003     * A human-readable error message
7004     */
7005    struct LDKStr err;
7006    /**
7007     * The feerate which was too high.
7008     */
7009    uint32_t feerate;
7010 } LDKAPIError_LDKFeeRateTooHigh_Body;
7011
7012 typedef struct LDKAPIError_LDKRouteError_Body {
7013    /**
7014     * A human-readable error message
7015     */
7016    struct LDKStr err;
7017 } LDKAPIError_LDKRouteError_Body;
7018
7019 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7020    /**
7021     * A human-readable error message
7022     */
7023    struct LDKStr err;
7024 } LDKAPIError_LDKChannelUnavailable_Body;
7025
7026 typedef struct MUST_USE_STRUCT LDKAPIError {
7027    LDKAPIError_Tag tag;
7028    union {
7029       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7030       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7031       LDKAPIError_LDKRouteError_Body route_error;
7032       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7033    };
7034 } LDKAPIError;
7035
7036 /**
7037  * The contents of CResult_NoneAPIErrorZ
7038  */
7039 typedef union LDKCResult_NoneAPIErrorZPtr {
7040    /**
7041     * Note that this value is always NULL, as there are no contents in the OK variant
7042     */
7043    void *result;
7044    /**
7045     * A pointer to the contents in the error state.
7046     * Reading from this pointer when `result_ok` is set is undefined.
7047     */
7048    struct LDKAPIError *err;
7049 } LDKCResult_NoneAPIErrorZPtr;
7050
7051 /**
7052  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7053  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7055  */
7056 typedef struct LDKCResult_NoneAPIErrorZ {
7057    /**
7058     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7059     * `err` or `result` depending on the state of `result_ok`.
7060     */
7061    union LDKCResult_NoneAPIErrorZPtr contents;
7062    /**
7063     * Whether this CResult_NoneAPIErrorZ represents a success state.
7064     */
7065    bool result_ok;
7066 } LDKCResult_NoneAPIErrorZ;
7067
7068 /**
7069  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7070  * This corresponds to std::vector in C++
7071  */
7072 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7073    /**
7074     * The elements in the array.
7075     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7076     */
7077    struct LDKCResult_NoneAPIErrorZ *data;
7078    /**
7079     * The number of elements pointed to by `data`.
7080     */
7081    uintptr_t datalen;
7082 } LDKCVec_CResult_NoneAPIErrorZZ;
7083
7084 /**
7085  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7086  * This corresponds to std::vector in C++
7087  */
7088 typedef struct LDKCVec_APIErrorZ {
7089    /**
7090     * The elements in the array.
7091     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7092     */
7093    struct LDKAPIError *data;
7094    /**
7095     * The number of elements pointed to by `data`.
7096     */
7097    uintptr_t datalen;
7098 } LDKCVec_APIErrorZ;
7099
7100 /**
7101  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7102  * Err() type describing which state the payment is in, see the description of individual enum
7103  * states for more.
7104  */
7105 typedef enum LDKPaymentSendFailure_Tag {
7106    /**
7107     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7108     * send the payment at all. No channel state has been changed or messages sent to peers, and
7109     * once you've changed the parameter at error, you can freely retry the payment in full.
7110     */
7111    LDKPaymentSendFailure_ParameterError,
7112    /**
7113     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7114     * from attempting to send the payment at all. No channel state has been changed or messages
7115     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7116     * payment in full.
7117     *
7118     * The results here are ordered the same as the paths in the route object which was passed to
7119     * send_payment.
7120     */
7121    LDKPaymentSendFailure_PathParameterError,
7122    /**
7123     * All paths which were attempted failed to send, with no channel state change taking place.
7124     * You can freely retry the payment in full (though you probably want to do so over different
7125     * paths than the ones selected).
7126     */
7127    LDKPaymentSendFailure_AllFailedRetrySafe,
7128    /**
7129     * Some paths which were attempted failed to send, though possibly not all. At least some
7130     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7131     * in over-/re-payment.
7132     *
7133     * The results here are ordered the same as the paths in the route object which was passed to
7134     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7135     * retried (though there is currently no API with which to do so).
7136     *
7137     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7138     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7139     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7140     * with the latest update_id.
7141     */
7142    LDKPaymentSendFailure_PartialFailure,
7143    /**
7144     * Must be last for serialization purposes
7145     */
7146    LDKPaymentSendFailure_Sentinel,
7147 } LDKPaymentSendFailure_Tag;
7148
7149 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7150    LDKPaymentSendFailure_Tag tag;
7151    union {
7152       struct {
7153          struct LDKAPIError parameter_error;
7154       };
7155       struct {
7156          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7157       };
7158       struct {
7159          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7160       };
7161       struct {
7162          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
7163       };
7164    };
7165 } LDKPaymentSendFailure;
7166
7167 /**
7168  * The contents of CResult_NonePaymentSendFailureZ
7169  */
7170 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7171    /**
7172     * Note that this value is always NULL, as there are no contents in the OK variant
7173     */
7174    void *result;
7175    /**
7176     * A pointer to the contents in the error state.
7177     * Reading from this pointer when `result_ok` is set is undefined.
7178     */
7179    struct LDKPaymentSendFailure *err;
7180 } LDKCResult_NonePaymentSendFailureZPtr;
7181
7182 /**
7183  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7184  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7185  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7186  */
7187 typedef struct LDKCResult_NonePaymentSendFailureZ {
7188    /**
7189     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7190     * `err` or `result` depending on the state of `result_ok`.
7191     */
7192    union LDKCResult_NonePaymentSendFailureZPtr contents;
7193    /**
7194     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7195     */
7196    bool result_ok;
7197 } LDKCResult_NonePaymentSendFailureZ;
7198
7199 /**
7200  * A tuple of 2 elements. See the individual fields for the types contained.
7201  */
7202 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7203    /**
7204     * The element at position 0
7205     */
7206    struct LDKThirtyTwoBytes a;
7207    /**
7208     * The element at position 1
7209     */
7210    struct LDKThirtyTwoBytes b;
7211 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7212
7213 /**
7214  * The contents of CResult_PaymentSecretAPIErrorZ
7215  */
7216 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7217    /**
7218     * A pointer to the contents in the success state.
7219     * Reading from this pointer when `result_ok` is not set is undefined.
7220     */
7221    struct LDKThirtyTwoBytes *result;
7222    /**
7223     * A pointer to the contents in the error state.
7224     * Reading from this pointer when `result_ok` is set is undefined.
7225     */
7226    struct LDKAPIError *err;
7227 } LDKCResult_PaymentSecretAPIErrorZPtr;
7228
7229 /**
7230  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7231  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7233  */
7234 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7235    /**
7236     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7237     * `err` or `result` depending on the state of `result_ok`.
7238     */
7239    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7240    /**
7241     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7242     */
7243    bool result_ok;
7244 } LDKCResult_PaymentSecretAPIErrorZ;
7245
7246 /**
7247  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7248  * This corresponds to std::vector in C++
7249  */
7250 typedef struct LDKCVec_ChannelMonitorZ {
7251    /**
7252     * The elements in the array.
7253     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7254     */
7255    struct LDKChannelMonitor *data;
7256    /**
7257     * The number of elements pointed to by `data`.
7258     */
7259    uintptr_t datalen;
7260 } LDKCVec_ChannelMonitorZ;
7261
7262 /**
7263  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7264  * blocks are connected and disconnected.
7265  *
7266  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7267  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7268  * channel state changes and HTLCs are resolved. See method documentation for specific
7269  * requirements.
7270  *
7271  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7272  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7273  * without taking any further action such as persisting the current state.
7274  *
7275  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7276  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7277  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7278  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7279  * multiple instances.
7280  *
7281  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7282  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7283  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
7284  */
7285 typedef struct LDKWatch {
7286    /**
7287     * An opaque pointer which is passed to your function implementations as an argument.
7288     * This has no meaning in the LDK, and can be NULL or any other value.
7289     */
7290    void *this_arg;
7291    /**
7292     * Watches a channel identified by `funding_txo` using `monitor`.
7293     *
7294     * Implementations are responsible for watching the chain for the funding transaction along
7295     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7296     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7297     *
7298     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7299     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7300     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7301     */
7302    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7303    /**
7304     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7305     *
7306     * Implementations must call [`update_monitor`] with the given update. See
7307     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7308     *
7309     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7310     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7311     */
7312    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7313    /**
7314     * Returns any monitor events since the last call. Subsequent calls must only return new
7315     * events.
7316     */
7317    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
7318    /**
7319     * Frees any resources associated with this object given its this_arg pointer.
7320     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7321     */
7322    void (*free)(void *this_arg);
7323 } LDKWatch;
7324
7325 /**
7326  * An interface to send a transaction to the Bitcoin network.
7327  */
7328 typedef struct LDKBroadcasterInterface {
7329    /**
7330     * An opaque pointer which is passed to your function implementations as an argument.
7331     * This has no meaning in the LDK, and can be NULL or any other value.
7332     */
7333    void *this_arg;
7334    /**
7335     * Sends a transaction out to (hopefully) be mined.
7336     */
7337    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7338    /**
7339     * Frees any resources associated with this object given its this_arg pointer.
7340     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7341     */
7342    void (*free)(void *this_arg);
7343 } LDKBroadcasterInterface;
7344
7345 /**
7346  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7347  * own the memory pointed to by data.
7348  */
7349 typedef struct LDKu8slice {
7350    /**
7351     * A pointer to the byte buffer
7352     */
7353    const uint8_t *data;
7354    /**
7355     * The number of bytes pointed to by `data`.
7356     */
7357    uintptr_t datalen;
7358 } LDKu8slice;
7359
7360 /**
7361  * A trait to describe an object which can get user secrets and key material.
7362  */
7363 typedef struct LDKKeysInterface {
7364    /**
7365     * An opaque pointer which is passed to your function implementations as an argument.
7366     * This has no meaning in the LDK, and can be NULL or any other value.
7367     */
7368    void *this_arg;
7369    /**
7370     * Get node secret key (aka node_id or network_key).
7371     *
7372     * This method must return the same value each time it is called.
7373     */
7374    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
7375    /**
7376     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7377     *
7378     * This method should return a different value each time it is called, to avoid linking
7379     * on-chain funds across channels as controlled to the same user.
7380     */
7381    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7382    /**
7383     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
7384     * a channel.
7385     *
7386     * This method should return a different value each time it is called, to avoid linking
7387     * on-chain funds across channels as controlled to the same user.
7388     */
7389    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
7390    /**
7391     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7392     * restarted with some stale data!
7393     *
7394     * This method must return a different value each time it is called.
7395     */
7396    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7397    /**
7398     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7399     * onion packets and for temporary channel IDs. There is no requirement that these be
7400     * persisted anywhere, though they must be unique across restarts.
7401     *
7402     * This method must return a different value each time it is called.
7403     */
7404    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7405    /**
7406     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7407     * This is only called during deserialization of other objects which contain
7408     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7409     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7410     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7411     * you've read all of the provided bytes to ensure no corruption occurred.
7412     */
7413    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7414    /**
7415     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
7416     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
7417     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7418     * blindly signing the hash.
7419     */
7420    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
7421    /**
7422     * Frees any resources associated with this object given its this_arg pointer.
7423     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7424     */
7425    void (*free)(void *this_arg);
7426 } LDKKeysInterface;
7427
7428 /**
7429  * A trait which should be implemented to provide feerate information on a number of time
7430  * horizons.
7431  *
7432  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7433  * called from inside the library in response to chain events, P2P events, or timer events).
7434  */
7435 typedef struct LDKFeeEstimator {
7436    /**
7437     * An opaque pointer which is passed to your function implementations as an argument.
7438     * This has no meaning in the LDK, and can be NULL or any other value.
7439     */
7440    void *this_arg;
7441    /**
7442     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7443     *
7444     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
7445     * don't put us below 1 satoshi-per-byte).
7446     *
7447     * This translates to:
7448     *  * satoshis-per-byte * 250
7449     *  * ceil(satoshis-per-kbyte / 4)
7450     */
7451    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7452    /**
7453     * Frees any resources associated with this object given its this_arg pointer.
7454     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7455     */
7456    void (*free)(void *this_arg);
7457 } LDKFeeEstimator;
7458
7459 /**
7460  * A trait encapsulating the operations required of a logger
7461  */
7462 typedef struct LDKLogger {
7463    /**
7464     * An opaque pointer which is passed to your function implementations as an argument.
7465     * This has no meaning in the LDK, and can be NULL or any other value.
7466     */
7467    void *this_arg;
7468    /**
7469     * Logs the `Record`
7470     */
7471    void (*log)(const void *this_arg, const char *record);
7472    /**
7473     * Frees any resources associated with this object given its this_arg pointer.
7474     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7475     */
7476    void (*free)(void *this_arg);
7477 } LDKLogger;
7478
7479
7480
7481 /**
7482  * Manager which keeps track of a number of channels and sends messages to the appropriate
7483  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7484  *
7485  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7486  * to individual Channels.
7487  *
7488  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7489  * all peers during write/read (though does not modify this instance, only the instance being
7490  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7491  * called funding_transaction_generated for outbound channels).
7492  *
7493  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7494  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7495  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7496  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7497  * the serialization process). If the deserialized version is out-of-date compared to the
7498  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7499  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7500  *
7501  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7502  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7503  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7504  * block_connected() to step towards your best block) upon deserialization before using the
7505  * object!
7506  *
7507  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7508  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7509  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7510  * offline for a full minute. In order to track this, you must call
7511  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7512  *
7513  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7514  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7515  * essentially you should default to using a SimpleRefChannelManager, and use a
7516  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7517  * you're using lightning-net-tokio.
7518  */
7519 typedef struct MUST_USE_STRUCT LDKChannelManager {
7520    /**
7521     * A pointer to the opaque Rust object.
7522     * Nearly everywhere, inner must be non-null, however in places where
7523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7524     */
7525    LDKnativeChannelManager *inner;
7526    /**
7527     * Indicates that this is the only struct which contains the same pointer.
7528     * Rust functions which take ownership of an object provided via an argument require
7529     * this to be true and invalidate the object pointed to by inner.
7530     */
7531    bool is_owned;
7532 } LDKChannelManager;
7533
7534 /**
7535  * A tuple of 2 elements. See the individual fields for the types contained.
7536  */
7537 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7538    /**
7539     * The element at position 0
7540     */
7541    struct LDKThirtyTwoBytes a;
7542    /**
7543     * The element at position 1
7544     */
7545    struct LDKChannelManager b;
7546 } LDKC2Tuple_BlockHashChannelManagerZ;
7547
7548 /**
7549  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7550  */
7551 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7552    /**
7553     * A pointer to the contents in the success state.
7554     * Reading from this pointer when `result_ok` is not set is undefined.
7555     */
7556    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7557    /**
7558     * A pointer to the contents in the error state.
7559     * Reading from this pointer when `result_ok` is set is undefined.
7560     */
7561    struct LDKDecodeError *err;
7562 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7563
7564 /**
7565  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7566  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7567  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7568  */
7569 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7570    /**
7571     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7572     * `err` or `result` depending on the state of `result_ok`.
7573     */
7574    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7575    /**
7576     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7577     */
7578    bool result_ok;
7579 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7580
7581 /**
7582  * A trait indicating an object may generate message send events
7583  */
7584 typedef struct LDKMessageSendEventsProvider {
7585    /**
7586     * An opaque pointer which is passed to your function implementations as an argument.
7587     * This has no meaning in the LDK, and can be NULL or any other value.
7588     */
7589    void *this_arg;
7590    /**
7591     * Gets the list of pending events which were generated by previous actions, clearing the list
7592     * in the process.
7593     */
7594    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7595    /**
7596     * Frees any resources associated with this object given its this_arg pointer.
7597     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7598     */
7599    void (*free)(void *this_arg);
7600 } LDKMessageSendEventsProvider;
7601
7602 /**
7603  * A trait indicating an object may generate events
7604  */
7605 typedef struct LDKEventsProvider {
7606    /**
7607     * An opaque pointer which is passed to your function implementations as an argument.
7608     * This has no meaning in the LDK, and can be NULL or any other value.
7609     */
7610    void *this_arg;
7611    /**
7612     * Gets the list of pending events which were generated by previous actions, clearing the list
7613     * in the process.
7614     */
7615    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
7616    /**
7617     * Frees any resources associated with this object given its this_arg pointer.
7618     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7619     */
7620    void (*free)(void *this_arg);
7621 } LDKEventsProvider;
7622
7623
7624
7625 /**
7626  * Configuration we set when applicable.
7627  *
7628  * Default::default() provides sane defaults.
7629  */
7630 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7631    /**
7632     * A pointer to the opaque Rust object.
7633     * Nearly everywhere, inner must be non-null, however in places where
7634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7635     */
7636    LDKnativeChannelHandshakeConfig *inner;
7637    /**
7638     * Indicates that this is the only struct which contains the same pointer.
7639     * Rust functions which take ownership of an object provided via an argument require
7640     * this to be true and invalidate the object pointed to by inner.
7641     */
7642    bool is_owned;
7643 } LDKChannelHandshakeConfig;
7644
7645
7646
7647 /**
7648  * Optional channel limits which are applied during channel creation.
7649  *
7650  * These limits are only applied to our counterparty's limits, not our own.
7651  *
7652  * Use 0/<type>::max_value() as appropriate to skip checking.
7653  *
7654  * Provides sane defaults for most configurations.
7655  *
7656  * Most additional limits are disabled except those with which specify a default in individual
7657  * field documentation. Note that this may result in barely-usable channels, but since they
7658  * are applied mostly only to incoming channels that's not much of a problem.
7659  */
7660 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7661    /**
7662     * A pointer to the opaque Rust object.
7663     * Nearly everywhere, inner must be non-null, however in places where
7664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7665     */
7666    LDKnativeChannelHandshakeLimits *inner;
7667    /**
7668     * Indicates that this is the only struct which contains the same pointer.
7669     * Rust functions which take ownership of an object provided via an argument require
7670     * this to be true and invalidate the object pointed to by inner.
7671     */
7672    bool is_owned;
7673 } LDKChannelHandshakeLimits;
7674
7675
7676
7677 /**
7678  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7679  *
7680  * Default::default() provides sane defaults for most configurations
7681  * (but currently with 0 relay fees!)
7682  */
7683 typedef struct MUST_USE_STRUCT LDKUserConfig {
7684    /**
7685     * A pointer to the opaque Rust object.
7686     * Nearly everywhere, inner must be non-null, however in places where
7687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7688     */
7689    LDKnativeUserConfig *inner;
7690    /**
7691     * Indicates that this is the only struct which contains the same pointer.
7692     * Rust functions which take ownership of an object provided via an argument require
7693     * this to be true and invalidate the object pointed to by inner.
7694     */
7695    bool is_owned;
7696 } LDKUserConfig;
7697
7698 /**
7699  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7700  * UTXOs.
7701  */
7702 typedef struct LDKAccess {
7703    /**
7704     * An opaque pointer which is passed to your function implementations as an argument.
7705     * This has no meaning in the LDK, and can be NULL or any other value.
7706     */
7707    void *this_arg;
7708    /**
7709     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7710     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7711     * is unknown.
7712     *
7713     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7714     */
7715    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7716    /**
7717     * Frees any resources associated with this object given its this_arg pointer.
7718     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7719     */
7720    void (*free)(void *this_arg);
7721 } LDKAccess;
7722
7723 /**
7724  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7725  * chain.
7726  *
7727  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7728  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7729  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7730  * when needed.
7731  */
7732 typedef struct LDKListen {
7733    /**
7734     * An opaque pointer which is passed to your function implementations as an argument.
7735     * This has no meaning in the LDK, and can be NULL or any other value.
7736     */
7737    void *this_arg;
7738    /**
7739     * Notifies the listener that a block was added at the given height.
7740     */
7741    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7742    /**
7743     * Notifies the listener that a block was removed at the given height.
7744     */
7745    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7746    /**
7747     * Frees any resources associated with this object given its this_arg pointer.
7748     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7749     */
7750    void (*free)(void *this_arg);
7751 } LDKListen;
7752
7753 /**
7754  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7755  * unconfirmed during a chain reorganization.
7756  *
7757  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7758  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7759  * related to registered transactions and outputs. Upon notification, it would pass along the
7760  * matching transactions using this interface.
7761  *
7762  * # Use
7763  *
7764  * The intended use is as follows:
7765  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7766  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7767  *   that has been reorganized out of the chain.
7768  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7769  *
7770  * # Order
7771  *
7772  * Clients must call these methods in chain order. Specifically:
7773  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7774  *   block.
7775  * - Dependent transactions within the same block must be given in topological order, possibly in
7776  *   separate calls.
7777  * - Unconfirmed transactions must be given after the original confirmations and before any
7778  *   reconfirmation.
7779  *
7780  * See individual method documentation for further details.
7781  *
7782  * [`transactions_confirmed`]: Self::transactions_confirmed
7783  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7784  * [`best_block_updated`]: Self::best_block_updated
7785  * [`get_relevant_txids`]: Self::get_relevant_txids
7786  */
7787 typedef struct LDKConfirm {
7788    /**
7789     * An opaque pointer which is passed to your function implementations as an argument.
7790     * This has no meaning in the LDK, and can be NULL or any other value.
7791     */
7792    void *this_arg;
7793    /**
7794     * Processes transactions confirmed in a block with a given header and height.
7795     *
7796     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7797     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7798     * appearing in the same block do not need to be included in the same call; instead, multiple
7799     * calls with additional transactions may be made so long as they are made in [chain order].
7800     *
7801     * May be called before or after [`best_block_updated`] for the corresponding block. However,
7802     * in the event of a chain reorganization, it must not be called with a `header` that is no
7803     * longer in the chain as of the last call to [`best_block_updated`].
7804     *
7805     * [chain order]: Confirm#Order
7806     * [`best_block_updated`]: Self::best_block_updated
7807     */
7808    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7809    /**
7810     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
7811     *
7812     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
7813     * reorganized out of the best chain. Once called, the given transaction should not be returned
7814     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
7815     *
7816     * [`get_relevant_txids`]: Self::get_relevant_txids
7817     * [`transactions_confirmed`]: Self::transactions_confirmed
7818     */
7819    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
7820    /**
7821     * Processes an update to the best header connected at the given height.
7822     *
7823     * Should be called when a new header is available but may be skipped for intermediary blocks
7824     * if they become available at the same time.
7825     */
7826    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7827    /**
7828     * Returns transactions that should be monitored for reorganization out of the chain.
7829     *
7830     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
7831     * confirmations to be safe from a chain reorganization. Should not include any transactions
7832     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
7833     *
7834     * May be called to determine the subset of transactions that must still be monitored for
7835     * reorganization. Will be idempotent between calls but may change as a result of calls to the
7836     * other interface methods. Thus, this is useful to determine which transactions may need to be
7837     * given to [`transaction_unconfirmed`].
7838     *
7839     * [`transactions_confirmed`]: Self::transactions_confirmed
7840     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7841     */
7842    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
7843    /**
7844     * Frees any resources associated with this object given its this_arg pointer.
7845     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7846     */
7847    void (*free)(void *this_arg);
7848 } LDKConfirm;
7849
7850
7851
7852 /**
7853  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
7854  *
7855  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
7856  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
7857  * the return value of [`Filter::register_output`].
7858  *
7859  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
7860  * may have been spent there. See [`Filter::register_output`] for details.
7861  *
7862  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7863  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
7864  */
7865 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
7866    /**
7867     * A pointer to the opaque Rust object.
7868     * Nearly everywhere, inner must be non-null, however in places where
7869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7870     */
7871    LDKnativeWatchedOutput *inner;
7872    /**
7873     * Indicates that this is the only struct which contains the same pointer.
7874     * Rust functions which take ownership of an object provided via an argument require
7875     * this to be true and invalidate the object pointed to by inner.
7876     */
7877    bool is_owned;
7878 } LDKWatchedOutput;
7879
7880 /**
7881  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
7882  * channels.
7883  *
7884  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
7885  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
7886  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
7887  * receiving full blocks from a chain source, any further filtering is unnecessary.
7888  *
7889  * After an output has been registered, subsequent block retrievals from the chain source must not
7890  * exclude any transactions matching the new criteria nor any in-block descendants of such
7891  * transactions.
7892  *
7893  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
7894  * should not block on I/O. Implementations should instead queue the newly monitored data to be
7895  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
7896  * invocation that has called the `Filter` must return [`TemporaryFailure`].
7897  *
7898  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
7899  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
7900  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
7901  */
7902 typedef struct LDKFilter {
7903    /**
7904     * An opaque pointer which is passed to your function implementations as an argument.
7905     * This has no meaning in the LDK, and can be NULL or any other value.
7906     */
7907    void *this_arg;
7908    /**
7909     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
7910     * a spending condition.
7911     */
7912    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
7913    /**
7914     * Registers interest in spends of a transaction output.
7915     *
7916     * Optionally, when `output.block_hash` is set, should return any transaction spending the
7917     * output that is found in the corresponding block along with its index.
7918     *
7919     * This return value is useful for Electrum clients in order to supply in-block descendant
7920     * transactions which otherwise were not included. This is not necessary for other clients if
7921     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
7922     * full block).
7923     */
7924    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
7925    /**
7926     * Frees any resources associated with this object given its this_arg pointer.
7927     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7928     */
7929    void (*free)(void *this_arg);
7930 } LDKFilter;
7931
7932 /**
7933  * `Persist` defines behavior for persisting channel monitors: this could mean
7934  * writing once to disk, and/or uploading to one or more backup services.
7935  *
7936  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
7937  * to disk/backups. And, on every update, you **must** persist either the
7938  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
7939  * of situations such as revoking a transaction, then crashing before this
7940  * revocation can be persisted, then unintentionally broadcasting a revoked
7941  * transaction and losing money. This is a risk because previous channel states
7942  * are toxic, so it's important that whatever channel state is persisted is
7943  * kept up-to-date.
7944  */
7945 typedef struct LDKPersist {
7946    /**
7947     * An opaque pointer which is passed to your function implementations as an argument.
7948     * This has no meaning in the LDK, and can be NULL or any other value.
7949     */
7950    void *this_arg;
7951    /**
7952     * Persist a new channel's data. The data can be stored any way you want, but
7953     * the identifier provided by Rust-Lightning is the channel's outpoint (and
7954     * it is up to you to maintain a correct mapping between the outpoint and the
7955     * stored channel data). Note that you **must** persist every new monitor to
7956     * disk. See the `Persist` trait documentation for more details.
7957     *
7958     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7959     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7960     */
7961    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
7962    /**
7963     * Update one channel's data. The provided `ChannelMonitor` has already
7964     * applied the given update.
7965     *
7966     * Note that on every update, you **must** persist either the
7967     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
7968     * the `Persist` trait documentation for more details.
7969     *
7970     * If an implementer chooses to persist the updates only, they need to make
7971     * sure that all the updates are applied to the `ChannelMonitors` *before*
7972     * the set of channel monitors is given to the `ChannelManager`
7973     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
7974     * applying a monitor update to a monitor. If full `ChannelMonitors` are
7975     * persisted, then there is no need to persist individual updates.
7976     *
7977     * Note that there could be a performance tradeoff between persisting complete
7978     * channel monitors on every update vs. persisting only updates and applying
7979     * them in batches. The size of each monitor grows `O(number of state updates)`
7980     * whereas updates are small and `O(1)`.
7981     *
7982     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7983     * [`ChannelMonitorUpdate::write`] for writing out an update, and
7984     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7985     */
7986    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);
7987    /**
7988     * Frees any resources associated with this object given its this_arg pointer.
7989     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7990     */
7991    void (*free)(void *this_arg);
7992 } LDKPersist;
7993
7994
7995
7996 /**
7997  * An implementation of [`chain::Watch`] for monitoring channels.
7998  *
7999  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8000  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8001  * or used independently to monitor channels remotely. See the [module-level documentation] for
8002  * details.
8003  *
8004  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8005  * [module-level documentation]: crate::chain::chainmonitor
8006  */
8007 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8008    /**
8009     * A pointer to the opaque Rust object.
8010     * Nearly everywhere, inner must be non-null, however in places where
8011     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8012     */
8013    LDKnativeChainMonitor *inner;
8014    /**
8015     * Indicates that this is the only struct which contains the same pointer.
8016     * Rust functions which take ownership of an object provided via an argument require
8017     * this to be true and invalidate the object pointed to by inner.
8018     */
8019    bool is_owned;
8020 } LDKChainMonitor;
8021
8022
8023
8024 /**
8025  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8026  * and derives keys from that.
8027  *
8028  * Your node_id is seed/0'
8029  * ChannelMonitor closes may use seed/1'
8030  * Cooperative closes may use seed/2'
8031  * The two close keys may be needed to claim on-chain funds!
8032  */
8033 typedef struct MUST_USE_STRUCT LDKKeysManager {
8034    /**
8035     * A pointer to the opaque Rust object.
8036     * Nearly everywhere, inner must be non-null, however in places where
8037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8038     */
8039    LDKnativeKeysManager *inner;
8040    /**
8041     * Indicates that this is the only struct which contains the same pointer.
8042     * Rust functions which take ownership of an object provided via an argument require
8043     * this to be true and invalidate the object pointed to by inner.
8044     */
8045    bool is_owned;
8046 } LDKKeysManager;
8047
8048
8049
8050 /**
8051  * Chain-related parameters used to construct a new `ChannelManager`.
8052  *
8053  * Typically, the block-specific parameters are derived from the best block hash for the network,
8054  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8055  * are not needed when deserializing a previously constructed `ChannelManager`.
8056  */
8057 typedef struct MUST_USE_STRUCT LDKChainParameters {
8058    /**
8059     * A pointer to the opaque Rust object.
8060     * Nearly everywhere, inner must be non-null, however in places where
8061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8062     */
8063    LDKnativeChainParameters *inner;
8064    /**
8065     * Indicates that this is the only struct which contains the same pointer.
8066     * Rust functions which take ownership of an object provided via an argument require
8067     * this to be true and invalidate the object pointed to by inner.
8068     */
8069    bool is_owned;
8070 } LDKChainParameters;
8071
8072
8073
8074 /**
8075  * The best known block as identified by its hash and height.
8076  */
8077 typedef struct MUST_USE_STRUCT LDKBestBlock {
8078    /**
8079     * A pointer to the opaque Rust object.
8080     * Nearly everywhere, inner must be non-null, however in places where
8081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8082     */
8083    LDKnativeBestBlock *inner;
8084    /**
8085     * Indicates that this is the only struct which contains the same pointer.
8086     * Rust functions which take ownership of an object provided via an argument require
8087     * this to be true and invalidate the object pointed to by inner.
8088     */
8089    bool is_owned;
8090 } LDKBestBlock;
8091
8092 /**
8093  * A 3-byte byte array.
8094  */
8095 typedef struct LDKThreeBytes {
8096    /**
8097     * The three bytes
8098     */
8099    uint8_t data[3];
8100 } LDKThreeBytes;
8101
8102 /**
8103  * A trait to describe an object which can receive channel messages.
8104  *
8105  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8106  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8107  */
8108 typedef struct LDKChannelMessageHandler {
8109    /**
8110     * An opaque pointer which is passed to your function implementations as an argument.
8111     * This has no meaning in the LDK, and can be NULL or any other value.
8112     */
8113    void *this_arg;
8114    /**
8115     * Handle an incoming open_channel message from the given peer.
8116     */
8117    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8118    /**
8119     * Handle an incoming accept_channel message from the given peer.
8120     */
8121    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8122    /**
8123     * Handle an incoming funding_created message from the given peer.
8124     */
8125    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8126    /**
8127     * Handle an incoming funding_signed message from the given peer.
8128     */
8129    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8130    /**
8131     * Handle an incoming funding_locked message from the given peer.
8132     */
8133    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8134    /**
8135     * Handle an incoming shutdown message from the given peer.
8136     */
8137    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);
8138    /**
8139     * Handle an incoming closing_signed message from the given peer.
8140     */
8141    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8142    /**
8143     * Handle an incoming update_add_htlc message from the given peer.
8144     */
8145    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8146    /**
8147     * Handle an incoming update_fulfill_htlc message from the given peer.
8148     */
8149    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8150    /**
8151     * Handle an incoming update_fail_htlc message from the given peer.
8152     */
8153    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8154    /**
8155     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8156     */
8157    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8158    /**
8159     * Handle an incoming commitment_signed message from the given peer.
8160     */
8161    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8162    /**
8163     * Handle an incoming revoke_and_ack message from the given peer.
8164     */
8165    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8166    /**
8167     * Handle an incoming update_fee message from the given peer.
8168     */
8169    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8170    /**
8171     * Handle an incoming announcement_signatures message from the given peer.
8172     */
8173    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8174    /**
8175     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8176     * is believed to be possible in the future (eg they're sending us messages we don't
8177     * understand or indicate they require unknown feature bits), no_connection_possible is set
8178     * and any outstanding channels should be failed.
8179     */
8180    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8181    /**
8182     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8183     */
8184    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8185    /**
8186     * Handle an incoming channel_reestablish message from the given peer.
8187     */
8188    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8189    /**
8190     * Handle an incoming channel update from the given peer.
8191     */
8192    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8193    /**
8194     * Handle an incoming error message from the given peer.
8195     */
8196    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8197    /**
8198     * Implementation of MessageSendEventsProvider for this object.
8199     */
8200    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8201    /**
8202     * Frees any resources associated with this object given its this_arg pointer.
8203     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8204     */
8205    void (*free)(void *this_arg);
8206 } LDKChannelMessageHandler;
8207
8208
8209
8210 /**
8211  * Arguments for the creation of a ChannelManager that are not deserialized.
8212  *
8213  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8214  * is:
8215  * 1) Deserialize all stored ChannelMonitors.
8216  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8217  *    <(BlockHash, ChannelManager)>::read(reader, args)
8218  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8219  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8220  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8221  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8222  *    ChannelMonitor::get_funding_txo().
8223  * 4) Reconnect blocks on your ChannelMonitors.
8224  * 5) Disconnect/connect blocks on the ChannelManager.
8225  * 6) Move the ChannelMonitors into your local chain::Watch.
8226  *
8227  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8228  * call any other methods on the newly-deserialized ChannelManager.
8229  *
8230  * Note that because some channels may be closed during deserialization, it is critical that you
8231  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8232  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8233  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8234  * not force-close the same channels but consider them live), you may end up revoking a state for
8235  * which you've already broadcasted the transaction.
8236  */
8237 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8238    /**
8239     * A pointer to the opaque Rust object.
8240     * Nearly everywhere, inner must be non-null, however in places where
8241     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8242     */
8243    LDKnativeChannelManagerReadArgs *inner;
8244    /**
8245     * Indicates that this is the only struct which contains the same pointer.
8246     * Rust functions which take ownership of an object provided via an argument require
8247     * this to be true and invalidate the object pointed to by inner.
8248     */
8249    bool is_owned;
8250 } LDKChannelManagerReadArgs;
8251
8252
8253
8254 /**
8255  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8256  * This is used to convince the recipient that the channel is at a certain commitment
8257  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8258  * and even later commitments may have been revoked.
8259  */
8260 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8261    /**
8262     * A pointer to the opaque Rust object.
8263     * Nearly everywhere, inner must be non-null, however in places where
8264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8265     */
8266    LDKnativeDataLossProtect *inner;
8267    /**
8268     * Indicates that this is the only struct which contains the same pointer.
8269     * Rust functions which take ownership of an object provided via an argument require
8270     * this to be true and invalidate the object pointed to by inner.
8271     */
8272    bool is_owned;
8273 } LDKDataLossProtect;
8274
8275 /**
8276  * A trait to describe an object which can receive routing messages.
8277  *
8278  * # Implementor DoS Warnings
8279  *
8280  * For `gossip_queries` messages there are potential DoS vectors when handling
8281  * inbound queries. Implementors using an on-disk network graph should be aware of
8282  * repeated disk I/O for queries accessing different parts of the network graph.
8283  */
8284 typedef struct LDKRoutingMessageHandler {
8285    /**
8286     * An opaque pointer which is passed to your function implementations as an argument.
8287     * This has no meaning in the LDK, and can be NULL or any other value.
8288     */
8289    void *this_arg;
8290    /**
8291     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8292     * false or returning an Err otherwise.
8293     */
8294    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8295    /**
8296     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8297     * or returning an Err otherwise.
8298     */
8299    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8300    /**
8301     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8302     * false or returning an Err otherwise.
8303     */
8304    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8305    /**
8306     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8307     */
8308    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8309    /**
8310     * Gets a subset of the channel announcements and updates required to dump our routing table
8311     * to a remote node, starting at the short_channel_id indicated by starting_point and
8312     * including the batch_amount entries immediately higher in numerical value than starting_point.
8313     */
8314    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8315    /**
8316     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8317     * starting at the node *after* the provided publickey and including batch_amount entries
8318     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8319     * If None is provided for starting_point, we start at the first node.
8320     */
8321    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8322    /**
8323     * Called when a connection is established with a peer. This can be used to
8324     * perform routing table synchronization using a strategy defined by the
8325     * implementor.
8326     */
8327    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8328    /**
8329     * Handles the reply of a query we initiated to learn about channels
8330     * for a given range of blocks. We can expect to receive one or more
8331     * replies to a single query.
8332     */
8333    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8334    /**
8335     * Handles the reply of a query we initiated asking for routing gossip
8336     * messages for a list of channels. We should receive this message when
8337     * a node has completed its best effort to send us the pertaining routing
8338     * gossip messages.
8339     */
8340    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8341    /**
8342     * Handles when a peer asks us to send a list of short_channel_ids
8343     * for the requested range of blocks.
8344     */
8345    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8346    /**
8347     * Handles when a peer asks us to send routing gossip messages for a
8348     * list of short_channel_ids.
8349     */
8350    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8351    /**
8352     * Implementation of MessageSendEventsProvider for this object.
8353     */
8354    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8355    /**
8356     * Frees any resources associated with this object given its this_arg pointer.
8357     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8358     */
8359    void (*free)(void *this_arg);
8360 } LDKRoutingMessageHandler;
8361
8362
8363
8364 /**
8365  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8366  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8367  */
8368 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8369    /**
8370     * A pointer to the opaque Rust object.
8371     * Nearly everywhere, inner must be non-null, however in places where
8372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8373     */
8374    LDKnativeIgnoringMessageHandler *inner;
8375    /**
8376     * Indicates that this is the only struct which contains the same pointer.
8377     * Rust functions which take ownership of an object provided via an argument require
8378     * this to be true and invalidate the object pointed to by inner.
8379     */
8380    bool is_owned;
8381 } LDKIgnoringMessageHandler;
8382
8383
8384
8385 /**
8386  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8387  * You can provide one of these as the route_handler in a MessageHandler.
8388  */
8389 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8390    /**
8391     * A pointer to the opaque Rust object.
8392     * Nearly everywhere, inner must be non-null, however in places where
8393     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8394     */
8395    LDKnativeErroringMessageHandler *inner;
8396    /**
8397     * Indicates that this is the only struct which contains the same pointer.
8398     * Rust functions which take ownership of an object provided via an argument require
8399     * this to be true and invalidate the object pointed to by inner.
8400     */
8401    bool is_owned;
8402 } LDKErroringMessageHandler;
8403
8404
8405
8406 /**
8407  * Provides references to trait impls which handle different types of messages.
8408  */
8409 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8410    /**
8411     * A pointer to the opaque Rust object.
8412     * Nearly everywhere, inner must be non-null, however in places where
8413     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8414     */
8415    LDKnativeMessageHandler *inner;
8416    /**
8417     * Indicates that this is the only struct which contains the same pointer.
8418     * Rust functions which take ownership of an object provided via an argument require
8419     * this to be true and invalidate the object pointed to by inner.
8420     */
8421    bool is_owned;
8422 } LDKMessageHandler;
8423
8424 /**
8425  * Provides an object which can be used to send data to and which uniquely identifies a connection
8426  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8427  * implement Hash to meet the PeerManager API.
8428  *
8429  * For efficiency, Clone should be relatively cheap for this type.
8430  *
8431  * You probably want to just extend an int and put a file descriptor in a struct and implement
8432  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8433  * be careful to ensure you don't have races whereby you might register a new connection with an
8434  * fd which is the same as a previous one which has yet to be removed via
8435  * PeerManager::socket_disconnected().
8436  */
8437 typedef struct LDKSocketDescriptor {
8438    /**
8439     * An opaque pointer which is passed to your function implementations as an argument.
8440     * This has no meaning in the LDK, and can be NULL or any other value.
8441     */
8442    void *this_arg;
8443    /**
8444     * Attempts to send some data from the given slice to the peer.
8445     *
8446     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8447     * Note that in the disconnected case, socket_disconnected must still fire and further write
8448     * attempts may occur until that time.
8449     *
8450     * If the returned size is smaller than data.len(), a write_available event must
8451     * trigger the next time more data can be written. Additionally, until the a send_data event
8452     * completes fully, no further read_events should trigger on the same peer!
8453     *
8454     * If a read_event on this descriptor had previously returned true (indicating that read
8455     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8456     * indicating that read events on this descriptor should resume. A resume_read of false does
8457     * *not* imply that further read events should be paused.
8458     */
8459    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8460    /**
8461     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8462     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8463     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8464     * though races may occur whereby disconnect_socket is called after a call to
8465     * socket_disconnected but prior to socket_disconnected returning.
8466     */
8467    void (*disconnect_socket)(void *this_arg);
8468    /**
8469     * Checks if two objects are equal given this object's this_arg pointer and another object.
8470     */
8471    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8472    /**
8473     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8474     * This is used, for example, for inclusion of this object in a hash map.
8475     */
8476    uint64_t (*hash)(const void *this_arg);
8477    /**
8478     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8479     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8480     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8481     */
8482    void *(*clone)(const void *this_arg);
8483    /**
8484     * Frees any resources associated with this object given its this_arg pointer.
8485     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8486     */
8487    void (*free)(void *this_arg);
8488 } LDKSocketDescriptor;
8489
8490
8491
8492 /**
8493  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8494  * events into messages which it passes on to its MessageHandlers.
8495  *
8496  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8497  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8498  * essentially you should default to using a SimpleRefPeerManager, and use a
8499  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8500  * you're using lightning-net-tokio.
8501  */
8502 typedef struct MUST_USE_STRUCT LDKPeerManager {
8503    /**
8504     * A pointer to the opaque Rust object.
8505     * Nearly everywhere, inner must be non-null, however in places where
8506     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8507     */
8508    LDKnativePeerManager *inner;
8509    /**
8510     * Indicates that this is the only struct which contains the same pointer.
8511     * Rust functions which take ownership of an object provided via an argument require
8512     * this to be true and invalidate the object pointed to by inner.
8513     */
8514    bool is_owned;
8515 } LDKPeerManager;
8516
8517
8518
8519 /**
8520  * Static channel fields used to build transactions given per-commitment fields, organized by
8521  * broadcaster/countersignatory.
8522  *
8523  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8524  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8525  */
8526 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8527    /**
8528     * A pointer to the opaque Rust object.
8529     * Nearly everywhere, inner must be non-null, however in places where
8530     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8531     */
8532    LDKnativeDirectedChannelTransactionParameters *inner;
8533    /**
8534     * Indicates that this is the only struct which contains the same pointer.
8535     * Rust functions which take ownership of an object provided via an argument require
8536     * this to be true and invalidate the object pointed to by inner.
8537     */
8538    bool is_owned;
8539 } LDKDirectedChannelTransactionParameters;
8540
8541
8542
8543 /**
8544  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8545  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8546  * the C bindings, as it can be done directly in Rust code.
8547  */
8548 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8549    /**
8550     * A pointer to the opaque Rust object.
8551     * Nearly everywhere, inner must be non-null, however in places where
8552     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8553     */
8554    LDKnativeLockedNetworkGraph *inner;
8555    /**
8556     * Indicates that this is the only struct which contains the same pointer.
8557     * Rust functions which take ownership of an object provided via an argument require
8558     * this to be true and invalidate the object pointed to by inner.
8559     */
8560    bool is_owned;
8561 } LDKLockedNetworkGraph;
8562
8563
8564
8565 /**
8566  * Receives and validates network updates from peers,
8567  * stores authentic and relevant data as a network graph.
8568  * This network graph is then used for routing payments.
8569  * Provides interface to help with initial routing sync by
8570  * serving historical announcements.
8571  */
8572 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8573    /**
8574     * A pointer to the opaque Rust object.
8575     * Nearly everywhere, inner must be non-null, however in places where
8576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8577     */
8578    LDKnativeNetGraphMsgHandler *inner;
8579    /**
8580     * Indicates that this is the only struct which contains the same pointer.
8581     * Rust functions which take ownership of an object provided via an argument require
8582     * this to be true and invalidate the object pointed to by inner.
8583     */
8584    bool is_owned;
8585 } LDKNetGraphMsgHandler;
8586
8587
8588
8589 /**
8590  * FilesystemPersister persists channel data on disk, where each channel's
8591  * data is stored in a file named after its funding outpoint.
8592  *
8593  * Warning: this module does the best it can with calls to persist data, but it
8594  * can only guarantee that the data is passed to the drive. It is up to the
8595  * drive manufacturers to do the actual persistence properly, which they often
8596  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8597  * user to validate their entire storage stack, to ensure the writes are
8598  * persistent.
8599  * Corollary: especially when dealing with larger amounts of money, it is best
8600  * practice to have multiple channel data backups and not rely only on one
8601  * FilesystemPersister.
8602  */
8603 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
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    LDKnativeFilesystemPersister *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 } LDKFilesystemPersister;
8617
8618
8619
8620 /**
8621  * Data of the `RawInvoice` that is encoded in the data part
8622  */
8623 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8624    /**
8625     * A pointer to the opaque Rust object.
8626     * Nearly everywhere, inner must be non-null, however in places where
8627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8628     */
8629    LDKnativeRawDataPart *inner;
8630    /**
8631     * Indicates that this is the only struct which contains the same pointer.
8632     * Rust functions which take ownership of an object provided via an argument require
8633     * this to be true and invalidate the object pointed to by inner.
8634     */
8635    bool is_owned;
8636 } LDKRawDataPart;
8637
8638
8639
8640 /**
8641  * SHA-256 hash
8642  */
8643 typedef struct MUST_USE_STRUCT LDKSha256 {
8644    /**
8645     * A pointer to the opaque Rust object.
8646     * Nearly everywhere, inner must be non-null, however in places where
8647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8648     */
8649    LDKnativeSha256 *inner;
8650    /**
8651     * Indicates that this is the only struct which contains the same pointer.
8652     * Rust functions which take ownership of an object provided via an argument require
8653     * this to be true and invalidate the object pointed to by inner.
8654     */
8655    bool is_owned;
8656 } LDKSha256;
8657
8658
8659
8660 /**
8661  * `min_final_cltv_expiry` to use for the last HTLC in the route
8662  */
8663 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8664    /**
8665     * A pointer to the opaque Rust object.
8666     * Nearly everywhere, inner must be non-null, however in places where
8667     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8668     */
8669    LDKnativeMinFinalCltvExpiry *inner;
8670    /**
8671     * Indicates that this is the only struct which contains the same pointer.
8672     * Rust functions which take ownership of an object provided via an argument require
8673     * this to be true and invalidate the object pointed to by inner.
8674     */
8675    bool is_owned;
8676 } LDKMinFinalCltvExpiry;
8677
8678 /**
8679  * Integer in the range `0..32`
8680  */
8681 typedef struct LDKu5 {
8682    uint8_t _0;
8683 } LDKu5;
8684
8685 /**
8686  * A 20-byte byte array.
8687  */
8688 typedef struct LDKTwentyBytes {
8689    /**
8690     * The twenty bytes
8691     */
8692    uint8_t data[20];
8693 } LDKTwentyBytes;
8694
8695 /**
8696  * Fallback address in case no LN payment is possible
8697  */
8698 typedef enum LDKFallback_Tag {
8699    LDKFallback_SegWitProgram,
8700    LDKFallback_PubKeyHash,
8701    LDKFallback_ScriptHash,
8702    /**
8703     * Must be last for serialization purposes
8704     */
8705    LDKFallback_Sentinel,
8706 } LDKFallback_Tag;
8707
8708 typedef struct LDKFallback_LDKSegWitProgram_Body {
8709    struct LDKu5 version;
8710    struct LDKCVec_u8Z program;
8711 } LDKFallback_LDKSegWitProgram_Body;
8712
8713 typedef struct MUST_USE_STRUCT LDKFallback {
8714    LDKFallback_Tag tag;
8715    union {
8716       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8717       struct {
8718          struct LDKTwentyBytes pub_key_hash;
8719       };
8720       struct {
8721          struct LDKTwentyBytes script_hash;
8722       };
8723    };
8724 } LDKFallback;
8725
8726 extern const uintptr_t MAX_BUF_SIZE;
8727
8728 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8729
8730 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8731
8732 extern const uint16_t BREAKDOWN_TIMEOUT;
8733
8734 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8735
8736 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8737
8738 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8739
8740 extern const uint8_t TAG_PAYMENT_HASH;
8741
8742 extern const uint8_t TAG_DESCRIPTION;
8743
8744 extern const uint8_t TAG_PAYEE_PUB_KEY;
8745
8746 extern const uint8_t TAG_DESCRIPTION_HASH;
8747
8748 extern const uint8_t TAG_EXPIRY_TIME;
8749
8750 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
8751
8752 extern const uint8_t TAG_FALLBACK;
8753
8754 extern const uint8_t TAG_ROUTE;
8755
8756 extern const uint8_t TAG_PAYMENT_SECRET;
8757
8758 extern const uint8_t TAG_FEATURES;
8759
8760 /**
8761  * Frees the data buffer, if data_is_owned is set and datalen > 0.
8762  */
8763 void Transaction_free(struct LDKTransaction _res);
8764
8765 /**
8766  * Frees the data pointed to by script_pubkey.
8767  */
8768 void TxOut_free(struct LDKTxOut _res);
8769
8770 /**
8771  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
8772  */
8773 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
8774
8775 /**
8776  * Frees the data buffer, if chars_is_owned is set and len > 0.
8777  */
8778 void Str_free(struct LDKStr _res);
8779
8780 /**
8781  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
8782  */
8783 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
8784
8785 /**
8786  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
8787  */
8788 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
8789
8790 /**
8791  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
8792  */
8793 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
8794
8795 /**
8796  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
8797  * but with all dynamically-allocated buffers duplicated in new buffers.
8798  */
8799 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
8800
8801 /**
8802  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
8803  */
8804 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
8805
8806 /**
8807  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
8808  */
8809 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
8810
8811 /**
8812  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
8813  */
8814 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
8815
8816 /**
8817  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
8818  * but with all dynamically-allocated buffers duplicated in new buffers.
8819  */
8820 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
8821
8822 /**
8823  * Creates a new CResult_SecretKeyErrorZ in the success state.
8824  */
8825 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
8826
8827 /**
8828  * Creates a new CResult_SecretKeyErrorZ in the error state.
8829  */
8830 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
8831
8832 /**
8833  * Frees any resources used by the CResult_SecretKeyErrorZ.
8834  */
8835 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
8836
8837 /**
8838  * Creates a new CResult_PublicKeyErrorZ in the success state.
8839  */
8840 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
8841
8842 /**
8843  * Creates a new CResult_PublicKeyErrorZ in the error state.
8844  */
8845 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
8846
8847 /**
8848  * Frees any resources used by the CResult_PublicKeyErrorZ.
8849  */
8850 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
8851
8852 /**
8853  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
8854  */
8855 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
8856
8857 /**
8858  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
8859  */
8860 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
8861
8862 /**
8863  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
8864  */
8865 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
8866
8867 /**
8868  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
8869  * but with all dynamically-allocated buffers duplicated in new buffers.
8870  */
8871 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
8872
8873 /**
8874  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
8875  */
8876 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
8877
8878 /**
8879  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
8880  */
8881 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
8882
8883 /**
8884  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
8885  */
8886 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
8887
8888 /**
8889  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
8890  * but with all dynamically-allocated buffers duplicated in new buffers.
8891  */
8892 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
8893
8894 /**
8895  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
8896  */
8897 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
8898
8899 /**
8900  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
8901  */
8902 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
8903
8904 /**
8905  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
8906  */
8907 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
8908
8909 /**
8910  * Constructs a new COption_u32Z containing a u32
8911  */
8912 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
8913
8914 /**
8915  * Constructs a new COption_u32Z containing nothing
8916  */
8917 struct LDKCOption_u32Z COption_u32Z_none(void);
8918
8919 /**
8920  * Frees any resources associated with the u32, if we are in the Some state
8921  */
8922 void COption_u32Z_free(struct LDKCOption_u32Z _res);
8923
8924 /**
8925  * Creates a new COption_u32Z which has the same data as `orig`
8926  * but with all dynamically-allocated buffers duplicated in new buffers.
8927  */
8928 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
8929
8930 /**
8931  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
8932  */
8933 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
8934
8935 /**
8936  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
8937  */
8938 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
8939
8940 /**
8941  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
8942  */
8943 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
8944
8945 /**
8946  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
8947  * but with all dynamically-allocated buffers duplicated in new buffers.
8948  */
8949 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
8950
8951 /**
8952  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
8953  */
8954 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
8955
8956 /**
8957  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
8958  */
8959 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8960
8961 /**
8962  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
8963  */
8964 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
8965
8966 /**
8967  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8968  * but with all dynamically-allocated buffers duplicated in new buffers.
8969  */
8970 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8971
8972 /**
8973  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
8974  */
8975 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
8976
8977 /**
8978  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
8979  */
8980 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8981
8982 /**
8983  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
8984  */
8985 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
8986
8987 /**
8988  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8989  * but with all dynamically-allocated buffers duplicated in new buffers.
8990  */
8991 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8992
8993 /**
8994  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8995  */
8996 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
8997
8998 /**
8999  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9000  */
9001 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9002
9003 /**
9004  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9005  */
9006 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9007
9008 /**
9009  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9010  */
9011 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9012
9013 /**
9014  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9015  * but with all dynamically-allocated buffers duplicated in new buffers.
9016  */
9017 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9018
9019 /**
9020  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9021  */
9022 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9023
9024 /**
9025  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9026  */
9027 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9028
9029 /**
9030  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9031  */
9032 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9033
9034 /**
9035  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9036  * but with all dynamically-allocated buffers duplicated in new buffers.
9037  */
9038 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9039
9040 /**
9041  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9042  */
9043 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9044
9045 /**
9046  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9047  */
9048 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9049
9050 /**
9051  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9052  */
9053 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9054
9055 /**
9056  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9057  * but with all dynamically-allocated buffers duplicated in new buffers.
9058  */
9059 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9060
9061 /**
9062  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9063  */
9064 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9065
9066 /**
9067  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9068  */
9069 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9070
9071 /**
9072  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9073  */
9074 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9075
9076 /**
9077  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9078  */
9079 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9080
9081 /**
9082  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9083  */
9084 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9085
9086 /**
9087  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9088  */
9089 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9090
9091 /**
9092  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9093  * but with all dynamically-allocated buffers duplicated in new buffers.
9094  */
9095 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9096
9097 /**
9098  * Creates a new CResult_SiPrefixNoneZ in the success state.
9099  */
9100 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
9101
9102 /**
9103  * Creates a new CResult_SiPrefixNoneZ in the error state.
9104  */
9105 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
9106
9107 /**
9108  * Frees any resources used by the CResult_SiPrefixNoneZ.
9109  */
9110 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
9111
9112 /**
9113  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
9114  * but with all dynamically-allocated buffers duplicated in new buffers.
9115  */
9116 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
9117
9118 /**
9119  * Creates a new CResult_InvoiceNoneZ in the success state.
9120  */
9121 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
9122
9123 /**
9124  * Creates a new CResult_InvoiceNoneZ in the error state.
9125  */
9126 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
9127
9128 /**
9129  * Frees any resources used by the CResult_InvoiceNoneZ.
9130  */
9131 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
9132
9133 /**
9134  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
9135  * but with all dynamically-allocated buffers duplicated in new buffers.
9136  */
9137 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
9138
9139 /**
9140  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
9141  */
9142 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
9143
9144 /**
9145  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
9146  */
9147 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
9148
9149 /**
9150  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
9151  */
9152 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
9153
9154 /**
9155  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
9156  * but with all dynamically-allocated buffers duplicated in new buffers.
9157  */
9158 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
9159
9160 /**
9161  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9162  */
9163 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9164
9165 /**
9166  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9167  */
9168 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
9169
9170 /**
9171  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9172  */
9173 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
9174
9175 /**
9176  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
9177  */
9178 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
9179
9180 /**
9181  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
9182  */
9183 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
9184
9185 /**
9186  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
9187  */
9188 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
9189
9190 /**
9191  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9192  */
9193 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9194
9195 /**
9196  * Constructs a new COption_u64Z containing a u64
9197  */
9198 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9199
9200 /**
9201  * Constructs a new COption_u64Z containing nothing
9202  */
9203 struct LDKCOption_u64Z COption_u64Z_none(void);
9204
9205 /**
9206  * Frees any resources associated with the u64, if we are in the Some state
9207  */
9208 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9209
9210 /**
9211  * Creates a new COption_u64Z which has the same data as `orig`
9212  * but with all dynamically-allocated buffers duplicated in new buffers.
9213  */
9214 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9215
9216 /**
9217  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9218  */
9219 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
9220
9221 /**
9222  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9223  */
9224 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
9225
9226 /**
9227  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9228  */
9229 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
9230
9231 /**
9232  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9233  * but with all dynamically-allocated buffers duplicated in new buffers.
9234  */
9235 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
9236
9237 /**
9238  * Creates a new CResult_NoneSemanticErrorZ in the success state.
9239  */
9240 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
9241
9242 /**
9243  * Creates a new CResult_NoneSemanticErrorZ in the error state.
9244  */
9245 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
9246
9247 /**
9248  * Frees any resources used by the CResult_NoneSemanticErrorZ.
9249  */
9250 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
9251
9252 /**
9253  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
9254  * but with all dynamically-allocated buffers duplicated in new buffers.
9255  */
9256 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
9257
9258 /**
9259  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
9260  */
9261 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
9262
9263 /**
9264  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
9265  */
9266 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
9267
9268 /**
9269  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
9270  */
9271 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
9272
9273 /**
9274  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
9275  * but with all dynamically-allocated buffers duplicated in new buffers.
9276  */
9277 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
9278
9279 /**
9280  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
9281  */
9282 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
9283
9284 /**
9285  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
9286  */
9287 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
9288
9289 /**
9290  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
9291  */
9292 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
9293
9294 /**
9295  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9296  * but with all dynamically-allocated buffers duplicated in new buffers.
9297  */
9298 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
9299
9300 /**
9301  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
9302  */
9303 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
9304
9305 /**
9306  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
9307  */
9308 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
9309
9310 /**
9311  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
9312  */
9313 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
9314
9315 /**
9316  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
9317  * but with all dynamically-allocated buffers duplicated in new buffers.
9318  */
9319 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
9320
9321 /**
9322  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9323  */
9324 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9325
9326 /**
9327  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
9328  */
9329 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
9330
9331 /**
9332  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
9333  */
9334 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
9335
9336 /**
9337  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
9338  */
9339 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
9340
9341 /**
9342  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
9343  * but with all dynamically-allocated buffers duplicated in new buffers.
9344  */
9345 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
9346
9347 /**
9348  * Creates a new CResult_StringErrorZ in the success state.
9349  */
9350 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
9351
9352 /**
9353  * Creates a new CResult_StringErrorZ in the error state.
9354  */
9355 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
9356
9357 /**
9358  * Frees any resources used by the CResult_StringErrorZ.
9359  */
9360 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
9361
9362 /**
9363  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9364  */
9365 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
9366
9367 /**
9368  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9369  */
9370 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9371
9372 /**
9373  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9374  */
9375 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
9376
9377 /**
9378  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9379  * but with all dynamically-allocated buffers duplicated in new buffers.
9380  */
9381 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
9382
9383 /**
9384  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9385  */
9386 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
9387
9388 /**
9389  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9390  */
9391 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9392
9393 /**
9394  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9395  */
9396 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
9397
9398 /**
9399  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9400  * but with all dynamically-allocated buffers duplicated in new buffers.
9401  */
9402 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
9403
9404 /**
9405  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
9406  */
9407 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
9408
9409 /**
9410  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
9411  */
9412 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
9413
9414 /**
9415  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
9416  */
9417 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
9418
9419 /**
9420  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
9421  * but with all dynamically-allocated buffers duplicated in new buffers.
9422  */
9423 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
9424
9425 /**
9426  * Creates a new tuple which has the same data as `orig`
9427  * but with all dynamically-allocated buffers duplicated in new buffers.
9428  */
9429 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
9430
9431 /**
9432  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9433  */
9434 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
9435
9436 /**
9437  * Frees any resources used by the C2Tuple_OutPointScriptZ.
9438  */
9439 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
9440
9441 /**
9442  * Creates a new tuple which has the same data as `orig`
9443  * but with all dynamically-allocated buffers duplicated in new buffers.
9444  */
9445 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
9446
9447 /**
9448  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
9449  */
9450 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
9451
9452 /**
9453  * Frees any resources used by the C2Tuple_u32ScriptZ.
9454  */
9455 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
9456
9457 /**
9458  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9459  */
9460 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
9461
9462 /**
9463  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9464  */
9465 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
9466
9467 /**
9468  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9469  */
9470 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
9471
9472 /**
9473  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9474  */
9475 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
9476
9477 /**
9478  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9479  */
9480 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9481
9482 /**
9483  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9484  */
9485 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
9486
9487 /**
9488  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9489  */
9490 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
9491
9492 /**
9493  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9494  */
9495 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9496
9497 /**
9498  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9499  */
9500 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9501
9502 /**
9503  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9504  */
9505 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9506
9507 /**
9508  * Creates a new tuple which has the same data as `orig`
9509  * but with all dynamically-allocated buffers duplicated in new buffers.
9510  */
9511 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
9512
9513 /**
9514  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
9515  */
9516 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
9517
9518 /**
9519  * Frees any resources used by the C2Tuple_u32TxOutZ.
9520  */
9521 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
9522
9523 /**
9524  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9525  */
9526 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
9527
9528 /**
9529  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9530  */
9531 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
9532
9533 /**
9534  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9535  */
9536 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
9537
9538 /**
9539  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9540  */
9541 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
9542
9543 /**
9544  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9545  */
9546 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9547
9548 /**
9549  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9550  */
9551 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9552
9553 /**
9554  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9555  */
9556 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9557
9558 /**
9559  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9560  */
9561 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9562
9563 /**
9564  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9565  * but with all dynamically-allocated buffers duplicated in new buffers.
9566  */
9567 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9568
9569 /**
9570  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9571  */
9572 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9573
9574 /**
9575  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9576  */
9577 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9578
9579 /**
9580  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9581  */
9582 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
9583
9584 /**
9585  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9586  */
9587 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
9588
9589 /**
9590  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9591  */
9592 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
9593
9594 /**
9595  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9596  */
9597 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9598
9599 /**
9600  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9601  */
9602 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9603
9604 /**
9605  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9606  */
9607 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9608
9609 /**
9610  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9611  */
9612 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9613
9614 /**
9615  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9616  */
9617 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9618
9619 /**
9620  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9621  * but with all dynamically-allocated buffers duplicated in new buffers.
9622  */
9623 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9624
9625 /**
9626  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9627  */
9628 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9629
9630 /**
9631  * Creates a new CResult_RouteLightningErrorZ in the success state.
9632  */
9633 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9634
9635 /**
9636  * Creates a new CResult_RouteLightningErrorZ in the error state.
9637  */
9638 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9639
9640 /**
9641  * Frees any resources used by the CResult_RouteLightningErrorZ.
9642  */
9643 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9644
9645 /**
9646  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9647  * but with all dynamically-allocated buffers duplicated in new buffers.
9648  */
9649 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9650
9651 /**
9652  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9653  */
9654 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9655
9656 /**
9657  * Creates a new CResult_boolLightningErrorZ in the success state.
9658  */
9659 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
9660
9661 /**
9662  * Creates a new CResult_boolLightningErrorZ in the error state.
9663  */
9664 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
9665
9666 /**
9667  * Frees any resources used by the CResult_boolLightningErrorZ.
9668  */
9669 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
9670
9671 /**
9672  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9673  * but with all dynamically-allocated buffers duplicated in new buffers.
9674  */
9675 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
9676
9677 /**
9678  * Creates a new tuple which has the same data as `orig`
9679  * but with all dynamically-allocated buffers duplicated in new buffers.
9680  */
9681 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
9682
9683 /**
9684  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9685  */
9686 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
9687
9688 /**
9689  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9690  */
9691 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
9692
9693 /**
9694  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9695  */
9696 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
9697
9698 /**
9699  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9700  */
9701 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
9702
9703 /**
9704  * Creates a new CResult_NoneLightningErrorZ in the success state.
9705  */
9706 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
9707
9708 /**
9709  * Creates a new CResult_NoneLightningErrorZ in the error state.
9710  */
9711 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
9712
9713 /**
9714  * Frees any resources used by the CResult_NoneLightningErrorZ.
9715  */
9716 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
9717
9718 /**
9719  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9720  * but with all dynamically-allocated buffers duplicated in new buffers.
9721  */
9722 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
9723
9724 /**
9725  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9726  */
9727 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
9728
9729 /**
9730  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9731  */
9732 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
9733
9734 /**
9735  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9736  */
9737 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9738
9739 /**
9740  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9741  */
9742 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
9743
9744 /**
9745  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9746  * but with all dynamically-allocated buffers duplicated in new buffers.
9747  */
9748 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
9749
9750 /**
9751  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
9752  */
9753 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
9754
9755 /**
9756  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
9757  */
9758 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
9759
9760 /**
9761  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
9762  */
9763 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
9764
9765 /**
9766  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9767  * but with all dynamically-allocated buffers duplicated in new buffers.
9768  */
9769 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
9770
9771 /**
9772  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
9773  */
9774 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
9775
9776 /**
9777  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
9778  */
9779 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9780
9781 /**
9782  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
9783  */
9784 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
9785
9786 /**
9787  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9788  * but with all dynamically-allocated buffers duplicated in new buffers.
9789  */
9790 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
9791
9792 /**
9793  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9794  */
9795 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9796
9797 /**
9798  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9799  */
9800 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9801
9802 /**
9803  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9804  */
9805 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9806
9807 /**
9808  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9809  * but with all dynamically-allocated buffers duplicated in new buffers.
9810  */
9811 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9812
9813 /**
9814  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9815  */
9816 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9817
9818 /**
9819  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9820  */
9821 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9822
9823 /**
9824  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9825  */
9826 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9827
9828 /**
9829  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9830  */
9831 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9832
9833 /**
9834  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9835  */
9836 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
9837
9838 /**
9839  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9840  */
9841 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9842
9843 /**
9844  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9845  */
9846 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
9847
9848 /**
9849  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9850  * but with all dynamically-allocated buffers duplicated in new buffers.
9851  */
9852 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9853
9854 /**
9855  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9856  */
9857 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
9858
9859 /**
9860  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9861  */
9862 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9863
9864 /**
9865  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9866  */
9867 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
9868
9869 /**
9870  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9871  * but with all dynamically-allocated buffers duplicated in new buffers.
9872  */
9873 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9874
9875 /**
9876  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9877  */
9878 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
9879
9880 /**
9881  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9882  */
9883 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
9884
9885 /**
9886  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9887  */
9888 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
9889
9890 /**
9891  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9892  * but with all dynamically-allocated buffers duplicated in new buffers.
9893  */
9894 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
9895
9896 /**
9897  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9898  */
9899 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9900
9901 /**
9902  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9903  */
9904 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
9905
9906 /**
9907  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9908  */
9909 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
9910
9911 /**
9912  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
9913  */
9914 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
9915
9916 /**
9917  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9918  * but with all dynamically-allocated buffers duplicated in new buffers.
9919  */
9920 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
9921
9922 /**
9923  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9924  */
9925 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
9926
9927 /**
9928  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9929  */
9930 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
9931
9932 /**
9933  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9934  */
9935 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
9936
9937 /**
9938  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9939  */
9940 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
9941
9942 /**
9943  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9944  * but with all dynamically-allocated buffers duplicated in new buffers.
9945  */
9946 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
9947
9948 /**
9949  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9950  */
9951 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
9952
9953 /**
9954  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9955  */
9956 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
9957
9958 /**
9959  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9960  */
9961 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
9962
9963 /**
9964  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9965  * but with all dynamically-allocated buffers duplicated in new buffers.
9966  */
9967 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
9968
9969 /**
9970  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9971  */
9972 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9973
9974 /**
9975  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9976  */
9977 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9978
9979 /**
9980  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9981  */
9982 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9983
9984 /**
9985  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9986  */
9987 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9988
9989 /**
9990  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9991  */
9992 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9993
9994 /**
9995  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9996  */
9997 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9998
9999 /**
10000  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10001  */
10002 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10003
10004 /**
10005  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10006  */
10007 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10008
10009 /**
10010  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10011  */
10012 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10013
10014 /**
10015  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10016  */
10017 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10018
10019 /**
10020  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10021  */
10022 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10023
10024 /**
10025  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10026  */
10027 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10028
10029 /**
10030  * Creates a new CResult_NetAddressu8Z in the success state.
10031  */
10032 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10033
10034 /**
10035  * Creates a new CResult_NetAddressu8Z in the error state.
10036  */
10037 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10038
10039 /**
10040  * Frees any resources used by the CResult_NetAddressu8Z.
10041  */
10042 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10043
10044 /**
10045  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10046  * but with all dynamically-allocated buffers duplicated in new buffers.
10047  */
10048 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10049
10050 /**
10051  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10052  */
10053 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10054
10055 /**
10056  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10057  */
10058 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10059
10060 /**
10061  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10062  */
10063 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10064
10065 /**
10066  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10067  * but with all dynamically-allocated buffers duplicated in new buffers.
10068  */
10069 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10070
10071 /**
10072  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10073  */
10074 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10075
10076 /**
10077  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10078  */
10079 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10080
10081 /**
10082  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10083  */
10084 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10085
10086 /**
10087  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10088  */
10089 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10090
10091 /**
10092  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10093  */
10094 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10095
10096 /**
10097  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10098  */
10099 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10100
10101 /**
10102  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10103  */
10104 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10105
10106 /**
10107  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10108  * but with all dynamically-allocated buffers duplicated in new buffers.
10109  */
10110 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10111
10112 /**
10113  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10114  */
10115 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10116
10117 /**
10118  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10119  */
10120 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10121
10122 /**
10123  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10124  */
10125 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10126
10127 /**
10128  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10129  * but with all dynamically-allocated buffers duplicated in new buffers.
10130  */
10131 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10132
10133 /**
10134  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10135  */
10136 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10137
10138 /**
10139  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10140  */
10141 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10142
10143 /**
10144  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10145  */
10146 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10147
10148 /**
10149  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10150  * but with all dynamically-allocated buffers duplicated in new buffers.
10151  */
10152 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10153
10154 /**
10155  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10156  */
10157 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10158
10159 /**
10160  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10161  */
10162 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10163
10164 /**
10165  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10166  */
10167 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10168
10169 /**
10170  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10171  * but with all dynamically-allocated buffers duplicated in new buffers.
10172  */
10173 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10174
10175 /**
10176  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10177  */
10178 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10179
10180 /**
10181  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10182  */
10183 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10184
10185 /**
10186  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10187  */
10188 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10189
10190 /**
10191  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10192  * but with all dynamically-allocated buffers duplicated in new buffers.
10193  */
10194 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10195
10196 /**
10197  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10198  */
10199 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10200
10201 /**
10202  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10203  */
10204 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10205
10206 /**
10207  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10208  */
10209 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10210
10211 /**
10212  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10213  * but with all dynamically-allocated buffers duplicated in new buffers.
10214  */
10215 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10216
10217 /**
10218  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10219  */
10220 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10221
10222 /**
10223  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10224  */
10225 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10226
10227 /**
10228  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10229  */
10230 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10231
10232 /**
10233  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10234  * but with all dynamically-allocated buffers duplicated in new buffers.
10235  */
10236 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10237
10238 /**
10239  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10240  */
10241 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10242
10243 /**
10244  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10245  */
10246 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10247
10248 /**
10249  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10250  */
10251 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
10252
10253 /**
10254  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10255  * but with all dynamically-allocated buffers duplicated in new buffers.
10256  */
10257 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
10258
10259 /**
10260  * Creates a new CResult_InitDecodeErrorZ in the success state.
10261  */
10262 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
10263
10264 /**
10265  * Creates a new CResult_InitDecodeErrorZ in the error state.
10266  */
10267 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
10268
10269 /**
10270  * Frees any resources used by the CResult_InitDecodeErrorZ.
10271  */
10272 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
10273
10274 /**
10275  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10276  * but with all dynamically-allocated buffers duplicated in new buffers.
10277  */
10278 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
10279
10280 /**
10281  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10282  */
10283 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
10284
10285 /**
10286  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10287  */
10288 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
10289
10290 /**
10291  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10292  */
10293 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
10294
10295 /**
10296  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10297  * but with all dynamically-allocated buffers duplicated in new buffers.
10298  */
10299 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
10300
10301 /**
10302  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10303  */
10304 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
10305
10306 /**
10307  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10308  */
10309 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
10310
10311 /**
10312  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10313  */
10314 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
10315
10316 /**
10317  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10318  * but with all dynamically-allocated buffers duplicated in new buffers.
10319  */
10320 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
10321
10322 /**
10323  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10324  */
10325 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
10326
10327 /**
10328  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10329  */
10330 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
10331
10332 /**
10333  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10334  */
10335 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
10336
10337 /**
10338  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10339  * but with all dynamically-allocated buffers duplicated in new buffers.
10340  */
10341 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
10342
10343 /**
10344  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10345  */
10346 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
10347
10348 /**
10349  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10350  */
10351 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10352
10353 /**
10354  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10355  */
10356 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
10357
10358 /**
10359  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10360  * but with all dynamically-allocated buffers duplicated in new buffers.
10361  */
10362 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
10363
10364 /**
10365  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10366  */
10367 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
10368
10369 /**
10370  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10371  */
10372 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10373
10374 /**
10375  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10376  */
10377 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
10378
10379 /**
10380  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10381  * but with all dynamically-allocated buffers duplicated in new buffers.
10382  */
10383 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
10384
10385 /**
10386  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10387  */
10388 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
10389
10390 /**
10391  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10392  */
10393 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
10394
10395 /**
10396  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10397  */
10398 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
10399
10400 /**
10401  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10402  * but with all dynamically-allocated buffers duplicated in new buffers.
10403  */
10404 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
10405
10406 /**
10407  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10408  */
10409 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
10410
10411 /**
10412  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10413  */
10414 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10415
10416 /**
10417  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10418  */
10419 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
10420
10421 /**
10422  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10423  * but with all dynamically-allocated buffers duplicated in new buffers.
10424  */
10425 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
10426
10427 /**
10428  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10429  */
10430 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
10431
10432 /**
10433  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10434  */
10435 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10436
10437 /**
10438  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10439  */
10440 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
10441
10442 /**
10443  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10444  * but with all dynamically-allocated buffers duplicated in new buffers.
10445  */
10446 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
10447
10448 /**
10449  * Creates a new CResult_PingDecodeErrorZ in the success state.
10450  */
10451 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
10452
10453 /**
10454  * Creates a new CResult_PingDecodeErrorZ in the error state.
10455  */
10456 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
10457
10458 /**
10459  * Frees any resources used by the CResult_PingDecodeErrorZ.
10460  */
10461 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
10462
10463 /**
10464  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10465  * but with all dynamically-allocated buffers duplicated in new buffers.
10466  */
10467 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
10468
10469 /**
10470  * Creates a new CResult_PongDecodeErrorZ in the success state.
10471  */
10472 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
10473
10474 /**
10475  * Creates a new CResult_PongDecodeErrorZ in the error state.
10476  */
10477 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
10478
10479 /**
10480  * Frees any resources used by the CResult_PongDecodeErrorZ.
10481  */
10482 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
10483
10484 /**
10485  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10486  * but with all dynamically-allocated buffers duplicated in new buffers.
10487  */
10488 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
10489
10490 /**
10491  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10492  */
10493 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
10494
10495 /**
10496  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10497  */
10498 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10499
10500 /**
10501  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10502  */
10503 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
10504
10505 /**
10506  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10507  * but with all dynamically-allocated buffers duplicated in new buffers.
10508  */
10509 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10510
10511 /**
10512  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10513  */
10514 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
10515
10516 /**
10517  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10518  */
10519 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10520
10521 /**
10522  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10523  */
10524 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
10525
10526 /**
10527  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10528  * but with all dynamically-allocated buffers duplicated in new buffers.
10529  */
10530 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10531
10532 /**
10533  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10534  */
10535 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
10536
10537 /**
10538  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10539  */
10540 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10541
10542 /**
10543  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10544  */
10545 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
10546
10547 /**
10548  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10549  * but with all dynamically-allocated buffers duplicated in new buffers.
10550  */
10551 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10552
10553 /**
10554  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10555  */
10556 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
10557
10558 /**
10559  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10560  */
10561 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10562
10563 /**
10564  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10565  */
10566 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
10567
10568 /**
10569  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10570  * but with all dynamically-allocated buffers duplicated in new buffers.
10571  */
10572 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10573
10574 /**
10575  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10576  */
10577 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
10578
10579 /**
10580  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10581  */
10582 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
10583
10584 /**
10585  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10586  */
10587 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
10588
10589 /**
10590  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10591  * but with all dynamically-allocated buffers duplicated in new buffers.
10592  */
10593 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
10594
10595 /**
10596  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10597  */
10598 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
10599
10600 /**
10601  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10602  */
10603 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10604
10605 /**
10606  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10607  */
10608 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
10609
10610 /**
10611  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10612  * but with all dynamically-allocated buffers duplicated in new buffers.
10613  */
10614 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10615
10616 /**
10617  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10618  */
10619 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
10620
10621 /**
10622  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10623  */
10624 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10625
10626 /**
10627  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10628  */
10629 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
10630
10631 /**
10632  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10633  * but with all dynamically-allocated buffers duplicated in new buffers.
10634  */
10635 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10636
10637 /**
10638  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10639  */
10640 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
10641
10642 /**
10643  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10644  */
10645 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
10646
10647 /**
10648  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10649  */
10650 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
10651
10652 /**
10653  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10654  * but with all dynamically-allocated buffers duplicated in new buffers.
10655  */
10656 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
10657
10658 /**
10659  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10660  */
10661 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
10662
10663 /**
10664  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10665  */
10666 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
10667
10668 /**
10669  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10670  */
10671 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
10672
10673 /**
10674  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10675  * but with all dynamically-allocated buffers duplicated in new buffers.
10676  */
10677 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
10678
10679 /**
10680  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10681  */
10682 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
10683
10684 /**
10685  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10686  */
10687 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10688
10689 /**
10690  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10691  */
10692 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
10693
10694 /**
10695  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10696  * but with all dynamically-allocated buffers duplicated in new buffers.
10697  */
10698 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10699
10700 /**
10701  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10702  */
10703 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
10704
10705 /**
10706  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10707  */
10708 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10709
10710 /**
10711  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10712  */
10713 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
10714
10715 /**
10716  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10717  * but with all dynamically-allocated buffers duplicated in new buffers.
10718  */
10719 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10720
10721 /**
10722  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10723  */
10724 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
10725
10726 /**
10727  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10728  */
10729 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
10730
10731 /**
10732  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10733  */
10734 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
10735
10736 /**
10737  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10738  * but with all dynamically-allocated buffers duplicated in new buffers.
10739  */
10740 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
10741
10742 /**
10743  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10744  */
10745 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
10746
10747 /**
10748  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10749  */
10750 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
10751
10752 /**
10753  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
10754  */
10755 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
10756
10757 /**
10758  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
10759  * but with all dynamically-allocated buffers duplicated in new buffers.
10760  */
10761 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
10762
10763 /**
10764  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10765  */
10766 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10767
10768 /**
10769  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10770  */
10771 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10772
10773 /**
10774  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10775  */
10776 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10777
10778 /**
10779  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10780  * but with all dynamically-allocated buffers duplicated in new buffers.
10781  */
10782 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10783
10784 /**
10785  * Creates a new tuple which has the same data as `orig`
10786  * but with all dynamically-allocated buffers duplicated in new buffers.
10787  */
10788 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10789
10790 /**
10791  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10792  */
10793 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10794
10795 /**
10796  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10797  */
10798 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10799
10800 /**
10801  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10802  */
10803 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10804
10805 /**
10806  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10807  */
10808 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10809
10810 /**
10811  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10812  */
10813 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10814
10815 /**
10816  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10817  * but with all dynamically-allocated buffers duplicated in new buffers.
10818  */
10819 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10820
10821 /**
10822  * Creates a new CResult_SignatureNoneZ in the success state.
10823  */
10824 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10825
10826 /**
10827  * Creates a new CResult_SignatureNoneZ in the error state.
10828  */
10829 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10830
10831 /**
10832  * Frees any resources used by the CResult_SignatureNoneZ.
10833  */
10834 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10835
10836 /**
10837  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10838  * but with all dynamically-allocated buffers duplicated in new buffers.
10839  */
10840 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10841
10842 /**
10843  * Creates a new CResult_SignDecodeErrorZ in the success state.
10844  */
10845 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10846
10847 /**
10848  * Creates a new CResult_SignDecodeErrorZ in the error state.
10849  */
10850 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10851
10852 /**
10853  * Frees any resources used by the CResult_SignDecodeErrorZ.
10854  */
10855 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10856
10857 /**
10858  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10859  * but with all dynamically-allocated buffers duplicated in new buffers.
10860  */
10861 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10862
10863 /**
10864  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
10865  */
10866 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
10867
10868 /**
10869  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
10870  */
10871 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
10872
10873 /**
10874  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
10875  */
10876 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
10877
10878 /**
10879  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
10880  * but with all dynamically-allocated buffers duplicated in new buffers.
10881  */
10882 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
10883
10884 /**
10885  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10886  */
10887 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
10888
10889 /**
10890  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
10891  */
10892 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
10893
10894 /**
10895  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
10896  */
10897 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
10898
10899 /**
10900  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
10901  */
10902 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
10903
10904 /**
10905  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
10906  * but with all dynamically-allocated buffers duplicated in new buffers.
10907  */
10908 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
10909
10910 /**
10911  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
10912  */
10913 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
10914
10915 /**
10916  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10917  */
10918 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10919
10920 /**
10921  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10922  */
10923 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10924
10925 /**
10926  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10927  * but with all dynamically-allocated buffers duplicated in new buffers.
10928  */
10929 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10930
10931 /**
10932  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10933  */
10934 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10935
10936 /**
10937  * Creates a new CResult_TransactionNoneZ in the success state.
10938  */
10939 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10940
10941 /**
10942  * Creates a new CResult_TransactionNoneZ in the error state.
10943  */
10944 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10945
10946 /**
10947  * Frees any resources used by the CResult_TransactionNoneZ.
10948  */
10949 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10950
10951 /**
10952  * Creates a new CResult_NoneErrorZ in the success state.
10953  */
10954 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
10955
10956 /**
10957  * Creates a new CResult_NoneErrorZ in the error state.
10958  */
10959 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
10960
10961 /**
10962  * Frees any resources used by the CResult_NoneErrorZ.
10963  */
10964 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
10965
10966 /**
10967  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10968  */
10969 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
10970
10971 /**
10972  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10973  */
10974 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
10975
10976 /**
10977  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10978  */
10979 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
10980
10981 /**
10982  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10983  */
10984 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
10985
10986 /**
10987  * Creates a new CResult_NoneAPIErrorZ in the success state.
10988  */
10989 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
10990
10991 /**
10992  * Creates a new CResult_NoneAPIErrorZ in the error state.
10993  */
10994 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
10995
10996 /**
10997  * Frees any resources used by the CResult_NoneAPIErrorZ.
10998  */
10999 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11000
11001 /**
11002  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11003  * but with all dynamically-allocated buffers duplicated in new buffers.
11004  */
11005 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11006
11007 /**
11008  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11009  */
11010 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11011
11012 /**
11013  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11014  */
11015 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11016
11017 /**
11018  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11019  */
11020 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11021
11022 /**
11023  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11024  */
11025 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11026
11027 /**
11028  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11029  */
11030 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11031
11032 /**
11033  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11034  * but with all dynamically-allocated buffers duplicated in new buffers.
11035  */
11036 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11037
11038 /**
11039  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11040  */
11041 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11042
11043 /**
11044  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11045  */
11046 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11047
11048 /**
11049  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11050  */
11051 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11052
11053 /**
11054  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11055  */
11056 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11057
11058 /**
11059  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11060  */
11061 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11062
11063 /**
11064  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11065  */
11066 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11067
11068 /**
11069  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11070  */
11071 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11072
11073 /**
11074  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11075  */
11076 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11077
11078 /**
11079  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11080  */
11081 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11082
11083 /**
11084  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11085  */
11086 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11087
11088 /**
11089  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11090  */
11091 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11092
11093 /**
11094  * Frees any resources used by the Event
11095  */
11096 void Event_free(struct LDKEvent this_ptr);
11097
11098 /**
11099  * Creates a copy of the Event
11100  */
11101 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11102
11103 /**
11104  * Serialize the Event object into a byte array which can be read by Event_read
11105  */
11106 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11107
11108 /**
11109  * Frees any resources used by the MessageSendEvent
11110  */
11111 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11112
11113 /**
11114  * Creates a copy of the MessageSendEvent
11115  */
11116 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11117
11118 /**
11119  * Calls the free function if one is set
11120  */
11121 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11122
11123 /**
11124  * Calls the free function if one is set
11125  */
11126 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11127
11128 /**
11129  * Frees any resources used by the APIError
11130  */
11131 void APIError_free(struct LDKAPIError this_ptr);
11132
11133 /**
11134  * Creates a copy of the APIError
11135  */
11136 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11137
11138 /**
11139  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11140  * 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.
11141  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11142  */
11143 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11144
11145 /**
11146  * Recovers the PublicKey of the signer of the message given the message and the signature.
11147  */
11148 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11149
11150 /**
11151  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11152  * and the PublicKey.
11153  */
11154 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11155
11156 /**
11157  * Creates a copy of the Level
11158  */
11159 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11160
11161 /**
11162  * Returns the most verbose logging level.
11163  */
11164 MUST_USE_RES enum LDKLevel Level_max(void);
11165
11166 /**
11167  * Calls the free function if one is set
11168  */
11169 void Logger_free(struct LDKLogger this_ptr);
11170
11171 /**
11172  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11173  */
11174 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11175
11176 /**
11177  * Confirmations we will wait for before considering the channel locked in.
11178  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11179  * equivalent limit applied to outbound channels).
11180  *
11181  * Default value: 6.
11182  */
11183 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11184
11185 /**
11186  * Confirmations we will wait for before considering the channel locked in.
11187  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11188  * equivalent limit applied to outbound channels).
11189  *
11190  * Default value: 6.
11191  */
11192 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11193
11194 /**
11195  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11196  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11197  * transaction).
11198  *
11199  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11200  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11201  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11202  * possibly with time in between to RBF the spending transaction).
11203  *
11204  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11205  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11206  * our channel.
11207  *
11208  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11209  * can tweak config to ask for more security, not less.
11210  */
11211 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11212
11213 /**
11214  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11215  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11216  * transaction).
11217  *
11218  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11219  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11220  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11221  * possibly with time in between to RBF the spending transaction).
11222  *
11223  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11224  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11225  * our channel.
11226  *
11227  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11228  * can tweak config to ask for more security, not less.
11229  */
11230 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11231
11232 /**
11233  * Set to the smallest value HTLC we will accept to process.
11234  *
11235  * This value is sent to our counterparty on channel-open and we close the channel any time
11236  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11237  *
11238  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11239  * by the protocol.
11240  */
11241 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11242
11243 /**
11244  * Set to the smallest value HTLC we will accept to process.
11245  *
11246  * This value is sent to our counterparty on channel-open and we close the channel any time
11247  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11248  *
11249  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11250  * by the protocol.
11251  */
11252 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11253
11254 /**
11255  * Constructs a new ChannelHandshakeConfig given each field
11256  */
11257 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);
11258
11259 /**
11260  * Creates a copy of the ChannelHandshakeConfig
11261  */
11262 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11263
11264 /**
11265  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11266  */
11267 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11268
11269 /**
11270  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11271  */
11272 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11273
11274 /**
11275  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11276  * only applies to inbound channels.
11277  *
11278  * Default value: 0.
11279  */
11280 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11281
11282 /**
11283  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11284  * only applies to inbound channels.
11285  *
11286  * Default value: 0.
11287  */
11288 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11289
11290 /**
11291  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11292  * you to limit the maximum minimum-size they can require.
11293  *
11294  * Default value: u64::max_value.
11295  */
11296 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11297
11298 /**
11299  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11300  * you to limit the maximum minimum-size they can require.
11301  *
11302  * Default value: u64::max_value.
11303  */
11304 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11305
11306 /**
11307  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11308  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11309  *
11310  * Default value: 0.
11311  */
11312 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11313
11314 /**
11315  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11316  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11317  *
11318  * Default value: 0.
11319  */
11320 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11321
11322 /**
11323  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11324  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11325  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11326  *
11327  * Default value: u64::max_value.
11328  */
11329 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11330
11331 /**
11332  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11333  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11334  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11335  *
11336  * Default value: u64::max_value.
11337  */
11338 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11339
11340 /**
11341  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11342  * time. This allows you to set a minimum such value.
11343  *
11344  * Default value: 0.
11345  */
11346 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11347
11348 /**
11349  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11350  * time. This allows you to set a minimum such value.
11351  *
11352  * Default value: 0.
11353  */
11354 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11355
11356 /**
11357  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11358  * required to always be higher than this value so this only applies to HTLC outputs (and
11359  * potentially to-self outputs before any payments have been made).
11360  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11361  * This setting allows you to set a minimum dust limit for their commitment transactions,
11362  * reflecting the reality that tiny outputs are not considered standard transactions and will
11363  * not propagate through the Bitcoin network.
11364  *
11365  * Default value: 546, the current dust limit on the Bitcoin network.
11366  */
11367 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11368
11369 /**
11370  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11371  * required to always be higher than this value so this only applies to HTLC outputs (and
11372  * potentially to-self outputs before any payments have been made).
11373  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11374  * This setting allows you to set a minimum dust limit for their commitment transactions,
11375  * reflecting the reality that tiny outputs are not considered standard transactions and will
11376  * not propagate through the Bitcoin network.
11377  *
11378  * Default value: 546, the current dust limit on the Bitcoin network.
11379  */
11380 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11381
11382 /**
11383  * Maximum allowed threshold above which outputs will not be generated in their commitment
11384  * transactions.
11385  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11386  *
11387  * Default value: u64::max_value.
11388  */
11389 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11390
11391 /**
11392  * Maximum allowed threshold above which outputs will not be generated in their commitment
11393  * transactions.
11394  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11395  *
11396  * Default value: u64::max_value.
11397  */
11398 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11399
11400 /**
11401  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11402  * certain number of blocks, specified by the node which is not the funder (as the funder can
11403  * assume they aren't going to double-spend themselves).
11404  * This config allows you to set a limit on the maximum amount of time to wait.
11405  *
11406  * Default value: 144, or roughly one day and only applies to outbound channels.
11407  */
11408 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11409
11410 /**
11411  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11412  * certain number of blocks, specified by the node which is not the funder (as the funder can
11413  * assume they aren't going to double-spend themselves).
11414  * This config allows you to set a limit on the maximum amount of time to wait.
11415  *
11416  * Default value: 144, or roughly one day and only applies to outbound channels.
11417  */
11418 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11419
11420 /**
11421  * Set to force the incoming channel to match our announced channel preference in
11422  * ChannelConfig.
11423  *
11424  * Default value: true, to make the default that no announced channels are possible (which is
11425  * appropriate for any nodes which are not online very reliably).
11426  */
11427 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11428
11429 /**
11430  * Set to force the incoming channel to match our announced channel preference in
11431  * ChannelConfig.
11432  *
11433  * Default value: true, to make the default that no announced channels are possible (which is
11434  * appropriate for any nodes which are not online very reliably).
11435  */
11436 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11437
11438 /**
11439  * Set to the amount of time we're willing to wait to claim money back to us.
11440  *
11441  * Not checking this value would be a security issue, as our peer would be able to set it to
11442  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11443  *
11444  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11445  * reduce the loss of having useless locked funds (if your peer accepts)
11446  */
11447 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11448
11449 /**
11450  * Set to the amount of time we're willing to wait to claim money back to us.
11451  *
11452  * Not checking this value would be a security issue, as our peer would be able to set it to
11453  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11454  *
11455  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11456  * reduce the loss of having useless locked funds (if your peer accepts)
11457  */
11458 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11459
11460 /**
11461  * Constructs a new ChannelHandshakeLimits given each field
11462  */
11463 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, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
11464
11465 /**
11466  * Creates a copy of the ChannelHandshakeLimits
11467  */
11468 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11469
11470 /**
11471  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11472  */
11473 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11474
11475 /**
11476  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11477  */
11478 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11479
11480 /**
11481  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11482  * This may be allowed to change at runtime in a later update, however doing so must result in
11483  * update messages sent to notify all nodes of our updated relay fee.
11484  *
11485  * Default value: 0.
11486  */
11487 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11488
11489 /**
11490  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11491  * This may be allowed to change at runtime in a later update, however doing so must result in
11492  * update messages sent to notify all nodes of our updated relay fee.
11493  *
11494  * Default value: 0.
11495  */
11496 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11497
11498 /**
11499  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11500  * the channel this config applies to.
11501  *
11502  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11503  * HTLC balance when a channel appears on-chain whereas
11504  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11505  * (non-HTLC-encumbered) balance.
11506  *
11507  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11508  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11509  * commitment transaction at least once per this many blocks (minus some margin to allow us
11510  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11511  * the spending transaction).
11512  *
11513  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11514  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11515  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11516  *
11517  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11518  */
11519 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11520
11521 /**
11522  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11523  * the channel this config applies to.
11524  *
11525  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11526  * HTLC balance when a channel appears on-chain whereas
11527  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11528  * (non-HTLC-encumbered) balance.
11529  *
11530  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11531  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11532  * commitment transaction at least once per this many blocks (minus some margin to allow us
11533  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11534  * the spending transaction).
11535  *
11536  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11537  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11538  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11539  *
11540  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11541  */
11542 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11543
11544 /**
11545  * Set to announce the channel publicly and notify all nodes that they can route via this
11546  * channel.
11547  *
11548  * This should only be set to true for nodes which expect to be online reliably.
11549  *
11550  * As the node which funds a channel picks this value this will only apply for new outbound
11551  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11552  *
11553  * This cannot be changed after the initial channel handshake.
11554  *
11555  * Default value: false.
11556  */
11557 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11558
11559 /**
11560  * Set to announce the channel publicly and notify all nodes that they can route via this
11561  * channel.
11562  *
11563  * This should only be set to true for nodes which expect to be online reliably.
11564  *
11565  * As the node which funds a channel picks this value this will only apply for new outbound
11566  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11567  *
11568  * This cannot be changed after the initial channel handshake.
11569  *
11570  * Default value: false.
11571  */
11572 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11573
11574 /**
11575  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11576  * supports it, they will then enforce the mutual-close output to us matches what we provided
11577  * at intialization, preventing us from closing to an alternate pubkey.
11578  *
11579  * This is set to true by default to provide a slight increase in security, though ultimately
11580  * any attacker who is able to take control of a channel can just as easily send the funds via
11581  * lightning payments, so we never require that our counterparties support this option.
11582  *
11583  * This cannot be changed after a channel has been initialized.
11584  *
11585  * Default value: true.
11586  */
11587 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11588
11589 /**
11590  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11591  * supports it, they will then enforce the mutual-close output to us matches what we provided
11592  * at intialization, preventing us from closing to an alternate pubkey.
11593  *
11594  * This is set to true by default to provide a slight increase in security, though ultimately
11595  * any attacker who is able to take control of a channel can just as easily send the funds via
11596  * lightning payments, so we never require that our counterparties support this option.
11597  *
11598  * This cannot be changed after a channel has been initialized.
11599  *
11600  * Default value: true.
11601  */
11602 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11603
11604 /**
11605  * Constructs a new ChannelConfig given each field
11606  */
11607 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);
11608
11609 /**
11610  * Creates a copy of the ChannelConfig
11611  */
11612 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
11613
11614 /**
11615  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
11616  */
11617 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
11618
11619 /**
11620  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
11621  */
11622 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
11623
11624 /**
11625  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
11626  */
11627 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
11628
11629 /**
11630  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
11631  */
11632 void UserConfig_free(struct LDKUserConfig this_obj);
11633
11634 /**
11635  * Channel config that we propose to our counterparty.
11636  */
11637 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11638
11639 /**
11640  * Channel config that we propose to our counterparty.
11641  */
11642 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
11643
11644 /**
11645  * Limits applied to our counterparty's proposed channel config settings.
11646  */
11647 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11648
11649 /**
11650  * Limits applied to our counterparty's proposed channel config settings.
11651  */
11652 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
11653
11654 /**
11655  * Channel config which affects behavior during channel lifetime.
11656  */
11657 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11658
11659 /**
11660  * Channel config which affects behavior during channel lifetime.
11661  */
11662 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
11663
11664 /**
11665  * Constructs a new UserConfig given each field
11666  */
11667 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);
11668
11669 /**
11670  * Creates a copy of the UserConfig
11671  */
11672 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
11673
11674 /**
11675  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
11676  */
11677 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
11678
11679 /**
11680  * Creates a copy of the AccessError
11681  */
11682 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
11683
11684 /**
11685  * Calls the free function if one is set
11686  */
11687 void Access_free(struct LDKAccess this_ptr);
11688
11689 /**
11690  * Calls the free function if one is set
11691  */
11692 void Listen_free(struct LDKListen this_ptr);
11693
11694 /**
11695  * Calls the free function if one is set
11696  */
11697 void Confirm_free(struct LDKConfirm this_ptr);
11698
11699 /**
11700  * Calls the free function if one is set
11701  */
11702 void Watch_free(struct LDKWatch this_ptr);
11703
11704 /**
11705  * Calls the free function if one is set
11706  */
11707 void Filter_free(struct LDKFilter this_ptr);
11708
11709 /**
11710  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
11711  */
11712 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
11713
11714 /**
11715  * First block where the transaction output may have been spent.
11716  */
11717 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11718
11719 /**
11720  * First block where the transaction output may have been spent.
11721  */
11722 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11723
11724 /**
11725  * Outpoint identifying the transaction output.
11726  */
11727 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11728
11729 /**
11730  * Outpoint identifying the transaction output.
11731  */
11732 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11733
11734 /**
11735  * Spending condition of the transaction output.
11736  */
11737 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11738
11739 /**
11740  * Spending condition of the transaction output.
11741  */
11742 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11743
11744 /**
11745  * Constructs a new WatchedOutput given each field
11746  */
11747 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
11748
11749 /**
11750  * Calls the free function if one is set
11751  */
11752 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
11753
11754 /**
11755  * Creates a copy of the ConfirmationTarget
11756  */
11757 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
11758
11759 /**
11760  * Calls the free function if one is set
11761  */
11762 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
11763
11764 /**
11765  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
11766  */
11767 void ChainMonitor_free(struct LDKChainMonitor this_obj);
11768
11769 /**
11770  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
11771  *
11772  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
11773  * will call back to it indicating transactions and outputs of interest. This allows clients to
11774  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
11775  * always need to fetch full blocks absent another means for determining which blocks contain
11776  * transactions relevant to the watched channels.
11777  */
11778 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
11779
11780 /**
11781  * Constructs a new Listen which calls the relevant methods on this_arg.
11782  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11783  */
11784 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11785
11786 /**
11787  * Constructs a new Confirm which calls the relevant methods on this_arg.
11788  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
11789  */
11790 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11791
11792 /**
11793  * Constructs a new Watch which calls the relevant methods on this_arg.
11794  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
11795  */
11796 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11797
11798 /**
11799  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11800  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11801  */
11802 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11803
11804 /**
11805  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
11806  */
11807 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
11808
11809 /**
11810  * The sequence number of this update. Updates *must* be replayed in-order according to this
11811  * sequence number (and updates may panic if they are not). The update_id values are strictly
11812  * increasing and increase by one for each new update, with one exception specified below.
11813  *
11814  * This sequence number is also used to track up to which points updates which returned
11815  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11816  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11817  *
11818  * The only instance where update_id values are not strictly increasing is the case where we
11819  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11820  * its docs for more details.
11821  */
11822 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
11823
11824 /**
11825  * The sequence number of this update. Updates *must* be replayed in-order according to this
11826  * sequence number (and updates may panic if they are not). The update_id values are strictly
11827  * increasing and increase by one for each new update, with one exception specified below.
11828  *
11829  * This sequence number is also used to track up to which points updates which returned
11830  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11831  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11832  *
11833  * The only instance where update_id values are not strictly increasing is the case where we
11834  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11835  * its docs for more details.
11836  */
11837 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
11838
11839 /**
11840  * Creates a copy of the ChannelMonitorUpdate
11841  */
11842 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
11843
11844 /**
11845  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
11846  */
11847 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
11848
11849 /**
11850  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
11851  */
11852 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
11853
11854 /**
11855  * Creates a copy of the ChannelMonitorUpdateErr
11856  */
11857 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
11858
11859 /**
11860  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
11861  */
11862 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
11863
11864 /**
11865  * Creates a copy of the MonitorUpdateError
11866  */
11867 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
11868
11869 /**
11870  * Frees any resources used by the MonitorEvent
11871  */
11872 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
11873
11874 /**
11875  * Creates a copy of the MonitorEvent
11876  */
11877 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
11878
11879 /**
11880  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
11881  */
11882 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
11883
11884 /**
11885  * Creates a copy of the HTLCUpdate
11886  */
11887 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
11888
11889 /**
11890  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
11891  */
11892 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
11893
11894 /**
11895  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
11896  */
11897 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
11898
11899 /**
11900  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
11901  */
11902 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
11903
11904 /**
11905  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
11906  */
11907 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
11908
11909 /**
11910  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
11911  * itself.
11912  *
11913  * panics if the given update is not the next update by update_id.
11914  */
11915 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);
11916
11917 /**
11918  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
11919  * ChannelMonitor.
11920  */
11921 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11922
11923 /**
11924  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
11925  */
11926 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11927
11928 /**
11929  * Gets a list of txids, with their output scripts (in the order they appear in the
11930  * transaction), which we must learn about spends of via block_connected().
11931  */
11932 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11933
11934 /**
11935  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
11936  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
11937  * have been registered.
11938  */
11939 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
11940
11941 /**
11942  * Get the list of HTLCs who's status has been updated on chain. This should be called by
11943  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
11944  */
11945 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11946
11947 /**
11948  * Gets the list of pending events which were generated by previous actions, clearing the list
11949  * in the process.
11950  *
11951  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
11952  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
11953  * no internal locking in ChannelMonitors.
11954  */
11955 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11956
11957 /**
11958  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
11959  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
11960  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
11961  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
11962  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
11963  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
11964  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
11965  * out-of-band the other node operator to coordinate with him if option is available to you.
11966  * In any-case, choice is up to the user.
11967  */
11968 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);
11969
11970 /**
11971  * Processes transactions in a newly connected block, which may result in any of the following:
11972  * - update the monitor's state against resolved HTLCs
11973  * - punish the counterparty in the case of seeing a revoked commitment transaction
11974  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
11975  * - detect settled outputs for later spending
11976  * - schedule and bump any in-flight claims
11977  *
11978  * Returns any new outputs to watch from `txdata`; after called, these are also included in
11979  * [`get_outputs_to_watch`].
11980  *
11981  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
11982  */
11983 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);
11984
11985 /**
11986  * Determines if the disconnected block contained any transactions of interest and updates
11987  * appropriately.
11988  */
11989 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);
11990
11991 /**
11992  * Processes transactions confirmed in a block with the given header and height, returning new
11993  * outputs to watch. See [`block_connected`] for details.
11994  *
11995  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
11996  * blocks. See [`chain::Confirm`] for calling expectations.
11997  *
11998  * [`block_connected`]: Self::block_connected
11999  */
12000 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);
12001
12002 /**
12003  * Processes a transaction that was reorganized out of the chain.
12004  *
12005  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12006  * than blocks. See [`chain::Confirm`] for calling expectations.
12007  *
12008  * [`block_disconnected`]: Self::block_disconnected
12009  */
12010 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);
12011
12012 /**
12013  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12014  * [`block_connected`] for details.
12015  *
12016  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12017  * blocks. See [`chain::Confirm`] for calling expectations.
12018  *
12019  * [`block_connected`]: Self::block_connected
12020  */
12021 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);
12022
12023 /**
12024  * Returns the set of txids that should be monitored for re-organization out of the chain.
12025  */
12026 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12027
12028 /**
12029  * Calls the free function if one is set
12030  */
12031 void Persist_free(struct LDKPersist this_ptr);
12032
12033 /**
12034  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12035  */
12036 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12037
12038 /**
12039  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12040  */
12041 void OutPoint_free(struct LDKOutPoint this_obj);
12042
12043 /**
12044  * The referenced transaction's txid.
12045  */
12046 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12047
12048 /**
12049  * The referenced transaction's txid.
12050  */
12051 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12052
12053 /**
12054  * The index of the referenced output in its transaction's vout.
12055  */
12056 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12057
12058 /**
12059  * The index of the referenced output in its transaction's vout.
12060  */
12061 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12062
12063 /**
12064  * Constructs a new OutPoint given each field
12065  */
12066 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12067
12068 /**
12069  * Creates a copy of the OutPoint
12070  */
12071 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12072
12073 /**
12074  * Convert an `OutPoint` to a lightning channel id.
12075  */
12076 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12077
12078 /**
12079  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12080  */
12081 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12082
12083 /**
12084  * Read a OutPoint from a byte array, created by OutPoint_write
12085  */
12086 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12087
12088 /**
12089  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12090  */
12091 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12092
12093 /**
12094  * The outpoint which is spendable
12095  */
12096 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12097
12098 /**
12099  * The outpoint which is spendable
12100  */
12101 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12102
12103 /**
12104  * Per commitment point to derive delayed_payment_key by key holder
12105  */
12106 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12107
12108 /**
12109  * Per commitment point to derive delayed_payment_key by key holder
12110  */
12111 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12112
12113 /**
12114  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12115  * the witness_script.
12116  */
12117 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12118
12119 /**
12120  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12121  * the witness_script.
12122  */
12123 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12124
12125 /**
12126  * The output which is referenced by the given outpoint
12127  */
12128 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12129
12130 /**
12131  * The revocation point specific to the commitment transaction which was broadcast. Used to
12132  * derive the witnessScript for this output.
12133  */
12134 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12135
12136 /**
12137  * The revocation point specific to the commitment transaction which was broadcast. Used to
12138  * derive the witnessScript for this output.
12139  */
12140 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12141
12142 /**
12143  * Arbitrary identification information returned by a call to
12144  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12145  * the channel to spend the output.
12146  */
12147 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12148
12149 /**
12150  * Arbitrary identification information returned by a call to
12151  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12152  * the channel to spend the output.
12153  */
12154 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12155
12156 /**
12157  * The value of the channel which this output originated from, possibly indirectly.
12158  */
12159 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12160
12161 /**
12162  * The value of the channel which this output originated from, possibly indirectly.
12163  */
12164 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12165
12166 /**
12167  * Constructs a new DelayedPaymentOutputDescriptor given each field
12168  */
12169 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);
12170
12171 /**
12172  * Creates a copy of the DelayedPaymentOutputDescriptor
12173  */
12174 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12175
12176 /**
12177  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12178  */
12179 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12180
12181 /**
12182  * The outpoint which is spendable
12183  */
12184 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12185
12186 /**
12187  * The outpoint which is spendable
12188  */
12189 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12190
12191 /**
12192  * The output which is referenced by the given outpoint
12193  */
12194 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12195
12196 /**
12197  * Arbitrary identification information returned by a call to
12198  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12199  * the channel to spend the output.
12200  */
12201 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12202
12203 /**
12204  * Arbitrary identification information returned by a call to
12205  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12206  * the channel to spend the output.
12207  */
12208 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12209
12210 /**
12211  * The value of the channel which this transactions spends.
12212  */
12213 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12214
12215 /**
12216  * The value of the channel which this transactions spends.
12217  */
12218 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12219
12220 /**
12221  * Constructs a new StaticPaymentOutputDescriptor given each field
12222  */
12223 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);
12224
12225 /**
12226  * Creates a copy of the StaticPaymentOutputDescriptor
12227  */
12228 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12229
12230 /**
12231  * Frees any resources used by the SpendableOutputDescriptor
12232  */
12233 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12234
12235 /**
12236  * Creates a copy of the SpendableOutputDescriptor
12237  */
12238 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12239
12240 /**
12241  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12242  */
12243 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12244
12245 /**
12246  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12247  */
12248 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12249
12250 /**
12251  * Calls the free function if one is set
12252  */
12253 void BaseSign_free(struct LDKBaseSign this_ptr);
12254
12255 /**
12256  * Creates a copy of a Sign
12257  */
12258 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12259
12260 /**
12261  * Calls the free function if one is set
12262  */
12263 void Sign_free(struct LDKSign this_ptr);
12264
12265 /**
12266  * Calls the free function if one is set
12267  */
12268 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12269
12270 /**
12271  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12272  */
12273 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12274
12275 /**
12276  * Private key of anchor tx
12277  */
12278 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12279
12280 /**
12281  * Private key of anchor tx
12282  */
12283 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12284
12285 /**
12286  * Holder secret key for blinded revocation pubkey
12287  */
12288 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12289
12290 /**
12291  * Holder secret key for blinded revocation pubkey
12292  */
12293 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12294
12295 /**
12296  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12297  */
12298 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12299
12300 /**
12301  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12302  */
12303 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12304
12305 /**
12306  * Holder secret key used in HTLC tx
12307  */
12308 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12309
12310 /**
12311  * Holder secret key used in HTLC tx
12312  */
12313 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12314
12315 /**
12316  * Holder htlc secret key used in commitment tx htlc outputs
12317  */
12318 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12319
12320 /**
12321  * Holder htlc secret key used in commitment tx htlc outputs
12322  */
12323 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12324
12325 /**
12326  * Commitment seed
12327  */
12328 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12329
12330 /**
12331  * Commitment seed
12332  */
12333 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12334
12335 /**
12336  * Creates a copy of the InMemorySigner
12337  */
12338 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12339
12340 /**
12341  * Create a new InMemorySigner
12342  */
12343 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);
12344
12345 /**
12346  * Counterparty pubkeys.
12347  * Will panic if ready_channel wasn't called.
12348  */
12349 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12350
12351 /**
12352  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12353  * transactions, ie the amount of time that we have to wait to recover our funds if we
12354  * broadcast a transaction.
12355  * Will panic if ready_channel wasn't called.
12356  */
12357 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12358
12359 /**
12360  * The contest_delay value specified by us and applied on transactions broadcastable
12361  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12362  * if they broadcast a transaction.
12363  * Will panic if ready_channel wasn't called.
12364  */
12365 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12366
12367 /**
12368  * Whether the holder is the initiator
12369  * Will panic if ready_channel wasn't called.
12370  */
12371 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12372
12373 /**
12374  * Funding outpoint
12375  * Will panic if ready_channel wasn't called.
12376  */
12377 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12378
12379 /**
12380  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12381  * building transactions.
12382  *
12383  * Will panic if ready_channel wasn't called.
12384  */
12385 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12386
12387 /**
12388  * Sign the single input of spend_tx at index `input_idx` which spends the output
12389  * described by descriptor, returning the witness stack for the input.
12390  *
12391  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12392  * or is not spending the outpoint described by `descriptor.outpoint`.
12393  */
12394 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);
12395
12396 /**
12397  * Sign the single input of spend_tx at index `input_idx` which spends the output
12398  * described by descriptor, returning the witness stack for the input.
12399  *
12400  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12401  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12402  * sequence set to `descriptor.to_self_delay`.
12403  */
12404 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);
12405
12406 /**
12407  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12408  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12409  */
12410 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12411
12412 /**
12413  * Constructs a new Sign which calls the relevant methods on this_arg.
12414  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12415  */
12416 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12417
12418 /**
12419  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12420  */
12421 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12422
12423 /**
12424  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12425  */
12426 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12427
12428 /**
12429  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12430  */
12431 void KeysManager_free(struct LDKKeysManager this_obj);
12432
12433 /**
12434  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12435  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12436  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12437  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12438  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12439  * simply use the current time (with very high precision).
12440  *
12441  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12442  * obviously, starting_time should be unique every time you reload the library - it is only
12443  * used to generate new ephemeral key data (which will be stored by the individual channel if
12444  * necessary).
12445  *
12446  * Note that the seed is required to recover certain on-chain funds independent of
12447  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12448  * channel, and some on-chain during-closing funds.
12449  *
12450  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12451  * versions. Once the library is more fully supported, the docs will be updated to include a
12452  * detailed description of the guarantee.
12453  */
12454 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12455
12456 /**
12457  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12458  *
12459  * Key derivation parameters are accessible through a per-channel secrets
12460  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12461  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12462  */
12463 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]);
12464
12465 /**
12466  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12467  * output to the given change destination (if sufficient change value remains). The
12468  * transaction will have a feerate, at least, of the given value.
12469  *
12470  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12471  * if a descriptor was duplicated.
12472  *
12473  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12474  *
12475  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12476  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12477  */
12478 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);
12479
12480 /**
12481  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12482  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12483  */
12484 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12485
12486 /**
12487  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12488  */
12489 void ChannelManager_free(struct LDKChannelManager this_obj);
12490
12491 /**
12492  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12493  */
12494 void ChainParameters_free(struct LDKChainParameters this_obj);
12495
12496 /**
12497  * The network for determining the `chain_hash` in Lightning messages.
12498  */
12499 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12500
12501 /**
12502  * The network for determining the `chain_hash` in Lightning messages.
12503  */
12504 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12505
12506 /**
12507  * The hash and height of the latest block successfully connected.
12508  *
12509  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12510  */
12511 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12512
12513 /**
12514  * The hash and height of the latest block successfully connected.
12515  *
12516  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12517  */
12518 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12519
12520 /**
12521  * Constructs a new ChainParameters given each field
12522  */
12523 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12524
12525 /**
12526  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12527  */
12528 void BestBlock_free(struct LDKBestBlock this_obj);
12529
12530 /**
12531  * Creates a copy of the BestBlock
12532  */
12533 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12534
12535 /**
12536  * Returns the best block from the genesis of the given network.
12537  */
12538 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12539
12540 /**
12541  * Returns the best block as identified by the given block hash and height.
12542  */
12543 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12544
12545 /**
12546  * Returns the best block hash.
12547  */
12548 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12549
12550 /**
12551  * Returns the best block height.
12552  */
12553 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12554
12555 /**
12556  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12557  */
12558 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12559
12560 /**
12561  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12562  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12563  * Note that this means this value is *not* persistent - it can change once during the
12564  * lifetime of the channel.
12565  */
12566 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12567
12568 /**
12569  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12570  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12571  * Note that this means this value is *not* persistent - it can change once during the
12572  * lifetime of the channel.
12573  */
12574 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12575
12576 /**
12577  * The position of the funding transaction in the chain. None if the funding transaction has
12578  * not yet been confirmed and the channel fully opened.
12579  */
12580 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12581
12582 /**
12583  * The position of the funding transaction in the chain. None if the funding transaction has
12584  * not yet been confirmed and the channel fully opened.
12585  */
12586 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
12587
12588 /**
12589  * The node_id of our counterparty
12590  */
12591 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12592
12593 /**
12594  * The node_id of our counterparty
12595  */
12596 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12597
12598 /**
12599  * The Features the channel counterparty provided upon last connection.
12600  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12601  * many routing-relevant features are present in the init context.
12602  */
12603 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12604
12605 /**
12606  * The Features the channel counterparty provided upon last connection.
12607  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12608  * many routing-relevant features are present in the init context.
12609  */
12610 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
12611
12612 /**
12613  * The value, in satoshis, of this channel as appears in the funding output
12614  */
12615 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12616
12617 /**
12618  * The value, in satoshis, of this channel as appears in the funding output
12619  */
12620 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12621
12622 /**
12623  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12624  */
12625 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12626
12627 /**
12628  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12629  */
12630 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12631
12632 /**
12633  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12634  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12635  * available for inclusion in new outbound HTLCs). This further does not include any pending
12636  * outgoing HTLCs which are awaiting some other resolution to be sent.
12637  */
12638 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12639
12640 /**
12641  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12642  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12643  * available for inclusion in new outbound HTLCs). This further does not include any pending
12644  * outgoing HTLCs which are awaiting some other resolution to be sent.
12645  */
12646 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12647
12648 /**
12649  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12650  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12651  * available for inclusion in new inbound HTLCs).
12652  * Note that there are some corner cases not fully handled here, so the actual available
12653  * inbound capacity may be slightly higher than this.
12654  */
12655 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12656
12657 /**
12658  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12659  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12660  * available for inclusion in new inbound HTLCs).
12661  * Note that there are some corner cases not fully handled here, so the actual available
12662  * inbound capacity may be slightly higher than this.
12663  */
12664 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12665
12666 /**
12667  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12668  * the peer is connected, and (c) no monitor update failure is pending resolution.
12669  */
12670 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12671
12672 /**
12673  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12674  * the peer is connected, and (c) no monitor update failure is pending resolution.
12675  */
12676 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12677
12678 /**
12679  * Creates a copy of the ChannelDetails
12680  */
12681 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
12682
12683 /**
12684  * Frees any resources used by the PaymentSendFailure
12685  */
12686 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
12687
12688 /**
12689  * Creates a copy of the PaymentSendFailure
12690  */
12691 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
12692
12693 /**
12694  * Constructs a new ChannelManager to hold several channels and route between them.
12695  *
12696  * This is the main \"logic hub\" for all channel-related actions, and implements
12697  * ChannelMessageHandler.
12698  *
12699  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
12700  *
12701  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
12702  *
12703  * Users need to notify the new ChannelManager when a new block is connected or
12704  * disconnected using its `block_connected` and `block_disconnected` methods, starting
12705  * from after `params.latest_hash`.
12706  */
12707 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);
12708
12709 /**
12710  * Gets the current configuration applied to all new channels,  as
12711  */
12712 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
12713
12714 /**
12715  * Creates a new outbound channel to the given remote node and with the given value.
12716  *
12717  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
12718  * tracking of which events correspond with which create_channel call. Note that the
12719  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
12720  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
12721  * otherwise ignored.
12722  *
12723  * If successful, will generate a SendOpenChannel message event, so you should probably poll
12724  * PeerManager::process_events afterwards.
12725  *
12726  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
12727  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
12728  */
12729 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);
12730
12731 /**
12732  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
12733  * more information.
12734  */
12735 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12736
12737 /**
12738  * Gets the list of usable channels, in random order. Useful as an argument to
12739  * get_route to ensure non-announced channels are used.
12740  *
12741  * These are guaranteed to have their is_live value set to true, see the documentation for
12742  * ChannelDetails::is_live for more info on exactly what the criteria are.
12743  */
12744 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12745
12746 /**
12747  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
12748  * will be accepted on the given channel, and after additional timeout/the closing of all
12749  * pending HTLCs, the channel will be closed on chain.
12750  *
12751  * May generate a SendShutdown message event on success, which should be relayed.
12752  */
12753 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12754
12755 /**
12756  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
12757  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
12758  */
12759 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12760
12761 /**
12762  * Force close all channels, immediately broadcasting the latest local commitment transaction
12763  * for each to the chain and rejecting new HTLCs on each.
12764  */
12765 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12766
12767 /**
12768  * Sends a payment along a given route.
12769  *
12770  * Value parameters are provided via the last hop in route, see documentation for RouteHop
12771  * fields for more info.
12772  *
12773  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
12774  * payment), we don't do anything to stop you! We always try to ensure that if the provided
12775  * next hop knows the preimage to payment_hash they can claim an additional amount as
12776  * specified in the last hop in the route! Thus, you should probably do your own
12777  * payment_preimage tracking (which you should already be doing as they represent \"proof of
12778  * payment\") and prevent double-sends yourself.
12779  *
12780  * May generate SendHTLCs message(s) event on success, which should be relayed.
12781  *
12782  * Each path may have a different return value, and PaymentSendValue may return a Vec with
12783  * each entry matching the corresponding-index entry in the route paths, see
12784  * PaymentSendFailure for more info.
12785  *
12786  * In general, a path may raise:
12787  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
12788  *    node public key) is specified.
12789  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
12790  *    (including due to previous monitor update failure or new permanent monitor update
12791  *    failure).
12792  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
12793  *    relevant updates.
12794  *
12795  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
12796  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
12797  * different route unless you intend to pay twice!
12798  *
12799  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
12800  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
12801  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
12802  * must not contain multiple paths as multi-path payments require a recipient-provided
12803  * payment_secret.
12804  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
12805  * bit set (either as required or as available). If multiple paths are present in the Route,
12806  * we assume the invoice had the basic_mpp feature set.
12807  */
12808 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);
12809
12810 /**
12811  * Call this upon creation of a funding transaction for the given channel.
12812  *
12813  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
12814  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
12815  *
12816  * Panics if a funding transaction has already been provided for this channel.
12817  *
12818  * May panic if the output found in the funding transaction is duplicative with some other
12819  * channel (note that this should be trivially prevented by using unique funding transaction
12820  * keys per-channel).
12821  *
12822  * Do NOT broadcast the funding transaction yourself. When we have safely received our
12823  * counterparty's signature the funding transaction will automatically be broadcast via the
12824  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
12825  *
12826  * Note that this includes RBF or similar transaction replacement strategies - lightning does
12827  * not currently support replacing a funding transaction on an existing channel. Instead,
12828  * create a new channel with a conflicting funding transaction.
12829  */
12830 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);
12831
12832 /**
12833  * Generates a signed node_announcement from the given arguments and creates a
12834  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
12835  * seen a channel_announcement from us (ie unless we have public channels open).
12836  *
12837  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
12838  * to humans. They carry no in-protocol meaning.
12839  *
12840  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
12841  * incoming connections. These will be broadcast to the network, publicly tying these
12842  * addresses together. If you wish to preserve user privacy, addresses should likely contain
12843  * only Tor Onion addresses.
12844  *
12845  * Panics if addresses is absurdly large (more than 500).
12846  */
12847 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
12848
12849 /**
12850  * Processes HTLCs which are pending waiting on random forward delay.
12851  *
12852  * Should only really ever be called in response to a PendingHTLCsForwardable event.
12853  * Will likely generate further events.
12854  */
12855 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
12856
12857 /**
12858  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
12859  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
12860  * to inform the network about the uselessness of these channels.
12861  *
12862  * This method handles all the details, and must be called roughly once per minute.
12863  *
12864  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
12865  */
12866 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
12867
12868 /**
12869  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
12870  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
12871  * along the path (including in our own channel on which we received it).
12872  * Returns false if no payment was found to fail backwards, true if the process of failing the
12873  * HTLC backwards has been started.
12874  */
12875 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
12876
12877 /**
12878  * Provides a payment preimage in response to a PaymentReceived event, returning true and
12879  * generating message events for the net layer to claim the payment, if possible. Thus, you
12880  * should probably kick the net layer to go send messages if this returns true!
12881  *
12882  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
12883  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
12884  * event matches your expectation. If you fail to do so and call this method, you may provide
12885  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
12886  *
12887  * May panic if called except in response to a PaymentReceived event.
12888  *
12889  * [`create_inbound_payment`]: Self::create_inbound_payment
12890  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12891  */
12892 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
12893
12894 /**
12895  * Gets the node_id held by this ChannelManager
12896  */
12897 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
12898
12899 /**
12900  * Restores a single, given channel to normal operation after a
12901  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
12902  * operation.
12903  *
12904  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
12905  * fully committed in every copy of the given channels' ChannelMonitors.
12906  *
12907  * Note that there is no effect to calling with a highest_applied_update_id other than the
12908  * current latest ChannelMonitorUpdate and one call to this function after multiple
12909  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
12910  * exists largely only to prevent races between this and concurrent update_monitor calls.
12911  *
12912  * Thus, the anticipated use is, at a high level:
12913  *  1) You register a chain::Watch with this ChannelManager,
12914  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
12915  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
12916  *     any time it cannot do so instantly,
12917  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
12918  *  4) once all remote copies are updated, you call this function with the update_id that
12919  *     completed, and once it is the latest the Channel will be re-enabled.
12920  */
12921 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);
12922
12923 /**
12924  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
12925  * to pay us.
12926  *
12927  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
12928  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
12929  *
12930  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
12931  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
12932  * passed directly to [`claim_funds`].
12933  *
12934  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
12935  *
12936  * [`claim_funds`]: Self::claim_funds
12937  * [`PaymentReceived`]: events::Event::PaymentReceived
12938  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
12939  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12940  */
12941 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);
12942
12943 /**
12944  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
12945  * stored external to LDK.
12946  *
12947  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
12948  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
12949  * the `min_value_msat` provided here, if one is provided.
12950  *
12951  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
12952  * method may return an Err if another payment with the same payment_hash is still pending.
12953  *
12954  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
12955  * allow tracking of which events correspond with which calls to this and
12956  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
12957  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
12958  * with invoice metadata stored elsewhere.
12959  *
12960  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
12961  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
12962  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
12963  * sender \"proof-of-payment\" unless they have paid the required amount.
12964  *
12965  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
12966  * in excess of the current time. This should roughly match the expiry time set in the invoice.
12967  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
12968  * pay the invoice failing. The BOLT spec suggests 7,200 secs as a default validity time for
12969  * invoices when no timeout is set.
12970  *
12971  * Note that we use block header time to time-out pending inbound payments (with some margin
12972  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
12973  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
12974  * If you need exact expiry semantics, you should enforce them upon receipt of
12975  * [`PaymentReceived`].
12976  *
12977  * Pending inbound payments are stored in memory and in serialized versions of this
12978  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
12979  * space is limited, you may wish to rate-limit inbound payment creation.
12980  *
12981  * May panic if `invoice_expiry_delta_secs` is greater than one year.
12982  *
12983  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
12984  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
12985  *
12986  * [`create_inbound_payment`]: Self::create_inbound_payment
12987  * [`PaymentReceived`]: events::Event::PaymentReceived
12988  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
12989  */
12990 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);
12991
12992 /**
12993  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
12994  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
12995  */
12996 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
12997
12998 /**
12999  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13000  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13001  */
13002 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13003
13004 /**
13005  * Constructs a new Listen which calls the relevant methods on this_arg.
13006  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13007  */
13008 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13009
13010 /**
13011  * Constructs a new Confirm which calls the relevant methods on this_arg.
13012  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13013  */
13014 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13015
13016 /**
13017  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13018  * indicating whether persistence is necessary. Only one listener on
13019  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13020  * up.
13021  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13022  */
13023 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13024
13025 /**
13026  * Blocks until ChannelManager needs to be persisted. Only one listener on
13027  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13028  * up.
13029  */
13030 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13031
13032 /**
13033  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13034  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13035  */
13036 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13037
13038 /**
13039  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13040  */
13041 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13042
13043 /**
13044  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13045  */
13046 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13047
13048 /**
13049  * The keys provider which will give us relevant keys. Some keys will be loaded during
13050  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13051  * signing data.
13052  */
13053 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13054
13055 /**
13056  * The keys provider which will give us relevant keys. Some keys will be loaded during
13057  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13058  * signing data.
13059  */
13060 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13061
13062 /**
13063  * The fee_estimator for use in the ChannelManager in the future.
13064  *
13065  * No calls to the FeeEstimator will be made during deserialization.
13066  */
13067 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13068
13069 /**
13070  * The fee_estimator for use in the ChannelManager in the future.
13071  *
13072  * No calls to the FeeEstimator will be made during deserialization.
13073  */
13074 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13075
13076 /**
13077  * The chain::Watch for use in the ChannelManager in the future.
13078  *
13079  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13080  * you have deserialized ChannelMonitors separately and will add them to your
13081  * chain::Watch after deserializing this ChannelManager.
13082  */
13083 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13084
13085 /**
13086  * The chain::Watch for use in the ChannelManager in the future.
13087  *
13088  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13089  * you have deserialized ChannelMonitors separately and will add them to your
13090  * chain::Watch after deserializing this ChannelManager.
13091  */
13092 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13093
13094 /**
13095  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13096  * used to broadcast the latest local commitment transactions of channels which must be
13097  * force-closed during deserialization.
13098  */
13099 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13100
13101 /**
13102  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13103  * used to broadcast the latest local commitment transactions of channels which must be
13104  * force-closed during deserialization.
13105  */
13106 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13107
13108 /**
13109  * The Logger for use in the ChannelManager and which may be used to log information during
13110  * deserialization.
13111  */
13112 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13113
13114 /**
13115  * The Logger for use in the ChannelManager and which may be used to log information during
13116  * deserialization.
13117  */
13118 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13119
13120 /**
13121  * Default settings used for new channels. Any existing channels will continue to use the
13122  * runtime settings which were stored when the ChannelManager was serialized.
13123  */
13124 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13125
13126 /**
13127  * Default settings used for new channels. Any existing channels will continue to use the
13128  * runtime settings which were stored when the ChannelManager was serialized.
13129  */
13130 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13131
13132 /**
13133  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13134  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13135  * populate a HashMap directly from C.
13136  */
13137 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);
13138
13139 /**
13140  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13141  */
13142 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13143
13144 /**
13145  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13146  */
13147 void DecodeError_free(struct LDKDecodeError this_obj);
13148
13149 /**
13150  * Creates a copy of the DecodeError
13151  */
13152 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13153
13154 /**
13155  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13156  */
13157 void Init_free(struct LDKInit this_obj);
13158
13159 /**
13160  * The relevant features which the sender supports
13161  */
13162 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13163
13164 /**
13165  * The relevant features which the sender supports
13166  */
13167 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13168
13169 /**
13170  * Constructs a new Init given each field
13171  */
13172 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13173
13174 /**
13175  * Creates a copy of the Init
13176  */
13177 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13178
13179 /**
13180  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13181  */
13182 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13183
13184 /**
13185  * The channel ID involved in the error
13186  */
13187 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13188
13189 /**
13190  * The channel ID involved in the error
13191  */
13192 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13193
13194 /**
13195  * A possibly human-readable error description.
13196  * The string should be sanitized before it is used (e.g. emitted to logs
13197  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13198  * vulnerability in the terminal emulator or the logging subsystem.
13199  */
13200 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13201
13202 /**
13203  * A possibly human-readable error description.
13204  * The string should be sanitized before it is used (e.g. emitted to logs
13205  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13206  * vulnerability in the terminal emulator or the logging subsystem.
13207  */
13208 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13209
13210 /**
13211  * Constructs a new ErrorMessage given each field
13212  */
13213 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13214
13215 /**
13216  * Creates a copy of the ErrorMessage
13217  */
13218 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13219
13220 /**
13221  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13222  */
13223 void Ping_free(struct LDKPing this_obj);
13224
13225 /**
13226  * The desired response length
13227  */
13228 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13229
13230 /**
13231  * The desired response length
13232  */
13233 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13234
13235 /**
13236  * The ping packet size.
13237  * This field is not sent on the wire. byteslen zeros are sent.
13238  */
13239 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13240
13241 /**
13242  * The ping packet size.
13243  * This field is not sent on the wire. byteslen zeros are sent.
13244  */
13245 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13246
13247 /**
13248  * Constructs a new Ping given each field
13249  */
13250 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13251
13252 /**
13253  * Creates a copy of the Ping
13254  */
13255 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13256
13257 /**
13258  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13259  */
13260 void Pong_free(struct LDKPong this_obj);
13261
13262 /**
13263  * The pong packet size.
13264  * This field is not sent on the wire. byteslen zeros are sent.
13265  */
13266 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13267
13268 /**
13269  * The pong packet size.
13270  * This field is not sent on the wire. byteslen zeros are sent.
13271  */
13272 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13273
13274 /**
13275  * Constructs a new Pong given each field
13276  */
13277 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13278
13279 /**
13280  * Creates a copy of the Pong
13281  */
13282 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13283
13284 /**
13285  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13286  */
13287 void OpenChannel_free(struct LDKOpenChannel this_obj);
13288
13289 /**
13290  * The genesis hash of the blockchain where the channel is to be opened
13291  */
13292 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13293
13294 /**
13295  * The genesis hash of the blockchain where the channel is to be opened
13296  */
13297 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13298
13299 /**
13300  * A temporary channel ID, until the funding outpoint is announced
13301  */
13302 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13303
13304 /**
13305  * A temporary channel ID, until the funding outpoint is announced
13306  */
13307 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13308
13309 /**
13310  * The channel value
13311  */
13312 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13313
13314 /**
13315  * The channel value
13316  */
13317 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13318
13319 /**
13320  * The amount to push to the counterparty as part of the open, in milli-satoshi
13321  */
13322 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13323
13324 /**
13325  * The amount to push to the counterparty as part of the open, in milli-satoshi
13326  */
13327 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13328
13329 /**
13330  * The threshold below which outputs on transactions broadcast by sender will be omitted
13331  */
13332 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13333
13334 /**
13335  * The threshold below which outputs on transactions broadcast by sender will be omitted
13336  */
13337 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13338
13339 /**
13340  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13341  */
13342 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13343
13344 /**
13345  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13346  */
13347 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13348
13349 /**
13350  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13351  */
13352 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13353
13354 /**
13355  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13356  */
13357 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13358
13359 /**
13360  * The minimum HTLC size incoming to sender, in milli-satoshi
13361  */
13362 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13363
13364 /**
13365  * The minimum HTLC size incoming to sender, in milli-satoshi
13366  */
13367 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13368
13369 /**
13370  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13371  */
13372 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13373
13374 /**
13375  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13376  */
13377 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13378
13379 /**
13380  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13381  */
13382 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13383
13384 /**
13385  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13386  */
13387 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13388
13389 /**
13390  * The maximum number of inbound HTLCs towards sender
13391  */
13392 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13393
13394 /**
13395  * The maximum number of inbound HTLCs towards sender
13396  */
13397 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13398
13399 /**
13400  * The sender's key controlling the funding transaction
13401  */
13402 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13403
13404 /**
13405  * The sender's key controlling the funding transaction
13406  */
13407 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13408
13409 /**
13410  * Used to derive a revocation key for transactions broadcast by counterparty
13411  */
13412 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13413
13414 /**
13415  * Used to derive a revocation key for transactions broadcast by counterparty
13416  */
13417 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13418
13419 /**
13420  * A payment key to sender for transactions broadcast by counterparty
13421  */
13422 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13423
13424 /**
13425  * A payment key to sender for transactions broadcast by counterparty
13426  */
13427 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13428
13429 /**
13430  * Used to derive a payment key to sender for transactions broadcast by sender
13431  */
13432 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13433
13434 /**
13435  * Used to derive a payment key to sender for transactions broadcast by sender
13436  */
13437 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13438
13439 /**
13440  * Used to derive an HTLC payment key to sender
13441  */
13442 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13443
13444 /**
13445  * Used to derive an HTLC payment key to sender
13446  */
13447 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13448
13449 /**
13450  * The first to-be-broadcast-by-sender transaction's per commitment point
13451  */
13452 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13453
13454 /**
13455  * The first to-be-broadcast-by-sender transaction's per commitment point
13456  */
13457 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13458
13459 /**
13460  * Channel flags
13461  */
13462 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13463
13464 /**
13465  * Channel flags
13466  */
13467 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13468
13469 /**
13470  * Creates a copy of the OpenChannel
13471  */
13472 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13473
13474 /**
13475  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13476  */
13477 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13478
13479 /**
13480  * A temporary channel ID, until the funding outpoint is announced
13481  */
13482 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13483
13484 /**
13485  * A temporary channel ID, until the funding outpoint is announced
13486  */
13487 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13488
13489 /**
13490  * The threshold below which outputs on transactions broadcast by sender will be omitted
13491  */
13492 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13493
13494 /**
13495  * The threshold below which outputs on transactions broadcast by sender will be omitted
13496  */
13497 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13498
13499 /**
13500  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13501  */
13502 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13503
13504 /**
13505  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13506  */
13507 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13508
13509 /**
13510  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13511  */
13512 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13513
13514 /**
13515  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13516  */
13517 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13518
13519 /**
13520  * The minimum HTLC size incoming to sender, in milli-satoshi
13521  */
13522 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13523
13524 /**
13525  * The minimum HTLC size incoming to sender, in milli-satoshi
13526  */
13527 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13528
13529 /**
13530  * Minimum depth of the funding transaction before the channel is considered open
13531  */
13532 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13533
13534 /**
13535  * Minimum depth of the funding transaction before the channel is considered open
13536  */
13537 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
13538
13539 /**
13540  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13541  */
13542 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13543
13544 /**
13545  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13546  */
13547 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13548
13549 /**
13550  * The maximum number of inbound HTLCs towards sender
13551  */
13552 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13553
13554 /**
13555  * The maximum number of inbound HTLCs towards sender
13556  */
13557 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13558
13559 /**
13560  * The sender's key controlling the funding transaction
13561  */
13562 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13563
13564 /**
13565  * The sender's key controlling the funding transaction
13566  */
13567 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13568
13569 /**
13570  * Used to derive a revocation key for transactions broadcast by counterparty
13571  */
13572 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13573
13574 /**
13575  * Used to derive a revocation key for transactions broadcast by counterparty
13576  */
13577 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13578
13579 /**
13580  * A payment key to sender for transactions broadcast by counterparty
13581  */
13582 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13583
13584 /**
13585  * A payment key to sender for transactions broadcast by counterparty
13586  */
13587 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13588
13589 /**
13590  * Used to derive a payment key to sender for transactions broadcast by sender
13591  */
13592 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13593
13594 /**
13595  * Used to derive a payment key to sender for transactions broadcast by sender
13596  */
13597 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13598
13599 /**
13600  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13601  */
13602 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13603
13604 /**
13605  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13606  */
13607 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13608
13609 /**
13610  * The first to-be-broadcast-by-sender transaction's per commitment point
13611  */
13612 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13613
13614 /**
13615  * The first to-be-broadcast-by-sender transaction's per commitment point
13616  */
13617 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13618
13619 /**
13620  * Creates a copy of the AcceptChannel
13621  */
13622 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
13623
13624 /**
13625  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
13626  */
13627 void FundingCreated_free(struct LDKFundingCreated this_obj);
13628
13629 /**
13630  * A temporary channel ID, until the funding is established
13631  */
13632 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13633
13634 /**
13635  * A temporary channel ID, until the funding is established
13636  */
13637 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13638
13639 /**
13640  * The funding transaction ID
13641  */
13642 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13643
13644 /**
13645  * The funding transaction ID
13646  */
13647 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13648
13649 /**
13650  * The specific output index funding this channel
13651  */
13652 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13653
13654 /**
13655  * The specific output index funding this channel
13656  */
13657 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
13658
13659 /**
13660  * The signature of the channel initiator (funder) on the funding transaction
13661  */
13662 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13663
13664 /**
13665  * The signature of the channel initiator (funder) on the funding transaction
13666  */
13667 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
13668
13669 /**
13670  * Constructs a new FundingCreated given each field
13671  */
13672 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);
13673
13674 /**
13675  * Creates a copy of the FundingCreated
13676  */
13677 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
13678
13679 /**
13680  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
13681  */
13682 void FundingSigned_free(struct LDKFundingSigned this_obj);
13683
13684 /**
13685  * The channel ID
13686  */
13687 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
13688
13689 /**
13690  * The channel ID
13691  */
13692 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13693
13694 /**
13695  * The signature of the channel acceptor (fundee) on the funding transaction
13696  */
13697 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
13698
13699 /**
13700  * The signature of the channel acceptor (fundee) on the funding transaction
13701  */
13702 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13703
13704 /**
13705  * Constructs a new FundingSigned given each field
13706  */
13707 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
13708
13709 /**
13710  * Creates a copy of the FundingSigned
13711  */
13712 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
13713
13714 /**
13715  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
13716  */
13717 void FundingLocked_free(struct LDKFundingLocked this_obj);
13718
13719 /**
13720  * The channel ID
13721  */
13722 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
13723
13724 /**
13725  * The channel ID
13726  */
13727 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13728
13729 /**
13730  * The per-commitment point of the second commitment transaction
13731  */
13732 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
13733
13734 /**
13735  * The per-commitment point of the second commitment transaction
13736  */
13737 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13738
13739 /**
13740  * Constructs a new FundingLocked given each field
13741  */
13742 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
13743
13744 /**
13745  * Creates a copy of the FundingLocked
13746  */
13747 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
13748
13749 /**
13750  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
13751  */
13752 void Shutdown_free(struct LDKShutdown this_obj);
13753
13754 /**
13755  * The channel ID
13756  */
13757 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
13758
13759 /**
13760  * The channel ID
13761  */
13762 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13763
13764 /**
13765  * The destination of this peer's funds on closing.
13766  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13767  */
13768 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
13769
13770 /**
13771  * The destination of this peer's funds on closing.
13772  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13773  */
13774 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13775
13776 /**
13777  * Constructs a new Shutdown given each field
13778  */
13779 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
13780
13781 /**
13782  * Creates a copy of the Shutdown
13783  */
13784 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
13785
13786 /**
13787  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
13788  */
13789 void ClosingSigned_free(struct LDKClosingSigned this_obj);
13790
13791 /**
13792  * The channel ID
13793  */
13794 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
13795
13796 /**
13797  * The channel ID
13798  */
13799 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13800
13801 /**
13802  * The proposed total fee for the closing transaction
13803  */
13804 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13805
13806 /**
13807  * The proposed total fee for the closing transaction
13808  */
13809 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
13810
13811 /**
13812  * A signature on the closing transaction
13813  */
13814 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13815
13816 /**
13817  * A signature on the closing transaction
13818  */
13819 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13820
13821 /**
13822  * Constructs a new ClosingSigned given each field
13823  */
13824 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
13825
13826 /**
13827  * Creates a copy of the ClosingSigned
13828  */
13829 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
13830
13831 /**
13832  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
13833  */
13834 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
13835
13836 /**
13837  * The channel ID
13838  */
13839 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13840
13841 /**
13842  * The channel ID
13843  */
13844 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13845
13846 /**
13847  * The HTLC ID
13848  */
13849 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13850
13851 /**
13852  * The HTLC ID
13853  */
13854 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13855
13856 /**
13857  * The HTLC value in milli-satoshi
13858  */
13859 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13860
13861 /**
13862  * The HTLC value in milli-satoshi
13863  */
13864 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13865
13866 /**
13867  * The payment hash, the pre-image of which controls HTLC redemption
13868  */
13869 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13870
13871 /**
13872  * The payment hash, the pre-image of which controls HTLC redemption
13873  */
13874 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13875
13876 /**
13877  * The expiry height of the HTLC
13878  */
13879 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13880
13881 /**
13882  * The expiry height of the HTLC
13883  */
13884 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
13885
13886 /**
13887  * Creates a copy of the UpdateAddHTLC
13888  */
13889 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
13890
13891 /**
13892  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
13893  */
13894 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
13895
13896 /**
13897  * The channel ID
13898  */
13899 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13900
13901 /**
13902  * The channel ID
13903  */
13904 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13905
13906 /**
13907  * The HTLC ID
13908  */
13909 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
13910
13911 /**
13912  * The HTLC ID
13913  */
13914 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
13915
13916 /**
13917  * The pre-image of the payment hash, allowing HTLC redemption
13918  */
13919 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13920
13921 /**
13922  * The pre-image of the payment hash, allowing HTLC redemption
13923  */
13924 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13925
13926 /**
13927  * Constructs a new UpdateFulfillHTLC given each field
13928  */
13929 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
13930
13931 /**
13932  * Creates a copy of the UpdateFulfillHTLC
13933  */
13934 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
13935
13936 /**
13937  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
13938  */
13939 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
13940
13941 /**
13942  * The channel ID
13943  */
13944 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
13945
13946 /**
13947  * The channel ID
13948  */
13949 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13950
13951 /**
13952  * The HTLC ID
13953  */
13954 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
13955
13956 /**
13957  * The HTLC ID
13958  */
13959 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
13960
13961 /**
13962  * Creates a copy of the UpdateFailHTLC
13963  */
13964 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
13965
13966 /**
13967  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
13968  */
13969 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
13970
13971 /**
13972  * The channel ID
13973  */
13974 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
13975
13976 /**
13977  * The channel ID
13978  */
13979 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13980
13981 /**
13982  * The HTLC ID
13983  */
13984 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13985
13986 /**
13987  * The HTLC ID
13988  */
13989 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
13990
13991 /**
13992  * The failure code
13993  */
13994 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13995
13996 /**
13997  * The failure code
13998  */
13999 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14000
14001 /**
14002  * Creates a copy of the UpdateFailMalformedHTLC
14003  */
14004 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14005
14006 /**
14007  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14008  */
14009 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14010
14011 /**
14012  * The channel ID
14013  */
14014 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14015
14016 /**
14017  * The channel ID
14018  */
14019 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14020
14021 /**
14022  * A signature on the commitment transaction
14023  */
14024 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * A signature on the commitment transaction
14028  */
14029 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14030
14031 /**
14032  * Signatures on the HTLC transactions
14033  */
14034 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14035
14036 /**
14037  * Constructs a new CommitmentSigned given each field
14038  */
14039 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14040
14041 /**
14042  * Creates a copy of the CommitmentSigned
14043  */
14044 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14045
14046 /**
14047  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14048  */
14049 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14050
14051 /**
14052  * The channel ID
14053  */
14054 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14055
14056 /**
14057  * The channel ID
14058  */
14059 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14060
14061 /**
14062  * The secret corresponding to the per-commitment point
14063  */
14064 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14065
14066 /**
14067  * The secret corresponding to the per-commitment point
14068  */
14069 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14070
14071 /**
14072  * The next sender-broadcast commitment transaction's per-commitment point
14073  */
14074 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14075
14076 /**
14077  * The next sender-broadcast commitment transaction's per-commitment point
14078  */
14079 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14080
14081 /**
14082  * Constructs a new RevokeAndACK given each field
14083  */
14084 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);
14085
14086 /**
14087  * Creates a copy of the RevokeAndACK
14088  */
14089 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14090
14091 /**
14092  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14093  */
14094 void UpdateFee_free(struct LDKUpdateFee this_obj);
14095
14096 /**
14097  * The channel ID
14098  */
14099 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14100
14101 /**
14102  * The channel ID
14103  */
14104 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14105
14106 /**
14107  * Fee rate per 1000-weight of the transaction
14108  */
14109 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14110
14111 /**
14112  * Fee rate per 1000-weight of the transaction
14113  */
14114 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14115
14116 /**
14117  * Constructs a new UpdateFee given each field
14118  */
14119 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14120
14121 /**
14122  * Creates a copy of the UpdateFee
14123  */
14124 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14125
14126 /**
14127  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14128  */
14129 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14130
14131 /**
14132  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14133  * belonging to the recipient
14134  */
14135 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14136
14137 /**
14138  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14139  * belonging to the recipient
14140  */
14141 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14142
14143 /**
14144  * The sender's per-commitment point for their current commitment transaction
14145  */
14146 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14147
14148 /**
14149  * The sender's per-commitment point for their current commitment transaction
14150  */
14151 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14152
14153 /**
14154  * Constructs a new DataLossProtect given each field
14155  */
14156 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14157
14158 /**
14159  * Creates a copy of the DataLossProtect
14160  */
14161 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14162
14163 /**
14164  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14165  */
14166 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14167
14168 /**
14169  * The channel ID
14170  */
14171 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14172
14173 /**
14174  * The channel ID
14175  */
14176 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14177
14178 /**
14179  * The next commitment number for the sender
14180  */
14181 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14182
14183 /**
14184  * The next commitment number for the sender
14185  */
14186 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14187
14188 /**
14189  * The next commitment number for the recipient
14190  */
14191 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14192
14193 /**
14194  * The next commitment number for the recipient
14195  */
14196 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14197
14198 /**
14199  * Creates a copy of the ChannelReestablish
14200  */
14201 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14202
14203 /**
14204  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14205  */
14206 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14207
14208 /**
14209  * The channel ID
14210  */
14211 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14212
14213 /**
14214  * The channel ID
14215  */
14216 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14217
14218 /**
14219  * The short channel ID
14220  */
14221 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14222
14223 /**
14224  * The short channel ID
14225  */
14226 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14227
14228 /**
14229  * A signature by the node key
14230  */
14231 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14232
14233 /**
14234  * A signature by the node key
14235  */
14236 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14237
14238 /**
14239  * A signature by the funding key
14240  */
14241 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14242
14243 /**
14244  * A signature by the funding key
14245  */
14246 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14247
14248 /**
14249  * Constructs a new AnnouncementSignatures given each field
14250  */
14251 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);
14252
14253 /**
14254  * Creates a copy of the AnnouncementSignatures
14255  */
14256 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14257
14258 /**
14259  * Frees any resources used by the NetAddress
14260  */
14261 void NetAddress_free(struct LDKNetAddress this_ptr);
14262
14263 /**
14264  * Creates a copy of the NetAddress
14265  */
14266 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14267
14268 /**
14269  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14270  */
14271 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14272
14273 /**
14274  * Read a Result from a byte array, created by Result_write
14275  */
14276 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14277
14278 /**
14279  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14280  */
14281 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14282
14283 /**
14284  * The advertised features
14285  */
14286 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14287
14288 /**
14289  * The advertised features
14290  */
14291 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14292
14293 /**
14294  * A strictly monotonic announcement counter, with gaps allowed
14295  */
14296 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14297
14298 /**
14299  * A strictly monotonic announcement counter, with gaps allowed
14300  */
14301 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14302
14303 /**
14304  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14305  * to this node).
14306  */
14307 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14308
14309 /**
14310  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14311  * to this node).
14312  */
14313 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14314
14315 /**
14316  * An RGB color for UI purposes
14317  */
14318 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14319
14320 /**
14321  * An RGB color for UI purposes
14322  */
14323 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14324
14325 /**
14326  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14327  * of uniqueness.
14328  */
14329 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14330
14331 /**
14332  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14333  * of uniqueness.
14334  */
14335 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14336
14337 /**
14338  * List of addresses on which this node is reachable
14339  */
14340 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14341
14342 /**
14343  * Creates a copy of the UnsignedNodeAnnouncement
14344  */
14345 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14346
14347 /**
14348  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14349  */
14350 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14351
14352 /**
14353  * The signature by the node key
14354  */
14355 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14356
14357 /**
14358  * The signature by the node key
14359  */
14360 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14361
14362 /**
14363  * The actual content of the announcement
14364  */
14365 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14366
14367 /**
14368  * The actual content of the announcement
14369  */
14370 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14371
14372 /**
14373  * Constructs a new NodeAnnouncement given each field
14374  */
14375 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14376
14377 /**
14378  * Creates a copy of the NodeAnnouncement
14379  */
14380 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14381
14382 /**
14383  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14384  */
14385 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14386
14387 /**
14388  * The advertised channel features
14389  */
14390 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14391
14392 /**
14393  * The advertised channel features
14394  */
14395 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14396
14397 /**
14398  * The genesis hash of the blockchain where the channel is to be opened
14399  */
14400 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14401
14402 /**
14403  * The genesis hash of the blockchain where the channel is to be opened
14404  */
14405 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14406
14407 /**
14408  * The short channel ID
14409  */
14410 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14411
14412 /**
14413  * The short channel ID
14414  */
14415 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14416
14417 /**
14418  * One of the two node_ids which are endpoints of this channel
14419  */
14420 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14421
14422 /**
14423  * One of the two node_ids which are endpoints of this channel
14424  */
14425 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14426
14427 /**
14428  * The other of the two node_ids which are endpoints of this channel
14429  */
14430 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14431
14432 /**
14433  * The other of the two node_ids which are endpoints of this channel
14434  */
14435 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14436
14437 /**
14438  * The funding key for the first node
14439  */
14440 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14441
14442 /**
14443  * The funding key for the first node
14444  */
14445 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14446
14447 /**
14448  * The funding key for the second node
14449  */
14450 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14451
14452 /**
14453  * The funding key for the second node
14454  */
14455 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14456
14457 /**
14458  * Creates a copy of the UnsignedChannelAnnouncement
14459  */
14460 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14461
14462 /**
14463  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14464  */
14465 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14466
14467 /**
14468  * Authentication of the announcement by the first public node
14469  */
14470 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14471
14472 /**
14473  * Authentication of the announcement by the first public node
14474  */
14475 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14476
14477 /**
14478  * Authentication of the announcement by the second public node
14479  */
14480 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14481
14482 /**
14483  * Authentication of the announcement by the second public node
14484  */
14485 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14486
14487 /**
14488  * Proof of funding UTXO ownership by the first public node
14489  */
14490 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14491
14492 /**
14493  * Proof of funding UTXO ownership by the first public node
14494  */
14495 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14496
14497 /**
14498  * Proof of funding UTXO ownership by the second public node
14499  */
14500 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14501
14502 /**
14503  * Proof of funding UTXO ownership by the second public node
14504  */
14505 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14506
14507 /**
14508  * The actual announcement
14509  */
14510 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14511
14512 /**
14513  * The actual announcement
14514  */
14515 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
14516
14517 /**
14518  * Constructs a new ChannelAnnouncement given each field
14519  */
14520 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);
14521
14522 /**
14523  * Creates a copy of the ChannelAnnouncement
14524  */
14525 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
14526
14527 /**
14528  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
14529  */
14530 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
14531
14532 /**
14533  * The genesis hash of the blockchain where the channel is to be opened
14534  */
14535 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
14536
14537 /**
14538  * The genesis hash of the blockchain where the channel is to be opened
14539  */
14540 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14541
14542 /**
14543  * The short channel ID
14544  */
14545 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14546
14547 /**
14548  * The short channel ID
14549  */
14550 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14551
14552 /**
14553  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14554  */
14555 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14556
14557 /**
14558  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14559  */
14560 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14561
14562 /**
14563  * Channel flags
14564  */
14565 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14566
14567 /**
14568  * Channel flags
14569  */
14570 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
14571
14572 /**
14573  * The number of blocks such that if:
14574  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14575  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14576  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14577  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14578  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14579  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14580  * constructing the route.
14581  */
14582 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14583
14584 /**
14585  * The number of blocks such that if:
14586  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14587  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14588  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14589  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14590  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14591  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14592  * constructing the route.
14593  */
14594 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
14595
14596 /**
14597  * The minimum HTLC size incoming to sender, in milli-satoshi
14598  */
14599 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14600
14601 /**
14602  * The minimum HTLC size incoming to sender, in milli-satoshi
14603  */
14604 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14605
14606 /**
14607  * The base HTLC fee charged by sender, in milli-satoshi
14608  */
14609 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14610
14611 /**
14612  * The base HTLC fee charged by sender, in milli-satoshi
14613  */
14614 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14615
14616 /**
14617  * The amount to fee multiplier, in micro-satoshi
14618  */
14619 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14620
14621 /**
14622  * The amount to fee multiplier, in micro-satoshi
14623  */
14624 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14625
14626 /**
14627  * Creates a copy of the UnsignedChannelUpdate
14628  */
14629 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
14630
14631 /**
14632  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
14633  */
14634 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
14635
14636 /**
14637  * A signature of the channel update
14638  */
14639 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14640
14641 /**
14642  * A signature of the channel update
14643  */
14644 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
14645
14646 /**
14647  * The actual channel update
14648  */
14649 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14650
14651 /**
14652  * The actual channel update
14653  */
14654 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
14655
14656 /**
14657  * Constructs a new ChannelUpdate given each field
14658  */
14659 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
14660
14661 /**
14662  * Creates a copy of the ChannelUpdate
14663  */
14664 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
14665
14666 /**
14667  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
14668  */
14669 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
14670
14671 /**
14672  * The genesis hash of the blockchain being queried
14673  */
14674 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
14675
14676 /**
14677  * The genesis hash of the blockchain being queried
14678  */
14679 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14680
14681 /**
14682  * The height of the first block for the channel UTXOs being queried
14683  */
14684 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14685
14686 /**
14687  * The height of the first block for the channel UTXOs being queried
14688  */
14689 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14690
14691 /**
14692  * The number of blocks to include in the query results
14693  */
14694 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14695
14696 /**
14697  * The number of blocks to include in the query results
14698  */
14699 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14700
14701 /**
14702  * Constructs a new QueryChannelRange given each field
14703  */
14704 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
14705
14706 /**
14707  * Creates a copy of the QueryChannelRange
14708  */
14709 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
14710
14711 /**
14712  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
14713  */
14714 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
14715
14716 /**
14717  * The genesis hash of the blockchain being queried
14718  */
14719 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
14720
14721 /**
14722  * The genesis hash of the blockchain being queried
14723  */
14724 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14725
14726 /**
14727  * The height of the first block in the range of the reply
14728  */
14729 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14730
14731 /**
14732  * The height of the first block in the range of the reply
14733  */
14734 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14735
14736 /**
14737  * The number of blocks included in the range of the reply
14738  */
14739 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14740
14741 /**
14742  * The number of blocks included in the range of the reply
14743  */
14744 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14745
14746 /**
14747  * True when this is the final reply for a query
14748  */
14749 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14750
14751 /**
14752  * True when this is the final reply for a query
14753  */
14754 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
14755
14756 /**
14757  * The short_channel_ids in the channel range
14758  */
14759 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14760
14761 /**
14762  * Constructs a new ReplyChannelRange given each field
14763  */
14764 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);
14765
14766 /**
14767  * Creates a copy of the ReplyChannelRange
14768  */
14769 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
14770
14771 /**
14772  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
14773  */
14774 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
14775
14776 /**
14777  * The genesis hash of the blockchain being queried
14778  */
14779 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
14780
14781 /**
14782  * The genesis hash of the blockchain being queried
14783  */
14784 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14785
14786 /**
14787  * The short_channel_ids that are being queried
14788  */
14789 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14790
14791 /**
14792  * Constructs a new QueryShortChannelIds given each field
14793  */
14794 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
14795
14796 /**
14797  * Creates a copy of the QueryShortChannelIds
14798  */
14799 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
14800
14801 /**
14802  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
14803  */
14804 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
14805
14806 /**
14807  * The genesis hash of the blockchain that was queried
14808  */
14809 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
14810
14811 /**
14812  * The genesis hash of the blockchain that was queried
14813  */
14814 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14815
14816 /**
14817  * Indicates if the query recipient maintains up-to-date channel
14818  * information for the chain_hash
14819  */
14820 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
14821
14822 /**
14823  * Indicates if the query recipient maintains up-to-date channel
14824  * information for the chain_hash
14825  */
14826 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
14827
14828 /**
14829  * Constructs a new ReplyShortChannelIdsEnd given each field
14830  */
14831 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
14832
14833 /**
14834  * Creates a copy of the ReplyShortChannelIdsEnd
14835  */
14836 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
14837
14838 /**
14839  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
14840  */
14841 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
14842
14843 /**
14844  * The genesis hash of the blockchain for channel and node information
14845  */
14846 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
14847
14848 /**
14849  * The genesis hash of the blockchain for channel and node information
14850  */
14851 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14852
14853 /**
14854  * The starting unix timestamp
14855  */
14856 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14857
14858 /**
14859  * The starting unix timestamp
14860  */
14861 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14862
14863 /**
14864  * The range of information in seconds
14865  */
14866 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14867
14868 /**
14869  * The range of information in seconds
14870  */
14871 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14872
14873 /**
14874  * Constructs a new GossipTimestampFilter given each field
14875  */
14876 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
14877
14878 /**
14879  * Creates a copy of the GossipTimestampFilter
14880  */
14881 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
14882
14883 /**
14884  * Frees any resources used by the ErrorAction
14885  */
14886 void ErrorAction_free(struct LDKErrorAction this_ptr);
14887
14888 /**
14889  * Creates a copy of the ErrorAction
14890  */
14891 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
14892
14893 /**
14894  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
14895  */
14896 void LightningError_free(struct LDKLightningError this_obj);
14897
14898 /**
14899  * A human-readable message describing the error
14900  */
14901 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
14902
14903 /**
14904  * A human-readable message describing the error
14905  */
14906 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
14907
14908 /**
14909  * The action which should be taken against the offending peer.
14910  */
14911 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
14912
14913 /**
14914  * The action which should be taken against the offending peer.
14915  */
14916 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
14917
14918 /**
14919  * Constructs a new LightningError given each field
14920  */
14921 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
14922
14923 /**
14924  * Creates a copy of the LightningError
14925  */
14926 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
14927
14928 /**
14929  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
14930  */
14931 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
14932
14933 /**
14934  * update_add_htlc messages which should be sent
14935  */
14936 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
14937
14938 /**
14939  * update_fulfill_htlc messages which should be sent
14940  */
14941 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
14942
14943 /**
14944  * update_fail_htlc messages which should be sent
14945  */
14946 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
14947
14948 /**
14949  * update_fail_malformed_htlc messages which should be sent
14950  */
14951 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
14952
14953 /**
14954  * An update_fee message which should be sent
14955  */
14956 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14957
14958 /**
14959  * An update_fee message which should be sent
14960  */
14961 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
14962
14963 /**
14964  * Finally, the commitment_signed message which should be sent
14965  */
14966 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14967
14968 /**
14969  * Finally, the commitment_signed message which should be sent
14970  */
14971 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
14972
14973 /**
14974  * Constructs a new CommitmentUpdate given each field
14975  */
14976 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);
14977
14978 /**
14979  * Creates a copy of the CommitmentUpdate
14980  */
14981 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
14982
14983 /**
14984  * Frees any resources used by the HTLCFailChannelUpdate
14985  */
14986 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
14987
14988 /**
14989  * Creates a copy of the HTLCFailChannelUpdate
14990  */
14991 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
14992
14993 /**
14994  * Calls the free function if one is set
14995  */
14996 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
14997
14998 /**
14999  * Calls the free function if one is set
15000  */
15001 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15002
15003 /**
15004  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15005  */
15006 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15007
15008 /**
15009  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15010  */
15011 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15012
15013 /**
15014  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15015  */
15016 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15017
15018 /**
15019  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15020  */
15021 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15022
15023 /**
15024  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15025  */
15026 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15027
15028 /**
15029  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15030  */
15031 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15032
15033 /**
15034  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15035  */
15036 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15037
15038 /**
15039  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15040  */
15041 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15042
15043 /**
15044  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15045  */
15046 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15047
15048 /**
15049  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15050  */
15051 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15052
15053 /**
15054  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15055  */
15056 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15057
15058 /**
15059  * Read a FundingCreated from a byte array, created by FundingCreated_write
15060  */
15061 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15062
15063 /**
15064  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15065  */
15066 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15067
15068 /**
15069  * Read a FundingSigned from a byte array, created by FundingSigned_write
15070  */
15071 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15072
15073 /**
15074  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15075  */
15076 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15077
15078 /**
15079  * Read a FundingLocked from a byte array, created by FundingLocked_write
15080  */
15081 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15082
15083 /**
15084  * Serialize the Init object into a byte array which can be read by Init_read
15085  */
15086 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15087
15088 /**
15089  * Read a Init from a byte array, created by Init_write
15090  */
15091 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15092
15093 /**
15094  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15095  */
15096 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15097
15098 /**
15099  * Read a OpenChannel from a byte array, created by OpenChannel_write
15100  */
15101 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15102
15103 /**
15104  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15105  */
15106 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15107
15108 /**
15109  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15110  */
15111 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15112
15113 /**
15114  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15115  */
15116 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15117
15118 /**
15119  * Read a Shutdown from a byte array, created by Shutdown_write
15120  */
15121 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15122
15123 /**
15124  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15125  */
15126 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15127
15128 /**
15129  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15130  */
15131 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15132
15133 /**
15134  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15135  */
15136 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15137
15138 /**
15139  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15140  */
15141 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15142
15143 /**
15144  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15145  */
15146 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15147
15148 /**
15149  * Read a UpdateFee from a byte array, created by UpdateFee_write
15150  */
15151 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15152
15153 /**
15154  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15155  */
15156 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15157
15158 /**
15159  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15160  */
15161 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15162
15163 /**
15164  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15165  */
15166 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15167
15168 /**
15169  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15170  */
15171 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15172
15173 /**
15174  * Serialize the Ping object into a byte array which can be read by Ping_read
15175  */
15176 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15177
15178 /**
15179  * Read a Ping from a byte array, created by Ping_write
15180  */
15181 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15182
15183 /**
15184  * Serialize the Pong object into a byte array which can be read by Pong_read
15185  */
15186 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15187
15188 /**
15189  * Read a Pong from a byte array, created by Pong_write
15190  */
15191 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15192
15193 /**
15194  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15195  */
15196 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15197
15198 /**
15199  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15200  */
15201 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15202
15203 /**
15204  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15205  */
15206 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15207
15208 /**
15209  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15210  */
15211 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15212
15213 /**
15214  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15215  */
15216 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15217
15218 /**
15219  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15220  */
15221 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15222
15223 /**
15224  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15225  */
15226 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15227
15228 /**
15229  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15230  */
15231 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15232
15233 /**
15234  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15235  */
15236 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15237
15238 /**
15239  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15240  */
15241 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15242
15243 /**
15244  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15245  */
15246 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15247
15248 /**
15249  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15250  */
15251 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15252
15253 /**
15254  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15255  */
15256 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15257
15258 /**
15259  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15260  */
15261 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15262
15263 /**
15264  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15265  */
15266 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15267
15268 /**
15269  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15270  */
15271 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15272
15273 /**
15274  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15275  */
15276 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15277
15278 /**
15279  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15280  */
15281 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15282
15283 /**
15284  *\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
15285  */
15286 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15287
15288 /**
15289  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15290  */
15291 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15292
15293 /**
15294  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15295  */
15296 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15297
15298 /**
15299  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15300  */
15301 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15302
15303 /**
15304  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15305  */
15306 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15307
15308 /**
15309  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15310  */
15311 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15312
15313 /**
15314  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15315  */
15316 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15317
15318 /**
15319  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15320  */
15321 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15322
15323 /**
15324  * Constructs a new IgnoringMessageHandler given each field
15325  */
15326 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15327
15328 /**
15329  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15330  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15331  */
15332 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15333
15334 /**
15335  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15336  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15337  */
15338 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15339
15340 /**
15341  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15342  */
15343 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15344
15345 /**
15346  * Constructs a new ErroringMessageHandler
15347  */
15348 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15349
15350 /**
15351  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15352  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15353  */
15354 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15355
15356 /**
15357  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15358  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15359  */
15360 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15361
15362 /**
15363  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15364  */
15365 void MessageHandler_free(struct LDKMessageHandler this_obj);
15366
15367 /**
15368  * A message handler which handles messages specific to channels. Usually this is just a
15369  * ChannelManager object or a ErroringMessageHandler.
15370  */
15371 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15372
15373 /**
15374  * A message handler which handles messages specific to channels. Usually this is just a
15375  * ChannelManager object or a ErroringMessageHandler.
15376  */
15377 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15378
15379 /**
15380  * A message handler which handles messages updating our knowledge of the network channel
15381  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15382  */
15383 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15384
15385 /**
15386  * A message handler which handles messages updating our knowledge of the network channel
15387  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15388  */
15389 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15390
15391 /**
15392  * Constructs a new MessageHandler given each field
15393  */
15394 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15395
15396 /**
15397  * Creates a copy of a SocketDescriptor
15398  */
15399 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15400
15401 /**
15402  * Calls the free function if one is set
15403  */
15404 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15405
15406 /**
15407  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15408  */
15409 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15410
15411 /**
15412  * Used to indicate that we probably can't make any future connections to this peer, implying
15413  * we should go ahead and force-close any channels we have with it.
15414  */
15415 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15416
15417 /**
15418  * Used to indicate that we probably can't make any future connections to this peer, implying
15419  * we should go ahead and force-close any channels we have with it.
15420  */
15421 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15422
15423 /**
15424  * Constructs a new PeerHandleError given each field
15425  */
15426 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15427
15428 /**
15429  * Creates a copy of the PeerHandleError
15430  */
15431 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15432
15433 /**
15434  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15435  */
15436 void PeerManager_free(struct LDKPeerManager this_obj);
15437
15438 /**
15439  * Constructs a new PeerManager with the given message handlers and node_id secret key
15440  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15441  * cryptographically secure random bytes.
15442  */
15443 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);
15444
15445 /**
15446  * Get the list of node ids for peers which have completed the initial handshake.
15447  *
15448  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15449  * new_outbound_connection, however entries will only appear once the initial handshake has
15450  * completed and we are sure the remote peer has the private key for the given node_id.
15451  */
15452 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15453
15454 /**
15455  * Indicates a new outbound connection has been established to a node with the given node_id.
15456  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15457  * descriptor but must disconnect the connection immediately.
15458  *
15459  * Returns a small number of bytes to send to the remote node (currently always 50).
15460  *
15461  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15462  * socket_disconnected().
15463  */
15464 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);
15465
15466 /**
15467  * Indicates a new inbound connection has been established.
15468  *
15469  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15470  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15471  * call socket_disconnected for the new descriptor but must disconnect the connection
15472  * immediately.
15473  *
15474  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15475  * socket_disconnected called.
15476  */
15477 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15478
15479 /**
15480  * Indicates that there is room to write data to the given socket descriptor.
15481  *
15482  * May return an Err to indicate that the connection should be closed.
15483  *
15484  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15485  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15486  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15487  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15488  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15489  * new_\\*_connection event.
15490  */
15491 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15492
15493 /**
15494  * Indicates that data was read from the given socket descriptor.
15495  *
15496  * May return an Err to indicate that the connection should be closed.
15497  *
15498  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15499  * Thus, however, you almost certainly want to call process_events() after any read_event to
15500  * generate send_data calls to handle responses.
15501  *
15502  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
15503  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
15504  *
15505  * Panics if the descriptor was not previously registered in a new_*_connection event.
15506  */
15507 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);
15508
15509 /**
15510  * Checks for any events generated by our handlers and processes them. Includes sending most
15511  * response messages as well as messages generated by calls to handler functions directly (eg
15512  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
15513  */
15514 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
15515
15516 /**
15517  * Indicates that the given socket descriptor's connection is now closed.
15518  *
15519  * This must only be called if the socket has been disconnected by the peer or your own
15520  * decision to disconnect it and must NOT be called in any case where other parts of this
15521  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
15522  * the peer.
15523  *
15524  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
15525  */
15526 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15527
15528 /**
15529  * Disconnect a peer given its node id.
15530  *
15531  * Set no_connection_possible to true to prevent any further connection with this peer,
15532  * force-closing any channels we have with it.
15533  *
15534  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
15535  * so be careful about reentrancy issues.
15536  */
15537 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
15538
15539 /**
15540  * This function should be called roughly once every 30 seconds.
15541  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
15542  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
15543  */
15544 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
15545
15546 /**
15547  * Build the commitment secret from the seed and the commitment number
15548  */
15549 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
15550
15551 /**
15552  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
15553  * from the base secret and the per_commitment_point.
15554  *
15555  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15556  * generated (ie our own).
15557  */
15558 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
15559
15560 /**
15561  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
15562  * from the base point and the per_commitment_key. This is the public equivalent of
15563  * derive_private_key - using only public keys to derive a public key instead of private keys.
15564  *
15565  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15566  * generated (ie our own).
15567  */
15568 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
15569
15570 /**
15571  * Derives a per-commitment-transaction revocation key from its constituent parts.
15572  *
15573  * Only the cheating participant owns a valid witness to propagate a revoked
15574  * commitment transaction, thus per_commitment_secret always come from cheater
15575  * and revocation_base_secret always come from punisher, which is the broadcaster
15576  * of the transaction spending with this key knowledge.
15577  *
15578  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15579  * generated (ie our own).
15580  */
15581 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
15582
15583 /**
15584  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
15585  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
15586  * public key instead of private keys.
15587  *
15588  * Only the cheating participant owns a valid witness to propagate a revoked
15589  * commitment transaction, thus per_commitment_point always come from cheater
15590  * and revocation_base_point always come from punisher, which is the broadcaster
15591  * of the transaction spending with this key knowledge.
15592  *
15593  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15594  * generated (ie our own).
15595  */
15596 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
15597
15598 /**
15599  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
15600  */
15601 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
15602
15603 /**
15604  * The broadcaster's per-commitment public key which was used to derive the other keys.
15605  */
15606 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15607
15608 /**
15609  * The broadcaster's per-commitment public key which was used to derive the other keys.
15610  */
15611 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15612
15613 /**
15614  * The revocation key which is used to allow the broadcaster of the commitment
15615  * transaction to provide their counterparty the ability to punish them if they broadcast
15616  * an old state.
15617  */
15618 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15619
15620 /**
15621  * The revocation key which is used to allow the broadcaster of the commitment
15622  * transaction to provide their counterparty the ability to punish them if they broadcast
15623  * an old state.
15624  */
15625 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15626
15627 /**
15628  * Broadcaster's HTLC Key
15629  */
15630 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15631
15632 /**
15633  * Broadcaster's HTLC Key
15634  */
15635 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15636
15637 /**
15638  * Countersignatory's HTLC Key
15639  */
15640 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15641
15642 /**
15643  * Countersignatory's HTLC Key
15644  */
15645 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15646
15647 /**
15648  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15649  */
15650 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15651
15652 /**
15653  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15654  */
15655 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15656
15657 /**
15658  * Constructs a new TxCreationKeys given each field
15659  */
15660 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);
15661
15662 /**
15663  * Creates a copy of the TxCreationKeys
15664  */
15665 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
15666
15667 /**
15668  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
15669  */
15670 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
15671
15672 /**
15673  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
15674  */
15675 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
15676
15677 /**
15678  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
15679  */
15680 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
15681
15682 /**
15683  * The public key which is used to sign all commitment transactions, as it appears in the
15684  * on-chain channel lock-in 2-of-2 multisig output.
15685  */
15686 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15687
15688 /**
15689  * The public key which is used to sign all commitment transactions, as it appears in the
15690  * on-chain channel lock-in 2-of-2 multisig output.
15691  */
15692 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15693
15694 /**
15695  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15696  * revocation keys. This is combined with the per-commitment-secret generated by the
15697  * counterparty to create a secret which the counterparty can reveal to revoke previous
15698  * states.
15699  */
15700 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15701
15702 /**
15703  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15704  * revocation keys. This is combined with the per-commitment-secret generated by the
15705  * counterparty to create a secret which the counterparty can reveal to revoke previous
15706  * states.
15707  */
15708 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15709
15710 /**
15711  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15712  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15713  * static across every commitment transaction.
15714  */
15715 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15716
15717 /**
15718  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15719  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15720  * static across every commitment transaction.
15721  */
15722 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15723
15724 /**
15725  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15726  * public key which receives non-HTLC-encumbered funds which are only available for spending
15727  * after some delay (or can be claimed via the revocation path).
15728  */
15729 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15730
15731 /**
15732  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15733  * public key which receives non-HTLC-encumbered funds which are only available for spending
15734  * after some delay (or can be claimed via the revocation path).
15735  */
15736 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15737
15738 /**
15739  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15740  * which is used to encumber HTLC-in-flight outputs.
15741  */
15742 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15743
15744 /**
15745  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15746  * which is used to encumber HTLC-in-flight outputs.
15747  */
15748 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15749
15750 /**
15751  * Constructs a new ChannelPublicKeys given each field
15752  */
15753 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);
15754
15755 /**
15756  * Creates a copy of the ChannelPublicKeys
15757  */
15758 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
15759
15760 /**
15761  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
15762  */
15763 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
15764
15765 /**
15766  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
15767  */
15768 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
15769
15770 /**
15771  * Create per-state keys from channel base points and the per-commitment point.
15772  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15773  */
15774 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);
15775
15776 /**
15777  * Generate per-state keys from channel static keys.
15778  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15779  */
15780 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);
15781
15782 /**
15783  * A script either spendable by the revocation
15784  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
15785  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
15786  */
15787 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
15788
15789 /**
15790  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
15791  */
15792 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
15793
15794 /**
15795  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15796  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15797  * need to compare this value to whether the commitment transaction in question is that of
15798  * the counterparty or our own.
15799  */
15800 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15801
15802 /**
15803  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15804  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15805  * need to compare this value to whether the commitment transaction in question is that of
15806  * the counterparty or our own.
15807  */
15808 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
15809
15810 /**
15811  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15812  * this divided by 1000.
15813  */
15814 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15815
15816 /**
15817  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15818  * this divided by 1000.
15819  */
15820 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
15821
15822 /**
15823  * The CLTV lock-time at which this HTLC expires.
15824  */
15825 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15826
15827 /**
15828  * The CLTV lock-time at which this HTLC expires.
15829  */
15830 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
15831
15832 /**
15833  * The hash of the preimage which unlocks this HTLC.
15834  */
15835 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
15836
15837 /**
15838  * The hash of the preimage which unlocks this HTLC.
15839  */
15840 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15841
15842 /**
15843  * The position within the commitment transactions' outputs. This may be None if the value is
15844  * below the dust limit (in which case no output appears in the commitment transaction and the
15845  * value is spent to additional transaction fees).
15846  */
15847 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15848
15849 /**
15850  * The position within the commitment transactions' outputs. This may be None if the value is
15851  * below the dust limit (in which case no output appears in the commitment transaction and the
15852  * value is spent to additional transaction fees).
15853  */
15854 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
15855
15856 /**
15857  * Constructs a new HTLCOutputInCommitment given each field
15858  */
15859 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);
15860
15861 /**
15862  * Creates a copy of the HTLCOutputInCommitment
15863  */
15864 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
15865
15866 /**
15867  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
15868  */
15869 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
15870
15871 /**
15872  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
15873  */
15874 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
15875
15876 /**
15877  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
15878  * does not need to have its previous_output_index filled.
15879  */
15880 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
15881
15882 /**
15883  * Gets the redeemscript for a funding output from the two funding public keys.
15884  * Note that the order of funding public keys does not matter.
15885  */
15886 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
15887
15888 /**
15889  * panics if htlc.transaction_output_index.is_none()!
15890  */
15891 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);
15892
15893 /**
15894  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15895  */
15896 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
15897
15898 /**
15899  * Holder public keys
15900  */
15901 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15902
15903 /**
15904  * Holder public keys
15905  */
15906 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15907
15908 /**
15909  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15910  */
15911 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15912
15913 /**
15914  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15915  */
15916 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15917
15918 /**
15919  * Whether the holder is the initiator of this channel.
15920  * This is an input to the commitment number obscure factor computation.
15921  */
15922 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15923
15924 /**
15925  * Whether the holder is the initiator of this channel.
15926  * This is an input to the commitment number obscure factor computation.
15927  */
15928 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
15929
15930 /**
15931  * The late-bound counterparty channel transaction parameters.
15932  * These parameters are populated at the point in the protocol where the counterparty provides them.
15933  */
15934 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15935
15936 /**
15937  * The late-bound counterparty channel transaction parameters.
15938  * These parameters are populated at the point in the protocol where the counterparty provides them.
15939  */
15940 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
15941
15942 /**
15943  * The late-bound funding outpoint
15944  */
15945 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15946
15947 /**
15948  * The late-bound funding outpoint
15949  */
15950 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15951
15952 /**
15953  * Constructs a new ChannelTransactionParameters given each field
15954  */
15955 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);
15956
15957 /**
15958  * Creates a copy of the ChannelTransactionParameters
15959  */
15960 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
15961
15962 /**
15963  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15964  */
15965 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
15966
15967 /**
15968  * Counter-party public keys
15969  */
15970 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15971
15972 /**
15973  * Counter-party public keys
15974  */
15975 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15976
15977 /**
15978  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15979  */
15980 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15981
15982 /**
15983  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15984  */
15985 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15986
15987 /**
15988  * Constructs a new CounterpartyChannelTransactionParameters given each field
15989  */
15990 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
15991
15992 /**
15993  * Creates a copy of the CounterpartyChannelTransactionParameters
15994  */
15995 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
15996
15997 /**
15998  * Whether the late bound parameters are populated.
15999  */
16000 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16001
16002 /**
16003  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16004  * given that the holder is the broadcaster.
16005  *
16006  * self.is_populated() must be true before calling this function.
16007  */
16008 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16009
16010 /**
16011  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16012  * given that the counterparty is the broadcaster.
16013  *
16014  * self.is_populated() must be true before calling this function.
16015  */
16016 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16017
16018 /**
16019  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16020  */
16021 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16022
16023 /**
16024  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16025  */
16026 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16027
16028 /**
16029  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16030  */
16031 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16032
16033 /**
16034  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16035  */
16036 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16037
16038 /**
16039  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16040  */
16041 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16042
16043 /**
16044  * Get the channel pubkeys for the broadcaster
16045  */
16046 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16047
16048 /**
16049  * Get the channel pubkeys for the countersignatory
16050  */
16051 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16052
16053 /**
16054  * Get the contest delay applicable to the transactions.
16055  * Note that the contest delay was selected by the countersignatory.
16056  */
16057 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16058
16059 /**
16060  * Whether the channel is outbound from the broadcaster.
16061  *
16062  * The boolean representing the side that initiated the channel is
16063  * an input to the commitment number obscure factor computation.
16064  */
16065 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16066
16067 /**
16068  * The funding outpoint
16069  */
16070 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16071
16072 /**
16073  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16074  */
16075 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16076
16077 /**
16078  * Our counterparty's signature for the transaction
16079  */
16080 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16081
16082 /**
16083  * Our counterparty's signature for the transaction
16084  */
16085 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16086
16087 /**
16088  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16089  */
16090 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16091
16092 /**
16093  * Creates a copy of the HolderCommitmentTransaction
16094  */
16095 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16096
16097 /**
16098  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16099  */
16100 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16101
16102 /**
16103  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16104  */
16105 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16106
16107 /**
16108  * Create a new holder transaction with the given counterparty signatures.
16109  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16110  */
16111 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);
16112
16113 /**
16114  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16115  */
16116 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16117
16118 /**
16119  * The commitment transaction
16120  */
16121 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16122
16123 /**
16124  * The commitment transaction
16125  */
16126 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16127
16128 /**
16129  * The txid for the commitment transaction.
16130  *
16131  * This is provided as a performance optimization, instead of calling transaction.txid()
16132  * multiple times.
16133  */
16134 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16135
16136 /**
16137  * The txid for the commitment transaction.
16138  *
16139  * This is provided as a performance optimization, instead of calling transaction.txid()
16140  * multiple times.
16141  */
16142 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16143
16144 /**
16145  * Constructs a new BuiltCommitmentTransaction given each field
16146  */
16147 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16148
16149 /**
16150  * Creates a copy of the BuiltCommitmentTransaction
16151  */
16152 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16153
16154 /**
16155  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16156  */
16157 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16158
16159 /**
16160  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16161  */
16162 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16163
16164 /**
16165  * Get the SIGHASH_ALL sighash value of the transaction.
16166  *
16167  * This can be used to verify a signature.
16168  */
16169 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);
16170
16171 /**
16172  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16173  * because we are about to broadcast a holder transaction.
16174  */
16175 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);
16176
16177 /**
16178  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16179  */
16180 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16181
16182 /**
16183  * Creates a copy of the CommitmentTransaction
16184  */
16185 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16186
16187 /**
16188  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16189  */
16190 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16191
16192 /**
16193  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16194  */
16195 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16196
16197 /**
16198  * The backwards-counting commitment number
16199  */
16200 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16201
16202 /**
16203  * The value to be sent to the broadcaster
16204  */
16205 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16206
16207 /**
16208  * The value to be sent to the counterparty
16209  */
16210 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16211
16212 /**
16213  * The feerate paid per 1000-weight-unit in this commitment transaction.
16214  */
16215 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16216
16217 /**
16218  * Trust our pre-built transaction and derived transaction creation public keys.
16219  *
16220  * Applies a wrapper which allows access to these fields.
16221  *
16222  * This should only be used if you fully trust the builder of this object.  It should not
16223  *\tbe used by an external signer - instead use the verify function.
16224  */
16225 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16226
16227 /**
16228  * Verify our pre-built transaction and derived transaction creation public keys.
16229  *
16230  * Applies a wrapper which allows access to these fields.
16231  *
16232  * An external validating signer must call this method before signing
16233  * or using the built transaction.
16234  */
16235 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);
16236
16237 /**
16238  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16239  */
16240 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16241
16242 /**
16243  * The transaction ID of the built Bitcoin transaction
16244  */
16245 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16246
16247 /**
16248  * The pre-built Bitcoin commitment transaction
16249  */
16250 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16251
16252 /**
16253  * The pre-calculated transaction creation public keys.
16254  */
16255 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16256
16257 /**
16258  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16259  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16260  *
16261  * The returned Vec has one entry for each HTLC, and in the same order.
16262  */
16263 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);
16264
16265 /**
16266  * Get the transaction number obscure factor
16267  */
16268 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16269
16270 /**
16271  * Creates a copy of the InitFeatures
16272  */
16273 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16274
16275 /**
16276  * Creates a copy of the NodeFeatures
16277  */
16278 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16279
16280 /**
16281  * Creates a copy of the ChannelFeatures
16282  */
16283 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16284
16285 /**
16286  * Creates a copy of the InvoiceFeatures
16287  */
16288 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16289
16290 /**
16291  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16292  */
16293 void InitFeatures_free(struct LDKInitFeatures this_obj);
16294
16295 /**
16296  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16297  */
16298 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16299
16300 /**
16301  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16302  */
16303 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16304
16305 /**
16306  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16307  */
16308 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16309
16310 /**
16311  * Create a blank Features with no features set
16312  */
16313 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16314
16315 /**
16316  * Creates a Features with the bits set which are known by the implementation
16317  */
16318 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16319
16320 /**
16321  * Create a blank Features with no features set
16322  */
16323 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16324
16325 /**
16326  * Creates a Features with the bits set which are known by the implementation
16327  */
16328 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16329
16330 /**
16331  * Create a blank Features with no features set
16332  */
16333 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16334
16335 /**
16336  * Creates a Features with the bits set which are known by the implementation
16337  */
16338 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16339
16340 /**
16341  * Create a blank Features with no features set
16342  */
16343 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16344
16345 /**
16346  * Creates a Features with the bits set which are known by the implementation
16347  */
16348 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16349
16350 /**
16351  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16352  */
16353 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16354
16355 /**
16356  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16357  */
16358 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16359
16360 /**
16361  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16362  */
16363 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16364
16365 /**
16366  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16367  */
16368 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16369
16370 /**
16371  * Read a InitFeatures from a byte array, created by InitFeatures_write
16372  */
16373 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16374
16375 /**
16376  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16377  */
16378 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16379
16380 /**
16381  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16382  */
16383 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16384
16385 /**
16386  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16387  */
16388 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16389
16390 /**
16391  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16392  */
16393 void RouteHop_free(struct LDKRouteHop this_obj);
16394
16395 /**
16396  * The node_id of the node at this hop.
16397  */
16398 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16399
16400 /**
16401  * The node_id of the node at this hop.
16402  */
16403 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16404
16405 /**
16406  * The node_announcement features of the node at this hop. For the last hop, these may be
16407  * amended to match the features present in the invoice this node generated.
16408  */
16409 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16410
16411 /**
16412  * The node_announcement features of the node at this hop. For the last hop, these may be
16413  * amended to match the features present in the invoice this node generated.
16414  */
16415 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16416
16417 /**
16418  * The channel that should be used from the previous hop to reach this node.
16419  */
16420 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16421
16422 /**
16423  * The channel that should be used from the previous hop to reach this node.
16424  */
16425 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16426
16427 /**
16428  * The channel_announcement features of the channel that should be used from the previous hop
16429  * to reach this node.
16430  */
16431 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16432
16433 /**
16434  * The channel_announcement features of the channel that should be used from the previous hop
16435  * to reach this node.
16436  */
16437 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16438
16439 /**
16440  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16441  * For the last hop, this should be the full value of the payment (might be more than
16442  * requested if we had to match htlc_minimum_msat).
16443  */
16444 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16445
16446 /**
16447  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16448  * For the last hop, this should be the full value of the payment (might be more than
16449  * requested if we had to match htlc_minimum_msat).
16450  */
16451 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16452
16453 /**
16454  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16455  * expected at the destination, in excess of the current block height.
16456  */
16457 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16458
16459 /**
16460  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16461  * expected at the destination, in excess of the current block height.
16462  */
16463 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
16464
16465 /**
16466  * Constructs a new RouteHop given each field
16467  */
16468 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);
16469
16470 /**
16471  * Creates a copy of the RouteHop
16472  */
16473 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
16474
16475 /**
16476  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
16477  */
16478 void Route_free(struct LDKRoute this_obj);
16479
16480 /**
16481  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
16482  * last RouteHop in each path must be the same.
16483  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
16484  * destination. Thus, this must always be at least length one. While the maximum length of any
16485  * given path is variable, keeping the length of any path to less than 20 should currently
16486  * ensure it is viable.
16487  */
16488 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
16489
16490 /**
16491  * Constructs a new Route given each field
16492  */
16493 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
16494
16495 /**
16496  * Creates a copy of the Route
16497  */
16498 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
16499
16500 /**
16501  * Serialize the Route object into a byte array which can be read by Route_read
16502  */
16503 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
16504
16505 /**
16506  * Read a Route from a byte array, created by Route_write
16507  */
16508 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
16509
16510 /**
16511  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
16512  */
16513 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
16514
16515 /**
16516  * The node_id of the non-target end of the route
16517  */
16518 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16519
16520 /**
16521  * The node_id of the non-target end of the route
16522  */
16523 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16524
16525 /**
16526  * The short_channel_id of this channel
16527  */
16528 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16529
16530 /**
16531  * The short_channel_id of this channel
16532  */
16533 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
16534
16535 /**
16536  * The fees which must be paid to use this channel
16537  */
16538 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16539
16540 /**
16541  * The fees which must be paid to use this channel
16542  */
16543 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16544
16545 /**
16546  * The difference in CLTV values between this node and the next node.
16547  */
16548 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16549
16550 /**
16551  * The difference in CLTV values between this node and the next node.
16552  */
16553 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
16554
16555 /**
16556  * The minimum value, in msat, which must be relayed to the next hop.
16557  */
16558 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16559
16560 /**
16561  * The minimum value, in msat, which must be relayed to the next hop.
16562  */
16563 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16564
16565 /**
16566  * The maximum value in msat available for routing with a single HTLC.
16567  */
16568 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16569
16570 /**
16571  * The maximum value in msat available for routing with a single HTLC.
16572  */
16573 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16574
16575 /**
16576  * Constructs a new RouteHintHop given each field
16577  */
16578 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);
16579
16580 /**
16581  * Creates a copy of the RouteHintHop
16582  */
16583 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
16584
16585 /**
16586  * Gets a route from us (payer) to the given target node (payee).
16587  *
16588  * If the payee provided features in their invoice, they should be provided via payee_features.
16589  * Without this, MPP will only be used if the payee's features are available in the network graph.
16590  *
16591  * Extra routing hops between known nodes and the target will be used if they are included in
16592  * last_hops.
16593  *
16594  * If some channels aren't announced, it may be useful to fill in a first_hops with the
16595  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
16596  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
16597  * in first_hops will be used.
16598  *
16599  * Panics if first_hops contains channels without short_channel_ids
16600  * (ChannelManager::list_usable_channels will never include such channels).
16601  *
16602  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
16603  * equal), however the enabled/disabled bit on such channels as well as the
16604  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
16605  */
16606 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);
16607
16608 /**
16609  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
16610  */
16611 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
16612
16613 /**
16614  * Creates a copy of the NetworkGraph
16615  */
16616 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
16617
16618 /**
16619  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
16620  */
16621 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
16622
16623 /**
16624  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
16625  */
16626 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
16627
16628 /**
16629  * Creates a new tracker of the actual state of the network of channels and nodes,
16630  * assuming a fresh network graph.
16631  * Chain monitor is used to make sure announced channels exist on-chain,
16632  * channel data is correct, and that the announcement is signed with
16633  * channel owners' keys.
16634  */
16635 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
16636
16637 /**
16638  * Creates a new tracker of the actual state of the network of channels and nodes,
16639  * assuming an existing Network Graph.
16640  */
16641 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
16642
16643 /**
16644  * Adds a provider used to check new announcements. Does not affect
16645  * existing announcements unless they are updated.
16646  * Add, update or remove the provider would replace the current one.
16647  */
16648 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
16649
16650 /**
16651  * Take a read lock on the network_graph and return it in the C-bindings
16652  * newtype helper. This is likely only useful when called via the C
16653  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
16654  * yourself.
16655  */
16656 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16657
16658 /**
16659  * Get a reference to the NetworkGraph which this read-lock contains.
16660  */
16661 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
16662
16663 /**
16664  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
16665  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
16666  */
16667 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16668
16669 /**
16670  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16671  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16672  */
16673 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16674
16675 /**
16676  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
16677  */
16678 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
16679
16680 /**
16681  * When the last update to the channel direction was issued.
16682  * Value is opaque, as set in the announcement.
16683  */
16684 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16685
16686 /**
16687  * When the last update to the channel direction was issued.
16688  * Value is opaque, as set in the announcement.
16689  */
16690 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
16691
16692 /**
16693  * Whether the channel can be currently used for payments (in this one direction).
16694  */
16695 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16696
16697 /**
16698  * Whether the channel can be currently used for payments (in this one direction).
16699  */
16700 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
16701
16702 /**
16703  * The difference in CLTV values that you must have when routing through this channel.
16704  */
16705 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16706
16707 /**
16708  * The difference in CLTV values that you must have when routing through this channel.
16709  */
16710 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
16711
16712 /**
16713  * The minimum value, which must be relayed to the next hop via the channel
16714  */
16715 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16716
16717 /**
16718  * The minimum value, which must be relayed to the next hop via the channel
16719  */
16720 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
16721
16722 /**
16723  * The maximum value which may be relayed to the next hop via the channel.
16724  */
16725 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16726
16727 /**
16728  * The maximum value which may be relayed to the next hop via the channel.
16729  */
16730 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16731
16732 /**
16733  * Fees charged when the channel is used for routing
16734  */
16735 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16736
16737 /**
16738  * Fees charged when the channel is used for routing
16739  */
16740 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16741
16742 /**
16743  * Most recent update for the channel received from the network
16744  * Mostly redundant with the data we store in fields explicitly.
16745  * Everything else is useful only for sending out for initial routing sync.
16746  * Not stored if contains excess data to prevent DoS.
16747  */
16748 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16749
16750 /**
16751  * Most recent update for the channel received from the network
16752  * Mostly redundant with the data we store in fields explicitly.
16753  * Everything else is useful only for sending out for initial routing sync.
16754  * Not stored if contains excess data to prevent DoS.
16755  */
16756 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
16757
16758 /**
16759  * Constructs a new DirectionalChannelInfo given each field
16760  */
16761 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);
16762
16763 /**
16764  * Creates a copy of the DirectionalChannelInfo
16765  */
16766 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
16767
16768 /**
16769  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
16770  */
16771 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
16772
16773 /**
16774  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
16775  */
16776 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
16777
16778 /**
16779  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
16780  */
16781 void ChannelInfo_free(struct LDKChannelInfo this_obj);
16782
16783 /**
16784  * Protocol features of a channel communicated during its announcement
16785  */
16786 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16787
16788 /**
16789  * Protocol features of a channel communicated during its announcement
16790  */
16791 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16792
16793 /**
16794  * Source node of the first direction of a channel
16795  */
16796 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16797
16798 /**
16799  * Source node of the first direction of a channel
16800  */
16801 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16802
16803 /**
16804  * Details about the first direction of a channel
16805  */
16806 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16807
16808 /**
16809  * Details about the first direction of a channel
16810  */
16811 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16812
16813 /**
16814  * Source node of the second direction of a channel
16815  */
16816 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16817
16818 /**
16819  * Source node of the second direction of a channel
16820  */
16821 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16822
16823 /**
16824  * Details about the second direction of a channel
16825  */
16826 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16827
16828 /**
16829  * Details about the second direction of a channel
16830  */
16831 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16832
16833 /**
16834  * The channel capacity as seen on-chain, if chain lookup is available.
16835  */
16836 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16837
16838 /**
16839  * The channel capacity as seen on-chain, if chain lookup is available.
16840  */
16841 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16842
16843 /**
16844  * An initial announcement of the channel
16845  * Mostly redundant with the data we store in fields explicitly.
16846  * Everything else is useful only for sending out for initial routing sync.
16847  * Not stored if contains excess data to prevent DoS.
16848  */
16849 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16850
16851 /**
16852  * An initial announcement of the channel
16853  * Mostly redundant with the data we store in fields explicitly.
16854  * Everything else is useful only for sending out for initial routing sync.
16855  * Not stored if contains excess data to prevent DoS.
16856  */
16857 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
16858
16859 /**
16860  * Constructs a new ChannelInfo given each field
16861  */
16862 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);
16863
16864 /**
16865  * Creates a copy of the ChannelInfo
16866  */
16867 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
16868
16869 /**
16870  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
16871  */
16872 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
16873
16874 /**
16875  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
16876  */
16877 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
16878
16879 /**
16880  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
16881  */
16882 void RoutingFees_free(struct LDKRoutingFees this_obj);
16883
16884 /**
16885  * Flat routing fee in satoshis
16886  */
16887 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16888
16889 /**
16890  * Flat routing fee in satoshis
16891  */
16892 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16893
16894 /**
16895  * Liquidity-based routing fee in millionths of a routed amount.
16896  * In other words, 10000 is 1%.
16897  */
16898 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16899
16900 /**
16901  * Liquidity-based routing fee in millionths of a routed amount.
16902  * In other words, 10000 is 1%.
16903  */
16904 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16905
16906 /**
16907  * Constructs a new RoutingFees given each field
16908  */
16909 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
16910
16911 /**
16912  * Creates a copy of the RoutingFees
16913  */
16914 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
16915
16916 /**
16917  * Read a RoutingFees from a byte array, created by RoutingFees_write
16918  */
16919 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
16920
16921 /**
16922  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
16923  */
16924 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
16925
16926 /**
16927  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
16928  */
16929 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
16930
16931 /**
16932  * Protocol features the node announced support for
16933  */
16934 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16935
16936 /**
16937  * Protocol features the node announced support for
16938  */
16939 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16940
16941 /**
16942  * When the last known update to the node state was issued.
16943  * Value is opaque, as set in the announcement.
16944  */
16945 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16946
16947 /**
16948  * When the last known update to the node state was issued.
16949  * Value is opaque, as set in the announcement.
16950  */
16951 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
16952
16953 /**
16954  * Color assigned to the node
16955  */
16956 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
16957
16958 /**
16959  * Color assigned to the node
16960  */
16961 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
16962
16963 /**
16964  * Moniker assigned to the node.
16965  * May be invalid or malicious (eg control chars),
16966  * should not be exposed to the user.
16967  */
16968 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
16969
16970 /**
16971  * Moniker assigned to the node.
16972  * May be invalid or malicious (eg control chars),
16973  * should not be exposed to the user.
16974  */
16975 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16976
16977 /**
16978  * Internet-level addresses via which one can connect to the node
16979  */
16980 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
16981
16982 /**
16983  * An initial announcement of the node
16984  * Mostly redundant with the data we store in fields explicitly.
16985  * Everything else is useful only for sending out for initial routing sync.
16986  * Not stored if contains excess data to prevent DoS.
16987  */
16988 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16989
16990 /**
16991  * An initial announcement of the node
16992  * Mostly redundant with the data we store in fields explicitly.
16993  * Everything else is useful only for sending out for initial routing sync.
16994  * Not stored if contains excess data to prevent DoS.
16995  */
16996 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
16997
16998 /**
16999  * Constructs a new NodeAnnouncementInfo given each field
17000  */
17001 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);
17002
17003 /**
17004  * Creates a copy of the NodeAnnouncementInfo
17005  */
17006 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17007
17008 /**
17009  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17010  */
17011 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17012
17013 /**
17014  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17015  */
17016 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17017
17018 /**
17019  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17020  */
17021 void NodeInfo_free(struct LDKNodeInfo this_obj);
17022
17023 /**
17024  * All valid channels a node has announced
17025  */
17026 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17027
17028 /**
17029  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17030  * The two fields (flat and proportional fee) are independent,
17031  * meaning they don't have to refer to the same channel.
17032  */
17033 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17034
17035 /**
17036  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17037  * The two fields (flat and proportional fee) are independent,
17038  * meaning they don't have to refer to the same channel.
17039  */
17040 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17041
17042 /**
17043  * More information about a node from node_announcement.
17044  * Optional because we store a Node entry after learning about it from
17045  * a channel announcement, but before receiving a node announcement.
17046  */
17047 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17048
17049 /**
17050  * More information about a node from node_announcement.
17051  * Optional because we store a Node entry after learning about it from
17052  * a channel announcement, but before receiving a node announcement.
17053  */
17054 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17055
17056 /**
17057  * Constructs a new NodeInfo given each field
17058  */
17059 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17060
17061 /**
17062  * Creates a copy of the NodeInfo
17063  */
17064 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17065
17066 /**
17067  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17068  */
17069 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17070
17071 /**
17072  * Read a NodeInfo from a byte array, created by NodeInfo_write
17073  */
17074 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17075
17076 /**
17077  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17078  */
17079 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17080
17081 /**
17082  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17083  */
17084 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17085
17086 /**
17087  * Creates a new, empty, network graph.
17088  */
17089 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17090
17091 /**
17092  * For an already known node (from channel announcements), update its stored properties from a
17093  * given node announcement.
17094  *
17095  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17096  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17097  * routing messages from a source using a protocol other than the lightning P2P protocol.
17098  */
17099 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17100
17101 /**
17102  * For an already known node (from channel announcements), update its stored properties from a
17103  * given node announcement without verifying the associated signatures. Because we aren't
17104  * given the associated signatures here we cannot relay the node announcement to any of our
17105  * peers.
17106  */
17107 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17108
17109 /**
17110  * Store or update channel info from a channel announcement.
17111  *
17112  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17113  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17114  * routing messages from a source using a protocol other than the lightning P2P protocol.
17115  *
17116  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17117  * the corresponding UTXO exists on chain and is correctly-formatted.
17118  */
17119 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);
17120
17121 /**
17122  * Store or update channel info from a channel announcement without verifying the associated
17123  * signatures. Because we aren't given the associated signatures here we cannot relay the
17124  * channel announcement to any of our peers.
17125  *
17126  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17127  * the corresponding UTXO exists on chain and is correctly-formatted.
17128  */
17129 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);
17130
17131 /**
17132  * Close a channel if a corresponding HTLC fail was sent.
17133  * If permanent, removes a channel from the local storage.
17134  * May cause the removal of nodes too, if this was their last channel.
17135  * If not permanent, makes channels unavailable for routing.
17136  */
17137 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17138
17139 /**
17140  * For an already known (from announcement) channel, update info about one of the directions
17141  * of the channel.
17142  *
17143  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17144  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17145  * routing messages from a source using a protocol other than the lightning P2P protocol.
17146  */
17147 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17148
17149 /**
17150  * For an already known (from announcement) channel, update info about one of the directions
17151  * of the channel without verifying the associated signatures. Because we aren't given the
17152  * associated signatures here we cannot relay the channel update to any of our peers.
17153  */
17154 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17155
17156 /**
17157  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17158  */
17159 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17160
17161 /**
17162  * Initialize a new FilesystemPersister and set the path to the individual channels'
17163  * files.
17164  */
17165 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17166
17167 /**
17168  * Get the directory which was provided when this persister was initialized.
17169  */
17170 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17171
17172 /**
17173  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17174  * initialization, within a file called \"manager\".
17175  */
17176 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17177
17178 /**
17179  * Read `ChannelMonitor`s from disk.
17180  */
17181 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17182
17183 /**
17184  * Constructs a new Persist which calls the relevant methods on this_arg.
17185  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17186  */
17187 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17188
17189 /**
17190  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17191  *
17192  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17193  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17194  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17195  * since this check is fast we recommend to do it anyway.
17196  *
17197  * If this function fails this is considered a bug. Please open an issue describing your
17198  * platform and stating your current system time.
17199  *
17200  * # Panics
17201  * If the check fails this function panics. By calling this function on startup you ensure that
17202  * this wont happen at an arbitrary later point in time.
17203  */
17204 void check_platform(void);
17205
17206 /**
17207  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17208  */
17209 void Invoice_free(struct LDKInvoice this_obj);
17210
17211 /**
17212  * Creates a copy of the Invoice
17213  */
17214 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17215
17216 /**
17217  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17218  */
17219 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17220
17221 /**
17222  * Creates a copy of the SignedRawInvoice
17223  */
17224 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17225
17226 /**
17227  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17228  */
17229 void RawInvoice_free(struct LDKRawInvoice this_obj);
17230
17231 /**
17232  * data part
17233  */
17234 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17235
17236 /**
17237  * data part
17238  */
17239 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17240
17241 /**
17242  * Creates a copy of the RawInvoice
17243  */
17244 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17245
17246 /**
17247  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17248  */
17249 void RawDataPart_free(struct LDKRawDataPart this_obj);
17250
17251 /**
17252  * generation time of the invoice
17253  */
17254 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17255
17256 /**
17257  * generation time of the invoice
17258  */
17259 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17260
17261 /**
17262  * Creates a copy of the RawDataPart
17263  */
17264 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17265
17266 /**
17267  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17268  */
17269 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17270
17271 /**
17272  * Creates a copy of the PositiveTimestamp
17273  */
17274 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17275
17276 /**
17277  * Creates a copy of the SiPrefix
17278  */
17279 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17280
17281 /**
17282  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17283  * This is effectively 10^12 * the prefix multiplier
17284  */
17285 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17286
17287 /**
17288  * Creates a copy of the Currency
17289  */
17290 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17291
17292 /**
17293  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17294  */
17295 void Sha256_free(struct LDKSha256 this_obj);
17296
17297 /**
17298  * Creates a copy of the Sha256
17299  */
17300 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17301
17302 /**
17303  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17304  */
17305 void Description_free(struct LDKDescription this_obj);
17306
17307 /**
17308  * Creates a copy of the Description
17309  */
17310 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17311
17312 /**
17313  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17314  */
17315 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17316
17317 /**
17318  * Creates a copy of the PayeePubKey
17319  */
17320 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17321
17322 /**
17323  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17324  */
17325 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17326
17327 /**
17328  * Creates a copy of the ExpiryTime
17329  */
17330 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
17331
17332 /**
17333  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
17334  */
17335 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
17336
17337 /**
17338  * Creates a copy of the MinFinalCltvExpiry
17339  */
17340 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
17341
17342 /**
17343  * Frees any resources used by the Fallback
17344  */
17345 void Fallback_free(struct LDKFallback this_ptr);
17346
17347 /**
17348  * Creates a copy of the Fallback
17349  */
17350 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
17351
17352 /**
17353  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
17354  */
17355 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
17356
17357 /**
17358  * Creates a copy of the InvoiceSignature
17359  */
17360 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
17361
17362 /**
17363  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17364  */
17365 void RouteHint_free(struct LDKRouteHint this_obj);
17366
17367 /**
17368  * Creates a copy of the RouteHint
17369  */
17370 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17371
17372 /**
17373  * Disassembles the `SignedRawInvoice` into its three parts:
17374  *  1. raw invoice
17375  *  2. hash of the raw invoice
17376  *  3. signature
17377  */
17378 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
17379
17380 /**
17381  * The `RawInvoice` which was signed.
17382  */
17383 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17384
17385 /**
17386  * The hash of the `RawInvoice` that was signed.
17387  */
17388 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
17389
17390 /**
17391  * InvoiceSignature for the invoice.
17392  */
17393 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17394
17395 /**
17396  * Recovers the public key used for signing the invoice from the recoverable signature.
17397  */
17398 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17399
17400 /**
17401  * Checks if the signature is valid for the included payee public key or if none exists if it's
17402  * valid for the recovered signature (which should always be true?).
17403  */
17404 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17405
17406 /**
17407  * Calculate the hash of the encoded `RawInvoice`
17408  */
17409 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17410
17411 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17412
17413 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17414
17415 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17416
17417 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17418
17419 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17420
17421 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17422
17423 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17424
17425 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17426
17427 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17428
17429 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17430
17431 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17432
17433 /**
17434  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
17435  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17436  * `CreationError::TimestampOutOfBounds`.
17437  */
17438 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
17439
17440 /**
17441  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
17442  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17443  * `CreationError::TimestampOutOfBounds`.
17444  */
17445 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
17446
17447 /**
17448  * Returns the UNIX timestamp representing the stored time
17449  */
17450 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17451
17452 /**
17453  * Returns a reference to the internal `SystemTime` time representation
17454  */
17455 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17456
17457 /**
17458  * Transform the `Invoice` into it's unchecked version
17459  */
17460 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
17461
17462 /**
17463  * Check that the invoice is signed correctly and that key recovery works
17464  */
17465 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
17466
17467 /**
17468  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
17469  * ```
17470  * use lightning_invoice::*;
17471  *
17472  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
17473  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
17474  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
17475  * \tky03ylcqca784w\";
17476  *
17477  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
17478  *
17479  * assert!(Invoice::from_signed(signed).is_ok());
17480  * ```
17481  */
17482 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
17483
17484 /**
17485  * Returns the `Invoice`'s timestamp (should equal it's creation time)
17486  */
17487 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
17488
17489 /**
17490  * Returns the hash to which we will receive the preimage on completion of the payment
17491  */
17492 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
17493
17494 /**
17495  * Get the payee's public key if one was included in the invoice
17496  */
17497 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17498
17499 /**
17500  * Get the payment secret if one was included in the invoice
17501  */
17502 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
17503
17504 /**
17505  * Get the invoice features if they were included in the invoice
17506  */
17507 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
17508
17509 /**
17510  * Recover the payee's public key (only to be used if none was included in the invoice)
17511  */
17512 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17513
17514 /**
17515  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
17516  */
17517 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
17518
17519 /**
17520  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
17521  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
17522  */
17523 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
17524
17525 /**
17526  * Returns a list of all routes included in the invoice
17527  */
17528 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
17529
17530 /**
17531  * Returns the currency for which the invoice was issued
17532  */
17533 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
17534
17535 /**
17536  * Returns the amount if specified in the invoice as pico <currency>.
17537  */
17538 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
17539
17540 /**
17541  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
17542  * returns `CreationError::DescriptionTooLong` otherwise
17543  *
17544  * Please note that single characters may use more than one byte due to UTF8 encoding.
17545  */
17546 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
17547
17548 /**
17549  * Returns the underlying description `String`
17550  */
17551 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
17552
17553 /**
17554  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
17555  * overflow on adding the `EpiryTime` to it then this function will return a
17556  * `CreationError::ExpiryTimeOutOfBounds`.
17557  */
17558 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
17559
17560 /**
17561  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
17562  * would overflow on adding the `EpiryTime` to it then this function will return a
17563  * `CreationError::ExpiryTimeOutOfBounds`.
17564  */
17565 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
17566
17567 /**
17568  * Returns the expiry time in seconds
17569  */
17570 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17571
17572 /**
17573  * Returns a reference to the underlying `Duration` (=expiry time)
17574  */
17575 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17576
17577 /**
17578  * Create a new (partial) route from a list of hops
17579  */
17580 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
17581
17582 /**
17583  * Returrn the underlying vector of hops
17584  */
17585 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
17586
17587 /**
17588  * Creates a copy of the CreationError
17589  */
17590 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
17591
17592 /**
17593  * Get the string representation of a CreationError object
17594  */
17595 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
17596
17597 /**
17598  * Creates a copy of the SemanticError
17599  */
17600 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
17601
17602 /**
17603  * Get the string representation of a SemanticError object
17604  */
17605 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
17606
17607 /**
17608  * Frees any resources used by the SignOrCreationError
17609  */
17610 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
17611
17612 /**
17613  * Creates a copy of the SignOrCreationError
17614  */
17615 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
17616
17617 /**
17618  * Get the string representation of a SignOrCreationError object
17619  */
17620 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
17621
17622 /**
17623  * Utility to construct an invoice. Generally, unless you want to do something like a custom
17624  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
17625  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
17626  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
17627  * that the payment secret is valid when the invoice is paid.
17628  */
17629 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);
17630
17631 /**
17632  * Read a SiPrefix object from a string
17633  */
17634 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
17635
17636 /**
17637  * Read a Invoice object from a string
17638  */
17639 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
17640
17641 /**
17642  * Read a SignedRawInvoice object from a string
17643  */
17644 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
17645
17646 /**
17647  * Get the string representation of a Invoice object
17648  */
17649 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
17650
17651 /**
17652  * Get the string representation of a SignedRawInvoice object
17653  */
17654 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
17655
17656 /**
17657  * Get the string representation of a Currency object
17658  */
17659 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
17660
17661 /**
17662  * Get the string representation of a SiPrefix object
17663  */
17664 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
17665
17666 #endif /* LDK_C_BINDINGS_H */