Merge pull request #18 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
1291 /**
1292  * SHA-256 hash
1293  */
1294 typedef struct MUST_USE_STRUCT LDKSha256 {
1295    /**
1296     * A pointer to the opaque Rust object.
1297     * Nearly everywhere, inner must be non-null, however in places where
1298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1299     */
1300    LDKnativeSha256 *inner;
1301    /**
1302     * Indicates that this is the only struct which contains the same pointer.
1303     * Rust functions which take ownership of an object provided via an argument require
1304     * this to be true and invalidate the object pointed to by inner.
1305     */
1306    bool is_owned;
1307 } LDKSha256;
1308
1309
1310
1311 /**
1312  * Description string
1313  *
1314  * # Invariants
1315  * The description can be at most 639 __bytes__ long
1316  */
1317 typedef struct MUST_USE_STRUCT LDKDescription {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeDescription *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKDescription;
1331
1332
1333
1334 /**
1335  * Payee public key
1336  */
1337 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
1338    /**
1339     * A pointer to the opaque Rust object.
1340     * Nearly everywhere, inner must be non-null, however in places where
1341     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1342     */
1343    LDKnativePayeePubKey *inner;
1344    /**
1345     * Indicates that this is the only struct which contains the same pointer.
1346     * Rust functions which take ownership of an object provided via an argument require
1347     * this to be true and invalidate the object pointed to by inner.
1348     */
1349    bool is_owned;
1350 } LDKPayeePubKey;
1351
1352
1353
1354 /**
1355  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
1356  * expires
1357  *
1358  * # Invariants
1359  * The number of seconds this expiry time represents has to be in the range
1360  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
1361  * timestamp
1362  */
1363 typedef struct MUST_USE_STRUCT LDKExpiryTime {
1364    /**
1365     * A pointer to the opaque Rust object.
1366     * Nearly everywhere, inner must be non-null, however in places where
1367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1368     */
1369    LDKnativeExpiryTime *inner;
1370    /**
1371     * Indicates that this is the only struct which contains the same pointer.
1372     * Rust functions which take ownership of an object provided via an argument require
1373     * this to be true and invalidate the object pointed to by inner.
1374     */
1375    bool is_owned;
1376 } LDKExpiryTime;
1377
1378
1379
1380 /**
1381  * `min_final_cltv_expiry` to use for the last HTLC in the route
1382  */
1383 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
1384    /**
1385     * A pointer to the opaque Rust object.
1386     * Nearly everywhere, inner must be non-null, however in places where
1387     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1388     */
1389    LDKnativeMinFinalCltvExpiry *inner;
1390    /**
1391     * Indicates that this is the only struct which contains the same pointer.
1392     * Rust functions which take ownership of an object provided via an argument require
1393     * this to be true and invalidate the object pointed to by inner.
1394     */
1395    bool is_owned;
1396 } LDKMinFinalCltvExpiry;
1397
1398 /**
1399  * Integer in the range `0..32`
1400  */
1401 typedef struct LDKu5 {
1402    uint8_t _0;
1403 } LDKu5;
1404
1405 /**
1406  * A 20-byte byte array.
1407  */
1408 typedef struct LDKTwentyBytes {
1409    /**
1410     * The twenty bytes
1411     */
1412    uint8_t data[20];
1413 } LDKTwentyBytes;
1414
1415 /**
1416  * Fallback address in case no LN payment is possible
1417  */
1418 typedef enum LDKFallback_Tag {
1419    LDKFallback_SegWitProgram,
1420    LDKFallback_PubKeyHash,
1421    LDKFallback_ScriptHash,
1422    /**
1423     * Must be last for serialization purposes
1424     */
1425    LDKFallback_Sentinel,
1426 } LDKFallback_Tag;
1427
1428 typedef struct LDKFallback_LDKSegWitProgram_Body {
1429    struct LDKu5 version;
1430    struct LDKCVec_u8Z program;
1431 } LDKFallback_LDKSegWitProgram_Body;
1432
1433 typedef struct MUST_USE_STRUCT LDKFallback {
1434    LDKFallback_Tag tag;
1435    union {
1436       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
1437       struct {
1438          struct LDKTwentyBytes pub_key_hash;
1439       };
1440       struct {
1441          struct LDKTwentyBytes script_hash;
1442       };
1443    };
1444 } LDKFallback;
1445
1446
1447
1448 /**
1449  * Private routing information
1450  *
1451  * # Invariants
1452  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
1453  *
1454  */
1455 typedef struct MUST_USE_STRUCT LDKRouteHint {
1456    /**
1457     * A pointer to the opaque Rust object.
1458     * Nearly everywhere, inner must be non-null, however in places where
1459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1460     */
1461    LDKnativeRouteHint *inner;
1462    /**
1463     * Indicates that this is the only struct which contains the same pointer.
1464     * Rust functions which take ownership of an object provided via an argument require
1465     * this to be true and invalidate the object pointed to by inner.
1466     */
1467    bool is_owned;
1468 } LDKRouteHint;
1469
1470
1471
1472 /**
1473  * 256-bit payment secret
1474  */
1475 typedef struct MUST_USE_STRUCT LDKPaymentSecret {
1476    /**
1477     * A pointer to the opaque Rust object.
1478     * Nearly everywhere, inner must be non-null, however in places where
1479     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1480     */
1481    LDKnativePaymentSecret *inner;
1482    /**
1483     * Indicates that this is the only struct which contains the same pointer.
1484     * Rust functions which take ownership of an object provided via an argument require
1485     * this to be true and invalidate the object pointed to by inner.
1486     */
1487    bool is_owned;
1488 } LDKPaymentSecret;
1489
1490
1491
1492 /**
1493  * Features used within an invoice.
1494  */
1495 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
1496    /**
1497     * A pointer to the opaque Rust object.
1498     * Nearly everywhere, inner must be non-null, however in places where
1499     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1500     */
1501    LDKnativeInvoiceFeatures *inner;
1502    /**
1503     * Indicates that this is the only struct which contains the same pointer.
1504     * Rust functions which take ownership of an object provided via an argument require
1505     * this to be true and invalidate the object pointed to by inner.
1506     */
1507    bool is_owned;
1508 } LDKInvoiceFeatures;
1509
1510 /**
1511  * Tagged field with known tag
1512  *
1513  * For descriptions of the enum values please refer to the enclosed type's docs.
1514  */
1515 typedef enum LDKTaggedField_Tag {
1516    LDKTaggedField_PaymentHash,
1517    LDKTaggedField_Description,
1518    LDKTaggedField_PayeePubKey,
1519    LDKTaggedField_DescriptionHash,
1520    LDKTaggedField_ExpiryTime,
1521    LDKTaggedField_MinFinalCltvExpiry,
1522    LDKTaggedField_Fallback,
1523    LDKTaggedField_Route,
1524    LDKTaggedField_PaymentSecret,
1525    LDKTaggedField_Features,
1526    /**
1527     * Must be last for serialization purposes
1528     */
1529    LDKTaggedField_Sentinel,
1530 } LDKTaggedField_Tag;
1531
1532 typedef struct MUST_USE_STRUCT LDKTaggedField {
1533    LDKTaggedField_Tag tag;
1534    union {
1535       struct {
1536          struct LDKSha256 payment_hash;
1537       };
1538       struct {
1539          struct LDKDescription description;
1540       };
1541       struct {
1542          struct LDKPayeePubKey payee_pub_key;
1543       };
1544       struct {
1545          struct LDKSha256 description_hash;
1546       };
1547       struct {
1548          struct LDKExpiryTime expiry_time;
1549       };
1550       struct {
1551          struct LDKMinFinalCltvExpiry min_final_cltv_expiry;
1552       };
1553       struct {
1554          struct LDKFallback fallback;
1555       };
1556       struct {
1557          struct LDKRouteHint route;
1558       };
1559       struct {
1560          struct LDKPaymentSecret payment_secret;
1561       };
1562       struct {
1563          struct LDKInvoiceFeatures features;
1564       };
1565    };
1566 } LDKTaggedField;
1567
1568 /**
1569  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
1570  * This corresponds to std::vector in C++
1571  */
1572 typedef struct LDKCVec_u5Z {
1573    /**
1574     * The elements in the array.
1575     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1576     */
1577    struct LDKu5 *data;
1578    /**
1579     * The number of elements pointed to by `data`.
1580     */
1581    uintptr_t datalen;
1582 } LDKCVec_u5Z;
1583
1584 /**
1585  * Tagged field which may have an unknown tag
1586  */
1587 typedef enum LDKRawTaggedField_Tag {
1588    /**
1589     * Parsed tagged field with known tag
1590     */
1591    LDKRawTaggedField_KnownSemantics,
1592    /**
1593     * tagged field which was not parsed due to an unknown tag or undefined field semantics
1594     */
1595    LDKRawTaggedField_UnknownSemantics,
1596    /**
1597     * Must be last for serialization purposes
1598     */
1599    LDKRawTaggedField_Sentinel,
1600 } LDKRawTaggedField_Tag;
1601
1602 typedef struct MUST_USE_STRUCT LDKRawTaggedField {
1603    LDKRawTaggedField_Tag tag;
1604    union {
1605       struct {
1606          struct LDKTaggedField known_semantics;
1607       };
1608       struct {
1609          struct LDKCVec_u5Z unknown_semantics;
1610       };
1611    };
1612 } LDKRawTaggedField;
1613
1614 /**
1615  * A dynamically-allocated array of crate::lightning_invoice::RawTaggedFields of arbitrary size.
1616  * This corresponds to std::vector in C++
1617  */
1618 typedef struct LDKCVec_RawTaggedFieldZ {
1619    /**
1620     * The elements in the array.
1621     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1622     */
1623    struct LDKRawTaggedField *data;
1624    /**
1625     * The number of elements pointed to by `data`.
1626     */
1627    uintptr_t datalen;
1628 } LDKCVec_RawTaggedFieldZ;
1629
1630
1631
1632 /**
1633  * Represents an syntactically correct Invoice for a payment on the lightning network,
1634  * but without the signature information.
1635  * De- and encoding should not lead to information loss but may lead to different hashes.
1636  *
1637  * For methods without docs see the corresponding methods in `Invoice`.
1638  */
1639 typedef struct MUST_USE_STRUCT LDKRawInvoice {
1640    /**
1641     * A pointer to the opaque Rust object.
1642     * Nearly everywhere, inner must be non-null, however in places where
1643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1644     */
1645    LDKnativeRawInvoice *inner;
1646    /**
1647     * Indicates that this is the only struct which contains the same pointer.
1648     * Rust functions which take ownership of an object provided via an argument require
1649     * this to be true and invalidate the object pointed to by inner.
1650     */
1651    bool is_owned;
1652 } LDKRawInvoice;
1653
1654 /**
1655  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1656  * look up the corresponding function in rust-lightning's docs.
1657  */
1658 typedef struct LDKThirtyTwoBytes {
1659    /**
1660     * The thirty-two bytes
1661     */
1662    uint8_t data[32];
1663 } LDKThirtyTwoBytes;
1664
1665
1666
1667 /**
1668  * Recoverable signature
1669  */
1670 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
1671    /**
1672     * A pointer to the opaque Rust object.
1673     * Nearly everywhere, inner must be non-null, however in places where
1674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1675     */
1676    LDKnativeInvoiceSignature *inner;
1677    /**
1678     * Indicates that this is the only struct which contains the same pointer.
1679     * Rust functions which take ownership of an object provided via an argument require
1680     * this to be true and invalidate the object pointed to by inner.
1681     */
1682    bool is_owned;
1683 } LDKInvoiceSignature;
1684
1685 /**
1686  * A tuple of 3 elements. See the individual fields for the types contained.
1687  */
1688 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
1689    /**
1690     * The element at position 0
1691     */
1692    struct LDKRawInvoice a;
1693    /**
1694     * The element at position 1
1695     */
1696    struct LDKThirtyTwoBytes b;
1697    /**
1698     * The element at position 2
1699     */
1700    struct LDKInvoiceSignature c;
1701 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
1702
1703 /**
1704  * The contents of CResult_PayeePubKeyErrorZ
1705  */
1706 typedef union LDKCResult_PayeePubKeyErrorZPtr {
1707    /**
1708     * A pointer to the contents in the success state.
1709     * Reading from this pointer when `result_ok` is not set is undefined.
1710     */
1711    struct LDKPayeePubKey *result;
1712    /**
1713     * A pointer to the contents in the error state.
1714     * Reading from this pointer when `result_ok` is set is undefined.
1715     */
1716    enum LDKSecp256k1Error *err;
1717 } LDKCResult_PayeePubKeyErrorZPtr;
1718
1719 /**
1720  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1721  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723  */
1724 typedef struct LDKCResult_PayeePubKeyErrorZ {
1725    /**
1726     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1727     * `err` or `result` depending on the state of `result_ok`.
1728     */
1729    union LDKCResult_PayeePubKeyErrorZPtr contents;
1730    /**
1731     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
1732     */
1733    bool result_ok;
1734 } LDKCResult_PayeePubKeyErrorZ;
1735
1736 /**
1737  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1738  * This corresponds to std::vector in C++
1739  */
1740 typedef struct LDKCVec_RouteHintZ {
1741    /**
1742     * The elements in the array.
1743     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1744     */
1745    struct LDKRouteHint *data;
1746    /**
1747     * The number of elements pointed to by `data`.
1748     */
1749    uintptr_t datalen;
1750 } LDKCVec_RouteHintZ;
1751
1752 /**
1753  * An enum which can either contain a u64 or not
1754  */
1755 typedef enum LDKCOption_u64Z_Tag {
1756    /**
1757     * When we're in this state, this COption_u64Z contains a u64
1758     */
1759    LDKCOption_u64Z_Some,
1760    /**
1761     * When we're in this state, this COption_u64Z contains nothing
1762     */
1763    LDKCOption_u64Z_None,
1764    /**
1765     * Must be last for serialization purposes
1766     */
1767    LDKCOption_u64Z_Sentinel,
1768 } LDKCOption_u64Z_Tag;
1769
1770 typedef struct LDKCOption_u64Z {
1771    LDKCOption_u64Z_Tag tag;
1772    union {
1773       struct {
1774          uint64_t some;
1775       };
1776    };
1777 } LDKCOption_u64Z;
1778
1779
1780
1781 /**
1782  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
1783  * timestamp is positive.
1784  *
1785  * # Invariants
1786  * The UNIX timestamp representing the stored time has to be positive and small enough so that
1787  * a `EpiryTime` can be added to it without an overflow.
1788  */
1789 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
1790    /**
1791     * A pointer to the opaque Rust object.
1792     * Nearly everywhere, inner must be non-null, however in places where
1793     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1794     */
1795    LDKnativePositiveTimestamp *inner;
1796    /**
1797     * Indicates that this is the only struct which contains the same pointer.
1798     * Rust functions which take ownership of an object provided via an argument require
1799     * this to be true and invalidate the object pointed to by inner.
1800     */
1801    bool is_owned;
1802 } LDKPositiveTimestamp;
1803
1804 /**
1805  * The contents of CResult_PositiveTimestampCreationErrorZ
1806  */
1807 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
1808    /**
1809     * A pointer to the contents in the success state.
1810     * Reading from this pointer when `result_ok` is not set is undefined.
1811     */
1812    struct LDKPositiveTimestamp *result;
1813    /**
1814     * A pointer to the contents in the error state.
1815     * Reading from this pointer when `result_ok` is set is undefined.
1816     */
1817    enum LDKCreationError *err;
1818 } LDKCResult_PositiveTimestampCreationErrorZPtr;
1819
1820 /**
1821  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1822  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1823  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1824  */
1825 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
1826    /**
1827     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1828     * `err` or `result` depending on the state of `result_ok`.
1829     */
1830    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
1831    /**
1832     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1833     */
1834    bool result_ok;
1835 } LDKCResult_PositiveTimestampCreationErrorZ;
1836
1837 /**
1838  * The contents of CResult_NoneSemanticErrorZ
1839  */
1840 typedef union LDKCResult_NoneSemanticErrorZPtr {
1841    /**
1842     * Note that this value is always NULL, as there are no contents in the OK variant
1843     */
1844    void *result;
1845    /**
1846     * A pointer to the contents in the error state.
1847     * Reading from this pointer when `result_ok` is set is undefined.
1848     */
1849    enum LDKSemanticError *err;
1850 } LDKCResult_NoneSemanticErrorZPtr;
1851
1852 /**
1853  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1854  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1856  */
1857 typedef struct LDKCResult_NoneSemanticErrorZ {
1858    /**
1859     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
1860     * `err` or `result` depending on the state of `result_ok`.
1861     */
1862    union LDKCResult_NoneSemanticErrorZPtr contents;
1863    /**
1864     * Whether this CResult_NoneSemanticErrorZ represents a success state.
1865     */
1866    bool result_ok;
1867 } LDKCResult_NoneSemanticErrorZ;
1868
1869
1870
1871 /**
1872  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
1873  *
1874  * There are three ways to construct an `Invoice`:
1875  *  1. using `InvoiceBuilder`
1876  *  2. using `Invoice::from_signed(SignedRawInvoice)`
1877  *  3. using `str::parse::<Invoice>(&str)`
1878  */
1879 typedef struct MUST_USE_STRUCT LDKInvoice {
1880    /**
1881     * A pointer to the opaque Rust object.
1882     * Nearly everywhere, inner must be non-null, however in places where
1883     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1884     */
1885    LDKnativeInvoice *inner;
1886    /**
1887     * Indicates that this is the only struct which contains the same pointer.
1888     * Rust functions which take ownership of an object provided via an argument require
1889     * this to be true and invalidate the object pointed to by inner.
1890     */
1891    bool is_owned;
1892 } LDKInvoice;
1893
1894 /**
1895  * The contents of CResult_InvoiceSemanticErrorZ
1896  */
1897 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
1898    /**
1899     * A pointer to the contents in the success state.
1900     * Reading from this pointer when `result_ok` is not set is undefined.
1901     */
1902    struct LDKInvoice *result;
1903    /**
1904     * A pointer to the contents in the error state.
1905     * Reading from this pointer when `result_ok` is set is undefined.
1906     */
1907    enum LDKSemanticError *err;
1908 } LDKCResult_InvoiceSemanticErrorZPtr;
1909
1910 /**
1911  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1912  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1913  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1914  */
1915 typedef struct LDKCResult_InvoiceSemanticErrorZ {
1916    /**
1917     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1918     * `err` or `result` depending on the state of `result_ok`.
1919     */
1920    union LDKCResult_InvoiceSemanticErrorZPtr contents;
1921    /**
1922     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1923     */
1924    bool result_ok;
1925 } LDKCResult_InvoiceSemanticErrorZ;
1926
1927 /**
1928  * The contents of CResult_DescriptionCreationErrorZ
1929  */
1930 typedef union LDKCResult_DescriptionCreationErrorZPtr {
1931    /**
1932     * A pointer to the contents in the success state.
1933     * Reading from this pointer when `result_ok` is not set is undefined.
1934     */
1935    struct LDKDescription *result;
1936    /**
1937     * A pointer to the contents in the error state.
1938     * Reading from this pointer when `result_ok` is set is undefined.
1939     */
1940    enum LDKCreationError *err;
1941 } LDKCResult_DescriptionCreationErrorZPtr;
1942
1943 /**
1944  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1945  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1946  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1947  */
1948 typedef struct LDKCResult_DescriptionCreationErrorZ {
1949    /**
1950     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1951     * `err` or `result` depending on the state of `result_ok`.
1952     */
1953    union LDKCResult_DescriptionCreationErrorZPtr contents;
1954    /**
1955     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
1956     */
1957    bool result_ok;
1958 } LDKCResult_DescriptionCreationErrorZ;
1959
1960 /**
1961  * The contents of CResult_ExpiryTimeCreationErrorZ
1962  */
1963 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
1964    /**
1965     * A pointer to the contents in the success state.
1966     * Reading from this pointer when `result_ok` is not set is undefined.
1967     */
1968    struct LDKExpiryTime *result;
1969    /**
1970     * A pointer to the contents in the error state.
1971     * Reading from this pointer when `result_ok` is set is undefined.
1972     */
1973    enum LDKCreationError *err;
1974 } LDKCResult_ExpiryTimeCreationErrorZPtr;
1975
1976 /**
1977  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
1978  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
1979  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1980  */
1981 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
1982    /**
1983     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
1984     * `err` or `result` depending on the state of `result_ok`.
1985     */
1986    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
1987    /**
1988     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
1989     */
1990    bool result_ok;
1991 } LDKCResult_ExpiryTimeCreationErrorZ;
1992
1993
1994
1995 /**
1996  * A channel descriptor which provides a last-hop route to get_route
1997  */
1998 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1999    /**
2000     * A pointer to the opaque Rust object.
2001     * Nearly everywhere, inner must be non-null, however in places where
2002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2003     */
2004    LDKnativeRouteHintHop *inner;
2005    /**
2006     * Indicates that this is the only struct which contains the same pointer.
2007     * Rust functions which take ownership of an object provided via an argument require
2008     * this to be true and invalidate the object pointed to by inner.
2009     */
2010    bool is_owned;
2011 } LDKRouteHintHop;
2012
2013 /**
2014  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2015  * This corresponds to std::vector in C++
2016  */
2017 typedef struct LDKCVec_RouteHintHopZ {
2018    /**
2019     * The elements in the array.
2020     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2021     */
2022    struct LDKRouteHintHop *data;
2023    /**
2024     * The number of elements pointed to by `data`.
2025     */
2026    uintptr_t datalen;
2027 } LDKCVec_RouteHintHopZ;
2028
2029 /**
2030  * The contents of CResult_RouteHintCreationErrorZ
2031  */
2032 typedef union LDKCResult_RouteHintCreationErrorZPtr {
2033    /**
2034     * A pointer to the contents in the success state.
2035     * Reading from this pointer when `result_ok` is not set is undefined.
2036     */
2037    struct LDKRouteHint *result;
2038    /**
2039     * A pointer to the contents in the error state.
2040     * Reading from this pointer when `result_ok` is set is undefined.
2041     */
2042    enum LDKCreationError *err;
2043 } LDKCResult_RouteHintCreationErrorZPtr;
2044
2045 /**
2046  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
2047  * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
2048  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2049  */
2050 typedef struct LDKCResult_RouteHintCreationErrorZ {
2051    /**
2052     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
2053     * `err` or `result` depending on the state of `result_ok`.
2054     */
2055    union LDKCResult_RouteHintCreationErrorZPtr contents;
2056    /**
2057     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
2058     */
2059    bool result_ok;
2060 } LDKCResult_RouteHintCreationErrorZ;
2061
2062 /**
2063  * The contents of CResult_StringErrorZ
2064  */
2065 typedef union LDKCResult_StringErrorZPtr {
2066    /**
2067     * A pointer to the contents in the success state.
2068     * Reading from this pointer when `result_ok` is not set is undefined.
2069     */
2070    struct LDKCVec_u8Z *result;
2071    /**
2072     * A pointer to the contents in the error state.
2073     * Reading from this pointer when `result_ok` is set is undefined.
2074     */
2075    enum LDKSecp256k1Error *err;
2076 } LDKCResult_StringErrorZPtr;
2077
2078 /**
2079  * A CResult_StringErrorZ represents the result of a fallible operation,
2080  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
2081  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2082  */
2083 typedef struct LDKCResult_StringErrorZ {
2084    /**
2085     * The contents of this CResult_StringErrorZ, accessible via either
2086     * `err` or `result` depending on the state of `result_ok`.
2087     */
2088    union LDKCResult_StringErrorZPtr contents;
2089    /**
2090     * Whether this CResult_StringErrorZ represents a success state.
2091     */
2092    bool result_ok;
2093 } LDKCResult_StringErrorZ;
2094
2095
2096
2097 /**
2098  * An update generated by the underlying Channel itself which contains some new information the
2099  * ChannelMonitor should be made aware of.
2100  */
2101 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
2102    /**
2103     * A pointer to the opaque Rust object.
2104     * Nearly everywhere, inner must be non-null, however in places where
2105     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2106     */
2107    LDKnativeChannelMonitorUpdate *inner;
2108    /**
2109     * Indicates that this is the only struct which contains the same pointer.
2110     * Rust functions which take ownership of an object provided via an argument require
2111     * this to be true and invalidate the object pointed to by inner.
2112     */
2113    bool is_owned;
2114 } LDKChannelMonitorUpdate;
2115
2116 /**
2117  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
2118  */
2119 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
2120    /**
2121     * A pointer to the contents in the success state.
2122     * Reading from this pointer when `result_ok` is not set is undefined.
2123     */
2124    struct LDKChannelMonitorUpdate *result;
2125    /**
2126     * A pointer to the contents in the error state.
2127     * Reading from this pointer when `result_ok` is set is undefined.
2128     */
2129    struct LDKDecodeError *err;
2130 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
2131
2132 /**
2133  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2134  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2135  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2136  */
2137 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
2138    /**
2139     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2140     * `err` or `result` depending on the state of `result_ok`.
2141     */
2142    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
2143    /**
2144     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2145     */
2146    bool result_ok;
2147 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2148
2149
2150
2151 /**
2152  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2153  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2154  * preimage claim backward will lead to loss of funds.
2155  */
2156 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2157    /**
2158     * A pointer to the opaque Rust object.
2159     * Nearly everywhere, inner must be non-null, however in places where
2160     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2161     */
2162    LDKnativeHTLCUpdate *inner;
2163    /**
2164     * Indicates that this is the only struct which contains the same pointer.
2165     * Rust functions which take ownership of an object provided via an argument require
2166     * this to be true and invalidate the object pointed to by inner.
2167     */
2168    bool is_owned;
2169 } LDKHTLCUpdate;
2170
2171 /**
2172  * The contents of CResult_HTLCUpdateDecodeErrorZ
2173  */
2174 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
2175    /**
2176     * A pointer to the contents in the success state.
2177     * Reading from this pointer when `result_ok` is not set is undefined.
2178     */
2179    struct LDKHTLCUpdate *result;
2180    /**
2181     * A pointer to the contents in the error state.
2182     * Reading from this pointer when `result_ok` is set is undefined.
2183     */
2184    struct LDKDecodeError *err;
2185 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
2186
2187 /**
2188  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2189  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2190  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2191  */
2192 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
2193    /**
2194     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2195     * `err` or `result` depending on the state of `result_ok`.
2196     */
2197    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
2198    /**
2199     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2200     */
2201    bool result_ok;
2202 } LDKCResult_HTLCUpdateDecodeErrorZ;
2203
2204
2205
2206 /**
2207  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
2208  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
2209  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
2210  * corrupted.
2211  * Contains a developer-readable error message.
2212  */
2213 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
2214    /**
2215     * A pointer to the opaque Rust object.
2216     * Nearly everywhere, inner must be non-null, however in places where
2217     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2218     */
2219    LDKnativeMonitorUpdateError *inner;
2220    /**
2221     * Indicates that this is the only struct which contains the same pointer.
2222     * Rust functions which take ownership of an object provided via an argument require
2223     * this to be true and invalidate the object pointed to by inner.
2224     */
2225    bool is_owned;
2226 } LDKMonitorUpdateError;
2227
2228 /**
2229  * The contents of CResult_NoneMonitorUpdateErrorZ
2230  */
2231 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
2232    /**
2233     * Note that this value is always NULL, as there are no contents in the OK variant
2234     */
2235    void *result;
2236    /**
2237     * A pointer to the contents in the error state.
2238     * Reading from this pointer when `result_ok` is set is undefined.
2239     */
2240    struct LDKMonitorUpdateError *err;
2241 } LDKCResult_NoneMonitorUpdateErrorZPtr;
2242
2243 /**
2244  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2245  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2247  */
2248 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
2249    /**
2250     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2251     * `err` or `result` depending on the state of `result_ok`.
2252     */
2253    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
2254    /**
2255     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2256     */
2257    bool result_ok;
2258 } LDKCResult_NoneMonitorUpdateErrorZ;
2259
2260 /**
2261  * A tuple of 2 elements. See the individual fields for the types contained.
2262  */
2263 typedef struct LDKC2Tuple_OutPointScriptZ {
2264    /**
2265     * The element at position 0
2266     */
2267    struct LDKOutPoint a;
2268    /**
2269     * The element at position 1
2270     */
2271    struct LDKCVec_u8Z b;
2272 } LDKC2Tuple_OutPointScriptZ;
2273
2274 /**
2275  * A tuple of 2 elements. See the individual fields for the types contained.
2276  */
2277 typedef struct LDKC2Tuple_u32ScriptZ {
2278    /**
2279     * The element at position 0
2280     */
2281    uint32_t a;
2282    /**
2283     * The element at position 1
2284     */
2285    struct LDKCVec_u8Z b;
2286 } LDKC2Tuple_u32ScriptZ;
2287
2288 /**
2289  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2290  * This corresponds to std::vector in C++
2291  */
2292 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
2293    /**
2294     * The elements in the array.
2295     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2296     */
2297    struct LDKC2Tuple_u32ScriptZ *data;
2298    /**
2299     * The number of elements pointed to by `data`.
2300     */
2301    uintptr_t datalen;
2302 } LDKCVec_C2Tuple_u32ScriptZZ;
2303
2304 /**
2305  * A tuple of 2 elements. See the individual fields for the types contained.
2306  */
2307 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2308    /**
2309     * The element at position 0
2310     */
2311    struct LDKThirtyTwoBytes a;
2312    /**
2313     * The element at position 1
2314     */
2315    struct LDKCVec_C2Tuple_u32ScriptZZ b;
2316 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
2317
2318 /**
2319  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2320  * This corresponds to std::vector in C++
2321  */
2322 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2323    /**
2324     * The elements in the array.
2325     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2326     */
2327    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
2328    /**
2329     * The number of elements pointed to by `data`.
2330     */
2331    uintptr_t datalen;
2332 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
2333
2334 /**
2335  * An event to be processed by the ChannelManager.
2336  */
2337 typedef enum LDKMonitorEvent_Tag {
2338    /**
2339     * A monitor event containing an HTLCUpdate.
2340     */
2341    LDKMonitorEvent_HTLCEvent,
2342    /**
2343     * A monitor event that the Channel's commitment transaction was broadcasted.
2344     */
2345    LDKMonitorEvent_CommitmentTxBroadcasted,
2346    /**
2347     * Must be last for serialization purposes
2348     */
2349    LDKMonitorEvent_Sentinel,
2350 } LDKMonitorEvent_Tag;
2351
2352 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2353    LDKMonitorEvent_Tag tag;
2354    union {
2355       struct {
2356          struct LDKHTLCUpdate htlc_event;
2357       };
2358       struct {
2359          struct LDKOutPoint commitment_tx_broadcasted;
2360       };
2361    };
2362 } LDKMonitorEvent;
2363
2364 /**
2365  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2366  * This corresponds to std::vector in C++
2367  */
2368 typedef struct LDKCVec_MonitorEventZ {
2369    /**
2370     * The elements in the array.
2371     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2372     */
2373    struct LDKMonitorEvent *data;
2374    /**
2375     * The number of elements pointed to by `data`.
2376     */
2377    uintptr_t datalen;
2378 } LDKCVec_MonitorEventZ;
2379
2380
2381
2382 /**
2383  * Information about a spendable output to a P2WSH script. See
2384  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2385  */
2386 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2387    /**
2388     * A pointer to the opaque Rust object.
2389     * Nearly everywhere, inner must be non-null, however in places where
2390     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2391     */
2392    LDKnativeDelayedPaymentOutputDescriptor *inner;
2393    /**
2394     * Indicates that this is the only struct which contains the same pointer.
2395     * Rust functions which take ownership of an object provided via an argument require
2396     * this to be true and invalidate the object pointed to by inner.
2397     */
2398    bool is_owned;
2399 } LDKDelayedPaymentOutputDescriptor;
2400
2401
2402
2403 /**
2404  * Information about a spendable output to our \"payment key\". See
2405  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2406  */
2407 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2408    /**
2409     * A pointer to the opaque Rust object.
2410     * Nearly everywhere, inner must be non-null, however in places where
2411     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2412     */
2413    LDKnativeStaticPaymentOutputDescriptor *inner;
2414    /**
2415     * Indicates that this is the only struct which contains the same pointer.
2416     * Rust functions which take ownership of an object provided via an argument require
2417     * this to be true and invalidate the object pointed to by inner.
2418     */
2419    bool is_owned;
2420 } LDKStaticPaymentOutputDescriptor;
2421
2422 /**
2423  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2424  * claim at any point in the future) an event is generated which you must track and be able to
2425  * spend on-chain. The information needed to do this is provided in this enum, including the
2426  * outpoint describing which txid and output index is available, the full output which exists at
2427  * that txid/index, and any keys or other information required to sign.
2428  */
2429 typedef enum LDKSpendableOutputDescriptor_Tag {
2430    /**
2431     * An output to a script which was provided via KeysInterface directly, either from
2432     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
2433     * spend it. No secret keys are provided as rust-lightning was never given any key.
2434     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2435     * on-chain using the payment preimage or after it has timed out.
2436     */
2437    LDKSpendableOutputDescriptor_StaticOutput,
2438    /**
2439     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2440     *
2441     * The witness in the spending input should be:
2442     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2443     *
2444     * Note that the nSequence field in the spending input must be set to to_self_delay
2445     * (which means the transaction is not broadcastable until at least to_self_delay
2446     * blocks after the outpoint confirms).
2447     *
2448     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2449     * it is an output from an old state which we broadcast (which should never happen).
2450     *
2451     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2452     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2453     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2454     * chan_utils::derive_private_key. The public key can be generated without the secret key
2455     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2456     * Sign::pubkeys().
2457     *
2458     * To derive the revocation_pubkey provided here (which is used in the witness
2459     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2460     * call to Sign::ready_channel) and the provided per_commitment point
2461     * to chan_utils::derive_public_revocation_key.
2462     *
2463     * The witness script which is hashed and included in the output script_pubkey may be
2464     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2465     * (derived as above), and the to_self_delay contained here to
2466     * chan_utils::get_revokeable_redeemscript.
2467     */
2468    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2469    /**
2470     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2471     * corresponds to the public key in Sign::pubkeys().payment_point).
2472     * The witness in the spending input, is, thus, simply:
2473     * <BIP 143 signature> <payment key>
2474     *
2475     * These are generally the result of our counterparty having broadcast the current state,
2476     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2477     */
2478    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2479    /**
2480     * Must be last for serialization purposes
2481     */
2482    LDKSpendableOutputDescriptor_Sentinel,
2483 } LDKSpendableOutputDescriptor_Tag;
2484
2485 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2486    /**
2487     * The outpoint which is spendable
2488     */
2489    struct LDKOutPoint outpoint;
2490    /**
2491     * The output which is referenced by the given outpoint.
2492     */
2493    struct LDKTxOut output;
2494 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2495
2496 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2497    LDKSpendableOutputDescriptor_Tag tag;
2498    union {
2499       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2500       struct {
2501          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2502       };
2503       struct {
2504          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2505       };
2506    };
2507 } LDKSpendableOutputDescriptor;
2508
2509 /**
2510  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2511  * This corresponds to std::vector in C++
2512  */
2513 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2514    /**
2515     * The elements in the array.
2516     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2517     */
2518    struct LDKSpendableOutputDescriptor *data;
2519    /**
2520     * The number of elements pointed to by `data`.
2521     */
2522    uintptr_t datalen;
2523 } LDKCVec_SpendableOutputDescriptorZ;
2524
2525 /**
2526  * An Event which you should probably take some action in response to.
2527  *
2528  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2529  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2530  * written as it makes no sense to respond to it after reconnecting to peers).
2531  */
2532 typedef enum LDKEvent_Tag {
2533    /**
2534     * Used to indicate that the client should generate a funding transaction with the given
2535     * parameters and then call ChannelManager::funding_transaction_generated.
2536     * Generated in ChannelManager message handling.
2537     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2538     * counterparty can steal your funds!
2539     */
2540    LDKEvent_FundingGenerationReady,
2541    /**
2542     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2543     * ChannelManager::claim_funds to get it....
2544     * Note that if the preimage is not known or the amount paid is incorrect, you should call
2545     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2546     * network congestion.
2547     * The amount paid should be considered 'incorrect' when it is less than or more than twice
2548     * the amount expected.
2549     * If you fail to call either ChannelManager::claim_funds or
2550     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2551     * automatically failed.
2552     */
2553    LDKEvent_PaymentReceived,
2554    /**
2555     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2556     * and we got back the payment preimage for it).
2557     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
2558     * deduplicate them by payment_preimage (which MUST be unique)!
2559     */
2560    LDKEvent_PaymentSent,
2561    /**
2562     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2563     * something. You may wish to retry with a different route.
2564     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
2565     * deduplicate them by payment_hash (which MUST be unique)!
2566     */
2567    LDKEvent_PaymentFailed,
2568    /**
2569     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2570     * time in the future.
2571     */
2572    LDKEvent_PendingHTLCsForwardable,
2573    /**
2574     * Used to indicate that an output was generated on-chain which you should know how to spend.
2575     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2576     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2577     * somewhere and spend them when you create on-chain transactions.
2578     */
2579    LDKEvent_SpendableOutputs,
2580    /**
2581     * Must be last for serialization purposes
2582     */
2583    LDKEvent_Sentinel,
2584 } LDKEvent_Tag;
2585
2586 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2587    /**
2588     * The random channel_id we picked which you'll need to pass into
2589     * ChannelManager::funding_transaction_generated.
2590     */
2591    struct LDKThirtyTwoBytes temporary_channel_id;
2592    /**
2593     * The value, in satoshis, that the output should have.
2594     */
2595    uint64_t channel_value_satoshis;
2596    /**
2597     * The script which should be used in the transaction output.
2598     */
2599    struct LDKCVec_u8Z output_script;
2600    /**
2601     * The value passed in to ChannelManager::create_channel
2602     */
2603    uint64_t user_channel_id;
2604 } LDKEvent_LDKFundingGenerationReady_Body;
2605
2606 typedef struct LDKEvent_LDKPaymentReceived_Body {
2607    /**
2608     * The hash for which the preimage should be handed to the ChannelManager.
2609     */
2610    struct LDKThirtyTwoBytes payment_hash;
2611    /**
2612     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2613     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2614     * [`ChannelManager::claim_funds`].
2615     *
2616     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2617     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2618     */
2619    struct LDKThirtyTwoBytes payment_preimage;
2620    /**
2621     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2622     * number of deanonymization attacks during the routing process.
2623     * It is provided here for your reference, however its accuracy is enforced directly by
2624     * [`ChannelManager`] using the values you previously provided to
2625     * [`ChannelManager::create_inbound_payment`] or
2626     * [`ChannelManager::create_inbound_payment_for_hash`].
2627     *
2628     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2629     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2630     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2631     */
2632    struct LDKThirtyTwoBytes payment_secret;
2633    /**
2634     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
2635     * compare this to the expected value before accepting the payment (as otherwise you are
2636     * providing proof-of-payment for less than the value you expected!).
2637     */
2638    uint64_t amt;
2639    /**
2640     * This is the `user_payment_id` which was provided to
2641     * [`ChannelManager::create_inbound_payment_for_hash`] or
2642     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
2643     * simply copied here. It may be used to correlate PaymentReceived events with invoice
2644     * metadata stored elsewhere.
2645     *
2646     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2647     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2648     */
2649    uint64_t user_payment_id;
2650 } LDKEvent_LDKPaymentReceived_Body;
2651
2652 typedef struct LDKEvent_LDKPaymentSent_Body {
2653    /**
2654     * The preimage to the hash given to ChannelManager::send_payment.
2655     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2656     * store it somehow!
2657     */
2658    struct LDKThirtyTwoBytes payment_preimage;
2659 } LDKEvent_LDKPaymentSent_Body;
2660
2661 typedef struct LDKEvent_LDKPaymentFailed_Body {
2662    /**
2663     * The hash which was given to ChannelManager::send_payment.
2664     */
2665    struct LDKThirtyTwoBytes payment_hash;
2666    /**
2667     * Indicates the payment was rejected for some reason by the recipient. This implies that
2668     * the payment has failed, not just the route in question. If this is not set, you may
2669     * retry the payment via a different route.
2670     */
2671    bool rejected_by_dest;
2672 } LDKEvent_LDKPaymentFailed_Body;
2673
2674 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2675    /**
2676     * The minimum amount of time that should be waited prior to calling
2677     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2678     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2679     * now + 5*time_forwardable).
2680     */
2681    uint64_t time_forwardable;
2682 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2683
2684 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2685    /**
2686     * The outputs which you should store as spendable by you.
2687     */
2688    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2689 } LDKEvent_LDKSpendableOutputs_Body;
2690
2691 typedef struct MUST_USE_STRUCT LDKEvent {
2692    LDKEvent_Tag tag;
2693    union {
2694       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2695       LDKEvent_LDKPaymentReceived_Body payment_received;
2696       LDKEvent_LDKPaymentSent_Body payment_sent;
2697       LDKEvent_LDKPaymentFailed_Body payment_failed;
2698       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2699       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2700    };
2701 } LDKEvent;
2702
2703 /**
2704  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2705  * This corresponds to std::vector in C++
2706  */
2707 typedef struct LDKCVec_EventZ {
2708    /**
2709     * The elements in the array.
2710     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2711     */
2712    struct LDKEvent *data;
2713    /**
2714     * The number of elements pointed to by `data`.
2715     */
2716    uintptr_t datalen;
2717 } LDKCVec_EventZ;
2718
2719 /**
2720  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2721  * This corresponds to std::vector in C++
2722  */
2723 typedef struct LDKCVec_TransactionZ {
2724    /**
2725     * The elements in the array.
2726     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2727     */
2728    struct LDKTransaction *data;
2729    /**
2730     * The number of elements pointed to by `data`.
2731     */
2732    uintptr_t datalen;
2733 } LDKCVec_TransactionZ;
2734
2735 /**
2736  * A tuple of 2 elements. See the individual fields for the types contained.
2737  */
2738 typedef struct LDKC2Tuple_usizeTransactionZ {
2739    /**
2740     * The element at position 0
2741     */
2742    uintptr_t a;
2743    /**
2744     * The element at position 1
2745     */
2746    struct LDKTransaction b;
2747 } LDKC2Tuple_usizeTransactionZ;
2748
2749 /**
2750  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2751  * This corresponds to std::vector in C++
2752  */
2753 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2754    /**
2755     * The elements in the array.
2756     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2757     */
2758    struct LDKC2Tuple_usizeTransactionZ *data;
2759    /**
2760     * The number of elements pointed to by `data`.
2761     */
2762    uintptr_t datalen;
2763 } LDKCVec_C2Tuple_usizeTransactionZZ;
2764
2765 /**
2766  * A tuple of 2 elements. See the individual fields for the types contained.
2767  */
2768 typedef struct LDKC2Tuple_u32TxOutZ {
2769    /**
2770     * The element at position 0
2771     */
2772    uint32_t a;
2773    /**
2774     * The element at position 1
2775     */
2776    struct LDKTxOut b;
2777 } LDKC2Tuple_u32TxOutZ;
2778
2779 /**
2780  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2781  * This corresponds to std::vector in C++
2782  */
2783 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
2784    /**
2785     * The elements in the array.
2786     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2787     */
2788    struct LDKC2Tuple_u32TxOutZ *data;
2789    /**
2790     * The number of elements pointed to by `data`.
2791     */
2792    uintptr_t datalen;
2793 } LDKCVec_C2Tuple_u32TxOutZZ;
2794
2795 /**
2796  * A tuple of 2 elements. See the individual fields for the types contained.
2797  */
2798 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2799    /**
2800     * The element at position 0
2801     */
2802    struct LDKThirtyTwoBytes a;
2803    /**
2804     * The element at position 1
2805     */
2806    struct LDKCVec_C2Tuple_u32TxOutZZ b;
2807 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
2808
2809 /**
2810  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2811  * This corresponds to std::vector in C++
2812  */
2813 typedef struct LDKCVec_TransactionOutputsZ {
2814    /**
2815     * The elements in the array.
2816     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2817     */
2818    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
2819    /**
2820     * The number of elements pointed to by `data`.
2821     */
2822    uintptr_t datalen;
2823 } LDKCVec_TransactionOutputsZ;
2824
2825 /**
2826  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2827  * This corresponds to std::vector in C++
2828  */
2829 typedef struct LDKCVec_TxidZ {
2830    /**
2831     * The elements in the array.
2832     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2833     */
2834    struct LDKThirtyTwoBytes *data;
2835    /**
2836     * The number of elements pointed to by `data`.
2837     */
2838    uintptr_t datalen;
2839 } LDKCVec_TxidZ;
2840
2841 /**
2842  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2843  */
2844 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2845    /**
2846     * Note that this value is always NULL, as there are no contents in the OK variant
2847     */
2848    void *result;
2849    /**
2850     * A pointer to the contents in the error state.
2851     * Reading from this pointer when `result_ok` is set is undefined.
2852     */
2853    enum LDKChannelMonitorUpdateErr *err;
2854 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2855
2856 /**
2857  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2858  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2859  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2860  */
2861 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2862    /**
2863     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2864     * `err` or `result` depending on the state of `result_ok`.
2865     */
2866    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2867    /**
2868     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2869     */
2870    bool result_ok;
2871 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2872
2873 /**
2874  * A tuple of 2 elements. See the individual fields for the types contained.
2875  */
2876 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2877    /**
2878     * The element at position 0
2879     */
2880    struct LDKSignature a;
2881    /**
2882     * The element at position 1
2883     */
2884    struct LDKCVec_SignatureZ b;
2885 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2886
2887 /**
2888  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2889  */
2890 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2891    /**
2892     * A pointer to the contents in the success state.
2893     * Reading from this pointer when `result_ok` is not set is undefined.
2894     */
2895    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2896    /**
2897     * Note that this value is always NULL, as there are no contents in the Err variant
2898     */
2899    void *err;
2900 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2901
2902 /**
2903  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2904  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2906  */
2907 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2908    /**
2909     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2910     * `err` or `result` depending on the state of `result_ok`.
2911     */
2912    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2913    /**
2914     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2915     */
2916    bool result_ok;
2917 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2918
2919 /**
2920  * The contents of CResult_SignatureNoneZ
2921  */
2922 typedef union LDKCResult_SignatureNoneZPtr {
2923    /**
2924     * A pointer to the contents in the success state.
2925     * Reading from this pointer when `result_ok` is not set is undefined.
2926     */
2927    struct LDKSignature *result;
2928    /**
2929     * Note that this value is always NULL, as there are no contents in the Err variant
2930     */
2931    void *err;
2932 } LDKCResult_SignatureNoneZPtr;
2933
2934 /**
2935  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2936  * containing a crate::c_types::Signature on success and a () on failure.
2937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2938  */
2939 typedef struct LDKCResult_SignatureNoneZ {
2940    /**
2941     * The contents of this CResult_SignatureNoneZ, accessible via either
2942     * `err` or `result` depending on the state of `result_ok`.
2943     */
2944    union LDKCResult_SignatureNoneZPtr contents;
2945    /**
2946     * Whether this CResult_SignatureNoneZ represents a success state.
2947     */
2948    bool result_ok;
2949 } LDKCResult_SignatureNoneZ;
2950
2951
2952
2953 /**
2954  * The unsigned part of a channel_announcement
2955  */
2956 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2957    /**
2958     * A pointer to the opaque Rust object.
2959     * Nearly everywhere, inner must be non-null, however in places where
2960     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2961     */
2962    LDKnativeUnsignedChannelAnnouncement *inner;
2963    /**
2964     * Indicates that this is the only struct which contains the same pointer.
2965     * Rust functions which take ownership of an object provided via an argument require
2966     * this to be true and invalidate the object pointed to by inner.
2967     */
2968    bool is_owned;
2969 } LDKUnsignedChannelAnnouncement;
2970
2971 /**
2972  * A trait to sign lightning channel transactions as described in BOLT 3.
2973  *
2974  * Signing services could be implemented on a hardware wallet. In this case,
2975  * the current Sign would be a front-end on top of a communication
2976  * channel connected to your secure device and lightning key material wouldn't
2977  * reside on a hot server. Nevertheless, a this deployment would still need
2978  * to trust the ChannelManager to avoid loss of funds as this latest component
2979  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2980  *
2981  * A more secure iteration would be to use hashlock (or payment points) to pair
2982  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2983  * at the price of more state and computation on the hardware wallet side. In the future,
2984  * we are looking forward to design such interface.
2985  *
2986  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2987  * to act, as liveness and breach reply correctness are always going to be hard requirements
2988  * of LN security model, orthogonal of key management issues.
2989  */
2990 typedef struct LDKBaseSign {
2991    /**
2992     * An opaque pointer which is passed to your function implementations as an argument.
2993     * This has no meaning in the LDK, and can be NULL or any other value.
2994     */
2995    void *this_arg;
2996    /**
2997     * Gets the per-commitment point for a specific commitment number
2998     *
2999     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3000     */
3001    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3002    /**
3003     * Gets the commitment secret for a specific commitment number as part of the revocation process
3004     *
3005     * An external signer implementation should error here if the commitment was already signed
3006     * and should refuse to sign it in the future.
3007     *
3008     * May be called more than once for the same index.
3009     *
3010     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3011     */
3012    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3013    /**
3014     * Gets the holder's channel public keys and basepoints
3015     */
3016    struct LDKChannelPublicKeys pubkeys;
3017    /**
3018     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3019     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3020     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3021     */
3022    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3023    /**
3024     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3025     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3026     * Sign object uniquely and lookup or re-derive its keys.
3027     */
3028    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3029    /**
3030     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3031     *
3032     * Note that if signing fails or is rejected, the channel will be force-closed.
3033     */
3034    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3035    /**
3036     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3037     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3038     * latest commitment_tx when we initiate a force-close.
3039     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3040     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3041     * the latest.
3042     * This may be called multiple times for the same transaction.
3043     *
3044     * An external signer implementation should check that the commitment has not been revoked.
3045     *
3046     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3047     */
3048    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3049    /**
3050     * Create a signature for the given input in a transaction spending an HTLC or commitment
3051     * transaction output when our counterparty broadcasts an old state.
3052     *
3053     * A justice transaction may claim multiples outputs at the same time if timelocks are
3054     * similar, but only a signature for the input at index `input` should be signed for here.
3055     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
3056     * to an upcoming timelock expiration.
3057     *
3058     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3059     *
3060     * per_commitment_key is revocation secret which was provided by our counterparty when they
3061     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3062     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3063     * so).
3064     *
3065     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
3066     * changing the format of the witness script (which is committed to in the BIP 143
3067     * signatures).
3068     */
3069    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);
3070    /**
3071     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3072     * transaction, either offered or received.
3073     *
3074     * Such a transaction may claim multiples offered outputs at same time if we know the
3075     * preimage for each when we create it, but only the input at index `input` should be
3076     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3077     * needed with regards to an upcoming timelock expiration.
3078     *
3079     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3080     * outputs.
3081     *
3082     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3083     *
3084     * Per_commitment_point is the dynamic point corresponding to the channel state
3085     * detected onchain. It has been generated by our counterparty and is used to derive
3086     * channel state keys, which are then included in the witness script and committed to in the
3087     * BIP 143 signature.
3088     */
3089    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);
3090    /**
3091     * Create a signature for a (proposed) closing transaction.
3092     *
3093     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3094     * chosen to forgo their output as dust.
3095     */
3096    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3097    /**
3098     * Signs a channel announcement message with our funding key, proving it comes from one
3099     * of the channel participants.
3100     *
3101     * Note that if this fails or is rejected, the channel will not be publicly announced and
3102     * our counterparty may (though likely will not) close the channel on us for violating the
3103     * protocol.
3104     */
3105    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3106    /**
3107     * Set the counterparty static channel data, including basepoints,
3108     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3109     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3110     * they MUST NOT be allowed to change to different values once set.
3111     *
3112     * channel_parameters.is_populated() MUST be true.
3113     *
3114     * We bind holder_selected_contest_delay late here for API convenience.
3115     *
3116     * Will be called before any signatures are applied.
3117     */
3118    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3119    /**
3120     * Frees any resources associated with this object given its this_arg pointer.
3121     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3122     */
3123    void (*free)(void *this_arg);
3124 } LDKBaseSign;
3125
3126 /**
3127  * A cloneable signer.
3128  *
3129  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3130  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3131  * which implies Sized, into this derived trait.
3132  */
3133 typedef struct LDKSign {
3134    /**
3135     * An opaque pointer which is passed to your function implementations as an argument.
3136     * This has no meaning in the LDK, and can be NULL or any other value.
3137     */
3138    void *this_arg;
3139    /**
3140     * Implementation of BaseSign for this object.
3141     */
3142    struct LDKBaseSign BaseSign;
3143    /**
3144     * Creates a copy of the BaseSign, for a copy of this Sign.
3145     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3146     */
3147    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3148    /**
3149     * Serialize the object into a byte array
3150     */
3151    struct LDKCVec_u8Z (*write)(const void *this_arg);
3152    /**
3153     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3154     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3155     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3156     */
3157    void *(*clone)(const void *this_arg);
3158    /**
3159     * Frees any resources associated with this object given its this_arg pointer.
3160     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3161     */
3162    void (*free)(void *this_arg);
3163 } LDKSign;
3164
3165
3166
3167 /**
3168  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3169  * on-chain transactions to ensure no loss of funds occurs.
3170  *
3171  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3172  * information and are actively monitoring the chain.
3173  *
3174  * Pending Events or updated HTLCs which have not yet been read out by
3175  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3176  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3177  * gotten are fully handled before re-serializing the new state.
3178  *
3179  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3180  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3181  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3182  * returned block hash and the the current chain and then reconnecting blocks to get to the
3183  * best chain) upon deserializing the object!
3184  */
3185 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3186    /**
3187     * A pointer to the opaque Rust object.
3188     * Nearly everywhere, inner must be non-null, however in places where
3189     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3190     */
3191    LDKnativeChannelMonitor *inner;
3192    /**
3193     * Indicates that this is the only struct which contains the same pointer.
3194     * Rust functions which take ownership of an object provided via an argument require
3195     * this to be true and invalidate the object pointed to by inner.
3196     */
3197    bool is_owned;
3198 } LDKChannelMonitor;
3199
3200 /**
3201  * A tuple of 2 elements. See the individual fields for the types contained.
3202  */
3203 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3204    /**
3205     * The element at position 0
3206     */
3207    struct LDKThirtyTwoBytes a;
3208    /**
3209     * The element at position 1
3210     */
3211    struct LDKChannelMonitor b;
3212 } LDKC2Tuple_BlockHashChannelMonitorZ;
3213
3214 /**
3215  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3216  */
3217 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3218    /**
3219     * A pointer to the contents in the success state.
3220     * Reading from this pointer when `result_ok` is not set is undefined.
3221     */
3222    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
3223    /**
3224     * A pointer to the contents in the error state.
3225     * Reading from this pointer when `result_ok` is set is undefined.
3226     */
3227    struct LDKDecodeError *err;
3228 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
3229
3230 /**
3231  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3232  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3233  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3234  */
3235 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3236    /**
3237     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3238     * `err` or `result` depending on the state of `result_ok`.
3239     */
3240    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
3241    /**
3242     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3243     */
3244    bool result_ok;
3245 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
3246
3247
3248
3249 /**
3250  * A hop in a route
3251  */
3252 typedef struct MUST_USE_STRUCT LDKRouteHop {
3253    /**
3254     * A pointer to the opaque Rust object.
3255     * Nearly everywhere, inner must be non-null, however in places where
3256     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3257     */
3258    LDKnativeRouteHop *inner;
3259    /**
3260     * Indicates that this is the only struct which contains the same pointer.
3261     * Rust functions which take ownership of an object provided via an argument require
3262     * this to be true and invalidate the object pointed to by inner.
3263     */
3264    bool is_owned;
3265 } LDKRouteHop;
3266
3267 /**
3268  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3269  * This corresponds to std::vector in C++
3270  */
3271 typedef struct LDKCVec_RouteHopZ {
3272    /**
3273     * The elements in the array.
3274     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3275     */
3276    struct LDKRouteHop *data;
3277    /**
3278     * The number of elements pointed to by `data`.
3279     */
3280    uintptr_t datalen;
3281 } LDKCVec_RouteHopZ;
3282
3283 /**
3284  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3285  * This corresponds to std::vector in C++
3286  */
3287 typedef struct LDKCVec_CVec_RouteHopZZ {
3288    /**
3289     * The elements in the array.
3290     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3291     */
3292    struct LDKCVec_RouteHopZ *data;
3293    /**
3294     * The number of elements pointed to by `data`.
3295     */
3296    uintptr_t datalen;
3297 } LDKCVec_CVec_RouteHopZZ;
3298
3299
3300
3301 /**
3302  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3303  * it can take multiple paths. Each path is composed of one or more hops through the network.
3304  */
3305 typedef struct MUST_USE_STRUCT LDKRoute {
3306    /**
3307     * A pointer to the opaque Rust object.
3308     * Nearly everywhere, inner must be non-null, however in places where
3309     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3310     */
3311    LDKnativeRoute *inner;
3312    /**
3313     * Indicates that this is the only struct which contains the same pointer.
3314     * Rust functions which take ownership of an object provided via an argument require
3315     * this to be true and invalidate the object pointed to by inner.
3316     */
3317    bool is_owned;
3318 } LDKRoute;
3319
3320 /**
3321  * The contents of CResult_RouteDecodeErrorZ
3322  */
3323 typedef union LDKCResult_RouteDecodeErrorZPtr {
3324    /**
3325     * A pointer to the contents in the success state.
3326     * Reading from this pointer when `result_ok` is not set is undefined.
3327     */
3328    struct LDKRoute *result;
3329    /**
3330     * A pointer to the contents in the error state.
3331     * Reading from this pointer when `result_ok` is set is undefined.
3332     */
3333    struct LDKDecodeError *err;
3334 } LDKCResult_RouteDecodeErrorZPtr;
3335
3336 /**
3337  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3338  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3339  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3340  */
3341 typedef struct LDKCResult_RouteDecodeErrorZ {
3342    /**
3343     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3344     * `err` or `result` depending on the state of `result_ok`.
3345     */
3346    union LDKCResult_RouteDecodeErrorZPtr contents;
3347    /**
3348     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3349     */
3350    bool result_ok;
3351 } LDKCResult_RouteDecodeErrorZ;
3352
3353
3354
3355 /**
3356  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
3357  */
3358 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3359    /**
3360     * A pointer to the opaque Rust object.
3361     * Nearly everywhere, inner must be non-null, however in places where
3362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3363     */
3364    LDKnativeChannelDetails *inner;
3365    /**
3366     * Indicates that this is the only struct which contains the same pointer.
3367     * Rust functions which take ownership of an object provided via an argument require
3368     * this to be true and invalidate the object pointed to by inner.
3369     */
3370    bool is_owned;
3371 } LDKChannelDetails;
3372
3373 /**
3374  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3375  * This corresponds to std::vector in C++
3376  */
3377 typedef struct LDKCVec_ChannelDetailsZ {
3378    /**
3379     * The elements in the array.
3380     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3381     */
3382    struct LDKChannelDetails *data;
3383    /**
3384     * The number of elements pointed to by `data`.
3385     */
3386    uintptr_t datalen;
3387 } LDKCVec_ChannelDetailsZ;
3388
3389
3390
3391 /**
3392  * An Err type for failure to process messages.
3393  */
3394 typedef struct MUST_USE_STRUCT LDKLightningError {
3395    /**
3396     * A pointer to the opaque Rust object.
3397     * Nearly everywhere, inner must be non-null, however in places where
3398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3399     */
3400    LDKnativeLightningError *inner;
3401    /**
3402     * Indicates that this is the only struct which contains the same pointer.
3403     * Rust functions which take ownership of an object provided via an argument require
3404     * this to be true and invalidate the object pointed to by inner.
3405     */
3406    bool is_owned;
3407 } LDKLightningError;
3408
3409 /**
3410  * The contents of CResult_RouteLightningErrorZ
3411  */
3412 typedef union LDKCResult_RouteLightningErrorZPtr {
3413    /**
3414     * A pointer to the contents in the success state.
3415     * Reading from this pointer when `result_ok` is not set is undefined.
3416     */
3417    struct LDKRoute *result;
3418    /**
3419     * A pointer to the contents in the error state.
3420     * Reading from this pointer when `result_ok` is set is undefined.
3421     */
3422    struct LDKLightningError *err;
3423 } LDKCResult_RouteLightningErrorZPtr;
3424
3425 /**
3426  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3427  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3428  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3429  */
3430 typedef struct LDKCResult_RouteLightningErrorZ {
3431    /**
3432     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3433     * `err` or `result` depending on the state of `result_ok`.
3434     */
3435    union LDKCResult_RouteLightningErrorZPtr contents;
3436    /**
3437     * Whether this CResult_RouteLightningErrorZ represents a success state.
3438     */
3439    bool result_ok;
3440 } LDKCResult_RouteLightningErrorZ;
3441
3442
3443
3444 /**
3445  * An accept_channel message to be sent or received from a peer
3446  */
3447 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3448    /**
3449     * A pointer to the opaque Rust object.
3450     * Nearly everywhere, inner must be non-null, however in places where
3451     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3452     */
3453    LDKnativeAcceptChannel *inner;
3454    /**
3455     * Indicates that this is the only struct which contains the same pointer.
3456     * Rust functions which take ownership of an object provided via an argument require
3457     * this to be true and invalidate the object pointed to by inner.
3458     */
3459    bool is_owned;
3460 } LDKAcceptChannel;
3461
3462
3463
3464 /**
3465  * An open_channel message to be sent or received from a peer
3466  */
3467 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3468    /**
3469     * A pointer to the opaque Rust object.
3470     * Nearly everywhere, inner must be non-null, however in places where
3471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3472     */
3473    LDKnativeOpenChannel *inner;
3474    /**
3475     * Indicates that this is the only struct which contains the same pointer.
3476     * Rust functions which take ownership of an object provided via an argument require
3477     * this to be true and invalidate the object pointed to by inner.
3478     */
3479    bool is_owned;
3480 } LDKOpenChannel;
3481
3482
3483
3484 /**
3485  * A funding_created message to be sent or received from a peer
3486  */
3487 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3488    /**
3489     * A pointer to the opaque Rust object.
3490     * Nearly everywhere, inner must be non-null, however in places where
3491     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3492     */
3493    LDKnativeFundingCreated *inner;
3494    /**
3495     * Indicates that this is the only struct which contains the same pointer.
3496     * Rust functions which take ownership of an object provided via an argument require
3497     * this to be true and invalidate the object pointed to by inner.
3498     */
3499    bool is_owned;
3500 } LDKFundingCreated;
3501
3502
3503
3504 /**
3505  * A funding_signed message to be sent or received from a peer
3506  */
3507 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3508    /**
3509     * A pointer to the opaque Rust object.
3510     * Nearly everywhere, inner must be non-null, however in places where
3511     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3512     */
3513    LDKnativeFundingSigned *inner;
3514    /**
3515     * Indicates that this is the only struct which contains the same pointer.
3516     * Rust functions which take ownership of an object provided via an argument require
3517     * this to be true and invalidate the object pointed to by inner.
3518     */
3519    bool is_owned;
3520 } LDKFundingSigned;
3521
3522
3523
3524 /**
3525  * A funding_locked message to be sent or received from a peer
3526  */
3527 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3528    /**
3529     * A pointer to the opaque Rust object.
3530     * Nearly everywhere, inner must be non-null, however in places where
3531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3532     */
3533    LDKnativeFundingLocked *inner;
3534    /**
3535     * Indicates that this is the only struct which contains the same pointer.
3536     * Rust functions which take ownership of an object provided via an argument require
3537     * this to be true and invalidate the object pointed to by inner.
3538     */
3539    bool is_owned;
3540 } LDKFundingLocked;
3541
3542
3543
3544 /**
3545  * An announcement_signatures message to be sent or received from a peer
3546  */
3547 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3548    /**
3549     * A pointer to the opaque Rust object.
3550     * Nearly everywhere, inner must be non-null, however in places where
3551     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3552     */
3553    LDKnativeAnnouncementSignatures *inner;
3554    /**
3555     * Indicates that this is the only struct which contains the same pointer.
3556     * Rust functions which take ownership of an object provided via an argument require
3557     * this to be true and invalidate the object pointed to by inner.
3558     */
3559    bool is_owned;
3560 } LDKAnnouncementSignatures;
3561
3562
3563
3564 /**
3565  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3566  * transaction updates if they were pending.
3567  */
3568 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3569    /**
3570     * A pointer to the opaque Rust object.
3571     * Nearly everywhere, inner must be non-null, however in places where
3572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3573     */
3574    LDKnativeCommitmentUpdate *inner;
3575    /**
3576     * Indicates that this is the only struct which contains the same pointer.
3577     * Rust functions which take ownership of an object provided via an argument require
3578     * this to be true and invalidate the object pointed to by inner.
3579     */
3580    bool is_owned;
3581 } LDKCommitmentUpdate;
3582
3583
3584
3585 /**
3586  * A revoke_and_ack message to be sent or received from a peer
3587  */
3588 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3589    /**
3590     * A pointer to the opaque Rust object.
3591     * Nearly everywhere, inner must be non-null, however in places where
3592     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3593     */
3594    LDKnativeRevokeAndACK *inner;
3595    /**
3596     * Indicates that this is the only struct which contains the same pointer.
3597     * Rust functions which take ownership of an object provided via an argument require
3598     * this to be true and invalidate the object pointed to by inner.
3599     */
3600    bool is_owned;
3601 } LDKRevokeAndACK;
3602
3603
3604
3605 /**
3606  * A closing_signed message to be sent or received from a peer
3607  */
3608 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3609    /**
3610     * A pointer to the opaque Rust object.
3611     * Nearly everywhere, inner must be non-null, however in places where
3612     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3613     */
3614    LDKnativeClosingSigned *inner;
3615    /**
3616     * Indicates that this is the only struct which contains the same pointer.
3617     * Rust functions which take ownership of an object provided via an argument require
3618     * this to be true and invalidate the object pointed to by inner.
3619     */
3620    bool is_owned;
3621 } LDKClosingSigned;
3622
3623
3624
3625 /**
3626  * A shutdown message to be sent or received from a peer
3627  */
3628 typedef struct MUST_USE_STRUCT LDKShutdown {
3629    /**
3630     * A pointer to the opaque Rust object.
3631     * Nearly everywhere, inner must be non-null, however in places where
3632     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3633     */
3634    LDKnativeShutdown *inner;
3635    /**
3636     * Indicates that this is the only struct which contains the same pointer.
3637     * Rust functions which take ownership of an object provided via an argument require
3638     * this to be true and invalidate the object pointed to by inner.
3639     */
3640    bool is_owned;
3641 } LDKShutdown;
3642
3643
3644
3645 /**
3646  * A channel_reestablish message to be sent or received from a peer
3647  */
3648 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3649    /**
3650     * A pointer to the opaque Rust object.
3651     * Nearly everywhere, inner must be non-null, however in places where
3652     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3653     */
3654    LDKnativeChannelReestablish *inner;
3655    /**
3656     * Indicates that this is the only struct which contains the same pointer.
3657     * Rust functions which take ownership of an object provided via an argument require
3658     * this to be true and invalidate the object pointed to by inner.
3659     */
3660    bool is_owned;
3661 } LDKChannelReestablish;
3662
3663
3664
3665 /**
3666  * A channel_announcement message to be sent or received from a peer
3667  */
3668 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3669    /**
3670     * A pointer to the opaque Rust object.
3671     * Nearly everywhere, inner must be non-null, however in places where
3672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3673     */
3674    LDKnativeChannelAnnouncement *inner;
3675    /**
3676     * Indicates that this is the only struct which contains the same pointer.
3677     * Rust functions which take ownership of an object provided via an argument require
3678     * this to be true and invalidate the object pointed to by inner.
3679     */
3680    bool is_owned;
3681 } LDKChannelAnnouncement;
3682
3683
3684
3685 /**
3686  * A channel_update message to be sent or received from a peer
3687  */
3688 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
3689    /**
3690     * A pointer to the opaque Rust object.
3691     * Nearly everywhere, inner must be non-null, however in places where
3692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3693     */
3694    LDKnativeChannelUpdate *inner;
3695    /**
3696     * Indicates that this is the only struct which contains the same pointer.
3697     * Rust functions which take ownership of an object provided via an argument require
3698     * this to be true and invalidate the object pointed to by inner.
3699     */
3700    bool is_owned;
3701 } LDKChannelUpdate;
3702
3703
3704
3705 /**
3706  * A node_announcement message to be sent or received from a peer
3707  */
3708 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3709    /**
3710     * A pointer to the opaque Rust object.
3711     * Nearly everywhere, inner must be non-null, however in places where
3712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3713     */
3714    LDKnativeNodeAnnouncement *inner;
3715    /**
3716     * Indicates that this is the only struct which contains the same pointer.
3717     * Rust functions which take ownership of an object provided via an argument require
3718     * this to be true and invalidate the object pointed to by inner.
3719     */
3720    bool is_owned;
3721 } LDKNodeAnnouncement;
3722
3723
3724
3725 /**
3726  * An error message to be sent or received from a peer
3727  */
3728 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3729    /**
3730     * A pointer to the opaque Rust object.
3731     * Nearly everywhere, inner must be non-null, however in places where
3732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3733     */
3734    LDKnativeErrorMessage *inner;
3735    /**
3736     * Indicates that this is the only struct which contains the same pointer.
3737     * Rust functions which take ownership of an object provided via an argument require
3738     * this to be true and invalidate the object pointed to by inner.
3739     */
3740    bool is_owned;
3741 } LDKErrorMessage;
3742
3743 /**
3744  * Used to put an error message in a LightningError
3745  */
3746 typedef enum LDKErrorAction_Tag {
3747    /**
3748     * The peer took some action which made us think they were useless. Disconnect them.
3749     */
3750    LDKErrorAction_DisconnectPeer,
3751    /**
3752     * The peer did something harmless that we weren't able to process, just log and ignore
3753     */
3754    LDKErrorAction_IgnoreError,
3755    /**
3756     * The peer did something incorrect. Tell them.
3757     */
3758    LDKErrorAction_SendErrorMessage,
3759    /**
3760     * Must be last for serialization purposes
3761     */
3762    LDKErrorAction_Sentinel,
3763 } LDKErrorAction_Tag;
3764
3765 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3766    /**
3767     * An error message which we should make an effort to send before we disconnect.
3768     */
3769    struct LDKErrorMessage msg;
3770 } LDKErrorAction_LDKDisconnectPeer_Body;
3771
3772 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3773    /**
3774     * The message to send.
3775     */
3776    struct LDKErrorMessage msg;
3777 } LDKErrorAction_LDKSendErrorMessage_Body;
3778
3779 typedef struct MUST_USE_STRUCT LDKErrorAction {
3780    LDKErrorAction_Tag tag;
3781    union {
3782       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3783       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3784    };
3785 } LDKErrorAction;
3786
3787 /**
3788  * The information we received from a peer along the route of a payment we originated. This is
3789  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3790  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3791  */
3792 typedef enum LDKHTLCFailChannelUpdate_Tag {
3793    /**
3794     * We received an error which included a full ChannelUpdate message.
3795     */
3796    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
3797    /**
3798     * We received an error which indicated only that a channel has been closed
3799     */
3800    LDKHTLCFailChannelUpdate_ChannelClosed,
3801    /**
3802     * We received an error which indicated only that a node has failed
3803     */
3804    LDKHTLCFailChannelUpdate_NodeFailure,
3805    /**
3806     * Must be last for serialization purposes
3807     */
3808    LDKHTLCFailChannelUpdate_Sentinel,
3809 } LDKHTLCFailChannelUpdate_Tag;
3810
3811 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
3812    /**
3813     * The unwrapped message we received
3814     */
3815    struct LDKChannelUpdate msg;
3816 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
3817
3818 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
3819    /**
3820     * The short_channel_id which has now closed.
3821     */
3822    uint64_t short_channel_id;
3823    /**
3824     * when this true, this channel should be permanently removed from the
3825     * consideration. Otherwise, this channel can be restored as new channel_update is received
3826     */
3827    bool is_permanent;
3828 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
3829
3830 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
3831    /**
3832     * The node_id that has failed.
3833     */
3834    struct LDKPublicKey node_id;
3835    /**
3836     * when this true, node should be permanently removed from the
3837     * consideration. Otherwise, the channels connected to this node can be
3838     * restored as new channel_update is received
3839     */
3840    bool is_permanent;
3841 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
3842
3843 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
3844    LDKHTLCFailChannelUpdate_Tag tag;
3845    union {
3846       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3847       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
3848       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
3849    };
3850 } LDKHTLCFailChannelUpdate;
3851
3852
3853
3854 /**
3855  * A query_channel_range message is used to query a peer for channel
3856  * UTXOs in a range of blocks. The recipient of a query makes a best
3857  * effort to reply to the query using one or more reply_channel_range
3858  * messages.
3859  */
3860 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3861    /**
3862     * A pointer to the opaque Rust object.
3863     * Nearly everywhere, inner must be non-null, however in places where
3864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3865     */
3866    LDKnativeQueryChannelRange *inner;
3867    /**
3868     * Indicates that this is the only struct which contains the same pointer.
3869     * Rust functions which take ownership of an object provided via an argument require
3870     * this to be true and invalidate the object pointed to by inner.
3871     */
3872    bool is_owned;
3873 } LDKQueryChannelRange;
3874
3875
3876
3877 /**
3878  * A query_short_channel_ids message is used to query a peer for
3879  * routing gossip messages related to one or more short_channel_ids.
3880  * The query recipient will reply with the latest, if available,
3881  * channel_announcement, channel_update and node_announcement messages
3882  * it maintains for the requested short_channel_ids followed by a
3883  * reply_short_channel_ids_end message. The short_channel_ids sent in
3884  * this query are encoded. We only support encoding_type=0 uncompressed
3885  * serialization and do not support encoding_type=1 zlib serialization.
3886  */
3887 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3888    /**
3889     * A pointer to the opaque Rust object.
3890     * Nearly everywhere, inner must be non-null, however in places where
3891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3892     */
3893    LDKnativeQueryShortChannelIds *inner;
3894    /**
3895     * Indicates that this is the only struct which contains the same pointer.
3896     * Rust functions which take ownership of an object provided via an argument require
3897     * this to be true and invalidate the object pointed to by inner.
3898     */
3899    bool is_owned;
3900 } LDKQueryShortChannelIds;
3901
3902
3903
3904 /**
3905  * A reply_channel_range message is a reply to a query_channel_range
3906  * message. Multiple reply_channel_range messages can be sent in reply
3907  * to a single query_channel_range message. The query recipient makes a
3908  * best effort to respond based on their local network view which may
3909  * not be a perfect view of the network. The short_channel_ids in the
3910  * reply are encoded. We only support encoding_type=0 uncompressed
3911  * serialization and do not support encoding_type=1 zlib serialization.
3912  */
3913 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3914    /**
3915     * A pointer to the opaque Rust object.
3916     * Nearly everywhere, inner must be non-null, however in places where
3917     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3918     */
3919    LDKnativeReplyChannelRange *inner;
3920    /**
3921     * Indicates that this is the only struct which contains the same pointer.
3922     * Rust functions which take ownership of an object provided via an argument require
3923     * this to be true and invalidate the object pointed to by inner.
3924     */
3925    bool is_owned;
3926 } LDKReplyChannelRange;
3927
3928 /**
3929  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3930  * broadcast to most peers).
3931  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3932  */
3933 typedef enum LDKMessageSendEvent_Tag {
3934    /**
3935     * Used to indicate that we've accepted a channel open and should send the accept_channel
3936     * message provided to the given peer.
3937     */
3938    LDKMessageSendEvent_SendAcceptChannel,
3939    /**
3940     * Used to indicate that we've initiated a channel open and should send the open_channel
3941     * message provided to the given peer.
3942     */
3943    LDKMessageSendEvent_SendOpenChannel,
3944    /**
3945     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3946     */
3947    LDKMessageSendEvent_SendFundingCreated,
3948    /**
3949     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3950     */
3951    LDKMessageSendEvent_SendFundingSigned,
3952    /**
3953     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3954     */
3955    LDKMessageSendEvent_SendFundingLocked,
3956    /**
3957     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3958     */
3959    LDKMessageSendEvent_SendAnnouncementSignatures,
3960    /**
3961     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3962     * message should be sent to the peer with the given node_id.
3963     */
3964    LDKMessageSendEvent_UpdateHTLCs,
3965    /**
3966     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3967     */
3968    LDKMessageSendEvent_SendRevokeAndACK,
3969    /**
3970     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3971     */
3972    LDKMessageSendEvent_SendClosingSigned,
3973    /**
3974     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3975     */
3976    LDKMessageSendEvent_SendShutdown,
3977    /**
3978     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3979     */
3980    LDKMessageSendEvent_SendChannelReestablish,
3981    /**
3982     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3983     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3984     *
3985     * Note that after doing so, you very likely (unless you did so very recently) want to call
3986     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3987     * This ensures that any nodes which see our channel_announcement also have a relevant
3988     * node_announcement, including relevant feature flags which may be important for routing
3989     * through or to us.
3990     */
3991    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3992    /**
3993     * Used to indicate that a node_announcement should be broadcast to all peers.
3994     */
3995    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3996    /**
3997     * Used to indicate that a channel_update should be broadcast to all peers.
3998     */
3999    LDKMessageSendEvent_BroadcastChannelUpdate,
4000    /**
4001     * Broadcast an error downstream to be handled
4002     */
4003    LDKMessageSendEvent_HandleError,
4004    /**
4005     * When a payment fails we may receive updates back from the hop where it failed. In such
4006     * cases this event is generated so that we can inform the network graph of this information.
4007     */
4008    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
4009    /**
4010     * Query a peer for channels with funding transaction UTXOs in a block range.
4011     */
4012    LDKMessageSendEvent_SendChannelRangeQuery,
4013    /**
4014     * Request routing gossip messages from a peer for a list of channels identified by
4015     * their short_channel_ids.
4016     */
4017    LDKMessageSendEvent_SendShortIdsQuery,
4018    /**
4019     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
4020     * emitted during processing of the query.
4021     */
4022    LDKMessageSendEvent_SendReplyChannelRange,
4023    /**
4024     * Must be last for serialization purposes
4025     */
4026    LDKMessageSendEvent_Sentinel,
4027 } LDKMessageSendEvent_Tag;
4028
4029 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4030    /**
4031     * The node_id of the node which should receive this message
4032     */
4033    struct LDKPublicKey node_id;
4034    /**
4035     * The message which should be sent.
4036     */
4037    struct LDKAcceptChannel msg;
4038 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4039
4040 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4041    /**
4042     * The node_id of the node which should receive this message
4043     */
4044    struct LDKPublicKey node_id;
4045    /**
4046     * The message which should be sent.
4047     */
4048    struct LDKOpenChannel msg;
4049 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4050
4051 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4052    /**
4053     * The node_id of the node which should receive this message
4054     */
4055    struct LDKPublicKey node_id;
4056    /**
4057     * The message which should be sent.
4058     */
4059    struct LDKFundingCreated msg;
4060 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4061
4062 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4063    /**
4064     * The node_id of the node which should receive this message
4065     */
4066    struct LDKPublicKey node_id;
4067    /**
4068     * The message which should be sent.
4069     */
4070    struct LDKFundingSigned msg;
4071 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4072
4073 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
4074    /**
4075     * The node_id of the node which should receive these message(s)
4076     */
4077    struct LDKPublicKey node_id;
4078    /**
4079     * The funding_locked message which should be sent.
4080     */
4081    struct LDKFundingLocked msg;
4082 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
4083
4084 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4085    /**
4086     * The node_id of the node which should receive these message(s)
4087     */
4088    struct LDKPublicKey node_id;
4089    /**
4090     * The announcement_signatures message which should be sent.
4091     */
4092    struct LDKAnnouncementSignatures msg;
4093 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4094
4095 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4096    /**
4097     * The node_id of the node which should receive these message(s)
4098     */
4099    struct LDKPublicKey node_id;
4100    /**
4101     * The update messages which should be sent. ALL messages in the struct should be sent!
4102     */
4103    struct LDKCommitmentUpdate updates;
4104 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4105
4106 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4107    /**
4108     * The node_id of the node which should receive this message
4109     */
4110    struct LDKPublicKey node_id;
4111    /**
4112     * The message which should be sent.
4113     */
4114    struct LDKRevokeAndACK msg;
4115 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4116
4117 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4118    /**
4119     * The node_id of the node which should receive this message
4120     */
4121    struct LDKPublicKey node_id;
4122    /**
4123     * The message which should be sent.
4124     */
4125    struct LDKClosingSigned msg;
4126 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4127
4128 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4129    /**
4130     * The node_id of the node which should receive this message
4131     */
4132    struct LDKPublicKey node_id;
4133    /**
4134     * The message which should be sent.
4135     */
4136    struct LDKShutdown msg;
4137 } LDKMessageSendEvent_LDKSendShutdown_Body;
4138
4139 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4140    /**
4141     * The node_id of the node which should receive this message
4142     */
4143    struct LDKPublicKey node_id;
4144    /**
4145     * The message which should be sent.
4146     */
4147    struct LDKChannelReestablish msg;
4148 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4149
4150 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4151    /**
4152     * The channel_announcement which should be sent.
4153     */
4154    struct LDKChannelAnnouncement msg;
4155    /**
4156     * The followup channel_update which should be sent.
4157     */
4158    struct LDKChannelUpdate update_msg;
4159 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4160
4161 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4162    /**
4163     * The node_announcement which should be sent.
4164     */
4165    struct LDKNodeAnnouncement msg;
4166 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4167
4168 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4169    /**
4170     * The channel_update which should be sent.
4171     */
4172    struct LDKChannelUpdate msg;
4173 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4174
4175 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4176    /**
4177     * The node_id of the node which should receive this message
4178     */
4179    struct LDKPublicKey node_id;
4180    /**
4181     * The action which should be taken.
4182     */
4183    struct LDKErrorAction action;
4184 } LDKMessageSendEvent_LDKHandleError_Body;
4185
4186 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
4187    /**
4188     * The channel/node update which should be sent to NetGraphMsgHandler
4189     */
4190    struct LDKHTLCFailChannelUpdate update;
4191 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
4192
4193 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4194    /**
4195     * The node_id of this message recipient
4196     */
4197    struct LDKPublicKey node_id;
4198    /**
4199     * The query_channel_range which should be sent.
4200     */
4201    struct LDKQueryChannelRange msg;
4202 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4203
4204 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4205    /**
4206     * The node_id of this message recipient
4207     */
4208    struct LDKPublicKey node_id;
4209    /**
4210     * The query_short_channel_ids which should be sent.
4211     */
4212    struct LDKQueryShortChannelIds msg;
4213 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4214
4215 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4216    /**
4217     * The node_id of this message recipient
4218     */
4219    struct LDKPublicKey node_id;
4220    /**
4221     * The reply_channel_range which should be sent.
4222     */
4223    struct LDKReplyChannelRange msg;
4224 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4225
4226 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4227    LDKMessageSendEvent_Tag tag;
4228    union {
4229       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4230       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4231       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4232       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4233       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4234       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4235       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4236       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4237       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4238       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4239       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4240       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4241       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4242       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4243       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4244       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
4245       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4246       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4247       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4248    };
4249 } LDKMessageSendEvent;
4250
4251 /**
4252  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4253  * This corresponds to std::vector in C++
4254  */
4255 typedef struct LDKCVec_MessageSendEventZ {
4256    /**
4257     * The elements in the array.
4258     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4259     */
4260    struct LDKMessageSendEvent *data;
4261    /**
4262     * The number of elements pointed to by `data`.
4263     */
4264    uintptr_t datalen;
4265 } LDKCVec_MessageSendEventZ;
4266
4267 /**
4268  * The contents of CResult_boolLightningErrorZ
4269  */
4270 typedef union LDKCResult_boolLightningErrorZPtr {
4271    /**
4272     * A pointer to the contents in the success state.
4273     * Reading from this pointer when `result_ok` is not set is undefined.
4274     */
4275    bool *result;
4276    /**
4277     * A pointer to the contents in the error state.
4278     * Reading from this pointer when `result_ok` is set is undefined.
4279     */
4280    struct LDKLightningError *err;
4281 } LDKCResult_boolLightningErrorZPtr;
4282
4283 /**
4284  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4285  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4286  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4287  */
4288 typedef struct LDKCResult_boolLightningErrorZ {
4289    /**
4290     * The contents of this CResult_boolLightningErrorZ, accessible via either
4291     * `err` or `result` depending on the state of `result_ok`.
4292     */
4293    union LDKCResult_boolLightningErrorZPtr contents;
4294    /**
4295     * Whether this CResult_boolLightningErrorZ represents a success state.
4296     */
4297    bool result_ok;
4298 } LDKCResult_boolLightningErrorZ;
4299
4300 /**
4301  * A tuple of 3 elements. See the individual fields for the types contained.
4302  */
4303 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4304    /**
4305     * The element at position 0
4306     */
4307    struct LDKChannelAnnouncement a;
4308    /**
4309     * The element at position 1
4310     */
4311    struct LDKChannelUpdate b;
4312    /**
4313     * The element at position 2
4314     */
4315    struct LDKChannelUpdate c;
4316 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4317
4318 /**
4319  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4320  * This corresponds to std::vector in C++
4321  */
4322 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4323    /**
4324     * The elements in the array.
4325     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4326     */
4327    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4328    /**
4329     * The number of elements pointed to by `data`.
4330     */
4331    uintptr_t datalen;
4332 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
4333
4334 /**
4335  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4336  * This corresponds to std::vector in C++
4337  */
4338 typedef struct LDKCVec_NodeAnnouncementZ {
4339    /**
4340     * The elements in the array.
4341     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4342     */
4343    struct LDKNodeAnnouncement *data;
4344    /**
4345     * The number of elements pointed to by `data`.
4346     */
4347    uintptr_t datalen;
4348 } LDKCVec_NodeAnnouncementZ;
4349
4350 /**
4351  * The contents of CResult_NoneLightningErrorZ
4352  */
4353 typedef union LDKCResult_NoneLightningErrorZPtr {
4354    /**
4355     * Note that this value is always NULL, as there are no contents in the OK variant
4356     */
4357    void *result;
4358    /**
4359     * A pointer to the contents in the error state.
4360     * Reading from this pointer when `result_ok` is set is undefined.
4361     */
4362    struct LDKLightningError *err;
4363 } LDKCResult_NoneLightningErrorZPtr;
4364
4365 /**
4366  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4367  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4368  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4369  */
4370 typedef struct LDKCResult_NoneLightningErrorZ {
4371    /**
4372     * The contents of this CResult_NoneLightningErrorZ, accessible via either
4373     * `err` or `result` depending on the state of `result_ok`.
4374     */
4375    union LDKCResult_NoneLightningErrorZPtr contents;
4376    /**
4377     * Whether this CResult_NoneLightningErrorZ represents a success state.
4378     */
4379    bool result_ok;
4380 } LDKCResult_NoneLightningErrorZ;
4381
4382 /**
4383  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4384  * This corresponds to std::vector in C++
4385  */
4386 typedef struct LDKCVec_PublicKeyZ {
4387    /**
4388     * The elements in the array.
4389     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4390     */
4391    struct LDKPublicKey *data;
4392    /**
4393     * The number of elements pointed to by `data`.
4394     */
4395    uintptr_t datalen;
4396 } LDKCVec_PublicKeyZ;
4397
4398
4399
4400 /**
4401  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
4402  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
4403  * descriptor.
4404  */
4405 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
4406    /**
4407     * A pointer to the opaque Rust object.
4408     * Nearly everywhere, inner must be non-null, however in places where
4409     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4410     */
4411    LDKnativePeerHandleError *inner;
4412    /**
4413     * Indicates that this is the only struct which contains the same pointer.
4414     * Rust functions which take ownership of an object provided via an argument require
4415     * this to be true and invalidate the object pointed to by inner.
4416     */
4417    bool is_owned;
4418 } LDKPeerHandleError;
4419
4420 /**
4421  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
4422  */
4423 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
4424    /**
4425     * A pointer to the contents in the success state.
4426     * Reading from this pointer when `result_ok` is not set is undefined.
4427     */
4428    struct LDKCVec_u8Z *result;
4429    /**
4430     * A pointer to the contents in the error state.
4431     * Reading from this pointer when `result_ok` is set is undefined.
4432     */
4433    struct LDKPeerHandleError *err;
4434 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
4435
4436 /**
4437  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4438  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4439  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4440  */
4441 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
4442    /**
4443     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4444     * `err` or `result` depending on the state of `result_ok`.
4445     */
4446    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
4447    /**
4448     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4449     */
4450    bool result_ok;
4451 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
4452
4453 /**
4454  * The contents of CResult_NonePeerHandleErrorZ
4455  */
4456 typedef union LDKCResult_NonePeerHandleErrorZPtr {
4457    /**
4458     * Note that this value is always NULL, as there are no contents in the OK variant
4459     */
4460    void *result;
4461    /**
4462     * A pointer to the contents in the error state.
4463     * Reading from this pointer when `result_ok` is set is undefined.
4464     */
4465    struct LDKPeerHandleError *err;
4466 } LDKCResult_NonePeerHandleErrorZPtr;
4467
4468 /**
4469  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4470  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4471  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4472  */
4473 typedef struct LDKCResult_NonePeerHandleErrorZ {
4474    /**
4475     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4476     * `err` or `result` depending on the state of `result_ok`.
4477     */
4478    union LDKCResult_NonePeerHandleErrorZPtr contents;
4479    /**
4480     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
4481     */
4482    bool result_ok;
4483 } LDKCResult_NonePeerHandleErrorZ;
4484
4485 /**
4486  * The contents of CResult_boolPeerHandleErrorZ
4487  */
4488 typedef union LDKCResult_boolPeerHandleErrorZPtr {
4489    /**
4490     * A pointer to the contents in the success state.
4491     * Reading from this pointer when `result_ok` is not set is undefined.
4492     */
4493    bool *result;
4494    /**
4495     * A pointer to the contents in the error state.
4496     * Reading from this pointer when `result_ok` is set is undefined.
4497     */
4498    struct LDKPeerHandleError *err;
4499 } LDKCResult_boolPeerHandleErrorZPtr;
4500
4501 /**
4502  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4503  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4504  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4505  */
4506 typedef struct LDKCResult_boolPeerHandleErrorZ {
4507    /**
4508     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4509     * `err` or `result` depending on the state of `result_ok`.
4510     */
4511    union LDKCResult_boolPeerHandleErrorZPtr contents;
4512    /**
4513     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
4514     */
4515    bool result_ok;
4516 } LDKCResult_boolPeerHandleErrorZ;
4517
4518 /**
4519  * The contents of CResult_TxOutAccessErrorZ
4520  */
4521 typedef union LDKCResult_TxOutAccessErrorZPtr {
4522    /**
4523     * A pointer to the contents in the success state.
4524     * Reading from this pointer when `result_ok` is not set is undefined.
4525     */
4526    struct LDKTxOut *result;
4527    /**
4528     * A pointer to the contents in the error state.
4529     * Reading from this pointer when `result_ok` is set is undefined.
4530     */
4531    enum LDKAccessError *err;
4532 } LDKCResult_TxOutAccessErrorZPtr;
4533
4534 /**
4535  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4536  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4538  */
4539 typedef struct LDKCResult_TxOutAccessErrorZ {
4540    /**
4541     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4542     * `err` or `result` depending on the state of `result_ok`.
4543     */
4544    union LDKCResult_TxOutAccessErrorZPtr contents;
4545    /**
4546     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4547     */
4548    bool result_ok;
4549 } LDKCResult_TxOutAccessErrorZ;
4550
4551 /**
4552  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4553  */
4554 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4555    /**
4556     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4557     */
4558    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4559    /**
4560     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4561     */
4562    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4563    /**
4564     * Must be last for serialization purposes
4565     */
4566    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4567 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4568
4569 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4570    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4571    union {
4572       struct {
4573          struct LDKC2Tuple_usizeTransactionZ some;
4574       };
4575    };
4576 } LDKCOption_C2Tuple_usizeTransactionZZ;
4577
4578
4579
4580 /**
4581  * Details about one direction of a channel. Received
4582  * within a channel update.
4583  */
4584 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
4585    /**
4586     * A pointer to the opaque Rust object.
4587     * Nearly everywhere, inner must be non-null, however in places where
4588     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4589     */
4590    LDKnativeDirectionalChannelInfo *inner;
4591    /**
4592     * Indicates that this is the only struct which contains the same pointer.
4593     * Rust functions which take ownership of an object provided via an argument require
4594     * this to be true and invalidate the object pointed to by inner.
4595     */
4596    bool is_owned;
4597 } LDKDirectionalChannelInfo;
4598
4599 /**
4600  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4601  */
4602 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
4603    /**
4604     * A pointer to the contents in the success state.
4605     * Reading from this pointer when `result_ok` is not set is undefined.
4606     */
4607    struct LDKDirectionalChannelInfo *result;
4608    /**
4609     * A pointer to the contents in the error state.
4610     * Reading from this pointer when `result_ok` is set is undefined.
4611     */
4612    struct LDKDecodeError *err;
4613 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
4614
4615 /**
4616  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4617  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4619  */
4620 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
4621    /**
4622     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4623     * `err` or `result` depending on the state of `result_ok`.
4624     */
4625    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
4626    /**
4627     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4628     */
4629    bool result_ok;
4630 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
4631
4632
4633
4634 /**
4635  * Details about a channel (both directions).
4636  * Received within a channel announcement.
4637  */
4638 typedef struct MUST_USE_STRUCT LDKChannelInfo {
4639    /**
4640     * A pointer to the opaque Rust object.
4641     * Nearly everywhere, inner must be non-null, however in places where
4642     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4643     */
4644    LDKnativeChannelInfo *inner;
4645    /**
4646     * Indicates that this is the only struct which contains the same pointer.
4647     * Rust functions which take ownership of an object provided via an argument require
4648     * this to be true and invalidate the object pointed to by inner.
4649     */
4650    bool is_owned;
4651 } LDKChannelInfo;
4652
4653 /**
4654  * The contents of CResult_ChannelInfoDecodeErrorZ
4655  */
4656 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
4657    /**
4658     * A pointer to the contents in the success state.
4659     * Reading from this pointer when `result_ok` is not set is undefined.
4660     */
4661    struct LDKChannelInfo *result;
4662    /**
4663     * A pointer to the contents in the error state.
4664     * Reading from this pointer when `result_ok` is set is undefined.
4665     */
4666    struct LDKDecodeError *err;
4667 } LDKCResult_ChannelInfoDecodeErrorZPtr;
4668
4669 /**
4670  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4671  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4673  */
4674 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
4675    /**
4676     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4677     * `err` or `result` depending on the state of `result_ok`.
4678     */
4679    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
4680    /**
4681     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4682     */
4683    bool result_ok;
4684 } LDKCResult_ChannelInfoDecodeErrorZ;
4685
4686
4687
4688 /**
4689  * Fees for routing via a given channel or a node
4690  */
4691 typedef struct MUST_USE_STRUCT LDKRoutingFees {
4692    /**
4693     * A pointer to the opaque Rust object.
4694     * Nearly everywhere, inner must be non-null, however in places where
4695     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4696     */
4697    LDKnativeRoutingFees *inner;
4698    /**
4699     * Indicates that this is the only struct which contains the same pointer.
4700     * Rust functions which take ownership of an object provided via an argument require
4701     * this to be true and invalidate the object pointed to by inner.
4702     */
4703    bool is_owned;
4704 } LDKRoutingFees;
4705
4706 /**
4707  * The contents of CResult_RoutingFeesDecodeErrorZ
4708  */
4709 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
4710    /**
4711     * A pointer to the contents in the success state.
4712     * Reading from this pointer when `result_ok` is not set is undefined.
4713     */
4714    struct LDKRoutingFees *result;
4715    /**
4716     * A pointer to the contents in the error state.
4717     * Reading from this pointer when `result_ok` is set is undefined.
4718     */
4719    struct LDKDecodeError *err;
4720 } LDKCResult_RoutingFeesDecodeErrorZPtr;
4721
4722 /**
4723  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4724  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4725  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4726  */
4727 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
4728    /**
4729     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4730     * `err` or `result` depending on the state of `result_ok`.
4731     */
4732    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
4733    /**
4734     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4735     */
4736    bool result_ok;
4737 } LDKCResult_RoutingFeesDecodeErrorZ;
4738
4739 /**
4740  * A 4-byte byte array.
4741  */
4742 typedef struct LDKFourBytes {
4743    /**
4744     * The four bytes
4745     */
4746    uint8_t data[4];
4747 } LDKFourBytes;
4748
4749 /**
4750  * A 16-byte byte array.
4751  */
4752 typedef struct LDKSixteenBytes {
4753    /**
4754     * The sixteen bytes
4755     */
4756    uint8_t data[16];
4757 } LDKSixteenBytes;
4758
4759 /**
4760  * A 10-byte byte array.
4761  */
4762 typedef struct LDKTenBytes {
4763    /**
4764     * The ten bytes
4765     */
4766    uint8_t data[10];
4767 } LDKTenBytes;
4768
4769 /**
4770  * An address which can be used to connect to a remote peer
4771  */
4772 typedef enum LDKNetAddress_Tag {
4773    /**
4774     * An IPv4 address/port on which the peer is listening.
4775     */
4776    LDKNetAddress_IPv4,
4777    /**
4778     * An IPv6 address/port on which the peer is listening.
4779     */
4780    LDKNetAddress_IPv6,
4781    /**
4782     * An old-style Tor onion address/port on which the peer is listening.
4783     */
4784    LDKNetAddress_OnionV2,
4785    /**
4786     * A new-style Tor onion address/port on which the peer is listening.
4787     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4788     * wrap as base32 and append \".onion\".
4789     */
4790    LDKNetAddress_OnionV3,
4791    /**
4792     * Must be last for serialization purposes
4793     */
4794    LDKNetAddress_Sentinel,
4795 } LDKNetAddress_Tag;
4796
4797 typedef struct LDKNetAddress_LDKIPv4_Body {
4798    /**
4799     * The 4-byte IPv4 address
4800     */
4801    struct LDKFourBytes addr;
4802    /**
4803     * The port on which the node is listening
4804     */
4805    uint16_t port;
4806 } LDKNetAddress_LDKIPv4_Body;
4807
4808 typedef struct LDKNetAddress_LDKIPv6_Body {
4809    /**
4810     * The 16-byte IPv6 address
4811     */
4812    struct LDKSixteenBytes addr;
4813    /**
4814     * The port on which the node is listening
4815     */
4816    uint16_t port;
4817 } LDKNetAddress_LDKIPv6_Body;
4818
4819 typedef struct LDKNetAddress_LDKOnionV2_Body {
4820    /**
4821     * The bytes (usually encoded in base32 with \".onion\" appended)
4822     */
4823    struct LDKTenBytes addr;
4824    /**
4825     * The port on which the node is listening
4826     */
4827    uint16_t port;
4828 } LDKNetAddress_LDKOnionV2_Body;
4829
4830 typedef struct LDKNetAddress_LDKOnionV3_Body {
4831    /**
4832     * The ed25519 long-term public key of the peer
4833     */
4834    struct LDKThirtyTwoBytes ed25519_pubkey;
4835    /**
4836     * The checksum of the pubkey and version, as included in the onion address
4837     */
4838    uint16_t checksum;
4839    /**
4840     * The version byte, as defined by the Tor Onion v3 spec.
4841     */
4842    uint8_t version;
4843    /**
4844     * The port on which the node is listening
4845     */
4846    uint16_t port;
4847 } LDKNetAddress_LDKOnionV3_Body;
4848
4849 typedef struct MUST_USE_STRUCT LDKNetAddress {
4850    LDKNetAddress_Tag tag;
4851    union {
4852       LDKNetAddress_LDKIPv4_Body i_pv4;
4853       LDKNetAddress_LDKIPv6_Body i_pv6;
4854       LDKNetAddress_LDKOnionV2_Body onion_v2;
4855       LDKNetAddress_LDKOnionV3_Body onion_v3;
4856    };
4857 } LDKNetAddress;
4858
4859 /**
4860  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4861  * This corresponds to std::vector in C++
4862  */
4863 typedef struct LDKCVec_NetAddressZ {
4864    /**
4865     * The elements in the array.
4866     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4867     */
4868    struct LDKNetAddress *data;
4869    /**
4870     * The number of elements pointed to by `data`.
4871     */
4872    uintptr_t datalen;
4873 } LDKCVec_NetAddressZ;
4874
4875
4876
4877 /**
4878  * Information received in the latest node_announcement from this node.
4879  */
4880 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4881    /**
4882     * A pointer to the opaque Rust object.
4883     * Nearly everywhere, inner must be non-null, however in places where
4884     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4885     */
4886    LDKnativeNodeAnnouncementInfo *inner;
4887    /**
4888     * Indicates that this is the only struct which contains the same pointer.
4889     * Rust functions which take ownership of an object provided via an argument require
4890     * this to be true and invalidate the object pointed to by inner.
4891     */
4892    bool is_owned;
4893 } LDKNodeAnnouncementInfo;
4894
4895 /**
4896  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4897  */
4898 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4899    /**
4900     * A pointer to the contents in the success state.
4901     * Reading from this pointer when `result_ok` is not set is undefined.
4902     */
4903    struct LDKNodeAnnouncementInfo *result;
4904    /**
4905     * A pointer to the contents in the error state.
4906     * Reading from this pointer when `result_ok` is set is undefined.
4907     */
4908    struct LDKDecodeError *err;
4909 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4910
4911 /**
4912  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4913  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4915  */
4916 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4917    /**
4918     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4919     * `err` or `result` depending on the state of `result_ok`.
4920     */
4921    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4922    /**
4923     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4924     */
4925    bool result_ok;
4926 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4927
4928 /**
4929  * A dynamically-allocated array of u64s of arbitrary size.
4930  * This corresponds to std::vector in C++
4931  */
4932 typedef struct LDKCVec_u64Z {
4933    /**
4934     * The elements in the array.
4935     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4936     */
4937    uint64_t *data;
4938    /**
4939     * The number of elements pointed to by `data`.
4940     */
4941    uintptr_t datalen;
4942 } LDKCVec_u64Z;
4943
4944
4945
4946 /**
4947  * Details about a node in the network, known from the network announcement.
4948  */
4949 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4950    /**
4951     * A pointer to the opaque Rust object.
4952     * Nearly everywhere, inner must be non-null, however in places where
4953     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4954     */
4955    LDKnativeNodeInfo *inner;
4956    /**
4957     * Indicates that this is the only struct which contains the same pointer.
4958     * Rust functions which take ownership of an object provided via an argument require
4959     * this to be true and invalidate the object pointed to by inner.
4960     */
4961    bool is_owned;
4962 } LDKNodeInfo;
4963
4964 /**
4965  * The contents of CResult_NodeInfoDecodeErrorZ
4966  */
4967 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4968    /**
4969     * A pointer to the contents in the success state.
4970     * Reading from this pointer when `result_ok` is not set is undefined.
4971     */
4972    struct LDKNodeInfo *result;
4973    /**
4974     * A pointer to the contents in the error state.
4975     * Reading from this pointer when `result_ok` is set is undefined.
4976     */
4977    struct LDKDecodeError *err;
4978 } LDKCResult_NodeInfoDecodeErrorZPtr;
4979
4980 /**
4981  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4982  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4983  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4984  */
4985 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4986    /**
4987     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4988     * `err` or `result` depending on the state of `result_ok`.
4989     */
4990    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4991    /**
4992     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4993     */
4994    bool result_ok;
4995 } LDKCResult_NodeInfoDecodeErrorZ;
4996
4997
4998
4999 /**
5000  * Represents the network as nodes and channels between them
5001  */
5002 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5003    /**
5004     * A pointer to the opaque Rust object.
5005     * Nearly everywhere, inner must be non-null, however in places where
5006     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5007     */
5008    LDKnativeNetworkGraph *inner;
5009    /**
5010     * Indicates that this is the only struct which contains the same pointer.
5011     * Rust functions which take ownership of an object provided via an argument require
5012     * this to be true and invalidate the object pointed to by inner.
5013     */
5014    bool is_owned;
5015 } LDKNetworkGraph;
5016
5017 /**
5018  * The contents of CResult_NetworkGraphDecodeErrorZ
5019  */
5020 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
5021    /**
5022     * A pointer to the contents in the success state.
5023     * Reading from this pointer when `result_ok` is not set is undefined.
5024     */
5025    struct LDKNetworkGraph *result;
5026    /**
5027     * A pointer to the contents in the error state.
5028     * Reading from this pointer when `result_ok` is set is undefined.
5029     */
5030    struct LDKDecodeError *err;
5031 } LDKCResult_NetworkGraphDecodeErrorZPtr;
5032
5033 /**
5034  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5035  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5036  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5037  */
5038 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
5039    /**
5040     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5041     * `err` or `result` depending on the state of `result_ok`.
5042     */
5043    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
5044    /**
5045     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5046     */
5047    bool result_ok;
5048 } LDKCResult_NetworkGraphDecodeErrorZ;
5049
5050
5051
5052 /**
5053  * Features used within an `init` message.
5054  */
5055 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5056    /**
5057     * A pointer to the opaque Rust object.
5058     * Nearly everywhere, inner must be non-null, however in places where
5059     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5060     */
5061    LDKnativeInitFeatures *inner;
5062    /**
5063     * Indicates that this is the only struct which contains the same pointer.
5064     * Rust functions which take ownership of an object provided via an argument require
5065     * this to be true and invalidate the object pointed to by inner.
5066     */
5067    bool is_owned;
5068 } LDKInitFeatures;
5069
5070 /**
5071  * The contents of CResult_InitFeaturesDecodeErrorZ
5072  */
5073 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5074    /**
5075     * A pointer to the contents in the success state.
5076     * Reading from this pointer when `result_ok` is not set is undefined.
5077     */
5078    struct LDKInitFeatures *result;
5079    /**
5080     * A pointer to the contents in the error state.
5081     * Reading from this pointer when `result_ok` is set is undefined.
5082     */
5083    struct LDKDecodeError *err;
5084 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5085
5086 /**
5087  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5088  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5089  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5090  */
5091 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5092    /**
5093     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5094     * `err` or `result` depending on the state of `result_ok`.
5095     */
5096    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5097    /**
5098     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5099     */
5100    bool result_ok;
5101 } LDKCResult_InitFeaturesDecodeErrorZ;
5102
5103
5104
5105 /**
5106  * Features used within a `node_announcement` message.
5107  */
5108 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5109    /**
5110     * A pointer to the opaque Rust object.
5111     * Nearly everywhere, inner must be non-null, however in places where
5112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5113     */
5114    LDKnativeNodeFeatures *inner;
5115    /**
5116     * Indicates that this is the only struct which contains the same pointer.
5117     * Rust functions which take ownership of an object provided via an argument require
5118     * this to be true and invalidate the object pointed to by inner.
5119     */
5120    bool is_owned;
5121 } LDKNodeFeatures;
5122
5123 /**
5124  * The contents of CResult_NodeFeaturesDecodeErrorZ
5125  */
5126 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5127    /**
5128     * A pointer to the contents in the success state.
5129     * Reading from this pointer when `result_ok` is not set is undefined.
5130     */
5131    struct LDKNodeFeatures *result;
5132    /**
5133     * A pointer to the contents in the error state.
5134     * Reading from this pointer when `result_ok` is set is undefined.
5135     */
5136    struct LDKDecodeError *err;
5137 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5138
5139 /**
5140  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5141  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5142  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5143  */
5144 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5145    /**
5146     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5147     * `err` or `result` depending on the state of `result_ok`.
5148     */
5149    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5150    /**
5151     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5152     */
5153    bool result_ok;
5154 } LDKCResult_NodeFeaturesDecodeErrorZ;
5155
5156
5157
5158 /**
5159  * Features used within a `channel_announcement` message.
5160  */
5161 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5162    /**
5163     * A pointer to the opaque Rust object.
5164     * Nearly everywhere, inner must be non-null, however in places where
5165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5166     */
5167    LDKnativeChannelFeatures *inner;
5168    /**
5169     * Indicates that this is the only struct which contains the same pointer.
5170     * Rust functions which take ownership of an object provided via an argument require
5171     * this to be true and invalidate the object pointed to by inner.
5172     */
5173    bool is_owned;
5174 } LDKChannelFeatures;
5175
5176 /**
5177  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5178  */
5179 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5180    /**
5181     * A pointer to the contents in the success state.
5182     * Reading from this pointer when `result_ok` is not set is undefined.
5183     */
5184    struct LDKChannelFeatures *result;
5185    /**
5186     * A pointer to the contents in the error state.
5187     * Reading from this pointer when `result_ok` is set is undefined.
5188     */
5189    struct LDKDecodeError *err;
5190 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5191
5192 /**
5193  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5194  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5195  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5196  */
5197 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5198    /**
5199     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5200     * `err` or `result` depending on the state of `result_ok`.
5201     */
5202    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5203    /**
5204     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5205     */
5206    bool result_ok;
5207 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5208
5209 /**
5210  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5211  */
5212 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5213    /**
5214     * A pointer to the contents in the success state.
5215     * Reading from this pointer when `result_ok` is not set is undefined.
5216     */
5217    struct LDKInvoiceFeatures *result;
5218    /**
5219     * A pointer to the contents in the error state.
5220     * Reading from this pointer when `result_ok` is set is undefined.
5221     */
5222    struct LDKDecodeError *err;
5223 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5224
5225 /**
5226  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5227  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5229  */
5230 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5231    /**
5232     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5233     * `err` or `result` depending on the state of `result_ok`.
5234     */
5235    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5236    /**
5237     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5238     */
5239    bool result_ok;
5240 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5241
5242 /**
5243  * The contents of CResult_NetAddressu8Z
5244  */
5245 typedef union LDKCResult_NetAddressu8ZPtr {
5246    /**
5247     * A pointer to the contents in the success state.
5248     * Reading from this pointer when `result_ok` is not set is undefined.
5249     */
5250    struct LDKNetAddress *result;
5251    /**
5252     * A pointer to the contents in the error state.
5253     * Reading from this pointer when `result_ok` is set is undefined.
5254     */
5255    uint8_t *err;
5256 } LDKCResult_NetAddressu8ZPtr;
5257
5258 /**
5259  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5260  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5261  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5262  */
5263 typedef struct LDKCResult_NetAddressu8Z {
5264    /**
5265     * The contents of this CResult_NetAddressu8Z, accessible via either
5266     * `err` or `result` depending on the state of `result_ok`.
5267     */
5268    union LDKCResult_NetAddressu8ZPtr contents;
5269    /**
5270     * Whether this CResult_NetAddressu8Z represents a success state.
5271     */
5272    bool result_ok;
5273 } LDKCResult_NetAddressu8Z;
5274
5275 /**
5276  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5277  */
5278 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5279    /**
5280     * A pointer to the contents in the success state.
5281     * Reading from this pointer when `result_ok` is not set is undefined.
5282     */
5283    struct LDKCResult_NetAddressu8Z *result;
5284    /**
5285     * A pointer to the contents in the error state.
5286     * Reading from this pointer when `result_ok` is set is undefined.
5287     */
5288    struct LDKDecodeError *err;
5289 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5290
5291 /**
5292  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5293  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5294  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5295  */
5296 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5297    /**
5298     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5299     * `err` or `result` depending on the state of `result_ok`.
5300     */
5301    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5302    /**
5303     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5304     */
5305    bool result_ok;
5306 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5307
5308
5309
5310 /**
5311  * An update_add_htlc message to be sent or received from a peer
5312  */
5313 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
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    LDKnativeUpdateAddHTLC *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 } LDKUpdateAddHTLC;
5327
5328 /**
5329  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5330  * This corresponds to std::vector in C++
5331  */
5332 typedef struct LDKCVec_UpdateAddHTLCZ {
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 LDKUpdateAddHTLC *data;
5338    /**
5339     * The number of elements pointed to by `data`.
5340     */
5341    uintptr_t datalen;
5342 } LDKCVec_UpdateAddHTLCZ;
5343
5344
5345
5346 /**
5347  * An update_fulfill_htlc message to be sent or received from a peer
5348  */
5349 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5350    /**
5351     * A pointer to the opaque Rust object.
5352     * Nearly everywhere, inner must be non-null, however in places where
5353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5354     */
5355    LDKnativeUpdateFulfillHTLC *inner;
5356    /**
5357     * Indicates that this is the only struct which contains the same pointer.
5358     * Rust functions which take ownership of an object provided via an argument require
5359     * this to be true and invalidate the object pointed to by inner.
5360     */
5361    bool is_owned;
5362 } LDKUpdateFulfillHTLC;
5363
5364 /**
5365  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5366  * This corresponds to std::vector in C++
5367  */
5368 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5369    /**
5370     * The elements in the array.
5371     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5372     */
5373    struct LDKUpdateFulfillHTLC *data;
5374    /**
5375     * The number of elements pointed to by `data`.
5376     */
5377    uintptr_t datalen;
5378 } LDKCVec_UpdateFulfillHTLCZ;
5379
5380
5381
5382 /**
5383  * An update_fail_htlc message to be sent or received from a peer
5384  */
5385 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5386    /**
5387     * A pointer to the opaque Rust object.
5388     * Nearly everywhere, inner must be non-null, however in places where
5389     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5390     */
5391    LDKnativeUpdateFailHTLC *inner;
5392    /**
5393     * Indicates that this is the only struct which contains the same pointer.
5394     * Rust functions which take ownership of an object provided via an argument require
5395     * this to be true and invalidate the object pointed to by inner.
5396     */
5397    bool is_owned;
5398 } LDKUpdateFailHTLC;
5399
5400 /**
5401  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5402  * This corresponds to std::vector in C++
5403  */
5404 typedef struct LDKCVec_UpdateFailHTLCZ {
5405    /**
5406     * The elements in the array.
5407     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5408     */
5409    struct LDKUpdateFailHTLC *data;
5410    /**
5411     * The number of elements pointed to by `data`.
5412     */
5413    uintptr_t datalen;
5414 } LDKCVec_UpdateFailHTLCZ;
5415
5416
5417
5418 /**
5419  * An update_fail_malformed_htlc message to be sent or received from a peer
5420  */
5421 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5422    /**
5423     * A pointer to the opaque Rust object.
5424     * Nearly everywhere, inner must be non-null, however in places where
5425     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5426     */
5427    LDKnativeUpdateFailMalformedHTLC *inner;
5428    /**
5429     * Indicates that this is the only struct which contains the same pointer.
5430     * Rust functions which take ownership of an object provided via an argument require
5431     * this to be true and invalidate the object pointed to by inner.
5432     */
5433    bool is_owned;
5434 } LDKUpdateFailMalformedHTLC;
5435
5436 /**
5437  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5438  * This corresponds to std::vector in C++
5439  */
5440 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5441    /**
5442     * The elements in the array.
5443     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5444     */
5445    struct LDKUpdateFailMalformedHTLC *data;
5446    /**
5447     * The number of elements pointed to by `data`.
5448     */
5449    uintptr_t datalen;
5450 } LDKCVec_UpdateFailMalformedHTLCZ;
5451
5452 /**
5453  * The contents of CResult_AcceptChannelDecodeErrorZ
5454  */
5455 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5456    /**
5457     * A pointer to the contents in the success state.
5458     * Reading from this pointer when `result_ok` is not set is undefined.
5459     */
5460    struct LDKAcceptChannel *result;
5461    /**
5462     * A pointer to the contents in the error state.
5463     * Reading from this pointer when `result_ok` is set is undefined.
5464     */
5465    struct LDKDecodeError *err;
5466 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5467
5468 /**
5469  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5470  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5471  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5472  */
5473 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5474    /**
5475     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5476     * `err` or `result` depending on the state of `result_ok`.
5477     */
5478    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5479    /**
5480     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5481     */
5482    bool result_ok;
5483 } LDKCResult_AcceptChannelDecodeErrorZ;
5484
5485 /**
5486  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5487  */
5488 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
5489    /**
5490     * A pointer to the contents in the success state.
5491     * Reading from this pointer when `result_ok` is not set is undefined.
5492     */
5493    struct LDKAnnouncementSignatures *result;
5494    /**
5495     * A pointer to the contents in the error state.
5496     * Reading from this pointer when `result_ok` is set is undefined.
5497     */
5498    struct LDKDecodeError *err;
5499 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
5500
5501 /**
5502  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5503  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5504  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5505  */
5506 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
5507    /**
5508     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5509     * `err` or `result` depending on the state of `result_ok`.
5510     */
5511    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5512    /**
5513     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5514     */
5515    bool result_ok;
5516 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5517
5518 /**
5519  * The contents of CResult_ChannelReestablishDecodeErrorZ
5520  */
5521 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
5522    /**
5523     * A pointer to the contents in the success state.
5524     * Reading from this pointer when `result_ok` is not set is undefined.
5525     */
5526    struct LDKChannelReestablish *result;
5527    /**
5528     * A pointer to the contents in the error state.
5529     * Reading from this pointer when `result_ok` is set is undefined.
5530     */
5531    struct LDKDecodeError *err;
5532 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
5533
5534 /**
5535  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5536  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5538  */
5539 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
5540    /**
5541     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5542     * `err` or `result` depending on the state of `result_ok`.
5543     */
5544    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5545    /**
5546     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5547     */
5548    bool result_ok;
5549 } LDKCResult_ChannelReestablishDecodeErrorZ;
5550
5551 /**
5552  * The contents of CResult_ClosingSignedDecodeErrorZ
5553  */
5554 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
5555    /**
5556     * A pointer to the contents in the success state.
5557     * Reading from this pointer when `result_ok` is not set is undefined.
5558     */
5559    struct LDKClosingSigned *result;
5560    /**
5561     * A pointer to the contents in the error state.
5562     * Reading from this pointer when `result_ok` is set is undefined.
5563     */
5564    struct LDKDecodeError *err;
5565 } LDKCResult_ClosingSignedDecodeErrorZPtr;
5566
5567 /**
5568  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5569  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5570  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5571  */
5572 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
5573    /**
5574     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5575     * `err` or `result` depending on the state of `result_ok`.
5576     */
5577    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5578    /**
5579     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5580     */
5581    bool result_ok;
5582 } LDKCResult_ClosingSignedDecodeErrorZ;
5583
5584
5585
5586 /**
5587  * A commitment_signed message to be sent or received from a peer
5588  */
5589 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5590    /**
5591     * A pointer to the opaque Rust object.
5592     * Nearly everywhere, inner must be non-null, however in places where
5593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5594     */
5595    LDKnativeCommitmentSigned *inner;
5596    /**
5597     * Indicates that this is the only struct which contains the same pointer.
5598     * Rust functions which take ownership of an object provided via an argument require
5599     * this to be true and invalidate the object pointed to by inner.
5600     */
5601    bool is_owned;
5602 } LDKCommitmentSigned;
5603
5604 /**
5605  * The contents of CResult_CommitmentSignedDecodeErrorZ
5606  */
5607 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
5608    /**
5609     * A pointer to the contents in the success state.
5610     * Reading from this pointer when `result_ok` is not set is undefined.
5611     */
5612    struct LDKCommitmentSigned *result;
5613    /**
5614     * A pointer to the contents in the error state.
5615     * Reading from this pointer when `result_ok` is set is undefined.
5616     */
5617    struct LDKDecodeError *err;
5618 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
5619
5620 /**
5621  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5622  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5624  */
5625 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
5626    /**
5627     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5628     * `err` or `result` depending on the state of `result_ok`.
5629     */
5630    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5631    /**
5632     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5633     */
5634    bool result_ok;
5635 } LDKCResult_CommitmentSignedDecodeErrorZ;
5636
5637 /**
5638  * The contents of CResult_FundingCreatedDecodeErrorZ
5639  */
5640 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
5641    /**
5642     * A pointer to the contents in the success state.
5643     * Reading from this pointer when `result_ok` is not set is undefined.
5644     */
5645    struct LDKFundingCreated *result;
5646    /**
5647     * A pointer to the contents in the error state.
5648     * Reading from this pointer when `result_ok` is set is undefined.
5649     */
5650    struct LDKDecodeError *err;
5651 } LDKCResult_FundingCreatedDecodeErrorZPtr;
5652
5653 /**
5654  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5655  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5656  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5657  */
5658 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
5659    /**
5660     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5661     * `err` or `result` depending on the state of `result_ok`.
5662     */
5663    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5664    /**
5665     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5666     */
5667    bool result_ok;
5668 } LDKCResult_FundingCreatedDecodeErrorZ;
5669
5670 /**
5671  * The contents of CResult_FundingSignedDecodeErrorZ
5672  */
5673 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
5674    /**
5675     * A pointer to the contents in the success state.
5676     * Reading from this pointer when `result_ok` is not set is undefined.
5677     */
5678    struct LDKFundingSigned *result;
5679    /**
5680     * A pointer to the contents in the error state.
5681     * Reading from this pointer when `result_ok` is set is undefined.
5682     */
5683    struct LDKDecodeError *err;
5684 } LDKCResult_FundingSignedDecodeErrorZPtr;
5685
5686 /**
5687  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5688  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5689  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5690  */
5691 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
5692    /**
5693     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5694     * `err` or `result` depending on the state of `result_ok`.
5695     */
5696    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5697    /**
5698     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5699     */
5700    bool result_ok;
5701 } LDKCResult_FundingSignedDecodeErrorZ;
5702
5703 /**
5704  * The contents of CResult_FundingLockedDecodeErrorZ
5705  */
5706 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
5707    /**
5708     * A pointer to the contents in the success state.
5709     * Reading from this pointer when `result_ok` is not set is undefined.
5710     */
5711    struct LDKFundingLocked *result;
5712    /**
5713     * A pointer to the contents in the error state.
5714     * Reading from this pointer when `result_ok` is set is undefined.
5715     */
5716    struct LDKDecodeError *err;
5717 } LDKCResult_FundingLockedDecodeErrorZPtr;
5718
5719 /**
5720  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5721  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5723  */
5724 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
5725    /**
5726     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5727     * `err` or `result` depending on the state of `result_ok`.
5728     */
5729    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5730    /**
5731     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5732     */
5733    bool result_ok;
5734 } LDKCResult_FundingLockedDecodeErrorZ;
5735
5736
5737
5738 /**
5739  * An init message to be sent or received from a peer
5740  */
5741 typedef struct MUST_USE_STRUCT LDKInit {
5742    /**
5743     * A pointer to the opaque Rust object.
5744     * Nearly everywhere, inner must be non-null, however in places where
5745     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5746     */
5747    LDKnativeInit *inner;
5748    /**
5749     * Indicates that this is the only struct which contains the same pointer.
5750     * Rust functions which take ownership of an object provided via an argument require
5751     * this to be true and invalidate the object pointed to by inner.
5752     */
5753    bool is_owned;
5754 } LDKInit;
5755
5756 /**
5757  * The contents of CResult_InitDecodeErrorZ
5758  */
5759 typedef union LDKCResult_InitDecodeErrorZPtr {
5760    /**
5761     * A pointer to the contents in the success state.
5762     * Reading from this pointer when `result_ok` is not set is undefined.
5763     */
5764    struct LDKInit *result;
5765    /**
5766     * A pointer to the contents in the error state.
5767     * Reading from this pointer when `result_ok` is set is undefined.
5768     */
5769    struct LDKDecodeError *err;
5770 } LDKCResult_InitDecodeErrorZPtr;
5771
5772 /**
5773  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5774  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5775  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5776  */
5777 typedef struct LDKCResult_InitDecodeErrorZ {
5778    /**
5779     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5780     * `err` or `result` depending on the state of `result_ok`.
5781     */
5782    union LDKCResult_InitDecodeErrorZPtr contents;
5783    /**
5784     * Whether this CResult_InitDecodeErrorZ represents a success state.
5785     */
5786    bool result_ok;
5787 } LDKCResult_InitDecodeErrorZ;
5788
5789 /**
5790  * The contents of CResult_OpenChannelDecodeErrorZ
5791  */
5792 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
5793    /**
5794     * A pointer to the contents in the success state.
5795     * Reading from this pointer when `result_ok` is not set is undefined.
5796     */
5797    struct LDKOpenChannel *result;
5798    /**
5799     * A pointer to the contents in the error state.
5800     * Reading from this pointer when `result_ok` is set is undefined.
5801     */
5802    struct LDKDecodeError *err;
5803 } LDKCResult_OpenChannelDecodeErrorZPtr;
5804
5805 /**
5806  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5807  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5808  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5809  */
5810 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
5811    /**
5812     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5813     * `err` or `result` depending on the state of `result_ok`.
5814     */
5815    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5816    /**
5817     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5818     */
5819    bool result_ok;
5820 } LDKCResult_OpenChannelDecodeErrorZ;
5821
5822 /**
5823  * The contents of CResult_RevokeAndACKDecodeErrorZ
5824  */
5825 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
5826    /**
5827     * A pointer to the contents in the success state.
5828     * Reading from this pointer when `result_ok` is not set is undefined.
5829     */
5830    struct LDKRevokeAndACK *result;
5831    /**
5832     * A pointer to the contents in the error state.
5833     * Reading from this pointer when `result_ok` is set is undefined.
5834     */
5835    struct LDKDecodeError *err;
5836 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5837
5838 /**
5839  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5840  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5841  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5842  */
5843 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5844    /**
5845     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5846     * `err` or `result` depending on the state of `result_ok`.
5847     */
5848    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5849    /**
5850     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5851     */
5852    bool result_ok;
5853 } LDKCResult_RevokeAndACKDecodeErrorZ;
5854
5855 /**
5856  * The contents of CResult_ShutdownDecodeErrorZ
5857  */
5858 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5859    /**
5860     * A pointer to the contents in the success state.
5861     * Reading from this pointer when `result_ok` is not set is undefined.
5862     */
5863    struct LDKShutdown *result;
5864    /**
5865     * A pointer to the contents in the error state.
5866     * Reading from this pointer when `result_ok` is set is undefined.
5867     */
5868    struct LDKDecodeError *err;
5869 } LDKCResult_ShutdownDecodeErrorZPtr;
5870
5871 /**
5872  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5873  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5874  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5875  */
5876 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5877    /**
5878     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5879     * `err` or `result` depending on the state of `result_ok`.
5880     */
5881    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5882    /**
5883     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5884     */
5885    bool result_ok;
5886 } LDKCResult_ShutdownDecodeErrorZ;
5887
5888 /**
5889  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5890  */
5891 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5892    /**
5893     * A pointer to the contents in the success state.
5894     * Reading from this pointer when `result_ok` is not set is undefined.
5895     */
5896    struct LDKUpdateFailHTLC *result;
5897    /**
5898     * A pointer to the contents in the error state.
5899     * Reading from this pointer when `result_ok` is set is undefined.
5900     */
5901    struct LDKDecodeError *err;
5902 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5903
5904 /**
5905  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5906  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5908  */
5909 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5910    /**
5911     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5912     * `err` or `result` depending on the state of `result_ok`.
5913     */
5914    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5915    /**
5916     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5917     */
5918    bool result_ok;
5919 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5920
5921 /**
5922  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5923  */
5924 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5925    /**
5926     * A pointer to the contents in the success state.
5927     * Reading from this pointer when `result_ok` is not set is undefined.
5928     */
5929    struct LDKUpdateFailMalformedHTLC *result;
5930    /**
5931     * A pointer to the contents in the error state.
5932     * Reading from this pointer when `result_ok` is set is undefined.
5933     */
5934    struct LDKDecodeError *err;
5935 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5936
5937 /**
5938  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5939  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5941  */
5942 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5943    /**
5944     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5945     * `err` or `result` depending on the state of `result_ok`.
5946     */
5947    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5948    /**
5949     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5950     */
5951    bool result_ok;
5952 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5953
5954
5955
5956 /**
5957  * An update_fee message to be sent or received from a peer
5958  */
5959 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5960    /**
5961     * A pointer to the opaque Rust object.
5962     * Nearly everywhere, inner must be non-null, however in places where
5963     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5964     */
5965    LDKnativeUpdateFee *inner;
5966    /**
5967     * Indicates that this is the only struct which contains the same pointer.
5968     * Rust functions which take ownership of an object provided via an argument require
5969     * this to be true and invalidate the object pointed to by inner.
5970     */
5971    bool is_owned;
5972 } LDKUpdateFee;
5973
5974 /**
5975  * The contents of CResult_UpdateFeeDecodeErrorZ
5976  */
5977 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5978    /**
5979     * A pointer to the contents in the success state.
5980     * Reading from this pointer when `result_ok` is not set is undefined.
5981     */
5982    struct LDKUpdateFee *result;
5983    /**
5984     * A pointer to the contents in the error state.
5985     * Reading from this pointer when `result_ok` is set is undefined.
5986     */
5987    struct LDKDecodeError *err;
5988 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5989
5990 /**
5991  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5992  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5993  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5994  */
5995 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5996    /**
5997     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5998     * `err` or `result` depending on the state of `result_ok`.
5999     */
6000    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
6001    /**
6002     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
6003     */
6004    bool result_ok;
6005 } LDKCResult_UpdateFeeDecodeErrorZ;
6006
6007 /**
6008  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
6009  */
6010 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
6011    /**
6012     * A pointer to the contents in the success state.
6013     * Reading from this pointer when `result_ok` is not set is undefined.
6014     */
6015    struct LDKUpdateFulfillHTLC *result;
6016    /**
6017     * A pointer to the contents in the error state.
6018     * Reading from this pointer when `result_ok` is set is undefined.
6019     */
6020    struct LDKDecodeError *err;
6021 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
6022
6023 /**
6024  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
6025  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6026  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6027  */
6028 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
6029    /**
6030     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
6031     * `err` or `result` depending on the state of `result_ok`.
6032     */
6033    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
6034    /**
6035     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
6036     */
6037    bool result_ok;
6038 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
6039
6040 /**
6041  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
6042  */
6043 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
6044    /**
6045     * A pointer to the contents in the success state.
6046     * Reading from this pointer when `result_ok` is not set is undefined.
6047     */
6048    struct LDKUpdateAddHTLC *result;
6049    /**
6050     * A pointer to the contents in the error state.
6051     * Reading from this pointer when `result_ok` is set is undefined.
6052     */
6053    struct LDKDecodeError *err;
6054 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
6055
6056 /**
6057  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6058  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6060  */
6061 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
6062    /**
6063     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6064     * `err` or `result` depending on the state of `result_ok`.
6065     */
6066    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
6067    /**
6068     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6069     */
6070    bool result_ok;
6071 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
6072
6073
6074
6075 /**
6076  * A ping message to be sent or received from a peer
6077  */
6078 typedef struct MUST_USE_STRUCT LDKPing {
6079    /**
6080     * A pointer to the opaque Rust object.
6081     * Nearly everywhere, inner must be non-null, however in places where
6082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6083     */
6084    LDKnativePing *inner;
6085    /**
6086     * Indicates that this is the only struct which contains the same pointer.
6087     * Rust functions which take ownership of an object provided via an argument require
6088     * this to be true and invalidate the object pointed to by inner.
6089     */
6090    bool is_owned;
6091 } LDKPing;
6092
6093 /**
6094  * The contents of CResult_PingDecodeErrorZ
6095  */
6096 typedef union LDKCResult_PingDecodeErrorZPtr {
6097    /**
6098     * A pointer to the contents in the success state.
6099     * Reading from this pointer when `result_ok` is not set is undefined.
6100     */
6101    struct LDKPing *result;
6102    /**
6103     * A pointer to the contents in the error state.
6104     * Reading from this pointer when `result_ok` is set is undefined.
6105     */
6106    struct LDKDecodeError *err;
6107 } LDKCResult_PingDecodeErrorZPtr;
6108
6109 /**
6110  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6111  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6112  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6113  */
6114 typedef struct LDKCResult_PingDecodeErrorZ {
6115    /**
6116     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6117     * `err` or `result` depending on the state of `result_ok`.
6118     */
6119    union LDKCResult_PingDecodeErrorZPtr contents;
6120    /**
6121     * Whether this CResult_PingDecodeErrorZ represents a success state.
6122     */
6123    bool result_ok;
6124 } LDKCResult_PingDecodeErrorZ;
6125
6126
6127
6128 /**
6129  * A pong message to be sent or received from a peer
6130  */
6131 typedef struct MUST_USE_STRUCT LDKPong {
6132    /**
6133     * A pointer to the opaque Rust object.
6134     * Nearly everywhere, inner must be non-null, however in places where
6135     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6136     */
6137    LDKnativePong *inner;
6138    /**
6139     * Indicates that this is the only struct which contains the same pointer.
6140     * Rust functions which take ownership of an object provided via an argument require
6141     * this to be true and invalidate the object pointed to by inner.
6142     */
6143    bool is_owned;
6144 } LDKPong;
6145
6146 /**
6147  * The contents of CResult_PongDecodeErrorZ
6148  */
6149 typedef union LDKCResult_PongDecodeErrorZPtr {
6150    /**
6151     * A pointer to the contents in the success state.
6152     * Reading from this pointer when `result_ok` is not set is undefined.
6153     */
6154    struct LDKPong *result;
6155    /**
6156     * A pointer to the contents in the error state.
6157     * Reading from this pointer when `result_ok` is set is undefined.
6158     */
6159    struct LDKDecodeError *err;
6160 } LDKCResult_PongDecodeErrorZPtr;
6161
6162 /**
6163  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6164  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6165  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6166  */
6167 typedef struct LDKCResult_PongDecodeErrorZ {
6168    /**
6169     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6170     * `err` or `result` depending on the state of `result_ok`.
6171     */
6172    union LDKCResult_PongDecodeErrorZPtr contents;
6173    /**
6174     * Whether this CResult_PongDecodeErrorZ represents a success state.
6175     */
6176    bool result_ok;
6177 } LDKCResult_PongDecodeErrorZ;
6178
6179 /**
6180  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6181  */
6182 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6183    /**
6184     * A pointer to the contents in the success state.
6185     * Reading from this pointer when `result_ok` is not set is undefined.
6186     */
6187    struct LDKUnsignedChannelAnnouncement *result;
6188    /**
6189     * A pointer to the contents in the error state.
6190     * Reading from this pointer when `result_ok` is set is undefined.
6191     */
6192    struct LDKDecodeError *err;
6193 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
6194
6195 /**
6196  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6197  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6198  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6199  */
6200 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
6201    /**
6202     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6203     * `err` or `result` depending on the state of `result_ok`.
6204     */
6205    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6206    /**
6207     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6208     */
6209    bool result_ok;
6210 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6211
6212 /**
6213  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6214  */
6215 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
6216    /**
6217     * A pointer to the contents in the success state.
6218     * Reading from this pointer when `result_ok` is not set is undefined.
6219     */
6220    struct LDKChannelAnnouncement *result;
6221    /**
6222     * A pointer to the contents in the error state.
6223     * Reading from this pointer when `result_ok` is set is undefined.
6224     */
6225    struct LDKDecodeError *err;
6226 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
6227
6228 /**
6229  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6230  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6232  */
6233 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
6234    /**
6235     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6236     * `err` or `result` depending on the state of `result_ok`.
6237     */
6238    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6239    /**
6240     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6241     */
6242    bool result_ok;
6243 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6244
6245
6246
6247 /**
6248  * The unsigned part of a channel_update
6249  */
6250 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6251    /**
6252     * A pointer to the opaque Rust object.
6253     * Nearly everywhere, inner must be non-null, however in places where
6254     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6255     */
6256    LDKnativeUnsignedChannelUpdate *inner;
6257    /**
6258     * Indicates that this is the only struct which contains the same pointer.
6259     * Rust functions which take ownership of an object provided via an argument require
6260     * this to be true and invalidate the object pointed to by inner.
6261     */
6262    bool is_owned;
6263 } LDKUnsignedChannelUpdate;
6264
6265 /**
6266  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6267  */
6268 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
6269    /**
6270     * A pointer to the contents in the success state.
6271     * Reading from this pointer when `result_ok` is not set is undefined.
6272     */
6273    struct LDKUnsignedChannelUpdate *result;
6274    /**
6275     * A pointer to the contents in the error state.
6276     * Reading from this pointer when `result_ok` is set is undefined.
6277     */
6278    struct LDKDecodeError *err;
6279 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
6280
6281 /**
6282  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6283  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6284  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6285  */
6286 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
6287    /**
6288     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6289     * `err` or `result` depending on the state of `result_ok`.
6290     */
6291    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6292    /**
6293     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6294     */
6295    bool result_ok;
6296 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6297
6298 /**
6299  * The contents of CResult_ChannelUpdateDecodeErrorZ
6300  */
6301 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
6302    /**
6303     * A pointer to the contents in the success state.
6304     * Reading from this pointer when `result_ok` is not set is undefined.
6305     */
6306    struct LDKChannelUpdate *result;
6307    /**
6308     * A pointer to the contents in the error state.
6309     * Reading from this pointer when `result_ok` is set is undefined.
6310     */
6311    struct LDKDecodeError *err;
6312 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
6313
6314 /**
6315  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6316  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6317  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6318  */
6319 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
6320    /**
6321     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6322     * `err` or `result` depending on the state of `result_ok`.
6323     */
6324    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6325    /**
6326     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6327     */
6328    bool result_ok;
6329 } LDKCResult_ChannelUpdateDecodeErrorZ;
6330
6331 /**
6332  * The contents of CResult_ErrorMessageDecodeErrorZ
6333  */
6334 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
6335    /**
6336     * A pointer to the contents in the success state.
6337     * Reading from this pointer when `result_ok` is not set is undefined.
6338     */
6339    struct LDKErrorMessage *result;
6340    /**
6341     * A pointer to the contents in the error state.
6342     * Reading from this pointer when `result_ok` is set is undefined.
6343     */
6344    struct LDKDecodeError *err;
6345 } LDKCResult_ErrorMessageDecodeErrorZPtr;
6346
6347 /**
6348  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6349  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
6350  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6351  */
6352 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
6353    /**
6354     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6355     * `err` or `result` depending on the state of `result_ok`.
6356     */
6357    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6358    /**
6359     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6360     */
6361    bool result_ok;
6362 } LDKCResult_ErrorMessageDecodeErrorZ;
6363
6364
6365
6366 /**
6367  * The unsigned part of a node_announcement
6368  */
6369 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6370    /**
6371     * A pointer to the opaque Rust object.
6372     * Nearly everywhere, inner must be non-null, however in places where
6373     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6374     */
6375    LDKnativeUnsignedNodeAnnouncement *inner;
6376    /**
6377     * Indicates that this is the only struct which contains the same pointer.
6378     * Rust functions which take ownership of an object provided via an argument require
6379     * this to be true and invalidate the object pointed to by inner.
6380     */
6381    bool is_owned;
6382 } LDKUnsignedNodeAnnouncement;
6383
6384 /**
6385  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6386  */
6387 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6388    /**
6389     * A pointer to the contents in the success state.
6390     * Reading from this pointer when `result_ok` is not set is undefined.
6391     */
6392    struct LDKUnsignedNodeAnnouncement *result;
6393    /**
6394     * A pointer to the contents in the error state.
6395     * Reading from this pointer when `result_ok` is set is undefined.
6396     */
6397    struct LDKDecodeError *err;
6398 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
6399
6400 /**
6401  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6402  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6403  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6404  */
6405 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
6406    /**
6407     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6408     * `err` or `result` depending on the state of `result_ok`.
6409     */
6410    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6411    /**
6412     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6413     */
6414    bool result_ok;
6415 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6416
6417 /**
6418  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6419  */
6420 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
6421    /**
6422     * A pointer to the contents in the success state.
6423     * Reading from this pointer when `result_ok` is not set is undefined.
6424     */
6425    struct LDKNodeAnnouncement *result;
6426    /**
6427     * A pointer to the contents in the error state.
6428     * Reading from this pointer when `result_ok` is set is undefined.
6429     */
6430    struct LDKDecodeError *err;
6431 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
6432
6433 /**
6434  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6435  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6437  */
6438 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
6439    /**
6440     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6441     * `err` or `result` depending on the state of `result_ok`.
6442     */
6443    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6444    /**
6445     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6446     */
6447    bool result_ok;
6448 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6449
6450 /**
6451  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6452  */
6453 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
6454    /**
6455     * A pointer to the contents in the success state.
6456     * Reading from this pointer when `result_ok` is not set is undefined.
6457     */
6458    struct LDKQueryShortChannelIds *result;
6459    /**
6460     * A pointer to the contents in the error state.
6461     * Reading from this pointer when `result_ok` is set is undefined.
6462     */
6463    struct LDKDecodeError *err;
6464 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
6465
6466 /**
6467  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6468  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
6469  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6470  */
6471 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
6472    /**
6473     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6474     * `err` or `result` depending on the state of `result_ok`.
6475     */
6476    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6477    /**
6478     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6479     */
6480    bool result_ok;
6481 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6482
6483
6484
6485 /**
6486  * A reply_short_channel_ids_end message is sent as a reply to a
6487  * query_short_channel_ids message. The query recipient makes a best
6488  * effort to respond based on their local network view which may not be
6489  * a perfect view of the network.
6490  */
6491 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6492    /**
6493     * A pointer to the opaque Rust object.
6494     * Nearly everywhere, inner must be non-null, however in places where
6495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6496     */
6497    LDKnativeReplyShortChannelIdsEnd *inner;
6498    /**
6499     * Indicates that this is the only struct which contains the same pointer.
6500     * Rust functions which take ownership of an object provided via an argument require
6501     * this to be true and invalidate the object pointed to by inner.
6502     */
6503    bool is_owned;
6504 } LDKReplyShortChannelIdsEnd;
6505
6506 /**
6507  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6508  */
6509 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6510    /**
6511     * A pointer to the contents in the success state.
6512     * Reading from this pointer when `result_ok` is not set is undefined.
6513     */
6514    struct LDKReplyShortChannelIdsEnd *result;
6515    /**
6516     * A pointer to the contents in the error state.
6517     * Reading from this pointer when `result_ok` is set is undefined.
6518     */
6519    struct LDKDecodeError *err;
6520 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6521
6522 /**
6523  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6524  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
6525  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6526  */
6527 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6528    /**
6529     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6530     * `err` or `result` depending on the state of `result_ok`.
6531     */
6532    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6533    /**
6534     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6535     */
6536    bool result_ok;
6537 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6538
6539 /**
6540  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6541  */
6542 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
6543    /**
6544     * A pointer to the contents in the success state.
6545     * Reading from this pointer when `result_ok` is not set is undefined.
6546     */
6547    struct LDKQueryChannelRange *result;
6548    /**
6549     * A pointer to the contents in the error state.
6550     * Reading from this pointer when `result_ok` is set is undefined.
6551     */
6552    struct LDKDecodeError *err;
6553 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
6554
6555 /**
6556  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6557  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6558  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6559  */
6560 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
6561    /**
6562     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6563     * `err` or `result` depending on the state of `result_ok`.
6564     */
6565    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6566    /**
6567     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6568     */
6569    bool result_ok;
6570 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6571
6572 /**
6573  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6574  */
6575 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
6576    /**
6577     * A pointer to the contents in the success state.
6578     * Reading from this pointer when `result_ok` is not set is undefined.
6579     */
6580    struct LDKReplyChannelRange *result;
6581    /**
6582     * A pointer to the contents in the error state.
6583     * Reading from this pointer when `result_ok` is set is undefined.
6584     */
6585    struct LDKDecodeError *err;
6586 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
6587
6588 /**
6589  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6590  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6592  */
6593 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
6594    /**
6595     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6596     * `err` or `result` depending on the state of `result_ok`.
6597     */
6598    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6599    /**
6600     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6601     */
6602    bool result_ok;
6603 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6604
6605
6606
6607 /**
6608  * A gossip_timestamp_filter message is used by a node to request
6609  * gossip relay for messages in the requested time range when the
6610  * gossip_queries feature has been negotiated.
6611  */
6612 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6613    /**
6614     * A pointer to the opaque Rust object.
6615     * Nearly everywhere, inner must be non-null, however in places where
6616     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6617     */
6618    LDKnativeGossipTimestampFilter *inner;
6619    /**
6620     * Indicates that this is the only struct which contains the same pointer.
6621     * Rust functions which take ownership of an object provided via an argument require
6622     * this to be true and invalidate the object pointed to by inner.
6623     */
6624    bool is_owned;
6625 } LDKGossipTimestampFilter;
6626
6627 /**
6628  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6629  */
6630 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6631    /**
6632     * A pointer to the contents in the success state.
6633     * Reading from this pointer when `result_ok` is not set is undefined.
6634     */
6635    struct LDKGossipTimestampFilter *result;
6636    /**
6637     * A pointer to the contents in the error state.
6638     * Reading from this pointer when `result_ok` is set is undefined.
6639     */
6640    struct LDKDecodeError *err;
6641 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6642
6643 /**
6644  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6645  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
6646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6647  */
6648 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6649    /**
6650     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6651     * `err` or `result` depending on the state of `result_ok`.
6652     */
6653    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6654    /**
6655     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6656     */
6657    bool result_ok;
6658 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6659
6660 /**
6661  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6662  */
6663 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6664    /**
6665     * A pointer to the contents in the success state.
6666     * Reading from this pointer when `result_ok` is not set is undefined.
6667     */
6668    struct LDKSpendableOutputDescriptor *result;
6669    /**
6670     * A pointer to the contents in the error state.
6671     * Reading from this pointer when `result_ok` is set is undefined.
6672     */
6673    struct LDKDecodeError *err;
6674 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6675
6676 /**
6677  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6678  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6680  */
6681 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6682    /**
6683     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6684     * `err` or `result` depending on the state of `result_ok`.
6685     */
6686    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6687    /**
6688     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6689     */
6690    bool result_ok;
6691 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6692
6693 /**
6694  * The contents of CResult_SignDecodeErrorZ
6695  */
6696 typedef union LDKCResult_SignDecodeErrorZPtr {
6697    /**
6698     * A pointer to the contents in the success state.
6699     * Reading from this pointer when `result_ok` is not set is undefined.
6700     */
6701    struct LDKSign *result;
6702    /**
6703     * A pointer to the contents in the error state.
6704     * Reading from this pointer when `result_ok` is set is undefined.
6705     */
6706    struct LDKDecodeError *err;
6707 } LDKCResult_SignDecodeErrorZPtr;
6708
6709 /**
6710  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6711  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6713  */
6714 typedef struct LDKCResult_SignDecodeErrorZ {
6715    /**
6716     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6717     * `err` or `result` depending on the state of `result_ok`.
6718     */
6719    union LDKCResult_SignDecodeErrorZPtr contents;
6720    /**
6721     * Whether this CResult_SignDecodeErrorZ represents a success state.
6722     */
6723    bool result_ok;
6724 } LDKCResult_SignDecodeErrorZ;
6725
6726 /**
6727  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6728  * This corresponds to std::vector in C++
6729  */
6730 typedef struct LDKCVec_CVec_u8ZZ {
6731    /**
6732     * The elements in the array.
6733     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6734     */
6735    struct LDKCVec_u8Z *data;
6736    /**
6737     * The number of elements pointed to by `data`.
6738     */
6739    uintptr_t datalen;
6740 } LDKCVec_CVec_u8ZZ;
6741
6742 /**
6743  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6744  */
6745 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6746    /**
6747     * A pointer to the contents in the success state.
6748     * Reading from this pointer when `result_ok` is not set is undefined.
6749     */
6750    struct LDKCVec_CVec_u8ZZ *result;
6751    /**
6752     * Note that this value is always NULL, as there are no contents in the Err variant
6753     */
6754    void *err;
6755 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6756
6757 /**
6758  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6759  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6760  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6761  */
6762 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6763    /**
6764     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6765     * `err` or `result` depending on the state of `result_ok`.
6766     */
6767    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6768    /**
6769     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6770     */
6771    bool result_ok;
6772 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6773
6774
6775
6776 /**
6777  * A simple implementation of Sign that just keeps the private keys in memory.
6778  *
6779  * This implementation performs no policy checks and is insufficient by itself as
6780  * a secure external signer.
6781  */
6782 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6783    /**
6784     * A pointer to the opaque Rust object.
6785     * Nearly everywhere, inner must be non-null, however in places where
6786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6787     */
6788    LDKnativeInMemorySigner *inner;
6789    /**
6790     * Indicates that this is the only struct which contains the same pointer.
6791     * Rust functions which take ownership of an object provided via an argument require
6792     * this to be true and invalidate the object pointed to by inner.
6793     */
6794    bool is_owned;
6795 } LDKInMemorySigner;
6796
6797 /**
6798  * The contents of CResult_InMemorySignerDecodeErrorZ
6799  */
6800 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6801    /**
6802     * A pointer to the contents in the success state.
6803     * Reading from this pointer when `result_ok` is not set is undefined.
6804     */
6805    struct LDKInMemorySigner *result;
6806    /**
6807     * A pointer to the contents in the error state.
6808     * Reading from this pointer when `result_ok` is set is undefined.
6809     */
6810    struct LDKDecodeError *err;
6811 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6812
6813 /**
6814  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6815  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6817  */
6818 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6819    /**
6820     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6821     * `err` or `result` depending on the state of `result_ok`.
6822     */
6823    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6824    /**
6825     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6826     */
6827    bool result_ok;
6828 } LDKCResult_InMemorySignerDecodeErrorZ;
6829
6830 /**
6831  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6832  * This corresponds to std::vector in C++
6833  */
6834 typedef struct LDKCVec_TxOutZ {
6835    /**
6836     * The elements in the array.
6837     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6838     */
6839    struct LDKTxOut *data;
6840    /**
6841     * The number of elements pointed to by `data`.
6842     */
6843    uintptr_t datalen;
6844 } LDKCVec_TxOutZ;
6845
6846 /**
6847  * The contents of CResult_TransactionNoneZ
6848  */
6849 typedef union LDKCResult_TransactionNoneZPtr {
6850    /**
6851     * A pointer to the contents in the success state.
6852     * Reading from this pointer when `result_ok` is not set is undefined.
6853     */
6854    struct LDKTransaction *result;
6855    /**
6856     * Note that this value is always NULL, as there are no contents in the Err variant
6857     */
6858    void *err;
6859 } LDKCResult_TransactionNoneZPtr;
6860
6861 /**
6862  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6863  * containing a crate::c_types::Transaction on success and a () on failure.
6864  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6865  */
6866 typedef struct LDKCResult_TransactionNoneZ {
6867    /**
6868     * The contents of this CResult_TransactionNoneZ, accessible via either
6869     * `err` or `result` depending on the state of `result_ok`.
6870     */
6871    union LDKCResult_TransactionNoneZPtr contents;
6872    /**
6873     * Whether this CResult_TransactionNoneZ represents a success state.
6874     */
6875    bool result_ok;
6876 } LDKCResult_TransactionNoneZ;
6877
6878 /**
6879  * The contents of CResult_NoneErrorZ
6880  */
6881 typedef union LDKCResult_NoneErrorZPtr {
6882    /**
6883     * Note that this value is always NULL, as there are no contents in the OK variant
6884     */
6885    void *result;
6886    /**
6887     * A pointer to the contents in the error state.
6888     * Reading from this pointer when `result_ok` is set is undefined.
6889     */
6890    enum LDKIOError *err;
6891 } LDKCResult_NoneErrorZPtr;
6892
6893 /**
6894  * A CResult_NoneErrorZ represents the result of a fallible operation,
6895  * containing a () on success and a crate::c_types::IOError on failure.
6896  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6897  */
6898 typedef struct LDKCResult_NoneErrorZ {
6899    /**
6900     * The contents of this CResult_NoneErrorZ, accessible via either
6901     * `err` or `result` depending on the state of `result_ok`.
6902     */
6903    union LDKCResult_NoneErrorZPtr contents;
6904    /**
6905     * Whether this CResult_NoneErrorZ represents a success state.
6906     */
6907    bool result_ok;
6908 } LDKCResult_NoneErrorZ;
6909
6910 /**
6911  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6912  * This corresponds to std::vector in C++
6913  */
6914 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6915    /**
6916     * The elements in the array.
6917     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6918     */
6919    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6920    /**
6921     * The number of elements pointed to by `data`.
6922     */
6923    uintptr_t datalen;
6924 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6925
6926 /**
6927  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6928  */
6929 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6930    /**
6931     * A pointer to the contents in the success state.
6932     * Reading from this pointer when `result_ok` is not set is undefined.
6933     */
6934    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6935    /**
6936     * A pointer to the contents in the error state.
6937     * Reading from this pointer when `result_ok` is set is undefined.
6938     */
6939    enum LDKIOError *err;
6940 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6941
6942 /**
6943  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6944  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6945  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6946  */
6947 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6948    /**
6949     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6950     * `err` or `result` depending on the state of `result_ok`.
6951     */
6952    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6953    /**
6954     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6955     */
6956    bool result_ok;
6957 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6958
6959 /**
6960  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6961  * too-high values)
6962  */
6963 typedef enum LDKAPIError_Tag {
6964    /**
6965     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6966     * are documented, but generally indicates some precondition of a function was violated.
6967     */
6968    LDKAPIError_APIMisuseError,
6969    /**
6970     * Due to a high feerate, we were unable to complete the request.
6971     * For example, this may be returned if the feerate implies we cannot open a channel at the
6972     * requested value, but opening a larger channel would succeed.
6973     */
6974    LDKAPIError_FeeRateTooHigh,
6975    /**
6976     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6977     * too-many-hops, etc).
6978     */
6979    LDKAPIError_RouteError,
6980    /**
6981     * We were unable to complete the request as the Channel required to do so is unable to
6982     * complete the request (or was not found). This can take many forms, including disconnected
6983     * peer, channel at capacity, channel shutting down, etc.
6984     */
6985    LDKAPIError_ChannelUnavailable,
6986    /**
6987     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6988     * attempted action to fail.
6989     */
6990    LDKAPIError_MonitorUpdateFailed,
6991    /**
6992     * Must be last for serialization purposes
6993     */
6994    LDKAPIError_Sentinel,
6995 } LDKAPIError_Tag;
6996
6997 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6998    /**
6999     * A human-readable error message
7000     */
7001    struct LDKCVec_u8Z err;
7002 } LDKAPIError_LDKAPIMisuseError_Body;
7003
7004 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7005    /**
7006     * A human-readable error message
7007     */
7008    struct LDKCVec_u8Z err;
7009    /**
7010     * The feerate which was too high.
7011     */
7012    uint32_t feerate;
7013 } LDKAPIError_LDKFeeRateTooHigh_Body;
7014
7015 typedef struct LDKAPIError_LDKRouteError_Body {
7016    /**
7017     * A human-readable error message
7018     */
7019    struct LDKStr err;
7020 } LDKAPIError_LDKRouteError_Body;
7021
7022 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7023    /**
7024     * A human-readable error message
7025     */
7026    struct LDKCVec_u8Z err;
7027 } LDKAPIError_LDKChannelUnavailable_Body;
7028
7029 typedef struct MUST_USE_STRUCT LDKAPIError {
7030    LDKAPIError_Tag tag;
7031    union {
7032       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7033       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7034       LDKAPIError_LDKRouteError_Body route_error;
7035       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7036    };
7037 } LDKAPIError;
7038
7039 /**
7040  * The contents of CResult_NoneAPIErrorZ
7041  */
7042 typedef union LDKCResult_NoneAPIErrorZPtr {
7043    /**
7044     * Note that this value is always NULL, as there are no contents in the OK variant
7045     */
7046    void *result;
7047    /**
7048     * A pointer to the contents in the error state.
7049     * Reading from this pointer when `result_ok` is set is undefined.
7050     */
7051    struct LDKAPIError *err;
7052 } LDKCResult_NoneAPIErrorZPtr;
7053
7054 /**
7055  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7056  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7057  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7058  */
7059 typedef struct LDKCResult_NoneAPIErrorZ {
7060    /**
7061     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7062     * `err` or `result` depending on the state of `result_ok`.
7063     */
7064    union LDKCResult_NoneAPIErrorZPtr contents;
7065    /**
7066     * Whether this CResult_NoneAPIErrorZ represents a success state.
7067     */
7068    bool result_ok;
7069 } LDKCResult_NoneAPIErrorZ;
7070
7071 /**
7072  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7073  * This corresponds to std::vector in C++
7074  */
7075 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7076    /**
7077     * The elements in the array.
7078     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7079     */
7080    struct LDKCResult_NoneAPIErrorZ *data;
7081    /**
7082     * The number of elements pointed to by `data`.
7083     */
7084    uintptr_t datalen;
7085 } LDKCVec_CResult_NoneAPIErrorZZ;
7086
7087 /**
7088  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7089  * This corresponds to std::vector in C++
7090  */
7091 typedef struct LDKCVec_APIErrorZ {
7092    /**
7093     * The elements in the array.
7094     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7095     */
7096    struct LDKAPIError *data;
7097    /**
7098     * The number of elements pointed to by `data`.
7099     */
7100    uintptr_t datalen;
7101 } LDKCVec_APIErrorZ;
7102
7103 /**
7104  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7105  * Err() type describing which state the payment is in, see the description of individual enum
7106  * states for more.
7107  */
7108 typedef enum LDKPaymentSendFailure_Tag {
7109    /**
7110     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7111     * send the payment at all. No channel state has been changed or messages sent to peers, and
7112     * once you've changed the parameter at error, you can freely retry the payment in full.
7113     */
7114    LDKPaymentSendFailure_ParameterError,
7115    /**
7116     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7117     * from attempting to send the payment at all. No channel state has been changed or messages
7118     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7119     * payment in full.
7120     *
7121     * The results here are ordered the same as the paths in the route object which was passed to
7122     * send_payment.
7123     */
7124    LDKPaymentSendFailure_PathParameterError,
7125    /**
7126     * All paths which were attempted failed to send, with no channel state change taking place.
7127     * You can freely retry the payment in full (though you probably want to do so over different
7128     * paths than the ones selected).
7129     */
7130    LDKPaymentSendFailure_AllFailedRetrySafe,
7131    /**
7132     * Some paths which were attempted failed to send, though possibly not all. At least some
7133     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7134     * in over-/re-payment.
7135     *
7136     * The results here are ordered the same as the paths in the route object which was passed to
7137     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7138     * retried (though there is currently no API with which to do so).
7139     *
7140     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7141     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7142     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7143     * with the latest update_id.
7144     */
7145    LDKPaymentSendFailure_PartialFailure,
7146    /**
7147     * Must be last for serialization purposes
7148     */
7149    LDKPaymentSendFailure_Sentinel,
7150 } LDKPaymentSendFailure_Tag;
7151
7152 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7153    LDKPaymentSendFailure_Tag tag;
7154    union {
7155       struct {
7156          struct LDKAPIError parameter_error;
7157       };
7158       struct {
7159          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7160       };
7161       struct {
7162          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7163       };
7164       struct {
7165          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
7166       };
7167    };
7168 } LDKPaymentSendFailure;
7169
7170 /**
7171  * The contents of CResult_NonePaymentSendFailureZ
7172  */
7173 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7174    /**
7175     * Note that this value is always NULL, as there are no contents in the OK variant
7176     */
7177    void *result;
7178    /**
7179     * A pointer to the contents in the error state.
7180     * Reading from this pointer when `result_ok` is set is undefined.
7181     */
7182    struct LDKPaymentSendFailure *err;
7183 } LDKCResult_NonePaymentSendFailureZPtr;
7184
7185 /**
7186  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7187  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7188  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7189  */
7190 typedef struct LDKCResult_NonePaymentSendFailureZ {
7191    /**
7192     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7193     * `err` or `result` depending on the state of `result_ok`.
7194     */
7195    union LDKCResult_NonePaymentSendFailureZPtr contents;
7196    /**
7197     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7198     */
7199    bool result_ok;
7200 } LDKCResult_NonePaymentSendFailureZ;
7201
7202 /**
7203  * A tuple of 2 elements. See the individual fields for the types contained.
7204  */
7205 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7206    /**
7207     * The element at position 0
7208     */
7209    struct LDKThirtyTwoBytes a;
7210    /**
7211     * The element at position 1
7212     */
7213    struct LDKThirtyTwoBytes b;
7214 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7215
7216 /**
7217  * The contents of CResult_PaymentSecretAPIErrorZ
7218  */
7219 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7220    /**
7221     * A pointer to the contents in the success state.
7222     * Reading from this pointer when `result_ok` is not set is undefined.
7223     */
7224    struct LDKThirtyTwoBytes *result;
7225    /**
7226     * A pointer to the contents in the error state.
7227     * Reading from this pointer when `result_ok` is set is undefined.
7228     */
7229    struct LDKAPIError *err;
7230 } LDKCResult_PaymentSecretAPIErrorZPtr;
7231
7232 /**
7233  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7234  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7235  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7236  */
7237 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7238    /**
7239     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7240     * `err` or `result` depending on the state of `result_ok`.
7241     */
7242    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7243    /**
7244     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7245     */
7246    bool result_ok;
7247 } LDKCResult_PaymentSecretAPIErrorZ;
7248
7249 /**
7250  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7251  * This corresponds to std::vector in C++
7252  */
7253 typedef struct LDKCVec_ChannelMonitorZ {
7254    /**
7255     * The elements in the array.
7256     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7257     */
7258    struct LDKChannelMonitor *data;
7259    /**
7260     * The number of elements pointed to by `data`.
7261     */
7262    uintptr_t datalen;
7263 } LDKCVec_ChannelMonitorZ;
7264
7265 /**
7266  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7267  * blocks are connected and disconnected.
7268  *
7269  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7270  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7271  * channel state changes and HTLCs are resolved. See method documentation for specific
7272  * requirements.
7273  *
7274  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7275  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7276  * without taking any further action such as persisting the current state.
7277  *
7278  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7279  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7280  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7281  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7282  * multiple instances.
7283  *
7284  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7285  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7286  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
7287  */
7288 typedef struct LDKWatch {
7289    /**
7290     * An opaque pointer which is passed to your function implementations as an argument.
7291     * This has no meaning in the LDK, and can be NULL or any other value.
7292     */
7293    void *this_arg;
7294    /**
7295     * Watches a channel identified by `funding_txo` using `monitor`.
7296     *
7297     * Implementations are responsible for watching the chain for the funding transaction along
7298     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7299     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7300     *
7301     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7302     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7303     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7304     */
7305    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7306    /**
7307     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7308     *
7309     * Implementations must call [`update_monitor`] with the given update. See
7310     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7311     *
7312     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7313     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7314     */
7315    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7316    /**
7317     * Returns any monitor events since the last call. Subsequent calls must only return new
7318     * events.
7319     */
7320    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
7321    /**
7322     * Frees any resources associated with this object given its this_arg pointer.
7323     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7324     */
7325    void (*free)(void *this_arg);
7326 } LDKWatch;
7327
7328 /**
7329  * An interface to send a transaction to the Bitcoin network.
7330  */
7331 typedef struct LDKBroadcasterInterface {
7332    /**
7333     * An opaque pointer which is passed to your function implementations as an argument.
7334     * This has no meaning in the LDK, and can be NULL or any other value.
7335     */
7336    void *this_arg;
7337    /**
7338     * Sends a transaction out to (hopefully) be mined.
7339     */
7340    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7341    /**
7342     * Frees any resources associated with this object given its this_arg pointer.
7343     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7344     */
7345    void (*free)(void *this_arg);
7346 } LDKBroadcasterInterface;
7347
7348 /**
7349  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7350  * own the memory pointed to by data.
7351  */
7352 typedef struct LDKu8slice {
7353    /**
7354     * A pointer to the byte buffer
7355     */
7356    const uint8_t *data;
7357    /**
7358     * The number of bytes pointed to by `data`.
7359     */
7360    uintptr_t datalen;
7361 } LDKu8slice;
7362
7363 /**
7364  * A trait to describe an object which can get user secrets and key material.
7365  */
7366 typedef struct LDKKeysInterface {
7367    /**
7368     * An opaque pointer which is passed to your function implementations as an argument.
7369     * This has no meaning in the LDK, and can be NULL or any other value.
7370     */
7371    void *this_arg;
7372    /**
7373     * Get node secret key (aka node_id or network_key).
7374     *
7375     * This method must return the same value each time it is called.
7376     */
7377    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
7378    /**
7379     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7380     *
7381     * This method should return a different value each time it is called, to avoid linking
7382     * on-chain funds across channels as controlled to the same user.
7383     */
7384    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7385    /**
7386     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
7387     * a channel.
7388     *
7389     * This method should return a different value each time it is called, to avoid linking
7390     * on-chain funds across channels as controlled to the same user.
7391     */
7392    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
7393    /**
7394     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7395     * restarted with some stale data!
7396     *
7397     * This method must return a different value each time it is called.
7398     */
7399    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7400    /**
7401     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7402     * onion packets and for temporary channel IDs. There is no requirement that these be
7403     * persisted anywhere, though they must be unique across restarts.
7404     *
7405     * This method must return a different value each time it is called.
7406     */
7407    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7408    /**
7409     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7410     * This is only called during deserialization of other objects which contain
7411     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7412     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7413     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7414     * you've read all of the provided bytes to ensure no corruption occurred.
7415     */
7416    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7417    /**
7418     * Frees any resources associated with this object given its this_arg pointer.
7419     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7420     */
7421    void (*free)(void *this_arg);
7422 } LDKKeysInterface;
7423
7424 /**
7425  * A trait which should be implemented to provide feerate information on a number of time
7426  * horizons.
7427  *
7428  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7429  * called from inside the library in response to chain events, P2P events, or timer events).
7430  */
7431 typedef struct LDKFeeEstimator {
7432    /**
7433     * An opaque pointer which is passed to your function implementations as an argument.
7434     * This has no meaning in the LDK, and can be NULL or any other value.
7435     */
7436    void *this_arg;
7437    /**
7438     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7439     *
7440     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
7441     * don't put us below 1 satoshi-per-byte).
7442     *
7443     * This translates to:
7444     *  * satoshis-per-byte * 250
7445     *  * ceil(satoshis-per-kbyte / 4)
7446     */
7447    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7448    /**
7449     * Frees any resources associated with this object given its this_arg pointer.
7450     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7451     */
7452    void (*free)(void *this_arg);
7453 } LDKFeeEstimator;
7454
7455 /**
7456  * A trait encapsulating the operations required of a logger
7457  */
7458 typedef struct LDKLogger {
7459    /**
7460     * An opaque pointer which is passed to your function implementations as an argument.
7461     * This has no meaning in the LDK, and can be NULL or any other value.
7462     */
7463    void *this_arg;
7464    /**
7465     * Logs the `Record`
7466     */
7467    void (*log)(const void *this_arg, const char *record);
7468    /**
7469     * Frees any resources associated with this object given its this_arg pointer.
7470     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7471     */
7472    void (*free)(void *this_arg);
7473 } LDKLogger;
7474
7475
7476
7477 /**
7478  * Manager which keeps track of a number of channels and sends messages to the appropriate
7479  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7480  *
7481  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7482  * to individual Channels.
7483  *
7484  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7485  * all peers during write/read (though does not modify this instance, only the instance being
7486  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7487  * called funding_transaction_generated for outbound channels).
7488  *
7489  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7490  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7491  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7492  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7493  * the serialization process). If the deserialized version is out-of-date compared to the
7494  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7495  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7496  *
7497  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7498  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7499  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7500  * block_connected() to step towards your best block) upon deserialization before using the
7501  * object!
7502  *
7503  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7504  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7505  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7506  * offline for a full minute. In order to track this, you must call
7507  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7508  *
7509  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7510  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7511  * essentially you should default to using a SimpleRefChannelManager, and use a
7512  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7513  * you're using lightning-net-tokio.
7514  */
7515 typedef struct MUST_USE_STRUCT LDKChannelManager {
7516    /**
7517     * A pointer to the opaque Rust object.
7518     * Nearly everywhere, inner must be non-null, however in places where
7519     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7520     */
7521    LDKnativeChannelManager *inner;
7522    /**
7523     * Indicates that this is the only struct which contains the same pointer.
7524     * Rust functions which take ownership of an object provided via an argument require
7525     * this to be true and invalidate the object pointed to by inner.
7526     */
7527    bool is_owned;
7528 } LDKChannelManager;
7529
7530 /**
7531  * A tuple of 2 elements. See the individual fields for the types contained.
7532  */
7533 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7534    /**
7535     * The element at position 0
7536     */
7537    struct LDKThirtyTwoBytes a;
7538    /**
7539     * The element at position 1
7540     */
7541    struct LDKChannelManager b;
7542 } LDKC2Tuple_BlockHashChannelManagerZ;
7543
7544 /**
7545  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7546  */
7547 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7548    /**
7549     * A pointer to the contents in the success state.
7550     * Reading from this pointer when `result_ok` is not set is undefined.
7551     */
7552    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7553    /**
7554     * A pointer to the contents in the error state.
7555     * Reading from this pointer when `result_ok` is set is undefined.
7556     */
7557    struct LDKDecodeError *err;
7558 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7559
7560 /**
7561  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7562  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7563  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7564  */
7565 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7566    /**
7567     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7568     * `err` or `result` depending on the state of `result_ok`.
7569     */
7570    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7571    /**
7572     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7573     */
7574    bool result_ok;
7575 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7576
7577 /**
7578  * A trait indicating an object may generate message send events
7579  */
7580 typedef struct LDKMessageSendEventsProvider {
7581    /**
7582     * An opaque pointer which is passed to your function implementations as an argument.
7583     * This has no meaning in the LDK, and can be NULL or any other value.
7584     */
7585    void *this_arg;
7586    /**
7587     * Gets the list of pending events which were generated by previous actions, clearing the list
7588     * in the process.
7589     */
7590    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7591    /**
7592     * Frees any resources associated with this object given its this_arg pointer.
7593     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7594     */
7595    void (*free)(void *this_arg);
7596 } LDKMessageSendEventsProvider;
7597
7598 /**
7599  * A trait indicating an object may generate events
7600  */
7601 typedef struct LDKEventsProvider {
7602    /**
7603     * An opaque pointer which is passed to your function implementations as an argument.
7604     * This has no meaning in the LDK, and can be NULL or any other value.
7605     */
7606    void *this_arg;
7607    /**
7608     * Gets the list of pending events which were generated by previous actions, clearing the list
7609     * in the process.
7610     */
7611    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
7612    /**
7613     * Frees any resources associated with this object given its this_arg pointer.
7614     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7615     */
7616    void (*free)(void *this_arg);
7617 } LDKEventsProvider;
7618
7619
7620
7621 /**
7622  * Configuration we set when applicable.
7623  *
7624  * Default::default() provides sane defaults.
7625  */
7626 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7627    /**
7628     * A pointer to the opaque Rust object.
7629     * Nearly everywhere, inner must be non-null, however in places where
7630     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7631     */
7632    LDKnativeChannelHandshakeConfig *inner;
7633    /**
7634     * Indicates that this is the only struct which contains the same pointer.
7635     * Rust functions which take ownership of an object provided via an argument require
7636     * this to be true and invalidate the object pointed to by inner.
7637     */
7638    bool is_owned;
7639 } LDKChannelHandshakeConfig;
7640
7641
7642
7643 /**
7644  * Optional channel limits which are applied during channel creation.
7645  *
7646  * These limits are only applied to our counterparty's limits, not our own.
7647  *
7648  * Use 0/<type>::max_value() as appropriate to skip checking.
7649  *
7650  * Provides sane defaults for most configurations.
7651  *
7652  * Most additional limits are disabled except those with which specify a default in individual
7653  * field documentation. Note that this may result in barely-usable channels, but since they
7654  * are applied mostly only to incoming channels that's not much of a problem.
7655  */
7656 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7657    /**
7658     * A pointer to the opaque Rust object.
7659     * Nearly everywhere, inner must be non-null, however in places where
7660     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7661     */
7662    LDKnativeChannelHandshakeLimits *inner;
7663    /**
7664     * Indicates that this is the only struct which contains the same pointer.
7665     * Rust functions which take ownership of an object provided via an argument require
7666     * this to be true and invalidate the object pointed to by inner.
7667     */
7668    bool is_owned;
7669 } LDKChannelHandshakeLimits;
7670
7671
7672
7673 /**
7674  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7675  *
7676  * Default::default() provides sane defaults for most configurations
7677  * (but currently with 0 relay fees!)
7678  */
7679 typedef struct MUST_USE_STRUCT LDKUserConfig {
7680    /**
7681     * A pointer to the opaque Rust object.
7682     * Nearly everywhere, inner must be non-null, however in places where
7683     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7684     */
7685    LDKnativeUserConfig *inner;
7686    /**
7687     * Indicates that this is the only struct which contains the same pointer.
7688     * Rust functions which take ownership of an object provided via an argument require
7689     * this to be true and invalidate the object pointed to by inner.
7690     */
7691    bool is_owned;
7692 } LDKUserConfig;
7693
7694 /**
7695  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7696  * UTXOs.
7697  */
7698 typedef struct LDKAccess {
7699    /**
7700     * An opaque pointer which is passed to your function implementations as an argument.
7701     * This has no meaning in the LDK, and can be NULL or any other value.
7702     */
7703    void *this_arg;
7704    /**
7705     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7706     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7707     * is unknown.
7708     *
7709     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7710     */
7711    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7712    /**
7713     * Frees any resources associated with this object given its this_arg pointer.
7714     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7715     */
7716    void (*free)(void *this_arg);
7717 } LDKAccess;
7718
7719 /**
7720  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7721  * chain.
7722  *
7723  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7724  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7725  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7726  * when needed.
7727  */
7728 typedef struct LDKListen {
7729    /**
7730     * An opaque pointer which is passed to your function implementations as an argument.
7731     * This has no meaning in the LDK, and can be NULL or any other value.
7732     */
7733    void *this_arg;
7734    /**
7735     * Notifies the listener that a block was added at the given height.
7736     */
7737    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7738    /**
7739     * Notifies the listener that a block was removed at the given height.
7740     */
7741    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7742    /**
7743     * Frees any resources associated with this object given its this_arg pointer.
7744     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7745     */
7746    void (*free)(void *this_arg);
7747 } LDKListen;
7748
7749 /**
7750  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7751  * unconfirmed during a chain reorganization.
7752  *
7753  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7754  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7755  * related to registered transactions and outputs. Upon notification, it would pass along the
7756  * matching transactions using this interface.
7757  *
7758  * # Use
7759  *
7760  * The intended use is as follows:
7761  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7762  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7763  *   that has been reorganized out of the chain.
7764  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7765  *
7766  * # Order
7767  *
7768  * Clients must call these methods in chain order. Specifically:
7769  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7770  *   block.
7771  * - Dependent transactions within the same block must be given in topological order, possibly in
7772  *   separate calls.
7773  * - Unconfirmed transactions must be given after the original confirmations and before any
7774  *   reconfirmation.
7775  *
7776  * See individual method documentation for further details.
7777  *
7778  * [`transactions_confirmed`]: Self::transactions_confirmed
7779  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7780  * [`best_block_updated`]: Self::best_block_updated
7781  * [`get_relevant_txids`]: Self::get_relevant_txids
7782  */
7783 typedef struct LDKConfirm {
7784    /**
7785     * An opaque pointer which is passed to your function implementations as an argument.
7786     * This has no meaning in the LDK, and can be NULL or any other value.
7787     */
7788    void *this_arg;
7789    /**
7790     * Processes transactions confirmed in a block with a given header and height.
7791     *
7792     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7793     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7794     * appearing in the same block do not need to be included in the same call; instead, multiple
7795     * calls with additional transactions may be made so long as they are made in [chain order].
7796     *
7797     * May be called before or after [`best_block_updated`] for the corresponding block. However,
7798     * in the event of a chain reorganization, it must not be called with a `header` that is no
7799     * longer in the chain as of the last call to [`best_block_updated`].
7800     *
7801     * [chain order]: Confirm#Order
7802     * [`best_block_updated`]: Self::best_block_updated
7803     */
7804    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7805    /**
7806     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
7807     *
7808     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
7809     * reorganized out of the best chain. Once called, the given transaction should not be returned
7810     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
7811     *
7812     * [`get_relevant_txids`]: Self::get_relevant_txids
7813     * [`transactions_confirmed`]: Self::transactions_confirmed
7814     */
7815    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
7816    /**
7817     * Processes an update to the best header connected at the given height.
7818     *
7819     * Should be called when a new header is available but may be skipped for intermediary blocks
7820     * if they become available at the same time.
7821     */
7822    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7823    /**
7824     * Returns transactions that should be monitored for reorganization out of the chain.
7825     *
7826     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
7827     * confirmations to be safe from a chain reorganization. Should not include any transactions
7828     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
7829     *
7830     * May be called to determine the subset of transactions that must still be monitored for
7831     * reorganization. Will be idempotent between calls but may change as a result of calls to the
7832     * other interface methods. Thus, this is useful to determine which transactions may need to be
7833     * given to [`transaction_unconfirmed`].
7834     *
7835     * [`transactions_confirmed`]: Self::transactions_confirmed
7836     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7837     */
7838    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
7839    /**
7840     * Frees any resources associated with this object given its this_arg pointer.
7841     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7842     */
7843    void (*free)(void *this_arg);
7844 } LDKConfirm;
7845
7846
7847
7848 /**
7849  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
7850  *
7851  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
7852  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
7853  * the return value of [`Filter::register_output`].
7854  *
7855  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
7856  * may have been spent there. See [`Filter::register_output`] for details.
7857  *
7858  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7859  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
7860  */
7861 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
7862    /**
7863     * A pointer to the opaque Rust object.
7864     * Nearly everywhere, inner must be non-null, however in places where
7865     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7866     */
7867    LDKnativeWatchedOutput *inner;
7868    /**
7869     * Indicates that this is the only struct which contains the same pointer.
7870     * Rust functions which take ownership of an object provided via an argument require
7871     * this to be true and invalidate the object pointed to by inner.
7872     */
7873    bool is_owned;
7874 } LDKWatchedOutput;
7875
7876 /**
7877  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
7878  * channels.
7879  *
7880  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
7881  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
7882  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
7883  * receiving full blocks from a chain source, any further filtering is unnecessary.
7884  *
7885  * After an output has been registered, subsequent block retrievals from the chain source must not
7886  * exclude any transactions matching the new criteria nor any in-block descendants of such
7887  * transactions.
7888  *
7889  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
7890  * should not block on I/O. Implementations should instead queue the newly monitored data to be
7891  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
7892  * invocation that has called the `Filter` must return [`TemporaryFailure`].
7893  *
7894  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
7895  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
7896  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
7897  */
7898 typedef struct LDKFilter {
7899    /**
7900     * An opaque pointer which is passed to your function implementations as an argument.
7901     * This has no meaning in the LDK, and can be NULL or any other value.
7902     */
7903    void *this_arg;
7904    /**
7905     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
7906     * a spending condition.
7907     */
7908    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
7909    /**
7910     * Registers interest in spends of a transaction output.
7911     *
7912     * Optionally, when `output.block_hash` is set, should return any transaction spending the
7913     * output that is found in the corresponding block along with its index.
7914     *
7915     * This return value is useful for Electrum clients in order to supply in-block descendant
7916     * transactions which otherwise were not included. This is not necessary for other clients if
7917     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
7918     * full block).
7919     */
7920    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
7921    /**
7922     * Frees any resources associated with this object given its this_arg pointer.
7923     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7924     */
7925    void (*free)(void *this_arg);
7926 } LDKFilter;
7927
7928 /**
7929  * `Persist` defines behavior for persisting channel monitors: this could mean
7930  * writing once to disk, and/or uploading to one or more backup services.
7931  *
7932  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
7933  * to disk/backups. And, on every update, you **must** persist either the
7934  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
7935  * of situations such as revoking a transaction, then crashing before this
7936  * revocation can be persisted, then unintentionally broadcasting a revoked
7937  * transaction and losing money. This is a risk because previous channel states
7938  * are toxic, so it's important that whatever channel state is persisted is
7939  * kept up-to-date.
7940  */
7941 typedef struct LDKPersist {
7942    /**
7943     * An opaque pointer which is passed to your function implementations as an argument.
7944     * This has no meaning in the LDK, and can be NULL or any other value.
7945     */
7946    void *this_arg;
7947    /**
7948     * Persist a new channel's data. The data can be stored any way you want, but
7949     * the identifier provided by Rust-Lightning is the channel's outpoint (and
7950     * it is up to you to maintain a correct mapping between the outpoint and the
7951     * stored channel data). Note that you **must** persist every new monitor to
7952     * disk. See the `Persist` trait documentation for more details.
7953     *
7954     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7955     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7956     */
7957    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
7958    /**
7959     * Update one channel's data. The provided `ChannelMonitor` has already
7960     * applied the given update.
7961     *
7962     * Note that on every update, you **must** persist either the
7963     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
7964     * the `Persist` trait documentation for more details.
7965     *
7966     * If an implementer chooses to persist the updates only, they need to make
7967     * sure that all the updates are applied to the `ChannelMonitors` *before*
7968     * the set of channel monitors is given to the `ChannelManager`
7969     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
7970     * applying a monitor update to a monitor. If full `ChannelMonitors` are
7971     * persisted, then there is no need to persist individual updates.
7972     *
7973     * Note that there could be a performance tradeoff between persisting complete
7974     * channel monitors on every update vs. persisting only updates and applying
7975     * them in batches. The size of each monitor grows `O(number of state updates)`
7976     * whereas updates are small and `O(1)`.
7977     *
7978     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7979     * [`ChannelMonitorUpdate::write`] for writing out an update, and
7980     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7981     */
7982    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);
7983    /**
7984     * Frees any resources associated with this object given its this_arg pointer.
7985     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7986     */
7987    void (*free)(void *this_arg);
7988 } LDKPersist;
7989
7990
7991
7992 /**
7993  * An implementation of [`chain::Watch`] for monitoring channels.
7994  *
7995  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
7996  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
7997  * or used independently to monitor channels remotely. See the [module-level documentation] for
7998  * details.
7999  *
8000  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8001  * [module-level documentation]: crate::chain::chainmonitor
8002  */
8003 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8004    /**
8005     * A pointer to the opaque Rust object.
8006     * Nearly everywhere, inner must be non-null, however in places where
8007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8008     */
8009    LDKnativeChainMonitor *inner;
8010    /**
8011     * Indicates that this is the only struct which contains the same pointer.
8012     * Rust functions which take ownership of an object provided via an argument require
8013     * this to be true and invalidate the object pointed to by inner.
8014     */
8015    bool is_owned;
8016 } LDKChainMonitor;
8017
8018
8019
8020 /**
8021  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8022  * and derives keys from that.
8023  *
8024  * Your node_id is seed/0'
8025  * ChannelMonitor closes may use seed/1'
8026  * Cooperative closes may use seed/2'
8027  * The two close keys may be needed to claim on-chain funds!
8028  */
8029 typedef struct MUST_USE_STRUCT LDKKeysManager {
8030    /**
8031     * A pointer to the opaque Rust object.
8032     * Nearly everywhere, inner must be non-null, however in places where
8033     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8034     */
8035    LDKnativeKeysManager *inner;
8036    /**
8037     * Indicates that this is the only struct which contains the same pointer.
8038     * Rust functions which take ownership of an object provided via an argument require
8039     * this to be true and invalidate the object pointed to by inner.
8040     */
8041    bool is_owned;
8042 } LDKKeysManager;
8043
8044
8045
8046 /**
8047  * Chain-related parameters used to construct a new `ChannelManager`.
8048  *
8049  * Typically, the block-specific parameters are derived from the best block hash for the network,
8050  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8051  * are not needed when deserializing a previously constructed `ChannelManager`.
8052  */
8053 typedef struct MUST_USE_STRUCT LDKChainParameters {
8054    /**
8055     * A pointer to the opaque Rust object.
8056     * Nearly everywhere, inner must be non-null, however in places where
8057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8058     */
8059    LDKnativeChainParameters *inner;
8060    /**
8061     * Indicates that this is the only struct which contains the same pointer.
8062     * Rust functions which take ownership of an object provided via an argument require
8063     * this to be true and invalidate the object pointed to by inner.
8064     */
8065    bool is_owned;
8066 } LDKChainParameters;
8067
8068
8069
8070 /**
8071  * The best known block as identified by its hash and height.
8072  */
8073 typedef struct MUST_USE_STRUCT LDKBestBlock {
8074    /**
8075     * A pointer to the opaque Rust object.
8076     * Nearly everywhere, inner must be non-null, however in places where
8077     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8078     */
8079    LDKnativeBestBlock *inner;
8080    /**
8081     * Indicates that this is the only struct which contains the same pointer.
8082     * Rust functions which take ownership of an object provided via an argument require
8083     * this to be true and invalidate the object pointed to by inner.
8084     */
8085    bool is_owned;
8086 } LDKBestBlock;
8087
8088 /**
8089  * A 3-byte byte array.
8090  */
8091 typedef struct LDKThreeBytes {
8092    /**
8093     * The three bytes
8094     */
8095    uint8_t data[3];
8096 } LDKThreeBytes;
8097
8098 /**
8099  * A trait to describe an object which can receive channel messages.
8100  *
8101  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8102  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8103  */
8104 typedef struct LDKChannelMessageHandler {
8105    /**
8106     * An opaque pointer which is passed to your function implementations as an argument.
8107     * This has no meaning in the LDK, and can be NULL or any other value.
8108     */
8109    void *this_arg;
8110    /**
8111     * Handle an incoming open_channel message from the given peer.
8112     */
8113    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8114    /**
8115     * Handle an incoming accept_channel message from the given peer.
8116     */
8117    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8118    /**
8119     * Handle an incoming funding_created message from the given peer.
8120     */
8121    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8122    /**
8123     * Handle an incoming funding_signed message from the given peer.
8124     */
8125    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8126    /**
8127     * Handle an incoming funding_locked message from the given peer.
8128     */
8129    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8130    /**
8131     * Handle an incoming shutdown message from the given peer.
8132     */
8133    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);
8134    /**
8135     * Handle an incoming closing_signed message from the given peer.
8136     */
8137    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8138    /**
8139     * Handle an incoming update_add_htlc message from the given peer.
8140     */
8141    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8142    /**
8143     * Handle an incoming update_fulfill_htlc message from the given peer.
8144     */
8145    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8146    /**
8147     * Handle an incoming update_fail_htlc message from the given peer.
8148     */
8149    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8150    /**
8151     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8152     */
8153    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8154    /**
8155     * Handle an incoming commitment_signed message from the given peer.
8156     */
8157    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8158    /**
8159     * Handle an incoming revoke_and_ack message from the given peer.
8160     */
8161    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8162    /**
8163     * Handle an incoming update_fee message from the given peer.
8164     */
8165    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8166    /**
8167     * Handle an incoming announcement_signatures message from the given peer.
8168     */
8169    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8170    /**
8171     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8172     * is believed to be possible in the future (eg they're sending us messages we don't
8173     * understand or indicate they require unknown feature bits), no_connection_possible is set
8174     * and any outstanding channels should be failed.
8175     */
8176    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8177    /**
8178     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8179     */
8180    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8181    /**
8182     * Handle an incoming channel_reestablish message from the given peer.
8183     */
8184    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8185    /**
8186     * Handle an incoming channel update from the given peer.
8187     */
8188    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8189    /**
8190     * Handle an incoming error message from the given peer.
8191     */
8192    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8193    /**
8194     * Implementation of MessageSendEventsProvider for this object.
8195     */
8196    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8197    /**
8198     * Frees any resources associated with this object given its this_arg pointer.
8199     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8200     */
8201    void (*free)(void *this_arg);
8202 } LDKChannelMessageHandler;
8203
8204
8205
8206 /**
8207  * Arguments for the creation of a ChannelManager that are not deserialized.
8208  *
8209  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8210  * is:
8211  * 1) Deserialize all stored ChannelMonitors.
8212  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8213  *    <(BlockHash, ChannelManager)>::read(reader, args)
8214  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8215  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8216  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8217  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8218  *    ChannelMonitor::get_funding_txo().
8219  * 4) Reconnect blocks on your ChannelMonitors.
8220  * 5) Disconnect/connect blocks on the ChannelManager.
8221  * 6) Move the ChannelMonitors into your local chain::Watch.
8222  *
8223  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8224  * call any other methods on the newly-deserialized ChannelManager.
8225  *
8226  * Note that because some channels may be closed during deserialization, it is critical that you
8227  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8228  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8229  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8230  * not force-close the same channels but consider them live), you may end up revoking a state for
8231  * which you've already broadcasted the transaction.
8232  */
8233 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8234    /**
8235     * A pointer to the opaque Rust object.
8236     * Nearly everywhere, inner must be non-null, however in places where
8237     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8238     */
8239    LDKnativeChannelManagerReadArgs *inner;
8240    /**
8241     * Indicates that this is the only struct which contains the same pointer.
8242     * Rust functions which take ownership of an object provided via an argument require
8243     * this to be true and invalidate the object pointed to by inner.
8244     */
8245    bool is_owned;
8246 } LDKChannelManagerReadArgs;
8247
8248
8249
8250 /**
8251  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8252  * This is used to convince the recipient that the channel is at a certain commitment
8253  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8254  * and even later commitments may have been revoked.
8255  */
8256 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8257    /**
8258     * A pointer to the opaque Rust object.
8259     * Nearly everywhere, inner must be non-null, however in places where
8260     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8261     */
8262    LDKnativeDataLossProtect *inner;
8263    /**
8264     * Indicates that this is the only struct which contains the same pointer.
8265     * Rust functions which take ownership of an object provided via an argument require
8266     * this to be true and invalidate the object pointed to by inner.
8267     */
8268    bool is_owned;
8269 } LDKDataLossProtect;
8270
8271 /**
8272  * A trait to describe an object which can receive routing messages.
8273  *
8274  * # Implementor DoS Warnings
8275  *
8276  * For `gossip_queries` messages there are potential DoS vectors when handling
8277  * inbound queries. Implementors using an on-disk network graph should be aware of
8278  * repeated disk I/O for queries accessing different parts of the network graph.
8279  */
8280 typedef struct LDKRoutingMessageHandler {
8281    /**
8282     * An opaque pointer which is passed to your function implementations as an argument.
8283     * This has no meaning in the LDK, and can be NULL or any other value.
8284     */
8285    void *this_arg;
8286    /**
8287     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8288     * false or returning an Err otherwise.
8289     */
8290    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8291    /**
8292     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8293     * or returning an Err otherwise.
8294     */
8295    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8296    /**
8297     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8298     * false or returning an Err otherwise.
8299     */
8300    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8301    /**
8302     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8303     */
8304    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8305    /**
8306     * Gets a subset of the channel announcements and updates required to dump our routing table
8307     * to a remote node, starting at the short_channel_id indicated by starting_point and
8308     * including the batch_amount entries immediately higher in numerical value than starting_point.
8309     */
8310    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8311    /**
8312     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8313     * starting at the node *after* the provided publickey and including batch_amount entries
8314     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8315     * If None is provided for starting_point, we start at the first node.
8316     */
8317    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8318    /**
8319     * Called when a connection is established with a peer. This can be used to
8320     * perform routing table synchronization using a strategy defined by the
8321     * implementor.
8322     */
8323    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8324    /**
8325     * Handles the reply of a query we initiated to learn about channels
8326     * for a given range of blocks. We can expect to receive one or more
8327     * replies to a single query.
8328     */
8329    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8330    /**
8331     * Handles the reply of a query we initiated asking for routing gossip
8332     * messages for a list of channels. We should receive this message when
8333     * a node has completed its best effort to send us the pertaining routing
8334     * gossip messages.
8335     */
8336    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8337    /**
8338     * Handles when a peer asks us to send a list of short_channel_ids
8339     * for the requested range of blocks.
8340     */
8341    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8342    /**
8343     * Handles when a peer asks us to send routing gossip messages for a
8344     * list of short_channel_ids.
8345     */
8346    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8347    /**
8348     * Implementation of MessageSendEventsProvider for this object.
8349     */
8350    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8351    /**
8352     * Frees any resources associated with this object given its this_arg pointer.
8353     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8354     */
8355    void (*free)(void *this_arg);
8356 } LDKRoutingMessageHandler;
8357
8358
8359
8360 /**
8361  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8362  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8363  */
8364 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8365    /**
8366     * A pointer to the opaque Rust object.
8367     * Nearly everywhere, inner must be non-null, however in places where
8368     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8369     */
8370    LDKnativeIgnoringMessageHandler *inner;
8371    /**
8372     * Indicates that this is the only struct which contains the same pointer.
8373     * Rust functions which take ownership of an object provided via an argument require
8374     * this to be true and invalidate the object pointed to by inner.
8375     */
8376    bool is_owned;
8377 } LDKIgnoringMessageHandler;
8378
8379
8380
8381 /**
8382  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8383  * You can provide one of these as the route_handler in a MessageHandler.
8384  */
8385 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8386    /**
8387     * A pointer to the opaque Rust object.
8388     * Nearly everywhere, inner must be non-null, however in places where
8389     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8390     */
8391    LDKnativeErroringMessageHandler *inner;
8392    /**
8393     * Indicates that this is the only struct which contains the same pointer.
8394     * Rust functions which take ownership of an object provided via an argument require
8395     * this to be true and invalidate the object pointed to by inner.
8396     */
8397    bool is_owned;
8398 } LDKErroringMessageHandler;
8399
8400
8401
8402 /**
8403  * Provides references to trait impls which handle different types of messages.
8404  */
8405 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8406    /**
8407     * A pointer to the opaque Rust object.
8408     * Nearly everywhere, inner must be non-null, however in places where
8409     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8410     */
8411    LDKnativeMessageHandler *inner;
8412    /**
8413     * Indicates that this is the only struct which contains the same pointer.
8414     * Rust functions which take ownership of an object provided via an argument require
8415     * this to be true and invalidate the object pointed to by inner.
8416     */
8417    bool is_owned;
8418 } LDKMessageHandler;
8419
8420 /**
8421  * Provides an object which can be used to send data to and which uniquely identifies a connection
8422  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8423  * implement Hash to meet the PeerManager API.
8424  *
8425  * For efficiency, Clone should be relatively cheap for this type.
8426  *
8427  * You probably want to just extend an int and put a file descriptor in a struct and implement
8428  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8429  * be careful to ensure you don't have races whereby you might register a new connection with an
8430  * fd which is the same as a previous one which has yet to be removed via
8431  * PeerManager::socket_disconnected().
8432  */
8433 typedef struct LDKSocketDescriptor {
8434    /**
8435     * An opaque pointer which is passed to your function implementations as an argument.
8436     * This has no meaning in the LDK, and can be NULL or any other value.
8437     */
8438    void *this_arg;
8439    /**
8440     * Attempts to send some data from the given slice to the peer.
8441     *
8442     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8443     * Note that in the disconnected case, socket_disconnected must still fire and further write
8444     * attempts may occur until that time.
8445     *
8446     * If the returned size is smaller than data.len(), a write_available event must
8447     * trigger the next time more data can be written. Additionally, until the a send_data event
8448     * completes fully, no further read_events should trigger on the same peer!
8449     *
8450     * If a read_event on this descriptor had previously returned true (indicating that read
8451     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8452     * indicating that read events on this descriptor should resume. A resume_read of false does
8453     * *not* imply that further read events should be paused.
8454     */
8455    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8456    /**
8457     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8458     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8459     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8460     * though races may occur whereby disconnect_socket is called after a call to
8461     * socket_disconnected but prior to socket_disconnected returning.
8462     */
8463    void (*disconnect_socket)(void *this_arg);
8464    /**
8465     * Checks if two objects are equal given this object's this_arg pointer and another object.
8466     */
8467    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8468    /**
8469     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8470     * This is used, for example, for inclusion of this object in a hash map.
8471     */
8472    uint64_t (*hash)(const void *this_arg);
8473    /**
8474     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8475     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8476     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8477     */
8478    void *(*clone)(const void *this_arg);
8479    /**
8480     * Frees any resources associated with this object given its this_arg pointer.
8481     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8482     */
8483    void (*free)(void *this_arg);
8484 } LDKSocketDescriptor;
8485
8486
8487
8488 /**
8489  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8490  * events into messages which it passes on to its MessageHandlers.
8491  *
8492  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8493  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8494  * essentially you should default to using a SimpleRefPeerManager, and use a
8495  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8496  * you're using lightning-net-tokio.
8497  */
8498 typedef struct MUST_USE_STRUCT LDKPeerManager {
8499    /**
8500     * A pointer to the opaque Rust object.
8501     * Nearly everywhere, inner must be non-null, however in places where
8502     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8503     */
8504    LDKnativePeerManager *inner;
8505    /**
8506     * Indicates that this is the only struct which contains the same pointer.
8507     * Rust functions which take ownership of an object provided via an argument require
8508     * this to be true and invalidate the object pointed to by inner.
8509     */
8510    bool is_owned;
8511 } LDKPeerManager;
8512
8513
8514
8515 /**
8516  * Static channel fields used to build transactions given per-commitment fields, organized by
8517  * broadcaster/countersignatory.
8518  *
8519  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8520  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8521  */
8522 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8523    /**
8524     * A pointer to the opaque Rust object.
8525     * Nearly everywhere, inner must be non-null, however in places where
8526     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8527     */
8528    LDKnativeDirectedChannelTransactionParameters *inner;
8529    /**
8530     * Indicates that this is the only struct which contains the same pointer.
8531     * Rust functions which take ownership of an object provided via an argument require
8532     * this to be true and invalidate the object pointed to by inner.
8533     */
8534    bool is_owned;
8535 } LDKDirectedChannelTransactionParameters;
8536
8537
8538
8539 /**
8540  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8541  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8542  * the C bindings, as it can be done directly in Rust code.
8543  */
8544 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8545    /**
8546     * A pointer to the opaque Rust object.
8547     * Nearly everywhere, inner must be non-null, however in places where
8548     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8549     */
8550    LDKnativeLockedNetworkGraph *inner;
8551    /**
8552     * Indicates that this is the only struct which contains the same pointer.
8553     * Rust functions which take ownership of an object provided via an argument require
8554     * this to be true and invalidate the object pointed to by inner.
8555     */
8556    bool is_owned;
8557 } LDKLockedNetworkGraph;
8558
8559
8560
8561 /**
8562  * Receives and validates network updates from peers,
8563  * stores authentic and relevant data as a network graph.
8564  * This network graph is then used for routing payments.
8565  * Provides interface to help with initial routing sync by
8566  * serving historical announcements.
8567  */
8568 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8569    /**
8570     * A pointer to the opaque Rust object.
8571     * Nearly everywhere, inner must be non-null, however in places where
8572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8573     */
8574    LDKnativeNetGraphMsgHandler *inner;
8575    /**
8576     * Indicates that this is the only struct which contains the same pointer.
8577     * Rust functions which take ownership of an object provided via an argument require
8578     * this to be true and invalidate the object pointed to by inner.
8579     */
8580    bool is_owned;
8581 } LDKNetGraphMsgHandler;
8582
8583
8584
8585 /**
8586  * FilesystemPersister persists channel data on disk, where each channel's
8587  * data is stored in a file named after its funding outpoint.
8588  *
8589  * Warning: this module does the best it can with calls to persist data, but it
8590  * can only guarantee that the data is passed to the drive. It is up to the
8591  * drive manufacturers to do the actual persistence properly, which they often
8592  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8593  * user to validate their entire storage stack, to ensure the writes are
8594  * persistent.
8595  * Corollary: especially when dealing with larger amounts of money, it is best
8596  * practice to have multiple channel data backups and not rely only on one
8597  * FilesystemPersister.
8598  */
8599 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8600    /**
8601     * A pointer to the opaque Rust object.
8602     * Nearly everywhere, inner must be non-null, however in places where
8603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8604     */
8605    LDKnativeFilesystemPersister *inner;
8606    /**
8607     * Indicates that this is the only struct which contains the same pointer.
8608     * Rust functions which take ownership of an object provided via an argument require
8609     * this to be true and invalidate the object pointed to by inner.
8610     */
8611    bool is_owned;
8612 } LDKFilesystemPersister;
8613
8614
8615
8616 /**
8617  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8618  * invalid.
8619  *
8620  * # Invariants
8621  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8622  */
8623 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
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    LDKnativeSignedRawInvoice *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 } LDKSignedRawInvoice;
8637
8638
8639
8640 /**
8641  * Data of the `RawInvoice` that is encoded in the data part
8642  */
8643 typedef struct MUST_USE_STRUCT LDKRawDataPart {
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    LDKnativeRawDataPart *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 } LDKRawDataPart;
8657
8658 extern const uintptr_t MAX_BUF_SIZE;
8659
8660 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8661
8662 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8663
8664 extern const uint16_t BREAKDOWN_TIMEOUT;
8665
8666 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8667
8668 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8669
8670 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8671
8672 extern const uint8_t TAG_PAYMENT_HASH;
8673
8674 extern const uint8_t TAG_DESCRIPTION;
8675
8676 extern const uint8_t TAG_PAYEE_PUB_KEY;
8677
8678 extern const uint8_t TAG_DESCRIPTION_HASH;
8679
8680 extern const uint8_t TAG_EXPIRY_TIME;
8681
8682 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
8683
8684 extern const uint8_t TAG_FALLBACK;
8685
8686 extern const uint8_t TAG_ROUTE;
8687
8688 extern const uint8_t TAG_PAYMENT_SECRET;
8689
8690 extern const uint8_t TAG_FEATURES;
8691
8692 /**
8693  * Frees the data buffer, if data_is_owned is set and datalen > 0.
8694  */
8695 void Transaction_free(struct LDKTransaction _res);
8696
8697 /**
8698  * Frees the data pointed to by script_pubkey.
8699  */
8700 void TxOut_free(struct LDKTxOut _res);
8701
8702 /**
8703  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
8704  */
8705 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
8706
8707 /**
8708  * Frees the data buffer, if chars_is_owned is set and len > 0.
8709  */
8710 void Str_free(struct LDKStr _res);
8711
8712 /**
8713  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
8714  */
8715 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
8716
8717 /**
8718  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
8719  */
8720 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
8721
8722 /**
8723  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
8724  */
8725 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
8726
8727 /**
8728  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
8729  * but with all dynamically-allocated buffers duplicated in new buffers.
8730  */
8731 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
8732
8733 /**
8734  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
8735  */
8736 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
8737
8738 /**
8739  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
8740  */
8741 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
8742
8743 /**
8744  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
8745  */
8746 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
8747
8748 /**
8749  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
8750  * but with all dynamically-allocated buffers duplicated in new buffers.
8751  */
8752 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
8753
8754 /**
8755  * Creates a new CResult_SecretKeyErrorZ in the success state.
8756  */
8757 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
8758
8759 /**
8760  * Creates a new CResult_SecretKeyErrorZ in the error state.
8761  */
8762 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
8763
8764 /**
8765  * Frees any resources used by the CResult_SecretKeyErrorZ.
8766  */
8767 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
8768
8769 /**
8770  * Creates a new CResult_PublicKeyErrorZ in the success state.
8771  */
8772 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
8773
8774 /**
8775  * Creates a new CResult_PublicKeyErrorZ in the error state.
8776  */
8777 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
8778
8779 /**
8780  * Frees any resources used by the CResult_PublicKeyErrorZ.
8781  */
8782 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
8783
8784 /**
8785  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
8786  */
8787 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
8788
8789 /**
8790  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
8791  */
8792 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
8793
8794 /**
8795  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
8796  */
8797 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
8798
8799 /**
8800  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
8801  * but with all dynamically-allocated buffers duplicated in new buffers.
8802  */
8803 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
8804
8805 /**
8806  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
8807  */
8808 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
8809
8810 /**
8811  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
8812  */
8813 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
8814
8815 /**
8816  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
8817  */
8818 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
8819
8820 /**
8821  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
8822  * but with all dynamically-allocated buffers duplicated in new buffers.
8823  */
8824 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
8825
8826 /**
8827  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
8828  */
8829 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
8830
8831 /**
8832  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
8833  */
8834 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
8835
8836 /**
8837  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
8838  */
8839 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
8840
8841 /**
8842  * Constructs a new COption_u32Z containing a u32
8843  */
8844 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
8845
8846 /**
8847  * Constructs a new COption_u32Z containing nothing
8848  */
8849 struct LDKCOption_u32Z COption_u32Z_none(void);
8850
8851 /**
8852  * Frees any resources associated with the u32, if we are in the Some state
8853  */
8854 void COption_u32Z_free(struct LDKCOption_u32Z _res);
8855
8856 /**
8857  * Creates a new COption_u32Z which has the same data as `orig`
8858  * but with all dynamically-allocated buffers duplicated in new buffers.
8859  */
8860 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
8861
8862 /**
8863  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
8864  */
8865 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
8866
8867 /**
8868  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
8869  */
8870 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
8871
8872 /**
8873  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
8874  */
8875 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
8876
8877 /**
8878  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
8879  * but with all dynamically-allocated buffers duplicated in new buffers.
8880  */
8881 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
8882
8883 /**
8884  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
8885  */
8886 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
8887
8888 /**
8889  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
8890  */
8891 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8892
8893 /**
8894  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
8895  */
8896 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
8897
8898 /**
8899  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8900  * but with all dynamically-allocated buffers duplicated in new buffers.
8901  */
8902 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8903
8904 /**
8905  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
8906  */
8907 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
8908
8909 /**
8910  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
8911  */
8912 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8913
8914 /**
8915  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
8916  */
8917 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
8918
8919 /**
8920  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8921  * but with all dynamically-allocated buffers duplicated in new buffers.
8922  */
8923 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8924
8925 /**
8926  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8927  */
8928 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
8929
8930 /**
8931  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
8932  */
8933 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
8934
8935 /**
8936  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
8937  */
8938 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8939
8940 /**
8941  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
8942  */
8943 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
8944
8945 /**
8946  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
8947  * but with all dynamically-allocated buffers duplicated in new buffers.
8948  */
8949 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8950
8951 /**
8952  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
8953  */
8954 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
8955
8956 /**
8957  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
8958  */
8959 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8960
8961 /**
8962  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
8963  */
8964 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
8965
8966 /**
8967  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
8968  * but with all dynamically-allocated buffers duplicated in new buffers.
8969  */
8970 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8971
8972 /**
8973  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
8974  */
8975 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
8976
8977 /**
8978  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
8979  */
8980 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8981
8982 /**
8983  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
8984  */
8985 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
8986
8987 /**
8988  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
8989  * but with all dynamically-allocated buffers duplicated in new buffers.
8990  */
8991 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8992
8993 /**
8994  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
8995  */
8996 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
8997
8998 /**
8999  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9000  */
9001 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9002
9003 /**
9004  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9005  */
9006 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9007
9008 /**
9009  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9010  */
9011 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9012
9013 /**
9014  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9015  */
9016 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9017
9018 /**
9019  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9020  */
9021 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9022
9023 /**
9024  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9025  * but with all dynamically-allocated buffers duplicated in new buffers.
9026  */
9027 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9028
9029 /**
9030  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9031  */
9032 void CVec_RawTaggedFieldZ_free(struct LDKCVec_RawTaggedFieldZ _res);
9033
9034 /**
9035  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9036  */
9037 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
9038
9039 /**
9040  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9041  */
9042 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9043
9044 /**
9045  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9046  */
9047 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
9048
9049 /**
9050  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9051  */
9052 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
9053
9054 /**
9055  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
9056  */
9057 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
9058
9059 /**
9060  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
9061  */
9062 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
9063
9064 /**
9065  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
9066  */
9067 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
9068
9069 /**
9070  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9071  */
9072 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9073
9074 /**
9075  * Constructs a new COption_u64Z containing a u64
9076  */
9077 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9078
9079 /**
9080  * Constructs a new COption_u64Z containing nothing
9081  */
9082 struct LDKCOption_u64Z COption_u64Z_none(void);
9083
9084 /**
9085  * Frees any resources associated with the u64, if we are in the Some state
9086  */
9087 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9088
9089 /**
9090  * Creates a new COption_u64Z which has the same data as `orig`
9091  * but with all dynamically-allocated buffers duplicated in new buffers.
9092  */
9093 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9094
9095 /**
9096  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9097  */
9098 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
9099
9100 /**
9101  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9102  */
9103 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
9104
9105 /**
9106  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9107  */
9108 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
9109
9110 /**
9111  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9112  * but with all dynamically-allocated buffers duplicated in new buffers.
9113  */
9114 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
9115
9116 /**
9117  * Creates a new CResult_NoneSemanticErrorZ in the success state.
9118  */
9119 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
9120
9121 /**
9122  * Creates a new CResult_NoneSemanticErrorZ in the error state.
9123  */
9124 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
9125
9126 /**
9127  * Frees any resources used by the CResult_NoneSemanticErrorZ.
9128  */
9129 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
9130
9131 /**
9132  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
9133  * but with all dynamically-allocated buffers duplicated in new buffers.
9134  */
9135 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
9136
9137 /**
9138  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
9139  */
9140 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
9141
9142 /**
9143  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
9144  */
9145 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
9146
9147 /**
9148  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
9149  */
9150 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
9151
9152 /**
9153  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
9154  * but with all dynamically-allocated buffers duplicated in new buffers.
9155  */
9156 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
9157
9158 /**
9159  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
9160  */
9161 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
9162
9163 /**
9164  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
9165  */
9166 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
9167
9168 /**
9169  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
9170  */
9171 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
9172
9173 /**
9174  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9175  * but with all dynamically-allocated buffers duplicated in new buffers.
9176  */
9177 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
9178
9179 /**
9180  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
9181  */
9182 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
9183
9184 /**
9185  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
9186  */
9187 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
9188
9189 /**
9190  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
9191  */
9192 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
9193
9194 /**
9195  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
9196  * but with all dynamically-allocated buffers duplicated in new buffers.
9197  */
9198 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
9199
9200 /**
9201  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9202  */
9203 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9204
9205 /**
9206  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
9207  */
9208 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
9209
9210 /**
9211  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
9212  */
9213 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
9214
9215 /**
9216  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
9217  */
9218 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
9219
9220 /**
9221  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
9222  * but with all dynamically-allocated buffers duplicated in new buffers.
9223  */
9224 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
9225
9226 /**
9227  * Creates a new CResult_StringErrorZ in the success state.
9228  */
9229 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKCVec_u8Z o);
9230
9231 /**
9232  * Creates a new CResult_StringErrorZ in the error state.
9233  */
9234 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
9235
9236 /**
9237  * Frees any resources used by the CResult_StringErrorZ.
9238  */
9239 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
9240
9241 /**
9242  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9243  */
9244 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
9245
9246 /**
9247  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9248  */
9249 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9250
9251 /**
9252  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9253  */
9254 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
9255
9256 /**
9257  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9258  * but with all dynamically-allocated buffers duplicated in new buffers.
9259  */
9260 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
9261
9262 /**
9263  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9264  */
9265 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
9266
9267 /**
9268  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9269  */
9270 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9271
9272 /**
9273  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9274  */
9275 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
9276
9277 /**
9278  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9279  * but with all dynamically-allocated buffers duplicated in new buffers.
9280  */
9281 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
9282
9283 /**
9284  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
9285  */
9286 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
9287
9288 /**
9289  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
9290  */
9291 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
9292
9293 /**
9294  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
9295  */
9296 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
9297
9298 /**
9299  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
9300  * but with all dynamically-allocated buffers duplicated in new buffers.
9301  */
9302 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
9303
9304 /**
9305  * Creates a new tuple which has the same data as `orig`
9306  * but with all dynamically-allocated buffers duplicated in new buffers.
9307  */
9308 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
9309
9310 /**
9311  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9312  */
9313 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
9314
9315 /**
9316  * Frees any resources used by the C2Tuple_OutPointScriptZ.
9317  */
9318 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
9319
9320 /**
9321  * Creates a new tuple which has the same data as `orig`
9322  * but with all dynamically-allocated buffers duplicated in new buffers.
9323  */
9324 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
9325
9326 /**
9327  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
9328  */
9329 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
9330
9331 /**
9332  * Frees any resources used by the C2Tuple_u32ScriptZ.
9333  */
9334 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
9335
9336 /**
9337  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9338  */
9339 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
9340
9341 /**
9342  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9343  */
9344 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
9345
9346 /**
9347  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9348  */
9349 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
9350
9351 /**
9352  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9353  */
9354 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
9355
9356 /**
9357  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9358  */
9359 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9360
9361 /**
9362  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9363  */
9364 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
9365
9366 /**
9367  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9368  */
9369 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
9370
9371 /**
9372  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9373  */
9374 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9375
9376 /**
9377  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9378  */
9379 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9380
9381 /**
9382  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9383  */
9384 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9385
9386 /**
9387  * Creates a new tuple which has the same data as `orig`
9388  * but with all dynamically-allocated buffers duplicated in new buffers.
9389  */
9390 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
9391
9392 /**
9393  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
9394  */
9395 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
9396
9397 /**
9398  * Frees any resources used by the C2Tuple_u32TxOutZ.
9399  */
9400 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
9401
9402 /**
9403  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9404  */
9405 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
9406
9407 /**
9408  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9409  */
9410 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
9411
9412 /**
9413  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9414  */
9415 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
9416
9417 /**
9418  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9419  */
9420 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
9421
9422 /**
9423  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9424  */
9425 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9426
9427 /**
9428  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9429  */
9430 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9431
9432 /**
9433  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9434  */
9435 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9436
9437 /**
9438  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9439  */
9440 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9441
9442 /**
9443  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9444  * but with all dynamically-allocated buffers duplicated in new buffers.
9445  */
9446 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9447
9448 /**
9449  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9450  */
9451 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9452
9453 /**
9454  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9455  */
9456 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9457
9458 /**
9459  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9460  */
9461 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
9462
9463 /**
9464  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9465  */
9466 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
9467
9468 /**
9469  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9470  */
9471 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
9472
9473 /**
9474  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9475  */
9476 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9477
9478 /**
9479  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9480  */
9481 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9482
9483 /**
9484  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9485  */
9486 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9487
9488 /**
9489  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9490  */
9491 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9492
9493 /**
9494  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9495  */
9496 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9497
9498 /**
9499  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9500  * but with all dynamically-allocated buffers duplicated in new buffers.
9501  */
9502 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9503
9504 /**
9505  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9506  */
9507 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9508
9509 /**
9510  * Creates a new CResult_RouteLightningErrorZ in the success state.
9511  */
9512 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9513
9514 /**
9515  * Creates a new CResult_RouteLightningErrorZ in the error state.
9516  */
9517 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9518
9519 /**
9520  * Frees any resources used by the CResult_RouteLightningErrorZ.
9521  */
9522 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9523
9524 /**
9525  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9526  * but with all dynamically-allocated buffers duplicated in new buffers.
9527  */
9528 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9529
9530 /**
9531  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9532  */
9533 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9534
9535 /**
9536  * Creates a new CResult_boolLightningErrorZ in the success state.
9537  */
9538 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
9539
9540 /**
9541  * Creates a new CResult_boolLightningErrorZ in the error state.
9542  */
9543 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
9544
9545 /**
9546  * Frees any resources used by the CResult_boolLightningErrorZ.
9547  */
9548 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
9549
9550 /**
9551  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9552  * but with all dynamically-allocated buffers duplicated in new buffers.
9553  */
9554 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
9555
9556 /**
9557  * Creates a new tuple which has the same data as `orig`
9558  * but with all dynamically-allocated buffers duplicated in new buffers.
9559  */
9560 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
9561
9562 /**
9563  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9564  */
9565 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
9566
9567 /**
9568  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9569  */
9570 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
9571
9572 /**
9573  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9574  */
9575 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
9576
9577 /**
9578  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9579  */
9580 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
9581
9582 /**
9583  * Creates a new CResult_NoneLightningErrorZ in the success state.
9584  */
9585 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
9586
9587 /**
9588  * Creates a new CResult_NoneLightningErrorZ in the error state.
9589  */
9590 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
9591
9592 /**
9593  * Frees any resources used by the CResult_NoneLightningErrorZ.
9594  */
9595 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
9596
9597 /**
9598  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9599  * but with all dynamically-allocated buffers duplicated in new buffers.
9600  */
9601 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
9602
9603 /**
9604  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9605  */
9606 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
9607
9608 /**
9609  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9610  */
9611 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
9612
9613 /**
9614  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9615  */
9616 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9617
9618 /**
9619  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9620  */
9621 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
9622
9623 /**
9624  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9625  * but with all dynamically-allocated buffers duplicated in new buffers.
9626  */
9627 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
9628
9629 /**
9630  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
9631  */
9632 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
9633
9634 /**
9635  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
9636  */
9637 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
9638
9639 /**
9640  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
9641  */
9642 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
9643
9644 /**
9645  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9646  * but with all dynamically-allocated buffers duplicated in new buffers.
9647  */
9648 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
9649
9650 /**
9651  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
9652  */
9653 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
9654
9655 /**
9656  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
9657  */
9658 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9659
9660 /**
9661  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
9662  */
9663 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
9664
9665 /**
9666  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9667  * but with all dynamically-allocated buffers duplicated in new buffers.
9668  */
9669 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
9670
9671 /**
9672  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9673  */
9674 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9675
9676 /**
9677  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9678  */
9679 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9680
9681 /**
9682  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9683  */
9684 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9685
9686 /**
9687  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9688  * but with all dynamically-allocated buffers duplicated in new buffers.
9689  */
9690 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9691
9692 /**
9693  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9694  */
9695 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9696
9697 /**
9698  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9699  */
9700 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9701
9702 /**
9703  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9704  */
9705 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9706
9707 /**
9708  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9709  */
9710 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9711
9712 /**
9713  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9714  */
9715 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
9716
9717 /**
9718  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9719  */
9720 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9721
9722 /**
9723  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9724  */
9725 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
9726
9727 /**
9728  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9729  * but with all dynamically-allocated buffers duplicated in new buffers.
9730  */
9731 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9732
9733 /**
9734  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9735  */
9736 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
9737
9738 /**
9739  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9740  */
9741 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9742
9743 /**
9744  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9745  */
9746 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
9747
9748 /**
9749  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9750  * but with all dynamically-allocated buffers duplicated in new buffers.
9751  */
9752 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9753
9754 /**
9755  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9756  */
9757 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
9758
9759 /**
9760  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9761  */
9762 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
9763
9764 /**
9765  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9766  */
9767 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
9768
9769 /**
9770  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9771  * but with all dynamically-allocated buffers duplicated in new buffers.
9772  */
9773 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
9774
9775 /**
9776  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9777  */
9778 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9779
9780 /**
9781  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9782  */
9783 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
9784
9785 /**
9786  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9787  */
9788 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
9789
9790 /**
9791  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
9792  */
9793 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
9794
9795 /**
9796  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9797  * but with all dynamically-allocated buffers duplicated in new buffers.
9798  */
9799 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
9800
9801 /**
9802  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9803  */
9804 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
9805
9806 /**
9807  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9808  */
9809 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
9810
9811 /**
9812  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9813  */
9814 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
9815
9816 /**
9817  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9818  */
9819 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
9820
9821 /**
9822  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9823  * but with all dynamically-allocated buffers duplicated in new buffers.
9824  */
9825 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
9826
9827 /**
9828  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9829  */
9830 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
9831
9832 /**
9833  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9834  */
9835 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
9836
9837 /**
9838  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9839  */
9840 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
9841
9842 /**
9843  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9844  * but with all dynamically-allocated buffers duplicated in new buffers.
9845  */
9846 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
9847
9848 /**
9849  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9850  */
9851 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9852
9853 /**
9854  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9855  */
9856 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9857
9858 /**
9859  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9860  */
9861 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9862
9863 /**
9864  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9865  */
9866 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9867
9868 /**
9869  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9870  */
9871 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9872
9873 /**
9874  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9875  */
9876 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9877
9878 /**
9879  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
9880  */
9881 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
9882
9883 /**
9884  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
9885  */
9886 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9887
9888 /**
9889  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
9890  */
9891 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
9892
9893 /**
9894  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
9895  */
9896 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
9897
9898 /**
9899  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
9900  */
9901 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9902
9903 /**
9904  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
9905  */
9906 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
9907
9908 /**
9909  * Creates a new CResult_NetAddressu8Z in the success state.
9910  */
9911 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
9912
9913 /**
9914  * Creates a new CResult_NetAddressu8Z in the error state.
9915  */
9916 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
9917
9918 /**
9919  * Frees any resources used by the CResult_NetAddressu8Z.
9920  */
9921 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
9922
9923 /**
9924  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
9925  * but with all dynamically-allocated buffers duplicated in new buffers.
9926  */
9927 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
9928
9929 /**
9930  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
9931  */
9932 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
9933
9934 /**
9935  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
9936  */
9937 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
9938
9939 /**
9940  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
9941  */
9942 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
9943
9944 /**
9945  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
9946  * but with all dynamically-allocated buffers duplicated in new buffers.
9947  */
9948 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
9949
9950 /**
9951  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9952  */
9953 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
9954
9955 /**
9956  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9957  */
9958 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
9959
9960 /**
9961  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9962  */
9963 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
9964
9965 /**
9966  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9967  */
9968 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
9969
9970 /**
9971  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9972  */
9973 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
9974
9975 /**
9976  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9977  */
9978 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
9979
9980 /**
9981  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9982  */
9983 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
9984
9985 /**
9986  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9987  * but with all dynamically-allocated buffers duplicated in new buffers.
9988  */
9989 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
9990
9991 /**
9992  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9993  */
9994 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
9995
9996 /**
9997  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9998  */
9999 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10000
10001 /**
10002  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10003  */
10004 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10005
10006 /**
10007  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10008  * but with all dynamically-allocated buffers duplicated in new buffers.
10009  */
10010 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10011
10012 /**
10013  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10014  */
10015 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10016
10017 /**
10018  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10019  */
10020 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10021
10022 /**
10023  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10024  */
10025 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10026
10027 /**
10028  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10029  * but with all dynamically-allocated buffers duplicated in new buffers.
10030  */
10031 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10032
10033 /**
10034  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10035  */
10036 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10037
10038 /**
10039  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10040  */
10041 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10042
10043 /**
10044  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10045  */
10046 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10047
10048 /**
10049  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10050  * but with all dynamically-allocated buffers duplicated in new buffers.
10051  */
10052 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10053
10054 /**
10055  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10056  */
10057 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10058
10059 /**
10060  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10061  */
10062 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10063
10064 /**
10065  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10066  */
10067 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10068
10069 /**
10070  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10071  * but with all dynamically-allocated buffers duplicated in new buffers.
10072  */
10073 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10074
10075 /**
10076  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10077  */
10078 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10079
10080 /**
10081  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10082  */
10083 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10084
10085 /**
10086  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10087  */
10088 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10089
10090 /**
10091  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10092  * but with all dynamically-allocated buffers duplicated in new buffers.
10093  */
10094 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10095
10096 /**
10097  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10098  */
10099 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10100
10101 /**
10102  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10103  */
10104 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10105
10106 /**
10107  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10108  */
10109 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10110
10111 /**
10112  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10113  * but with all dynamically-allocated buffers duplicated in new buffers.
10114  */
10115 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10116
10117 /**
10118  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10119  */
10120 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10121
10122 /**
10123  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10124  */
10125 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10126
10127 /**
10128  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10129  */
10130 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
10131
10132 /**
10133  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10134  * but with all dynamically-allocated buffers duplicated in new buffers.
10135  */
10136 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
10137
10138 /**
10139  * Creates a new CResult_InitDecodeErrorZ in the success state.
10140  */
10141 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
10142
10143 /**
10144  * Creates a new CResult_InitDecodeErrorZ in the error state.
10145  */
10146 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
10147
10148 /**
10149  * Frees any resources used by the CResult_InitDecodeErrorZ.
10150  */
10151 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
10152
10153 /**
10154  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10155  * but with all dynamically-allocated buffers duplicated in new buffers.
10156  */
10157 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
10158
10159 /**
10160  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10161  */
10162 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
10163
10164 /**
10165  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10166  */
10167 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
10168
10169 /**
10170  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10171  */
10172 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
10173
10174 /**
10175  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10176  * but with all dynamically-allocated buffers duplicated in new buffers.
10177  */
10178 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
10179
10180 /**
10181  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10182  */
10183 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
10184
10185 /**
10186  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10187  */
10188 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
10189
10190 /**
10191  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10192  */
10193 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
10194
10195 /**
10196  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10197  * but with all dynamically-allocated buffers duplicated in new buffers.
10198  */
10199 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
10200
10201 /**
10202  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10203  */
10204 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
10205
10206 /**
10207  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10208  */
10209 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
10210
10211 /**
10212  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10213  */
10214 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
10215
10216 /**
10217  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10218  * but with all dynamically-allocated buffers duplicated in new buffers.
10219  */
10220 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
10221
10222 /**
10223  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10224  */
10225 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
10226
10227 /**
10228  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10229  */
10230 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10231
10232 /**
10233  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10234  */
10235 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
10236
10237 /**
10238  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10239  * but with all dynamically-allocated buffers duplicated in new buffers.
10240  */
10241 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
10242
10243 /**
10244  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10245  */
10246 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
10247
10248 /**
10249  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10250  */
10251 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10252
10253 /**
10254  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10255  */
10256 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
10257
10258 /**
10259  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10260  * but with all dynamically-allocated buffers duplicated in new buffers.
10261  */
10262 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
10263
10264 /**
10265  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10266  */
10267 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
10268
10269 /**
10270  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10271  */
10272 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
10273
10274 /**
10275  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10276  */
10277 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
10278
10279 /**
10280  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10281  * but with all dynamically-allocated buffers duplicated in new buffers.
10282  */
10283 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
10284
10285 /**
10286  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10287  */
10288 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
10289
10290 /**
10291  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10292  */
10293 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10294
10295 /**
10296  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10297  */
10298 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
10299
10300 /**
10301  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10302  * but with all dynamically-allocated buffers duplicated in new buffers.
10303  */
10304 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
10305
10306 /**
10307  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10308  */
10309 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
10310
10311 /**
10312  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10313  */
10314 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10315
10316 /**
10317  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10318  */
10319 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
10320
10321 /**
10322  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10323  * but with all dynamically-allocated buffers duplicated in new buffers.
10324  */
10325 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
10326
10327 /**
10328  * Creates a new CResult_PingDecodeErrorZ in the success state.
10329  */
10330 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
10331
10332 /**
10333  * Creates a new CResult_PingDecodeErrorZ in the error state.
10334  */
10335 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
10336
10337 /**
10338  * Frees any resources used by the CResult_PingDecodeErrorZ.
10339  */
10340 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
10341
10342 /**
10343  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10344  * but with all dynamically-allocated buffers duplicated in new buffers.
10345  */
10346 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
10347
10348 /**
10349  * Creates a new CResult_PongDecodeErrorZ in the success state.
10350  */
10351 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
10352
10353 /**
10354  * Creates a new CResult_PongDecodeErrorZ in the error state.
10355  */
10356 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
10357
10358 /**
10359  * Frees any resources used by the CResult_PongDecodeErrorZ.
10360  */
10361 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
10362
10363 /**
10364  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10365  * but with all dynamically-allocated buffers duplicated in new buffers.
10366  */
10367 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
10368
10369 /**
10370  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10371  */
10372 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
10373
10374 /**
10375  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10376  */
10377 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10378
10379 /**
10380  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10381  */
10382 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
10383
10384 /**
10385  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10386  * but with all dynamically-allocated buffers duplicated in new buffers.
10387  */
10388 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10389
10390 /**
10391  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10392  */
10393 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
10394
10395 /**
10396  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10397  */
10398 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10399
10400 /**
10401  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10402  */
10403 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
10404
10405 /**
10406  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10407  * but with all dynamically-allocated buffers duplicated in new buffers.
10408  */
10409 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10410
10411 /**
10412  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10413  */
10414 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
10415
10416 /**
10417  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10418  */
10419 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10420
10421 /**
10422  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10423  */
10424 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
10425
10426 /**
10427  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10428  * but with all dynamically-allocated buffers duplicated in new buffers.
10429  */
10430 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10431
10432 /**
10433  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10434  */
10435 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
10436
10437 /**
10438  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10439  */
10440 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10441
10442 /**
10443  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10444  */
10445 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
10446
10447 /**
10448  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10449  * but with all dynamically-allocated buffers duplicated in new buffers.
10450  */
10451 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10452
10453 /**
10454  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10455  */
10456 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
10457
10458 /**
10459  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10460  */
10461 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
10462
10463 /**
10464  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10465  */
10466 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
10467
10468 /**
10469  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10470  * but with all dynamically-allocated buffers duplicated in new buffers.
10471  */
10472 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
10473
10474 /**
10475  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10476  */
10477 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
10478
10479 /**
10480  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10481  */
10482 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10483
10484 /**
10485  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10486  */
10487 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
10488
10489 /**
10490  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10491  * but with all dynamically-allocated buffers duplicated in new buffers.
10492  */
10493 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10494
10495 /**
10496  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10497  */
10498 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
10499
10500 /**
10501  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10502  */
10503 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10504
10505 /**
10506  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10507  */
10508 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
10509
10510 /**
10511  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10512  * but with all dynamically-allocated buffers duplicated in new buffers.
10513  */
10514 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10515
10516 /**
10517  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10518  */
10519 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
10520
10521 /**
10522  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10523  */
10524 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
10525
10526 /**
10527  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10528  */
10529 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
10530
10531 /**
10532  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10533  * but with all dynamically-allocated buffers duplicated in new buffers.
10534  */
10535 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
10536
10537 /**
10538  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10539  */
10540 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
10541
10542 /**
10543  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10544  */
10545 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
10546
10547 /**
10548  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10549  */
10550 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
10551
10552 /**
10553  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10554  * but with all dynamically-allocated buffers duplicated in new buffers.
10555  */
10556 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
10557
10558 /**
10559  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10560  */
10561 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
10562
10563 /**
10564  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10565  */
10566 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10567
10568 /**
10569  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10570  */
10571 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
10572
10573 /**
10574  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10575  * but with all dynamically-allocated buffers duplicated in new buffers.
10576  */
10577 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10578
10579 /**
10580  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10581  */
10582 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
10583
10584 /**
10585  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10586  */
10587 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10588
10589 /**
10590  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10591  */
10592 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
10593
10594 /**
10595  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10596  * but with all dynamically-allocated buffers duplicated in new buffers.
10597  */
10598 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10599
10600 /**
10601  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10602  */
10603 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
10604
10605 /**
10606  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10607  */
10608 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
10609
10610 /**
10611  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10612  */
10613 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
10614
10615 /**
10616  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10617  * but with all dynamically-allocated buffers duplicated in new buffers.
10618  */
10619 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
10620
10621 /**
10622  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10623  */
10624 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10625
10626 /**
10627  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10628  */
10629 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10630
10631 /**
10632  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10633  */
10634 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10635
10636 /**
10637  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10638  * but with all dynamically-allocated buffers duplicated in new buffers.
10639  */
10640 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10641
10642 /**
10643  * Creates a new tuple which has the same data as `orig`
10644  * but with all dynamically-allocated buffers duplicated in new buffers.
10645  */
10646 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10647
10648 /**
10649  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10650  */
10651 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10652
10653 /**
10654  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10655  */
10656 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10657
10658 /**
10659  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10660  */
10661 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10662
10663 /**
10664  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10665  */
10666 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10667
10668 /**
10669  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10670  */
10671 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10672
10673 /**
10674  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10675  * but with all dynamically-allocated buffers duplicated in new buffers.
10676  */
10677 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10678
10679 /**
10680  * Creates a new CResult_SignatureNoneZ in the success state.
10681  */
10682 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10683
10684 /**
10685  * Creates a new CResult_SignatureNoneZ in the error state.
10686  */
10687 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10688
10689 /**
10690  * Frees any resources used by the CResult_SignatureNoneZ.
10691  */
10692 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10693
10694 /**
10695  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10696  * but with all dynamically-allocated buffers duplicated in new buffers.
10697  */
10698 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10699
10700 /**
10701  * Creates a new CResult_SignDecodeErrorZ in the success state.
10702  */
10703 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10704
10705 /**
10706  * Creates a new CResult_SignDecodeErrorZ in the error state.
10707  */
10708 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10709
10710 /**
10711  * Frees any resources used by the CResult_SignDecodeErrorZ.
10712  */
10713 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10714
10715 /**
10716  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10717  * but with all dynamically-allocated buffers duplicated in new buffers.
10718  */
10719 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10720
10721 /**
10722  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10723  */
10724 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
10725
10726 /**
10727  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
10728  */
10729 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
10730
10731 /**
10732  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
10733  */
10734 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
10735
10736 /**
10737  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
10738  */
10739 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
10740
10741 /**
10742  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
10743  * but with all dynamically-allocated buffers duplicated in new buffers.
10744  */
10745 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
10746
10747 /**
10748  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
10749  */
10750 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
10751
10752 /**
10753  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10754  */
10755 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10756
10757 /**
10758  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10759  */
10760 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10761
10762 /**
10763  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10764  * but with all dynamically-allocated buffers duplicated in new buffers.
10765  */
10766 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10767
10768 /**
10769  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10770  */
10771 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10772
10773 /**
10774  * Creates a new CResult_TransactionNoneZ in the success state.
10775  */
10776 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10777
10778 /**
10779  * Creates a new CResult_TransactionNoneZ in the error state.
10780  */
10781 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10782
10783 /**
10784  * Frees any resources used by the CResult_TransactionNoneZ.
10785  */
10786 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10787
10788 /**
10789  * Creates a new CResult_NoneErrorZ in the success state.
10790  */
10791 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
10792
10793 /**
10794  * Creates a new CResult_NoneErrorZ in the error state.
10795  */
10796 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
10797
10798 /**
10799  * Frees any resources used by the CResult_NoneErrorZ.
10800  */
10801 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
10802
10803 /**
10804  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10805  */
10806 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
10807
10808 /**
10809  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10810  */
10811 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
10812
10813 /**
10814  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10815  */
10816 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
10817
10818 /**
10819  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10820  */
10821 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
10822
10823 /**
10824  * Creates a new CResult_NoneAPIErrorZ in the success state.
10825  */
10826 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
10827
10828 /**
10829  * Creates a new CResult_NoneAPIErrorZ in the error state.
10830  */
10831 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
10832
10833 /**
10834  * Frees any resources used by the CResult_NoneAPIErrorZ.
10835  */
10836 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
10837
10838 /**
10839  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10840  * but with all dynamically-allocated buffers duplicated in new buffers.
10841  */
10842 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
10843
10844 /**
10845  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10846  */
10847 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
10848
10849 /**
10850  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10851  */
10852 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
10853
10854 /**
10855  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
10856  */
10857 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
10858
10859 /**
10860  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
10861  */
10862 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
10863
10864 /**
10865  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
10866  */
10867 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
10868
10869 /**
10870  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10871  * but with all dynamically-allocated buffers duplicated in new buffers.
10872  */
10873 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
10874
10875 /**
10876  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10877  */
10878 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
10879
10880 /**
10881  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10882  */
10883 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
10884
10885 /**
10886  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10887  */
10888 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
10889
10890 /**
10891  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10892  */
10893 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
10894
10895 /**
10896  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10897  */
10898 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
10899
10900 /**
10901  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10902  */
10903 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
10904
10905 /**
10906  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10907  */
10908 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
10909
10910 /**
10911  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10912  */
10913 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
10914
10915 /**
10916  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10917  */
10918 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10919
10920 /**
10921  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10922  */
10923 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10924
10925 /**
10926  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10927  */
10928 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10929
10930 /**
10931  * Frees any resources used by the Event
10932  */
10933 void Event_free(struct LDKEvent this_ptr);
10934
10935 /**
10936  * Creates a copy of the Event
10937  */
10938 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
10939
10940 /**
10941  * Serialize the Event object into a byte array which can be read by Event_read
10942  */
10943 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
10944
10945 /**
10946  * Frees any resources used by the MessageSendEvent
10947  */
10948 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
10949
10950 /**
10951  * Creates a copy of the MessageSendEvent
10952  */
10953 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
10954
10955 /**
10956  * Calls the free function if one is set
10957  */
10958 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
10959
10960 /**
10961  * Calls the free function if one is set
10962  */
10963 void EventsProvider_free(struct LDKEventsProvider this_ptr);
10964
10965 /**
10966  * Frees any resources used by the APIError
10967  */
10968 void APIError_free(struct LDKAPIError this_ptr);
10969
10970 /**
10971  * Creates a copy of the APIError
10972  */
10973 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
10974
10975 /**
10976  * Creates a digital signature of a message given a SecretKey, like the node's secret.
10977  * 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.
10978  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
10979  */
10980 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
10981
10982 /**
10983  * Recovers the PublicKey of the signer of the message given the message and the signature.
10984  */
10985 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
10986
10987 /**
10988  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
10989  * and the PublicKey.
10990  */
10991 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
10992
10993 /**
10994  * Creates a copy of the Level
10995  */
10996 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
10997
10998 /**
10999  * Returns the most verbose logging level.
11000  */
11001 MUST_USE_RES enum LDKLevel Level_max(void);
11002
11003 /**
11004  * Calls the free function if one is set
11005  */
11006 void Logger_free(struct LDKLogger this_ptr);
11007
11008 /**
11009  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11010  */
11011 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11012
11013 /**
11014  * Confirmations we will wait for before considering the channel locked in.
11015  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11016  * equivalent limit applied to outbound channels).
11017  *
11018  * Default value: 6.
11019  */
11020 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11021
11022 /**
11023  * Confirmations we will wait for before considering the channel locked in.
11024  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11025  * equivalent limit applied to outbound channels).
11026  *
11027  * Default value: 6.
11028  */
11029 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11030
11031 /**
11032  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11033  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11034  * transaction).
11035  *
11036  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11037  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11038  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11039  * possibly with time in between to RBF the spending transaction).
11040  *
11041  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11042  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11043  * our channel.
11044  *
11045  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11046  * can tweak config to ask for more security, not less.
11047  */
11048 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11049
11050 /**
11051  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11052  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11053  * transaction).
11054  *
11055  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11056  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11057  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11058  * possibly with time in between to RBF the spending transaction).
11059  *
11060  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11061  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11062  * our channel.
11063  *
11064  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11065  * can tweak config to ask for more security, not less.
11066  */
11067 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11068
11069 /**
11070  * Set to the smallest value HTLC we will accept to process.
11071  *
11072  * This value is sent to our counterparty on channel-open and we close the channel any time
11073  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11074  *
11075  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11076  * by the protocol.
11077  */
11078 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11079
11080 /**
11081  * Set to the smallest value HTLC we will accept to process.
11082  *
11083  * This value is sent to our counterparty on channel-open and we close the channel any time
11084  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11085  *
11086  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11087  * by the protocol.
11088  */
11089 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11090
11091 /**
11092  * Constructs a new ChannelHandshakeConfig given each field
11093  */
11094 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);
11095
11096 /**
11097  * Creates a copy of the ChannelHandshakeConfig
11098  */
11099 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11100
11101 /**
11102  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11103  */
11104 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11105
11106 /**
11107  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11108  */
11109 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11110
11111 /**
11112  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11113  * only applies to inbound channels.
11114  *
11115  * Default value: 0.
11116  */
11117 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11118
11119 /**
11120  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11121  * only applies to inbound channels.
11122  *
11123  * Default value: 0.
11124  */
11125 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11126
11127 /**
11128  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11129  * you to limit the maximum minimum-size they can require.
11130  *
11131  * Default value: u64::max_value.
11132  */
11133 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11134
11135 /**
11136  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11137  * you to limit the maximum minimum-size they can require.
11138  *
11139  * Default value: u64::max_value.
11140  */
11141 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11142
11143 /**
11144  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11145  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11146  *
11147  * Default value: 0.
11148  */
11149 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11150
11151 /**
11152  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11153  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11154  *
11155  * Default value: 0.
11156  */
11157 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11158
11159 /**
11160  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11161  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11162  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11163  *
11164  * Default value: u64::max_value.
11165  */
11166 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11167
11168 /**
11169  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11170  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11171  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11172  *
11173  * Default value: u64::max_value.
11174  */
11175 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11176
11177 /**
11178  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11179  * time. This allows you to set a minimum such value.
11180  *
11181  * Default value: 0.
11182  */
11183 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11184
11185 /**
11186  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11187  * time. This allows you to set a minimum such value.
11188  *
11189  * Default value: 0.
11190  */
11191 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11192
11193 /**
11194  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11195  * required to always be higher than this value so this only applies to HTLC outputs (and
11196  * potentially to-self outputs before any payments have been made).
11197  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11198  * This setting allows you to set a minimum dust limit for their commitment transactions,
11199  * reflecting the reality that tiny outputs are not considered standard transactions and will
11200  * not propagate through the Bitcoin network.
11201  *
11202  * Default value: 546, the current dust limit on the Bitcoin network.
11203  */
11204 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11205
11206 /**
11207  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11208  * required to always be higher than this value so this only applies to HTLC outputs (and
11209  * potentially to-self outputs before any payments have been made).
11210  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11211  * This setting allows you to set a minimum dust limit for their commitment transactions,
11212  * reflecting the reality that tiny outputs are not considered standard transactions and will
11213  * not propagate through the Bitcoin network.
11214  *
11215  * Default value: 546, the current dust limit on the Bitcoin network.
11216  */
11217 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11218
11219 /**
11220  * Maximum allowed threshold above which outputs will not be generated in their commitment
11221  * transactions.
11222  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11223  *
11224  * Default value: u64::max_value.
11225  */
11226 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11227
11228 /**
11229  * Maximum allowed threshold above which outputs will not be generated in their commitment
11230  * transactions.
11231  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11232  *
11233  * Default value: u64::max_value.
11234  */
11235 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11236
11237 /**
11238  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11239  * certain number of blocks, specified by the node which is not the funder (as the funder can
11240  * assume they aren't going to double-spend themselves).
11241  * This config allows you to set a limit on the maximum amount of time to wait.
11242  *
11243  * Default value: 144, or roughly one day and only applies to outbound channels.
11244  */
11245 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11246
11247 /**
11248  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11249  * certain number of blocks, specified by the node which is not the funder (as the funder can
11250  * assume they aren't going to double-spend themselves).
11251  * This config allows you to set a limit on the maximum amount of time to wait.
11252  *
11253  * Default value: 144, or roughly one day and only applies to outbound channels.
11254  */
11255 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11256
11257 /**
11258  * Set to force the incoming channel to match our announced channel preference in
11259  * ChannelConfig.
11260  *
11261  * Default value: true, to make the default that no announced channels are possible (which is
11262  * appropriate for any nodes which are not online very reliably).
11263  */
11264 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11265
11266 /**
11267  * Set to force the incoming channel to match our announced channel preference in
11268  * ChannelConfig.
11269  *
11270  * Default value: true, to make the default that no announced channels are possible (which is
11271  * appropriate for any nodes which are not online very reliably).
11272  */
11273 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11274
11275 /**
11276  * Set to the amount of time we're willing to wait to claim money back to us.
11277  *
11278  * Not checking this value would be a security issue, as our peer would be able to set it to
11279  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11280  *
11281  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11282  * reduce the loss of having useless locked funds (if your peer accepts)
11283  */
11284 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11285
11286 /**
11287  * Set to the amount of time we're willing to wait to claim money back to us.
11288  *
11289  * Not checking this value would be a security issue, as our peer would be able to set it to
11290  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11291  *
11292  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11293  * reduce the loss of having useless locked funds (if your peer accepts)
11294  */
11295 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11296
11297 /**
11298  * Constructs a new ChannelHandshakeLimits given each field
11299  */
11300 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);
11301
11302 /**
11303  * Creates a copy of the ChannelHandshakeLimits
11304  */
11305 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11306
11307 /**
11308  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11309  */
11310 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11311
11312 /**
11313  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11314  */
11315 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11316
11317 /**
11318  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11319  * This may be allowed to change at runtime in a later update, however doing so must result in
11320  * update messages sent to notify all nodes of our updated relay fee.
11321  *
11322  * Default value: 0.
11323  */
11324 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11325
11326 /**
11327  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11328  * This may be allowed to change at runtime in a later update, however doing so must result in
11329  * update messages sent to notify all nodes of our updated relay fee.
11330  *
11331  * Default value: 0.
11332  */
11333 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11334
11335 /**
11336  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11337  * the channel this config applies to.
11338  *
11339  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11340  * HTLC balance when a channel appears on-chain whereas
11341  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11342  * (non-HTLC-encumbered) balance.
11343  *
11344  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11345  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11346  * commitment transaction at least once per this many blocks (minus some margin to allow us
11347  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11348  * the spending transaction).
11349  *
11350  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11351  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11352  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11353  *
11354  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11355  */
11356 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11357
11358 /**
11359  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11360  * the channel this config applies to.
11361  *
11362  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11363  * HTLC balance when a channel appears on-chain whereas
11364  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11365  * (non-HTLC-encumbered) balance.
11366  *
11367  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11368  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11369  * commitment transaction at least once per this many blocks (minus some margin to allow us
11370  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11371  * the spending transaction).
11372  *
11373  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11374  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11375  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11376  *
11377  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11378  */
11379 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11380
11381 /**
11382  * Set to announce the channel publicly and notify all nodes that they can route via this
11383  * channel.
11384  *
11385  * This should only be set to true for nodes which expect to be online reliably.
11386  *
11387  * As the node which funds a channel picks this value this will only apply for new outbound
11388  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11389  *
11390  * This cannot be changed after the initial channel handshake.
11391  *
11392  * Default value: false.
11393  */
11394 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11395
11396 /**
11397  * Set to announce the channel publicly and notify all nodes that they can route via this
11398  * channel.
11399  *
11400  * This should only be set to true for nodes which expect to be online reliably.
11401  *
11402  * As the node which funds a channel picks this value this will only apply for new outbound
11403  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11404  *
11405  * This cannot be changed after the initial channel handshake.
11406  *
11407  * Default value: false.
11408  */
11409 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11410
11411 /**
11412  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11413  * supports it, they will then enforce the mutual-close output to us matches what we provided
11414  * at intialization, preventing us from closing to an alternate pubkey.
11415  *
11416  * This is set to true by default to provide a slight increase in security, though ultimately
11417  * any attacker who is able to take control of a channel can just as easily send the funds via
11418  * lightning payments, so we never require that our counterparties support this option.
11419  *
11420  * This cannot be changed after a channel has been initialized.
11421  *
11422  * Default value: true.
11423  */
11424 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11425
11426 /**
11427  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11428  * supports it, they will then enforce the mutual-close output to us matches what we provided
11429  * at intialization, preventing us from closing to an alternate pubkey.
11430  *
11431  * This is set to true by default to provide a slight increase in security, though ultimately
11432  * any attacker who is able to take control of a channel can just as easily send the funds via
11433  * lightning payments, so we never require that our counterparties support this option.
11434  *
11435  * This cannot be changed after a channel has been initialized.
11436  *
11437  * Default value: true.
11438  */
11439 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11440
11441 /**
11442  * Constructs a new ChannelConfig given each field
11443  */
11444 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);
11445
11446 /**
11447  * Creates a copy of the ChannelConfig
11448  */
11449 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
11450
11451 /**
11452  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
11453  */
11454 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
11455
11456 /**
11457  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
11458  */
11459 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
11460
11461 /**
11462  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
11463  */
11464 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
11465
11466 /**
11467  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
11468  */
11469 void UserConfig_free(struct LDKUserConfig this_obj);
11470
11471 /**
11472  * Channel config that we propose to our counterparty.
11473  */
11474 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11475
11476 /**
11477  * Channel config that we propose to our counterparty.
11478  */
11479 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
11480
11481 /**
11482  * Limits applied to our counterparty's proposed channel config settings.
11483  */
11484 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11485
11486 /**
11487  * Limits applied to our counterparty's proposed channel config settings.
11488  */
11489 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
11490
11491 /**
11492  * Channel config which affects behavior during channel lifetime.
11493  */
11494 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11495
11496 /**
11497  * Channel config which affects behavior during channel lifetime.
11498  */
11499 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
11500
11501 /**
11502  * Constructs a new UserConfig given each field
11503  */
11504 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);
11505
11506 /**
11507  * Creates a copy of the UserConfig
11508  */
11509 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
11510
11511 /**
11512  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
11513  */
11514 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
11515
11516 /**
11517  * Creates a copy of the AccessError
11518  */
11519 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
11520
11521 /**
11522  * Calls the free function if one is set
11523  */
11524 void Access_free(struct LDKAccess this_ptr);
11525
11526 /**
11527  * Calls the free function if one is set
11528  */
11529 void Listen_free(struct LDKListen this_ptr);
11530
11531 /**
11532  * Calls the free function if one is set
11533  */
11534 void Confirm_free(struct LDKConfirm this_ptr);
11535
11536 /**
11537  * Calls the free function if one is set
11538  */
11539 void Watch_free(struct LDKWatch this_ptr);
11540
11541 /**
11542  * Calls the free function if one is set
11543  */
11544 void Filter_free(struct LDKFilter this_ptr);
11545
11546 /**
11547  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
11548  */
11549 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
11550
11551 /**
11552  * First block where the transaction output may have been spent.
11553  */
11554 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11555
11556 /**
11557  * First block where the transaction output may have been spent.
11558  */
11559 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11560
11561 /**
11562  * Outpoint identifying the transaction output.
11563  */
11564 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11565
11566 /**
11567  * Outpoint identifying the transaction output.
11568  */
11569 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11570
11571 /**
11572  * Spending condition of the transaction output.
11573  */
11574 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11575
11576 /**
11577  * Spending condition of the transaction output.
11578  */
11579 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11580
11581 /**
11582  * Constructs a new WatchedOutput given each field
11583  */
11584 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
11585
11586 /**
11587  * Calls the free function if one is set
11588  */
11589 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
11590
11591 /**
11592  * Creates a copy of the ConfirmationTarget
11593  */
11594 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
11595
11596 /**
11597  * Calls the free function if one is set
11598  */
11599 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
11600
11601 /**
11602  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
11603  */
11604 void ChainMonitor_free(struct LDKChainMonitor this_obj);
11605
11606 /**
11607  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
11608  *
11609  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
11610  * will call back to it indicating transactions and outputs of interest. This allows clients to
11611  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
11612  * always need to fetch full blocks absent another means for determining which blocks contain
11613  * transactions relevant to the watched channels.
11614  */
11615 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
11616
11617 /**
11618  * Constructs a new Listen which calls the relevant methods on this_arg.
11619  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11620  */
11621 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11622
11623 /**
11624  * Constructs a new Confirm which calls the relevant methods on this_arg.
11625  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
11626  */
11627 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11628
11629 /**
11630  * Constructs a new Watch which calls the relevant methods on this_arg.
11631  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
11632  */
11633 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11634
11635 /**
11636  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11637  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11638  */
11639 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11640
11641 /**
11642  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
11643  */
11644 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
11645
11646 /**
11647  * The sequence number of this update. Updates *must* be replayed in-order according to this
11648  * sequence number (and updates may panic if they are not). The update_id values are strictly
11649  * increasing and increase by one for each new update, with one exception specified below.
11650  *
11651  * This sequence number is also used to track up to which points updates which returned
11652  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11653  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11654  *
11655  * The only instance where update_id values are not strictly increasing is the case where we
11656  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11657  * its docs for more details.
11658  */
11659 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
11660
11661 /**
11662  * The sequence number of this update. Updates *must* be replayed in-order according to this
11663  * sequence number (and updates may panic if they are not). The update_id values are strictly
11664  * increasing and increase by one for each new update, with one exception specified below.
11665  *
11666  * This sequence number is also used to track up to which points updates which returned
11667  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11668  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11669  *
11670  * The only instance where update_id values are not strictly increasing is the case where we
11671  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11672  * its docs for more details.
11673  */
11674 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
11675
11676 /**
11677  * Creates a copy of the ChannelMonitorUpdate
11678  */
11679 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
11680
11681 /**
11682  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
11683  */
11684 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
11685
11686 /**
11687  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
11688  */
11689 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
11690
11691 /**
11692  * Creates a copy of the ChannelMonitorUpdateErr
11693  */
11694 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
11695
11696 /**
11697  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
11698  */
11699 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
11700
11701 /**
11702  * Creates a copy of the MonitorUpdateError
11703  */
11704 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
11705
11706 /**
11707  * Frees any resources used by the MonitorEvent
11708  */
11709 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
11710
11711 /**
11712  * Creates a copy of the MonitorEvent
11713  */
11714 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
11715
11716 /**
11717  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
11718  */
11719 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
11720
11721 /**
11722  * Creates a copy of the HTLCUpdate
11723  */
11724 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
11725
11726 /**
11727  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
11728  */
11729 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
11730
11731 /**
11732  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
11733  */
11734 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
11735
11736 /**
11737  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
11738  */
11739 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
11740
11741 /**
11742  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
11743  */
11744 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
11745
11746 /**
11747  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
11748  * itself.
11749  *
11750  * panics if the given update is not the next update by update_id.
11751  */
11752 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);
11753
11754 /**
11755  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
11756  * ChannelMonitor.
11757  */
11758 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11759
11760 /**
11761  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
11762  */
11763 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11764
11765 /**
11766  * Gets a list of txids, with their output scripts (in the order they appear in the
11767  * transaction), which we must learn about spends of via block_connected().
11768  */
11769 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11770
11771 /**
11772  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
11773  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
11774  * have been registered.
11775  */
11776 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
11777
11778 /**
11779  * Get the list of HTLCs who's status has been updated on chain. This should be called by
11780  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
11781  */
11782 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11783
11784 /**
11785  * Gets the list of pending events which were generated by previous actions, clearing the list
11786  * in the process.
11787  *
11788  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
11789  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
11790  * no internal locking in ChannelMonitors.
11791  */
11792 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11793
11794 /**
11795  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
11796  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
11797  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
11798  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
11799  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
11800  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
11801  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
11802  * out-of-band the other node operator to coordinate with him if option is available to you.
11803  * In any-case, choice is up to the user.
11804  */
11805 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);
11806
11807 /**
11808  * Processes transactions in a newly connected block, which may result in any of the following:
11809  * - update the monitor's state against resolved HTLCs
11810  * - punish the counterparty in the case of seeing a revoked commitment transaction
11811  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
11812  * - detect settled outputs for later spending
11813  * - schedule and bump any in-flight claims
11814  *
11815  * Returns any new outputs to watch from `txdata`; after called, these are also included in
11816  * [`get_outputs_to_watch`].
11817  *
11818  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
11819  */
11820 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);
11821
11822 /**
11823  * Determines if the disconnected block contained any transactions of interest and updates
11824  * appropriately.
11825  */
11826 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);
11827
11828 /**
11829  * Processes transactions confirmed in a block with the given header and height, returning new
11830  * outputs to watch. See [`block_connected`] for details.
11831  *
11832  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
11833  * blocks. See [`chain::Confirm`] for calling expectations.
11834  *
11835  * [`block_connected`]: Self::block_connected
11836  */
11837 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);
11838
11839 /**
11840  * Processes a transaction that was reorganized out of the chain.
11841  *
11842  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
11843  * than blocks. See [`chain::Confirm`] for calling expectations.
11844  *
11845  * [`block_disconnected`]: Self::block_disconnected
11846  */
11847 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);
11848
11849 /**
11850  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
11851  * [`block_connected`] for details.
11852  *
11853  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
11854  * blocks. See [`chain::Confirm`] for calling expectations.
11855  *
11856  * [`block_connected`]: Self::block_connected
11857  */
11858 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);
11859
11860 /**
11861  * Returns the set of txids that should be monitored for re-organization out of the chain.
11862  */
11863 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11864
11865 /**
11866  * Calls the free function if one is set
11867  */
11868 void Persist_free(struct LDKPersist this_ptr);
11869
11870 /**
11871  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
11872  */
11873 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
11874
11875 /**
11876  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
11877  */
11878 void OutPoint_free(struct LDKOutPoint this_obj);
11879
11880 /**
11881  * The referenced transaction's txid.
11882  */
11883 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
11884
11885 /**
11886  * The referenced transaction's txid.
11887  */
11888 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11889
11890 /**
11891  * The index of the referenced output in its transaction's vout.
11892  */
11893 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
11894
11895 /**
11896  * The index of the referenced output in its transaction's vout.
11897  */
11898 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
11899
11900 /**
11901  * Constructs a new OutPoint given each field
11902  */
11903 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
11904
11905 /**
11906  * Creates a copy of the OutPoint
11907  */
11908 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
11909
11910 /**
11911  * Convert an `OutPoint` to a lightning channel id.
11912  */
11913 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
11914
11915 /**
11916  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
11917  */
11918 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
11919
11920 /**
11921  * Read a OutPoint from a byte array, created by OutPoint_write
11922  */
11923 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
11924
11925 /**
11926  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
11927  */
11928 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
11929
11930 /**
11931  * The outpoint which is spendable
11932  */
11933 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
11934
11935 /**
11936  * The outpoint which is spendable
11937  */
11938 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11939
11940 /**
11941  * Per commitment point to derive delayed_payment_key by key holder
11942  */
11943 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
11944
11945 /**
11946  * Per commitment point to derive delayed_payment_key by key holder
11947  */
11948 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11949
11950 /**
11951  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
11952  * the witness_script.
11953  */
11954 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
11955
11956 /**
11957  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
11958  * the witness_script.
11959  */
11960 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
11961
11962 /**
11963  * The output which is referenced by the given outpoint
11964  */
11965 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
11966
11967 /**
11968  * The revocation point specific to the commitment transaction which was broadcast. Used to
11969  * derive the witnessScript for this output.
11970  */
11971 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
11972
11973 /**
11974  * The revocation point specific to the commitment transaction which was broadcast. Used to
11975  * derive the witnessScript for this output.
11976  */
11977 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11978
11979 /**
11980  * Arbitrary identification information returned by a call to
11981  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
11982  * the channel to spend the output.
11983  */
11984 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
11985
11986 /**
11987  * Arbitrary identification information returned by a call to
11988  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
11989  * the channel to spend the output.
11990  */
11991 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11992
11993 /**
11994  * The value of the channel which this output originated from, possibly indirectly.
11995  */
11996 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
11997
11998 /**
11999  * The value of the channel which this output originated from, possibly indirectly.
12000  */
12001 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12002
12003 /**
12004  * Constructs a new DelayedPaymentOutputDescriptor given each field
12005  */
12006 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);
12007
12008 /**
12009  * Creates a copy of the DelayedPaymentOutputDescriptor
12010  */
12011 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12012
12013 /**
12014  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12015  */
12016 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12017
12018 /**
12019  * The outpoint which is spendable
12020  */
12021 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12022
12023 /**
12024  * The outpoint which is spendable
12025  */
12026 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12027
12028 /**
12029  * The output which is referenced by the given outpoint
12030  */
12031 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12032
12033 /**
12034  * Arbitrary identification information returned by a call to
12035  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12036  * the channel to spend the output.
12037  */
12038 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12039
12040 /**
12041  * Arbitrary identification information returned by a call to
12042  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12043  * the channel to spend the output.
12044  */
12045 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12046
12047 /**
12048  * The value of the channel which this transactions spends.
12049  */
12050 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12051
12052 /**
12053  * The value of the channel which this transactions spends.
12054  */
12055 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12056
12057 /**
12058  * Constructs a new StaticPaymentOutputDescriptor given each field
12059  */
12060 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);
12061
12062 /**
12063  * Creates a copy of the StaticPaymentOutputDescriptor
12064  */
12065 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12066
12067 /**
12068  * Frees any resources used by the SpendableOutputDescriptor
12069  */
12070 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12071
12072 /**
12073  * Creates a copy of the SpendableOutputDescriptor
12074  */
12075 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12076
12077 /**
12078  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12079  */
12080 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12081
12082 /**
12083  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12084  */
12085 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12086
12087 /**
12088  * Calls the free function if one is set
12089  */
12090 void BaseSign_free(struct LDKBaseSign this_ptr);
12091
12092 /**
12093  * Creates a copy of a Sign
12094  */
12095 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12096
12097 /**
12098  * Calls the free function if one is set
12099  */
12100 void Sign_free(struct LDKSign this_ptr);
12101
12102 /**
12103  * Calls the free function if one is set
12104  */
12105 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12106
12107 /**
12108  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12109  */
12110 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12111
12112 /**
12113  * Private key of anchor tx
12114  */
12115 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12116
12117 /**
12118  * Private key of anchor tx
12119  */
12120 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12121
12122 /**
12123  * Holder secret key for blinded revocation pubkey
12124  */
12125 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12126
12127 /**
12128  * Holder secret key for blinded revocation pubkey
12129  */
12130 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12131
12132 /**
12133  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12134  */
12135 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12136
12137 /**
12138  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12139  */
12140 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12141
12142 /**
12143  * Holder secret key used in HTLC tx
12144  */
12145 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12146
12147 /**
12148  * Holder secret key used in HTLC tx
12149  */
12150 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12151
12152 /**
12153  * Holder htlc secret key used in commitment tx htlc outputs
12154  */
12155 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12156
12157 /**
12158  * Holder htlc secret key used in commitment tx htlc outputs
12159  */
12160 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12161
12162 /**
12163  * Commitment seed
12164  */
12165 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12166
12167 /**
12168  * Commitment seed
12169  */
12170 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12171
12172 /**
12173  * Creates a copy of the InMemorySigner
12174  */
12175 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12176
12177 /**
12178  * Create a new InMemorySigner
12179  */
12180 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);
12181
12182 /**
12183  * Counterparty pubkeys.
12184  * Will panic if ready_channel wasn't called.
12185  */
12186 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12187
12188 /**
12189  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12190  * transactions, ie the amount of time that we have to wait to recover our funds if we
12191  * broadcast a transaction.
12192  * Will panic if ready_channel wasn't called.
12193  */
12194 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12195
12196 /**
12197  * The contest_delay value specified by us and applied on transactions broadcastable
12198  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12199  * if they broadcast a transaction.
12200  * Will panic if ready_channel wasn't called.
12201  */
12202 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12203
12204 /**
12205  * Whether the holder is the initiator
12206  * Will panic if ready_channel wasn't called.
12207  */
12208 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12209
12210 /**
12211  * Funding outpoint
12212  * Will panic if ready_channel wasn't called.
12213  */
12214 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12215
12216 /**
12217  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12218  * building transactions.
12219  *
12220  * Will panic if ready_channel wasn't called.
12221  */
12222 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12223
12224 /**
12225  * Sign the single input of spend_tx at index `input_idx` which spends the output
12226  * described by descriptor, returning the witness stack for the input.
12227  *
12228  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12229  * or is not spending the outpoint described by `descriptor.outpoint`.
12230  */
12231 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);
12232
12233 /**
12234  * Sign the single input of spend_tx at index `input_idx` which spends the output
12235  * described by descriptor, returning the witness stack for the input.
12236  *
12237  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12238  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12239  * sequence set to `descriptor.to_self_delay`.
12240  */
12241 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);
12242
12243 /**
12244  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12245  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12246  */
12247 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12248
12249 /**
12250  * Constructs a new Sign which calls the relevant methods on this_arg.
12251  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12252  */
12253 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12254
12255 /**
12256  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12257  */
12258 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12259
12260 /**
12261  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12262  */
12263 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12264
12265 /**
12266  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12267  */
12268 void KeysManager_free(struct LDKKeysManager this_obj);
12269
12270 /**
12271  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12272  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12273  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12274  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12275  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12276  * simply use the current time (with very high precision).
12277  *
12278  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12279  * obviously, starting_time should be unique every time you reload the library - it is only
12280  * used to generate new ephemeral key data (which will be stored by the individual channel if
12281  * necessary).
12282  *
12283  * Note that the seed is required to recover certain on-chain funds independent of
12284  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12285  * channel, and some on-chain during-closing funds.
12286  *
12287  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12288  * versions. Once the library is more fully supported, the docs will be updated to include a
12289  * detailed description of the guarantee.
12290  */
12291 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12292
12293 /**
12294  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12295  *
12296  * Key derivation parameters are accessible through a per-channel secrets
12297  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12298  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12299  */
12300 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]);
12301
12302 /**
12303  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12304  * output to the given change destination (if sufficient change value remains). The
12305  * transaction will have a feerate, at least, of the given value.
12306  *
12307  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12308  * if a descriptor was duplicated.
12309  *
12310  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12311  *
12312  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12313  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12314  */
12315 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);
12316
12317 /**
12318  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12319  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12320  */
12321 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12322
12323 /**
12324  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12325  */
12326 void ChannelManager_free(struct LDKChannelManager this_obj);
12327
12328 /**
12329  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12330  */
12331 void ChainParameters_free(struct LDKChainParameters this_obj);
12332
12333 /**
12334  * The network for determining the `chain_hash` in Lightning messages.
12335  */
12336 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12337
12338 /**
12339  * The network for determining the `chain_hash` in Lightning messages.
12340  */
12341 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12342
12343 /**
12344  * The hash and height of the latest block successfully connected.
12345  *
12346  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12347  */
12348 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12349
12350 /**
12351  * The hash and height of the latest block successfully connected.
12352  *
12353  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12354  */
12355 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12356
12357 /**
12358  * Constructs a new ChainParameters given each field
12359  */
12360 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12361
12362 /**
12363  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12364  */
12365 void BestBlock_free(struct LDKBestBlock this_obj);
12366
12367 /**
12368  * Creates a copy of the BestBlock
12369  */
12370 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12371
12372 /**
12373  * Returns the best block from the genesis of the given network.
12374  */
12375 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12376
12377 /**
12378  * Returns the best block as identified by the given block hash and height.
12379  */
12380 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12381
12382 /**
12383  * Returns the best block hash.
12384  */
12385 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12386
12387 /**
12388  * Returns the best block height.
12389  */
12390 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12391
12392 /**
12393  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12394  */
12395 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12396
12397 /**
12398  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12399  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12400  * Note that this means this value is *not* persistent - it can change once during the
12401  * lifetime of the channel.
12402  */
12403 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12404
12405 /**
12406  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12407  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12408  * Note that this means this value is *not* persistent - it can change once during the
12409  * lifetime of the channel.
12410  */
12411 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12412
12413 /**
12414  * The position of the funding transaction in the chain. None if the funding transaction has
12415  * not yet been confirmed and the channel fully opened.
12416  */
12417 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12418
12419 /**
12420  * The position of the funding transaction in the chain. None if the funding transaction has
12421  * not yet been confirmed and the channel fully opened.
12422  */
12423 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
12424
12425 /**
12426  * The node_id of our counterparty
12427  */
12428 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12429
12430 /**
12431  * The node_id of our counterparty
12432  */
12433 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12434
12435 /**
12436  * The Features the channel counterparty provided upon last connection.
12437  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12438  * many routing-relevant features are present in the init context.
12439  */
12440 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12441
12442 /**
12443  * The Features the channel counterparty provided upon last connection.
12444  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12445  * many routing-relevant features are present in the init context.
12446  */
12447 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
12448
12449 /**
12450  * The value, in satoshis, of this channel as appears in the funding output
12451  */
12452 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12453
12454 /**
12455  * The value, in satoshis, of this channel as appears in the funding output
12456  */
12457 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12458
12459 /**
12460  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12461  */
12462 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12463
12464 /**
12465  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12466  */
12467 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12468
12469 /**
12470  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12471  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12472  * available for inclusion in new outbound HTLCs). This further does not include any pending
12473  * outgoing HTLCs which are awaiting some other resolution to be sent.
12474  */
12475 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12476
12477 /**
12478  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12479  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12480  * available for inclusion in new outbound HTLCs). This further does not include any pending
12481  * outgoing HTLCs which are awaiting some other resolution to be sent.
12482  */
12483 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12484
12485 /**
12486  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12487  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12488  * available for inclusion in new inbound HTLCs).
12489  * Note that there are some corner cases not fully handled here, so the actual available
12490  * inbound capacity may be slightly higher than this.
12491  */
12492 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12493
12494 /**
12495  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12496  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12497  * available for inclusion in new inbound HTLCs).
12498  * Note that there are some corner cases not fully handled here, so the actual available
12499  * inbound capacity may be slightly higher than this.
12500  */
12501 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12502
12503 /**
12504  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12505  * the peer is connected, and (c) no monitor update failure is pending resolution.
12506  */
12507 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12508
12509 /**
12510  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12511  * the peer is connected, and (c) no monitor update failure is pending resolution.
12512  */
12513 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12514
12515 /**
12516  * Creates a copy of the ChannelDetails
12517  */
12518 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
12519
12520 /**
12521  * Frees any resources used by the PaymentSendFailure
12522  */
12523 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
12524
12525 /**
12526  * Creates a copy of the PaymentSendFailure
12527  */
12528 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
12529
12530 /**
12531  * Constructs a new ChannelManager to hold several channels and route between them.
12532  *
12533  * This is the main \"logic hub\" for all channel-related actions, and implements
12534  * ChannelMessageHandler.
12535  *
12536  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
12537  *
12538  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
12539  *
12540  * Users need to notify the new ChannelManager when a new block is connected or
12541  * disconnected using its `block_connected` and `block_disconnected` methods, starting
12542  * from after `params.latest_hash`.
12543  */
12544 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);
12545
12546 /**
12547  * Gets the current configuration applied to all new channels,  as
12548  */
12549 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
12550
12551 /**
12552  * Creates a new outbound channel to the given remote node and with the given value.
12553  *
12554  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
12555  * tracking of which events correspond with which create_channel call. Note that the
12556  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
12557  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
12558  * otherwise ignored.
12559  *
12560  * If successful, will generate a SendOpenChannel message event, so you should probably poll
12561  * PeerManager::process_events afterwards.
12562  *
12563  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
12564  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
12565  */
12566 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);
12567
12568 /**
12569  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
12570  * more information.
12571  */
12572 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12573
12574 /**
12575  * Gets the list of usable channels, in random order. Useful as an argument to
12576  * get_route to ensure non-announced channels are used.
12577  *
12578  * These are guaranteed to have their is_live value set to true, see the documentation for
12579  * ChannelDetails::is_live for more info on exactly what the criteria are.
12580  */
12581 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12582
12583 /**
12584  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
12585  * will be accepted on the given channel, and after additional timeout/the closing of all
12586  * pending HTLCs, the channel will be closed on chain.
12587  *
12588  * May generate a SendShutdown message event on success, which should be relayed.
12589  */
12590 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12591
12592 /**
12593  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
12594  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
12595  */
12596 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12597
12598 /**
12599  * Force close all channels, immediately broadcasting the latest local commitment transaction
12600  * for each to the chain and rejecting new HTLCs on each.
12601  */
12602 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12603
12604 /**
12605  * Sends a payment along a given route.
12606  *
12607  * Value parameters are provided via the last hop in route, see documentation for RouteHop
12608  * fields for more info.
12609  *
12610  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
12611  * payment), we don't do anything to stop you! We always try to ensure that if the provided
12612  * next hop knows the preimage to payment_hash they can claim an additional amount as
12613  * specified in the last hop in the route! Thus, you should probably do your own
12614  * payment_preimage tracking (which you should already be doing as they represent \"proof of
12615  * payment\") and prevent double-sends yourself.
12616  *
12617  * May generate SendHTLCs message(s) event on success, which should be relayed.
12618  *
12619  * Each path may have a different return value, and PaymentSendValue may return a Vec with
12620  * each entry matching the corresponding-index entry in the route paths, see
12621  * PaymentSendFailure for more info.
12622  *
12623  * In general, a path may raise:
12624  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
12625  *    node public key) is specified.
12626  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
12627  *    (including due to previous monitor update failure or new permanent monitor update
12628  *    failure).
12629  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
12630  *    relevant updates.
12631  *
12632  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
12633  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
12634  * different route unless you intend to pay twice!
12635  *
12636  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
12637  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
12638  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
12639  * must not contain multiple paths as multi-path payments require a recipient-provided
12640  * payment_secret.
12641  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
12642  * bit set (either as required or as available). If multiple paths are present in the Route,
12643  * we assume the invoice had the basic_mpp feature set.
12644  */
12645 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);
12646
12647 /**
12648  * Call this upon creation of a funding transaction for the given channel.
12649  *
12650  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
12651  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
12652  *
12653  * Panics if a funding transaction has already been provided for this channel.
12654  *
12655  * May panic if the output found in the funding transaction is duplicative with some other
12656  * channel (note that this should be trivially prevented by using unique funding transaction
12657  * keys per-channel).
12658  *
12659  * Do NOT broadcast the funding transaction yourself. When we have safely received our
12660  * counterparty's signature the funding transaction will automatically be broadcast via the
12661  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
12662  *
12663  * Note that this includes RBF or similar transaction replacement strategies - lightning does
12664  * not currently support replacing a funding transaction on an existing channel. Instead,
12665  * create a new channel with a conflicting funding transaction.
12666  */
12667 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);
12668
12669 /**
12670  * Generates a signed node_announcement from the given arguments and creates a
12671  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
12672  * seen a channel_announcement from us (ie unless we have public channels open).
12673  *
12674  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
12675  * to humans. They carry no in-protocol meaning.
12676  *
12677  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
12678  * incoming connections. These will be broadcast to the network, publicly tying these
12679  * addresses together. If you wish to preserve user privacy, addresses should likely contain
12680  * only Tor Onion addresses.
12681  *
12682  * Panics if addresses is absurdly large (more than 500).
12683  */
12684 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
12685
12686 /**
12687  * Processes HTLCs which are pending waiting on random forward delay.
12688  *
12689  * Should only really ever be called in response to a PendingHTLCsForwardable event.
12690  * Will likely generate further events.
12691  */
12692 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
12693
12694 /**
12695  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
12696  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
12697  * to inform the network about the uselessness of these channels.
12698  *
12699  * This method handles all the details, and must be called roughly once per minute.
12700  *
12701  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
12702  */
12703 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
12704
12705 /**
12706  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
12707  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
12708  * along the path (including in our own channel on which we received it).
12709  * Returns false if no payment was found to fail backwards, true if the process of failing the
12710  * HTLC backwards has been started.
12711  */
12712 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
12713
12714 /**
12715  * Provides a payment preimage in response to a PaymentReceived event, returning true and
12716  * generating message events for the net layer to claim the payment, if possible. Thus, you
12717  * should probably kick the net layer to go send messages if this returns true!
12718  *
12719  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
12720  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
12721  * event matches your expectation. If you fail to do so and call this method, you may provide
12722  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
12723  *
12724  * May panic if called except in response to a PaymentReceived event.
12725  *
12726  * [`create_inbound_payment`]: Self::create_inbound_payment
12727  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12728  */
12729 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
12730
12731 /**
12732  * Gets the node_id held by this ChannelManager
12733  */
12734 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
12735
12736 /**
12737  * Restores a single, given channel to normal operation after a
12738  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
12739  * operation.
12740  *
12741  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
12742  * fully committed in every copy of the given channels' ChannelMonitors.
12743  *
12744  * Note that there is no effect to calling with a highest_applied_update_id other than the
12745  * current latest ChannelMonitorUpdate and one call to this function after multiple
12746  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
12747  * exists largely only to prevent races between this and concurrent update_monitor calls.
12748  *
12749  * Thus, the anticipated use is, at a high level:
12750  *  1) You register a chain::Watch with this ChannelManager,
12751  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
12752  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
12753  *     any time it cannot do so instantly,
12754  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
12755  *  4) once all remote copies are updated, you call this function with the update_id that
12756  *     completed, and once it is the latest the Channel will be re-enabled.
12757  */
12758 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);
12759
12760 /**
12761  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
12762  * to pay us.
12763  *
12764  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
12765  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
12766  *
12767  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
12768  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
12769  * passed directly to [`claim_funds`].
12770  *
12771  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
12772  *
12773  * [`claim_funds`]: Self::claim_funds
12774  * [`PaymentReceived`]: events::Event::PaymentReceived
12775  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
12776  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12777  */
12778 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);
12779
12780 /**
12781  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
12782  * stored external to LDK.
12783  *
12784  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
12785  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
12786  * the `min_value_msat` provided here, if one is provided.
12787  *
12788  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
12789  * method may return an Err if another payment with the same payment_hash is still pending.
12790  *
12791  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
12792  * allow tracking of which events correspond with which calls to this and
12793  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
12794  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
12795  * with invoice metadata stored elsewhere.
12796  *
12797  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
12798  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
12799  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
12800  * sender \"proof-of-payment\" unless they have paid the required amount.
12801  *
12802  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
12803  * in excess of the current time. This should roughly match the expiry time set in the invoice.
12804  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
12805  * pay the invoice failing. The BOLT spec suggests 7,200 secs as a default validity time for
12806  * invoices when no timeout is set.
12807  *
12808  * Note that we use block header time to time-out pending inbound payments (with some margin
12809  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
12810  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
12811  * If you need exact expiry semantics, you should enforce them upon receipt of
12812  * [`PaymentReceived`].
12813  *
12814  * May panic if `invoice_expiry_delta_secs` is greater than one year.
12815  *
12816  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
12817  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
12818  *
12819  * [`create_inbound_payment`]: Self::create_inbound_payment
12820  * [`PaymentReceived`]: events::Event::PaymentReceived
12821  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
12822  */
12823 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);
12824
12825 /**
12826  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
12827  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
12828  */
12829 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
12830
12831 /**
12832  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12833  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12834  */
12835 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
12836
12837 /**
12838  * Constructs a new Listen which calls the relevant methods on this_arg.
12839  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12840  */
12841 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
12842
12843 /**
12844  * Constructs a new Confirm which calls the relevant methods on this_arg.
12845  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12846  */
12847 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
12848
12849 /**
12850  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
12851  * indicating whether persistence is necessary. Only one listener on
12852  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
12853  * up.
12854  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
12855  */
12856 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
12857
12858 /**
12859  * Blocks until ChannelManager needs to be persisted. Only one listener on
12860  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
12861  * up.
12862  */
12863 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
12864
12865 /**
12866  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
12867  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
12868  */
12869 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
12870
12871 /**
12872  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
12873  */
12874 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
12875
12876 /**
12877  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
12878  */
12879 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
12880
12881 /**
12882  * The keys provider which will give us relevant keys. Some keys will be loaded during
12883  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
12884  * signing data.
12885  */
12886 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12887
12888 /**
12889  * The keys provider which will give us relevant keys. Some keys will be loaded during
12890  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
12891  * signing data.
12892  */
12893 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
12894
12895 /**
12896  * The fee_estimator for use in the ChannelManager in the future.
12897  *
12898  * No calls to the FeeEstimator will be made during deserialization.
12899  */
12900 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12901
12902 /**
12903  * The fee_estimator for use in the ChannelManager in the future.
12904  *
12905  * No calls to the FeeEstimator will be made during deserialization.
12906  */
12907 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
12908
12909 /**
12910  * The chain::Watch for use in the ChannelManager in the future.
12911  *
12912  * No calls to the chain::Watch will be made during deserialization. It is assumed that
12913  * you have deserialized ChannelMonitors separately and will add them to your
12914  * chain::Watch after deserializing this ChannelManager.
12915  */
12916 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12917
12918 /**
12919  * The chain::Watch for use in the ChannelManager in the future.
12920  *
12921  * No calls to the chain::Watch will be made during deserialization. It is assumed that
12922  * you have deserialized ChannelMonitors separately and will add them to your
12923  * chain::Watch after deserializing this ChannelManager.
12924  */
12925 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
12926
12927 /**
12928  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
12929  * used to broadcast the latest local commitment transactions of channels which must be
12930  * force-closed during deserialization.
12931  */
12932 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12933
12934 /**
12935  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
12936  * used to broadcast the latest local commitment transactions of channels which must be
12937  * force-closed during deserialization.
12938  */
12939 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
12940
12941 /**
12942  * The Logger for use in the ChannelManager and which may be used to log information during
12943  * deserialization.
12944  */
12945 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12946
12947 /**
12948  * The Logger for use in the ChannelManager and which may be used to log information during
12949  * deserialization.
12950  */
12951 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
12952
12953 /**
12954  * Default settings used for new channels. Any existing channels will continue to use the
12955  * runtime settings which were stored when the ChannelManager was serialized.
12956  */
12957 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
12958
12959 /**
12960  * Default settings used for new channels. Any existing channels will continue to use the
12961  * runtime settings which were stored when the ChannelManager was serialized.
12962  */
12963 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
12964
12965 /**
12966  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
12967  * HashMap for you. This is primarily useful for C bindings where it is not practical to
12968  * populate a HashMap directly from C.
12969  */
12970 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);
12971
12972 /**
12973  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
12974  */
12975 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
12976
12977 /**
12978  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
12979  */
12980 void DecodeError_free(struct LDKDecodeError this_obj);
12981
12982 /**
12983  * Creates a copy of the DecodeError
12984  */
12985 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
12986
12987 /**
12988  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
12989  */
12990 void Init_free(struct LDKInit this_obj);
12991
12992 /**
12993  * The relevant features which the sender supports
12994  */
12995 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
12996
12997 /**
12998  * The relevant features which the sender supports
12999  */
13000 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13001
13002 /**
13003  * Constructs a new Init given each field
13004  */
13005 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13006
13007 /**
13008  * Creates a copy of the Init
13009  */
13010 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13011
13012 /**
13013  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13014  */
13015 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13016
13017 /**
13018  * The channel ID involved in the error
13019  */
13020 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13021
13022 /**
13023  * The channel ID involved in the error
13024  */
13025 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13026
13027 /**
13028  * A possibly human-readable error description.
13029  * The string should be sanitized before it is used (e.g. emitted to logs
13030  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13031  * vulnerability in the terminal emulator or the logging subsystem.
13032  */
13033 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13034
13035 /**
13036  * A possibly human-readable error description.
13037  * The string should be sanitized before it is used (e.g. emitted to logs
13038  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13039  * vulnerability in the terminal emulator or the logging subsystem.
13040  */
13041 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13042
13043 /**
13044  * Constructs a new ErrorMessage given each field
13045  */
13046 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
13047
13048 /**
13049  * Creates a copy of the ErrorMessage
13050  */
13051 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13052
13053 /**
13054  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13055  */
13056 void Ping_free(struct LDKPing this_obj);
13057
13058 /**
13059  * The desired response length
13060  */
13061 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13062
13063 /**
13064  * The desired response length
13065  */
13066 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13067
13068 /**
13069  * The ping packet size.
13070  * This field is not sent on the wire. byteslen zeros are sent.
13071  */
13072 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13073
13074 /**
13075  * The ping packet size.
13076  * This field is not sent on the wire. byteslen zeros are sent.
13077  */
13078 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13079
13080 /**
13081  * Constructs a new Ping given each field
13082  */
13083 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13084
13085 /**
13086  * Creates a copy of the Ping
13087  */
13088 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13089
13090 /**
13091  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13092  */
13093 void Pong_free(struct LDKPong this_obj);
13094
13095 /**
13096  * The pong packet size.
13097  * This field is not sent on the wire. byteslen zeros are sent.
13098  */
13099 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13100
13101 /**
13102  * The pong packet size.
13103  * This field is not sent on the wire. byteslen zeros are sent.
13104  */
13105 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13106
13107 /**
13108  * Constructs a new Pong given each field
13109  */
13110 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13111
13112 /**
13113  * Creates a copy of the Pong
13114  */
13115 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13116
13117 /**
13118  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13119  */
13120 void OpenChannel_free(struct LDKOpenChannel this_obj);
13121
13122 /**
13123  * The genesis hash of the blockchain where the channel is to be opened
13124  */
13125 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13126
13127 /**
13128  * The genesis hash of the blockchain where the channel is to be opened
13129  */
13130 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13131
13132 /**
13133  * A temporary channel ID, until the funding outpoint is announced
13134  */
13135 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13136
13137 /**
13138  * A temporary channel ID, until the funding outpoint is announced
13139  */
13140 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13141
13142 /**
13143  * The channel value
13144  */
13145 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13146
13147 /**
13148  * The channel value
13149  */
13150 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13151
13152 /**
13153  * The amount to push to the counterparty as part of the open, in milli-satoshi
13154  */
13155 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13156
13157 /**
13158  * The amount to push to the counterparty as part of the open, in milli-satoshi
13159  */
13160 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13161
13162 /**
13163  * The threshold below which outputs on transactions broadcast by sender will be omitted
13164  */
13165 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13166
13167 /**
13168  * The threshold below which outputs on transactions broadcast by sender will be omitted
13169  */
13170 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13171
13172 /**
13173  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13174  */
13175 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13176
13177 /**
13178  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13179  */
13180 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13181
13182 /**
13183  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13184  */
13185 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13186
13187 /**
13188  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13189  */
13190 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13191
13192 /**
13193  * The minimum HTLC size incoming to sender, in milli-satoshi
13194  */
13195 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13196
13197 /**
13198  * The minimum HTLC size incoming to sender, in milli-satoshi
13199  */
13200 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13201
13202 /**
13203  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13204  */
13205 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13206
13207 /**
13208  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13209  */
13210 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13211
13212 /**
13213  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13214  */
13215 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13216
13217 /**
13218  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13219  */
13220 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13221
13222 /**
13223  * The maximum number of inbound HTLCs towards sender
13224  */
13225 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13226
13227 /**
13228  * The maximum number of inbound HTLCs towards sender
13229  */
13230 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13231
13232 /**
13233  * The sender's key controlling the funding transaction
13234  */
13235 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13236
13237 /**
13238  * The sender's key controlling the funding transaction
13239  */
13240 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13241
13242 /**
13243  * Used to derive a revocation key for transactions broadcast by counterparty
13244  */
13245 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13246
13247 /**
13248  * Used to derive a revocation key for transactions broadcast by counterparty
13249  */
13250 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13251
13252 /**
13253  * A payment key to sender for transactions broadcast by counterparty
13254  */
13255 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13256
13257 /**
13258  * A payment key to sender for transactions broadcast by counterparty
13259  */
13260 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13261
13262 /**
13263  * Used to derive a payment key to sender for transactions broadcast by sender
13264  */
13265 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13266
13267 /**
13268  * Used to derive a payment key to sender for transactions broadcast by sender
13269  */
13270 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13271
13272 /**
13273  * Used to derive an HTLC payment key to sender
13274  */
13275 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13276
13277 /**
13278  * Used to derive an HTLC payment key to sender
13279  */
13280 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13281
13282 /**
13283  * The first to-be-broadcast-by-sender transaction's per commitment point
13284  */
13285 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13286
13287 /**
13288  * The first to-be-broadcast-by-sender transaction's per commitment point
13289  */
13290 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13291
13292 /**
13293  * Channel flags
13294  */
13295 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13296
13297 /**
13298  * Channel flags
13299  */
13300 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13301
13302 /**
13303  * Creates a copy of the OpenChannel
13304  */
13305 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13306
13307 /**
13308  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13309  */
13310 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13311
13312 /**
13313  * A temporary channel ID, until the funding outpoint is announced
13314  */
13315 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13316
13317 /**
13318  * A temporary channel ID, until the funding outpoint is announced
13319  */
13320 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13321
13322 /**
13323  * The threshold below which outputs on transactions broadcast by sender will be omitted
13324  */
13325 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13326
13327 /**
13328  * The threshold below which outputs on transactions broadcast by sender will be omitted
13329  */
13330 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13331
13332 /**
13333  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13334  */
13335 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13336
13337 /**
13338  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13339  */
13340 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13341
13342 /**
13343  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13344  */
13345 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13346
13347 /**
13348  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13349  */
13350 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13351
13352 /**
13353  * The minimum HTLC size incoming to sender, in milli-satoshi
13354  */
13355 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13356
13357 /**
13358  * The minimum HTLC size incoming to sender, in milli-satoshi
13359  */
13360 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13361
13362 /**
13363  * Minimum depth of the funding transaction before the channel is considered open
13364  */
13365 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13366
13367 /**
13368  * Minimum depth of the funding transaction before the channel is considered open
13369  */
13370 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
13371
13372 /**
13373  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13374  */
13375 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13376
13377 /**
13378  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13379  */
13380 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13381
13382 /**
13383  * The maximum number of inbound HTLCs towards sender
13384  */
13385 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13386
13387 /**
13388  * The maximum number of inbound HTLCs towards sender
13389  */
13390 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13391
13392 /**
13393  * The sender's key controlling the funding transaction
13394  */
13395 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13396
13397 /**
13398  * The sender's key controlling the funding transaction
13399  */
13400 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13401
13402 /**
13403  * Used to derive a revocation key for transactions broadcast by counterparty
13404  */
13405 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13406
13407 /**
13408  * Used to derive a revocation key for transactions broadcast by counterparty
13409  */
13410 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13411
13412 /**
13413  * A payment key to sender for transactions broadcast by counterparty
13414  */
13415 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13416
13417 /**
13418  * A payment key to sender for transactions broadcast by counterparty
13419  */
13420 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13421
13422 /**
13423  * Used to derive a payment key to sender for transactions broadcast by sender
13424  */
13425 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13426
13427 /**
13428  * Used to derive a payment key to sender for transactions broadcast by sender
13429  */
13430 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13431
13432 /**
13433  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13434  */
13435 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13436
13437 /**
13438  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13439  */
13440 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13441
13442 /**
13443  * The first to-be-broadcast-by-sender transaction's per commitment point
13444  */
13445 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13446
13447 /**
13448  * The first to-be-broadcast-by-sender transaction's per commitment point
13449  */
13450 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13451
13452 /**
13453  * Creates a copy of the AcceptChannel
13454  */
13455 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
13456
13457 /**
13458  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
13459  */
13460 void FundingCreated_free(struct LDKFundingCreated this_obj);
13461
13462 /**
13463  * A temporary channel ID, until the funding is established
13464  */
13465 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13466
13467 /**
13468  * A temporary channel ID, until the funding is established
13469  */
13470 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13471
13472 /**
13473  * The funding transaction ID
13474  */
13475 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13476
13477 /**
13478  * The funding transaction ID
13479  */
13480 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13481
13482 /**
13483  * The specific output index funding this channel
13484  */
13485 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13486
13487 /**
13488  * The specific output index funding this channel
13489  */
13490 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
13491
13492 /**
13493  * The signature of the channel initiator (funder) on the funding transaction
13494  */
13495 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13496
13497 /**
13498  * The signature of the channel initiator (funder) on the funding transaction
13499  */
13500 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
13501
13502 /**
13503  * Constructs a new FundingCreated given each field
13504  */
13505 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);
13506
13507 /**
13508  * Creates a copy of the FundingCreated
13509  */
13510 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
13511
13512 /**
13513  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
13514  */
13515 void FundingSigned_free(struct LDKFundingSigned this_obj);
13516
13517 /**
13518  * The channel ID
13519  */
13520 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
13521
13522 /**
13523  * The channel ID
13524  */
13525 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13526
13527 /**
13528  * The signature of the channel acceptor (fundee) on the funding transaction
13529  */
13530 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
13531
13532 /**
13533  * The signature of the channel acceptor (fundee) on the funding transaction
13534  */
13535 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13536
13537 /**
13538  * Constructs a new FundingSigned given each field
13539  */
13540 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
13541
13542 /**
13543  * Creates a copy of the FundingSigned
13544  */
13545 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
13546
13547 /**
13548  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
13549  */
13550 void FundingLocked_free(struct LDKFundingLocked this_obj);
13551
13552 /**
13553  * The channel ID
13554  */
13555 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
13556
13557 /**
13558  * The channel ID
13559  */
13560 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13561
13562 /**
13563  * The per-commitment point of the second commitment transaction
13564  */
13565 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
13566
13567 /**
13568  * The per-commitment point of the second commitment transaction
13569  */
13570 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13571
13572 /**
13573  * Constructs a new FundingLocked given each field
13574  */
13575 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
13576
13577 /**
13578  * Creates a copy of the FundingLocked
13579  */
13580 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
13581
13582 /**
13583  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
13584  */
13585 void Shutdown_free(struct LDKShutdown this_obj);
13586
13587 /**
13588  * The channel ID
13589  */
13590 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
13591
13592 /**
13593  * The channel ID
13594  */
13595 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13596
13597 /**
13598  * The destination of this peer's funds on closing.
13599  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13600  */
13601 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
13602
13603 /**
13604  * The destination of this peer's funds on closing.
13605  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13606  */
13607 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13608
13609 /**
13610  * Constructs a new Shutdown given each field
13611  */
13612 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
13613
13614 /**
13615  * Creates a copy of the Shutdown
13616  */
13617 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
13618
13619 /**
13620  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
13621  */
13622 void ClosingSigned_free(struct LDKClosingSigned this_obj);
13623
13624 /**
13625  * The channel ID
13626  */
13627 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
13628
13629 /**
13630  * The channel ID
13631  */
13632 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13633
13634 /**
13635  * The proposed total fee for the closing transaction
13636  */
13637 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13638
13639 /**
13640  * The proposed total fee for the closing transaction
13641  */
13642 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
13643
13644 /**
13645  * A signature on the closing transaction
13646  */
13647 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13648
13649 /**
13650  * A signature on the closing transaction
13651  */
13652 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13653
13654 /**
13655  * Constructs a new ClosingSigned given each field
13656  */
13657 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
13658
13659 /**
13660  * Creates a copy of the ClosingSigned
13661  */
13662 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
13663
13664 /**
13665  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
13666  */
13667 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
13668
13669 /**
13670  * The channel ID
13671  */
13672 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13673
13674 /**
13675  * The channel ID
13676  */
13677 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13678
13679 /**
13680  * The HTLC ID
13681  */
13682 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13683
13684 /**
13685  * The HTLC ID
13686  */
13687 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13688
13689 /**
13690  * The HTLC value in milli-satoshi
13691  */
13692 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13693
13694 /**
13695  * The HTLC value in milli-satoshi
13696  */
13697 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13698
13699 /**
13700  * The payment hash, the pre-image of which controls HTLC redemption
13701  */
13702 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13703
13704 /**
13705  * The payment hash, the pre-image of which controls HTLC redemption
13706  */
13707 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13708
13709 /**
13710  * The expiry height of the HTLC
13711  */
13712 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13713
13714 /**
13715  * The expiry height of the HTLC
13716  */
13717 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
13718
13719 /**
13720  * Creates a copy of the UpdateAddHTLC
13721  */
13722 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
13723
13724 /**
13725  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
13726  */
13727 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
13728
13729 /**
13730  * The channel ID
13731  */
13732 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13733
13734 /**
13735  * The channel ID
13736  */
13737 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13738
13739 /**
13740  * The HTLC ID
13741  */
13742 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
13743
13744 /**
13745  * The HTLC ID
13746  */
13747 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
13748
13749 /**
13750  * The pre-image of the payment hash, allowing HTLC redemption
13751  */
13752 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13753
13754 /**
13755  * The pre-image of the payment hash, allowing HTLC redemption
13756  */
13757 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13758
13759 /**
13760  * Constructs a new UpdateFulfillHTLC given each field
13761  */
13762 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
13763
13764 /**
13765  * Creates a copy of the UpdateFulfillHTLC
13766  */
13767 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
13768
13769 /**
13770  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
13771  */
13772 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
13773
13774 /**
13775  * The channel ID
13776  */
13777 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
13778
13779 /**
13780  * The channel ID
13781  */
13782 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13783
13784 /**
13785  * The HTLC ID
13786  */
13787 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
13788
13789 /**
13790  * The HTLC ID
13791  */
13792 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
13793
13794 /**
13795  * Creates a copy of the UpdateFailHTLC
13796  */
13797 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
13798
13799 /**
13800  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
13801  */
13802 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
13803
13804 /**
13805  * The channel ID
13806  */
13807 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
13808
13809 /**
13810  * The channel ID
13811  */
13812 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13813
13814 /**
13815  * The HTLC ID
13816  */
13817 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13818
13819 /**
13820  * The HTLC ID
13821  */
13822 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
13823
13824 /**
13825  * The failure code
13826  */
13827 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13828
13829 /**
13830  * The failure code
13831  */
13832 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
13833
13834 /**
13835  * Creates a copy of the UpdateFailMalformedHTLC
13836  */
13837 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
13838
13839 /**
13840  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
13841  */
13842 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
13843
13844 /**
13845  * The channel ID
13846  */
13847 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
13848
13849 /**
13850  * The channel ID
13851  */
13852 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13853
13854 /**
13855  * A signature on the commitment transaction
13856  */
13857 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
13858
13859 /**
13860  * A signature on the commitment transaction
13861  */
13862 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13863
13864 /**
13865  * Signatures on the HTLC transactions
13866  */
13867 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
13868
13869 /**
13870  * Constructs a new CommitmentSigned given each field
13871  */
13872 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
13873
13874 /**
13875  * Creates a copy of the CommitmentSigned
13876  */
13877 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
13878
13879 /**
13880  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
13881  */
13882 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
13883
13884 /**
13885  * The channel ID
13886  */
13887 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
13888
13889 /**
13890  * The channel ID
13891  */
13892 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13893
13894 /**
13895  * The secret corresponding to the per-commitment point
13896  */
13897 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
13898
13899 /**
13900  * The secret corresponding to the per-commitment point
13901  */
13902 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13903
13904 /**
13905  * The next sender-broadcast commitment transaction's per-commitment point
13906  */
13907 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
13908
13909 /**
13910  * The next sender-broadcast commitment transaction's per-commitment point
13911  */
13912 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13913
13914 /**
13915  * Constructs a new RevokeAndACK given each field
13916  */
13917 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);
13918
13919 /**
13920  * Creates a copy of the RevokeAndACK
13921  */
13922 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
13923
13924 /**
13925  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
13926  */
13927 void UpdateFee_free(struct LDKUpdateFee this_obj);
13928
13929 /**
13930  * The channel ID
13931  */
13932 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
13933
13934 /**
13935  * The channel ID
13936  */
13937 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13938
13939 /**
13940  * Fee rate per 1000-weight of the transaction
13941  */
13942 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
13943
13944 /**
13945  * Fee rate per 1000-weight of the transaction
13946  */
13947 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
13948
13949 /**
13950  * Constructs a new UpdateFee given each field
13951  */
13952 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
13953
13954 /**
13955  * Creates a copy of the UpdateFee
13956  */
13957 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
13958
13959 /**
13960  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
13961  */
13962 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
13963
13964 /**
13965  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
13966  * belonging to the recipient
13967  */
13968 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
13969
13970 /**
13971  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
13972  * belonging to the recipient
13973  */
13974 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13975
13976 /**
13977  * The sender's per-commitment point for their current commitment transaction
13978  */
13979 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
13980
13981 /**
13982  * The sender's per-commitment point for their current commitment transaction
13983  */
13984 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13985
13986 /**
13987  * Constructs a new DataLossProtect given each field
13988  */
13989 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
13990
13991 /**
13992  * Creates a copy of the DataLossProtect
13993  */
13994 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
13995
13996 /**
13997  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
13998  */
13999 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14000
14001 /**
14002  * The channel ID
14003  */
14004 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14005
14006 /**
14007  * The channel ID
14008  */
14009 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14010
14011 /**
14012  * The next commitment number for the sender
14013  */
14014 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14015
14016 /**
14017  * The next commitment number for the sender
14018  */
14019 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14020
14021 /**
14022  * The next commitment number for the recipient
14023  */
14024 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * The next commitment number for the recipient
14028  */
14029 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14030
14031 /**
14032  * Creates a copy of the ChannelReestablish
14033  */
14034 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14035
14036 /**
14037  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14038  */
14039 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14040
14041 /**
14042  * The channel ID
14043  */
14044 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14045
14046 /**
14047  * The channel ID
14048  */
14049 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14050
14051 /**
14052  * The short channel ID
14053  */
14054 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14055
14056 /**
14057  * The short channel ID
14058  */
14059 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14060
14061 /**
14062  * A signature by the node key
14063  */
14064 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14065
14066 /**
14067  * A signature by the node key
14068  */
14069 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14070
14071 /**
14072  * A signature by the funding key
14073  */
14074 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14075
14076 /**
14077  * A signature by the funding key
14078  */
14079 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14080
14081 /**
14082  * Constructs a new AnnouncementSignatures given each field
14083  */
14084 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);
14085
14086 /**
14087  * Creates a copy of the AnnouncementSignatures
14088  */
14089 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14090
14091 /**
14092  * Frees any resources used by the NetAddress
14093  */
14094 void NetAddress_free(struct LDKNetAddress this_ptr);
14095
14096 /**
14097  * Creates a copy of the NetAddress
14098  */
14099 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14100
14101 /**
14102  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14103  */
14104 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14105
14106 /**
14107  * Read a Result from a byte array, created by Result_write
14108  */
14109 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14110
14111 /**
14112  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14113  */
14114 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14115
14116 /**
14117  * The advertised features
14118  */
14119 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14120
14121 /**
14122  * The advertised features
14123  */
14124 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14125
14126 /**
14127  * A strictly monotonic announcement counter, with gaps allowed
14128  */
14129 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14130
14131 /**
14132  * A strictly monotonic announcement counter, with gaps allowed
14133  */
14134 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14135
14136 /**
14137  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14138  * to this node).
14139  */
14140 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14141
14142 /**
14143  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14144  * to this node).
14145  */
14146 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14147
14148 /**
14149  * An RGB color for UI purposes
14150  */
14151 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14152
14153 /**
14154  * An RGB color for UI purposes
14155  */
14156 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14157
14158 /**
14159  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14160  * of uniqueness.
14161  */
14162 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14163
14164 /**
14165  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14166  * of uniqueness.
14167  */
14168 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14169
14170 /**
14171  * List of addresses on which this node is reachable
14172  */
14173 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14174
14175 /**
14176  * Creates a copy of the UnsignedNodeAnnouncement
14177  */
14178 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14179
14180 /**
14181  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14182  */
14183 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14184
14185 /**
14186  * The signature by the node key
14187  */
14188 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14189
14190 /**
14191  * The signature by the node key
14192  */
14193 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14194
14195 /**
14196  * The actual content of the announcement
14197  */
14198 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14199
14200 /**
14201  * The actual content of the announcement
14202  */
14203 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14204
14205 /**
14206  * Constructs a new NodeAnnouncement given each field
14207  */
14208 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14209
14210 /**
14211  * Creates a copy of the NodeAnnouncement
14212  */
14213 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14214
14215 /**
14216  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14217  */
14218 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14219
14220 /**
14221  * The advertised channel features
14222  */
14223 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14224
14225 /**
14226  * The advertised channel features
14227  */
14228 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14229
14230 /**
14231  * The genesis hash of the blockchain where the channel is to be opened
14232  */
14233 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14234
14235 /**
14236  * The genesis hash of the blockchain where the channel is to be opened
14237  */
14238 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14239
14240 /**
14241  * The short channel ID
14242  */
14243 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14244
14245 /**
14246  * The short channel ID
14247  */
14248 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14249
14250 /**
14251  * One of the two node_ids which are endpoints of this channel
14252  */
14253 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14254
14255 /**
14256  * One of the two node_ids which are endpoints of this channel
14257  */
14258 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14259
14260 /**
14261  * The other of the two node_ids which are endpoints of this channel
14262  */
14263 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14264
14265 /**
14266  * The other of the two node_ids which are endpoints of this channel
14267  */
14268 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14269
14270 /**
14271  * The funding key for the first node
14272  */
14273 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14274
14275 /**
14276  * The funding key for the first node
14277  */
14278 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14279
14280 /**
14281  * The funding key for the second node
14282  */
14283 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14284
14285 /**
14286  * The funding key for the second node
14287  */
14288 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14289
14290 /**
14291  * Creates a copy of the UnsignedChannelAnnouncement
14292  */
14293 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14294
14295 /**
14296  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14297  */
14298 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14299
14300 /**
14301  * Authentication of the announcement by the first public node
14302  */
14303 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14304
14305 /**
14306  * Authentication of the announcement by the first public node
14307  */
14308 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14309
14310 /**
14311  * Authentication of the announcement by the second public node
14312  */
14313 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14314
14315 /**
14316  * Authentication of the announcement by the second public node
14317  */
14318 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14319
14320 /**
14321  * Proof of funding UTXO ownership by the first public node
14322  */
14323 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14324
14325 /**
14326  * Proof of funding UTXO ownership by the first public node
14327  */
14328 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14329
14330 /**
14331  * Proof of funding UTXO ownership by the second public node
14332  */
14333 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14334
14335 /**
14336  * Proof of funding UTXO ownership by the second public node
14337  */
14338 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14339
14340 /**
14341  * The actual announcement
14342  */
14343 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14344
14345 /**
14346  * The actual announcement
14347  */
14348 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
14349
14350 /**
14351  * Constructs a new ChannelAnnouncement given each field
14352  */
14353 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);
14354
14355 /**
14356  * Creates a copy of the ChannelAnnouncement
14357  */
14358 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
14359
14360 /**
14361  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
14362  */
14363 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
14364
14365 /**
14366  * The genesis hash of the blockchain where the channel is to be opened
14367  */
14368 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
14369
14370 /**
14371  * The genesis hash of the blockchain where the channel is to be opened
14372  */
14373 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14374
14375 /**
14376  * The short channel ID
14377  */
14378 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14379
14380 /**
14381  * The short channel ID
14382  */
14383 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14384
14385 /**
14386  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14387  */
14388 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14389
14390 /**
14391  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14392  */
14393 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14394
14395 /**
14396  * Channel flags
14397  */
14398 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14399
14400 /**
14401  * Channel flags
14402  */
14403 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
14404
14405 /**
14406  * The number of blocks such that if:
14407  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14408  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14409  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14410  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14411  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14412  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14413  * constructing the route.
14414  */
14415 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14416
14417 /**
14418  * The number of blocks such that if:
14419  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14420  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14421  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14422  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14423  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14424  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14425  * constructing the route.
14426  */
14427 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
14428
14429 /**
14430  * The minimum HTLC size incoming to sender, in milli-satoshi
14431  */
14432 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14433
14434 /**
14435  * The minimum HTLC size incoming to sender, in milli-satoshi
14436  */
14437 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14438
14439 /**
14440  * The base HTLC fee charged by sender, in milli-satoshi
14441  */
14442 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14443
14444 /**
14445  * The base HTLC fee charged by sender, in milli-satoshi
14446  */
14447 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14448
14449 /**
14450  * The amount to fee multiplier, in micro-satoshi
14451  */
14452 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14453
14454 /**
14455  * The amount to fee multiplier, in micro-satoshi
14456  */
14457 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14458
14459 /**
14460  * Creates a copy of the UnsignedChannelUpdate
14461  */
14462 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
14463
14464 /**
14465  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
14466  */
14467 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
14468
14469 /**
14470  * A signature of the channel update
14471  */
14472 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14473
14474 /**
14475  * A signature of the channel update
14476  */
14477 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
14478
14479 /**
14480  * The actual channel update
14481  */
14482 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14483
14484 /**
14485  * The actual channel update
14486  */
14487 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
14488
14489 /**
14490  * Constructs a new ChannelUpdate given each field
14491  */
14492 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
14493
14494 /**
14495  * Creates a copy of the ChannelUpdate
14496  */
14497 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
14498
14499 /**
14500  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
14501  */
14502 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
14503
14504 /**
14505  * The genesis hash of the blockchain being queried
14506  */
14507 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
14508
14509 /**
14510  * The genesis hash of the blockchain being queried
14511  */
14512 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14513
14514 /**
14515  * The height of the first block for the channel UTXOs being queried
14516  */
14517 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14518
14519 /**
14520  * The height of the first block for the channel UTXOs being queried
14521  */
14522 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14523
14524 /**
14525  * The number of blocks to include in the query results
14526  */
14527 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14528
14529 /**
14530  * The number of blocks to include in the query results
14531  */
14532 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14533
14534 /**
14535  * Constructs a new QueryChannelRange given each field
14536  */
14537 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
14538
14539 /**
14540  * Creates a copy of the QueryChannelRange
14541  */
14542 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
14543
14544 /**
14545  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
14546  */
14547 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
14548
14549 /**
14550  * The genesis hash of the blockchain being queried
14551  */
14552 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
14553
14554 /**
14555  * The genesis hash of the blockchain being queried
14556  */
14557 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14558
14559 /**
14560  * The height of the first block in the range of the reply
14561  */
14562 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14563
14564 /**
14565  * The height of the first block in the range of the reply
14566  */
14567 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14568
14569 /**
14570  * The number of blocks included in the range of the reply
14571  */
14572 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14573
14574 /**
14575  * The number of blocks included in the range of the reply
14576  */
14577 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14578
14579 /**
14580  * True when this is the final reply for a query
14581  */
14582 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14583
14584 /**
14585  * True when this is the final reply for a query
14586  */
14587 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
14588
14589 /**
14590  * The short_channel_ids in the channel range
14591  */
14592 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14593
14594 /**
14595  * Constructs a new ReplyChannelRange given each field
14596  */
14597 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);
14598
14599 /**
14600  * Creates a copy of the ReplyChannelRange
14601  */
14602 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
14603
14604 /**
14605  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
14606  */
14607 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
14608
14609 /**
14610  * The genesis hash of the blockchain being queried
14611  */
14612 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
14613
14614 /**
14615  * The genesis hash of the blockchain being queried
14616  */
14617 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14618
14619 /**
14620  * The short_channel_ids that are being queried
14621  */
14622 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14623
14624 /**
14625  * Constructs a new QueryShortChannelIds given each field
14626  */
14627 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
14628
14629 /**
14630  * Creates a copy of the QueryShortChannelIds
14631  */
14632 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
14633
14634 /**
14635  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
14636  */
14637 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
14638
14639 /**
14640  * The genesis hash of the blockchain that was queried
14641  */
14642 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
14643
14644 /**
14645  * The genesis hash of the blockchain that was queried
14646  */
14647 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14648
14649 /**
14650  * Indicates if the query recipient maintains up-to-date channel
14651  * information for the chain_hash
14652  */
14653 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
14654
14655 /**
14656  * Indicates if the query recipient maintains up-to-date channel
14657  * information for the chain_hash
14658  */
14659 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
14660
14661 /**
14662  * Constructs a new ReplyShortChannelIdsEnd given each field
14663  */
14664 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
14665
14666 /**
14667  * Creates a copy of the ReplyShortChannelIdsEnd
14668  */
14669 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
14670
14671 /**
14672  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
14673  */
14674 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
14675
14676 /**
14677  * The genesis hash of the blockchain for channel and node information
14678  */
14679 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
14680
14681 /**
14682  * The genesis hash of the blockchain for channel and node information
14683  */
14684 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14685
14686 /**
14687  * The starting unix timestamp
14688  */
14689 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14690
14691 /**
14692  * The starting unix timestamp
14693  */
14694 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14695
14696 /**
14697  * The range of information in seconds
14698  */
14699 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14700
14701 /**
14702  * The range of information in seconds
14703  */
14704 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14705
14706 /**
14707  * Constructs a new GossipTimestampFilter given each field
14708  */
14709 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
14710
14711 /**
14712  * Creates a copy of the GossipTimestampFilter
14713  */
14714 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
14715
14716 /**
14717  * Frees any resources used by the ErrorAction
14718  */
14719 void ErrorAction_free(struct LDKErrorAction this_ptr);
14720
14721 /**
14722  * Creates a copy of the ErrorAction
14723  */
14724 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
14725
14726 /**
14727  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
14728  */
14729 void LightningError_free(struct LDKLightningError this_obj);
14730
14731 /**
14732  * A human-readable message describing the error
14733  */
14734 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
14735
14736 /**
14737  * A human-readable message describing the error
14738  */
14739 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14740
14741 /**
14742  * The action which should be taken against the offending peer.
14743  */
14744 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
14745
14746 /**
14747  * The action which should be taken against the offending peer.
14748  */
14749 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
14750
14751 /**
14752  * Constructs a new LightningError given each field
14753  */
14754 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
14755
14756 /**
14757  * Creates a copy of the LightningError
14758  */
14759 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
14760
14761 /**
14762  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
14763  */
14764 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
14765
14766 /**
14767  * update_add_htlc messages which should be sent
14768  */
14769 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
14770
14771 /**
14772  * update_fulfill_htlc messages which should be sent
14773  */
14774 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
14775
14776 /**
14777  * update_fail_htlc messages which should be sent
14778  */
14779 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
14780
14781 /**
14782  * update_fail_malformed_htlc messages which should be sent
14783  */
14784 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
14785
14786 /**
14787  * An update_fee message which should be sent
14788  */
14789 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14790
14791 /**
14792  * An update_fee message which should be sent
14793  */
14794 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
14795
14796 /**
14797  * Finally, the commitment_signed message which should be sent
14798  */
14799 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14800
14801 /**
14802  * Finally, the commitment_signed message which should be sent
14803  */
14804 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
14805
14806 /**
14807  * Constructs a new CommitmentUpdate given each field
14808  */
14809 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);
14810
14811 /**
14812  * Creates a copy of the CommitmentUpdate
14813  */
14814 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
14815
14816 /**
14817  * Frees any resources used by the HTLCFailChannelUpdate
14818  */
14819 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
14820
14821 /**
14822  * Creates a copy of the HTLCFailChannelUpdate
14823  */
14824 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
14825
14826 /**
14827  * Calls the free function if one is set
14828  */
14829 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
14830
14831 /**
14832  * Calls the free function if one is set
14833  */
14834 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
14835
14836 /**
14837  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
14838  */
14839 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
14840
14841 /**
14842  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
14843  */
14844 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
14845
14846 /**
14847  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
14848  */
14849 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
14850
14851 /**
14852  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
14853  */
14854 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
14855
14856 /**
14857  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
14858  */
14859 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
14860
14861 /**
14862  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
14863  */
14864 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
14865
14866 /**
14867  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
14868  */
14869 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
14870
14871 /**
14872  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
14873  */
14874 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
14875
14876 /**
14877  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
14878  */
14879 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
14880
14881 /**
14882  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
14883  */
14884 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
14885
14886 /**
14887  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
14888  */
14889 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
14890
14891 /**
14892  * Read a FundingCreated from a byte array, created by FundingCreated_write
14893  */
14894 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
14895
14896 /**
14897  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
14898  */
14899 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
14900
14901 /**
14902  * Read a FundingSigned from a byte array, created by FundingSigned_write
14903  */
14904 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
14905
14906 /**
14907  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
14908  */
14909 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
14910
14911 /**
14912  * Read a FundingLocked from a byte array, created by FundingLocked_write
14913  */
14914 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
14915
14916 /**
14917  * Serialize the Init object into a byte array which can be read by Init_read
14918  */
14919 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
14920
14921 /**
14922  * Read a Init from a byte array, created by Init_write
14923  */
14924 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
14925
14926 /**
14927  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
14928  */
14929 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
14930
14931 /**
14932  * Read a OpenChannel from a byte array, created by OpenChannel_write
14933  */
14934 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
14935
14936 /**
14937  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
14938  */
14939 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
14940
14941 /**
14942  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
14943  */
14944 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
14945
14946 /**
14947  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
14948  */
14949 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
14950
14951 /**
14952  * Read a Shutdown from a byte array, created by Shutdown_write
14953  */
14954 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
14955
14956 /**
14957  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
14958  */
14959 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
14960
14961 /**
14962  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
14963  */
14964 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
14965
14966 /**
14967  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
14968  */
14969 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
14970
14971 /**
14972  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
14973  */
14974 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
14975
14976 /**
14977  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
14978  */
14979 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
14980
14981 /**
14982  * Read a UpdateFee from a byte array, created by UpdateFee_write
14983  */
14984 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
14985
14986 /**
14987  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
14988  */
14989 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
14990
14991 /**
14992  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
14993  */
14994 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
14995
14996 /**
14997  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
14998  */
14999 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15000
15001 /**
15002  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15003  */
15004 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15005
15006 /**
15007  * Serialize the Ping object into a byte array which can be read by Ping_read
15008  */
15009 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15010
15011 /**
15012  * Read a Ping from a byte array, created by Ping_write
15013  */
15014 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15015
15016 /**
15017  * Serialize the Pong object into a byte array which can be read by Pong_read
15018  */
15019 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15020
15021 /**
15022  * Read a Pong from a byte array, created by Pong_write
15023  */
15024 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15025
15026 /**
15027  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15028  */
15029 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15030
15031 /**
15032  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15033  */
15034 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15035
15036 /**
15037  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15038  */
15039 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15040
15041 /**
15042  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15043  */
15044 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15045
15046 /**
15047  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15048  */
15049 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15050
15051 /**
15052  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15053  */
15054 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15055
15056 /**
15057  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15058  */
15059 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15060
15061 /**
15062  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15063  */
15064 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15065
15066 /**
15067  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15068  */
15069 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15070
15071 /**
15072  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15073  */
15074 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15075
15076 /**
15077  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15078  */
15079 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15080
15081 /**
15082  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15083  */
15084 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15085
15086 /**
15087  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15088  */
15089 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15090
15091 /**
15092  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15093  */
15094 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15095
15096 /**
15097  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15098  */
15099 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15100
15101 /**
15102  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15103  */
15104 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15105
15106 /**
15107  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15108  */
15109 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15110
15111 /**
15112  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15113  */
15114 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15115
15116 /**
15117  *\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
15118  */
15119 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15120
15121 /**
15122  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15123  */
15124 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15125
15126 /**
15127  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15128  */
15129 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15130
15131 /**
15132  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15133  */
15134 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15135
15136 /**
15137  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15138  */
15139 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15140
15141 /**
15142  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15143  */
15144 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15145
15146 /**
15147  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15148  */
15149 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15150
15151 /**
15152  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15153  */
15154 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15155
15156 /**
15157  * Constructs a new IgnoringMessageHandler given each field
15158  */
15159 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15160
15161 /**
15162  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15163  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15164  */
15165 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15166
15167 /**
15168  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15169  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15170  */
15171 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15172
15173 /**
15174  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15175  */
15176 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15177
15178 /**
15179  * Constructs a new ErroringMessageHandler
15180  */
15181 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15182
15183 /**
15184  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15185  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15186  */
15187 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15188
15189 /**
15190  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15191  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15192  */
15193 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15194
15195 /**
15196  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15197  */
15198 void MessageHandler_free(struct LDKMessageHandler this_obj);
15199
15200 /**
15201  * A message handler which handles messages specific to channels. Usually this is just a
15202  * ChannelManager object or a ErroringMessageHandler.
15203  */
15204 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15205
15206 /**
15207  * A message handler which handles messages specific to channels. Usually this is just a
15208  * ChannelManager object or a ErroringMessageHandler.
15209  */
15210 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15211
15212 /**
15213  * A message handler which handles messages updating our knowledge of the network channel
15214  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15215  */
15216 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15217
15218 /**
15219  * A message handler which handles messages updating our knowledge of the network channel
15220  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15221  */
15222 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15223
15224 /**
15225  * Constructs a new MessageHandler given each field
15226  */
15227 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15228
15229 /**
15230  * Creates a copy of a SocketDescriptor
15231  */
15232 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15233
15234 /**
15235  * Calls the free function if one is set
15236  */
15237 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15238
15239 /**
15240  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15241  */
15242 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15243
15244 /**
15245  * Used to indicate that we probably can't make any future connections to this peer, implying
15246  * we should go ahead and force-close any channels we have with it.
15247  */
15248 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15249
15250 /**
15251  * Used to indicate that we probably can't make any future connections to this peer, implying
15252  * we should go ahead and force-close any channels we have with it.
15253  */
15254 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15255
15256 /**
15257  * Constructs a new PeerHandleError given each field
15258  */
15259 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15260
15261 /**
15262  * Creates a copy of the PeerHandleError
15263  */
15264 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15265
15266 /**
15267  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15268  */
15269 void PeerManager_free(struct LDKPeerManager this_obj);
15270
15271 /**
15272  * Constructs a new PeerManager with the given message handlers and node_id secret key
15273  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15274  * cryptographically secure random bytes.
15275  */
15276 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);
15277
15278 /**
15279  * Get the list of node ids for peers which have completed the initial handshake.
15280  *
15281  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15282  * new_outbound_connection, however entries will only appear once the initial handshake has
15283  * completed and we are sure the remote peer has the private key for the given node_id.
15284  */
15285 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15286
15287 /**
15288  * Indicates a new outbound connection has been established to a node with the given node_id.
15289  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15290  * descriptor but must disconnect the connection immediately.
15291  *
15292  * Returns a small number of bytes to send to the remote node (currently always 50).
15293  *
15294  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15295  * socket_disconnected().
15296  */
15297 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);
15298
15299 /**
15300  * Indicates a new inbound connection has been established.
15301  *
15302  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15303  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15304  * call socket_disconnected for the new descriptor but must disconnect the connection
15305  * immediately.
15306  *
15307  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15308  * socket_disconnected called.
15309  */
15310 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15311
15312 /**
15313  * Indicates that there is room to write data to the given socket descriptor.
15314  *
15315  * May return an Err to indicate that the connection should be closed.
15316  *
15317  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15318  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15319  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15320  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15321  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15322  * new_\\*_connection event.
15323  */
15324 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15325
15326 /**
15327  * Indicates that data was read from the given socket descriptor.
15328  *
15329  * May return an Err to indicate that the connection should be closed.
15330  *
15331  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15332  * Thus, however, you almost certainly want to call process_events() after any read_event to
15333  * generate send_data calls to handle responses.
15334  *
15335  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
15336  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
15337  *
15338  * Panics if the descriptor was not previously registered in a new_*_connection event.
15339  */
15340 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);
15341
15342 /**
15343  * Checks for any events generated by our handlers and processes them. Includes sending most
15344  * response messages as well as messages generated by calls to handler functions directly (eg
15345  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
15346  */
15347 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
15348
15349 /**
15350  * Indicates that the given socket descriptor's connection is now closed.
15351  *
15352  * This must only be called if the socket has been disconnected by the peer or your own
15353  * decision to disconnect it and must NOT be called in any case where other parts of this
15354  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
15355  * the peer.
15356  *
15357  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
15358  */
15359 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15360
15361 /**
15362  * Disconnect a peer given its node id.
15363  *
15364  * Set no_connection_possible to true to prevent any further connection with this peer,
15365  * force-closing any channels we have with it.
15366  *
15367  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
15368  * so be careful about reentrancy issues.
15369  */
15370 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
15371
15372 /**
15373  * This function should be called roughly once every 30 seconds.
15374  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
15375  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
15376  */
15377 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
15378
15379 /**
15380  * Build the commitment secret from the seed and the commitment number
15381  */
15382 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
15383
15384 /**
15385  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
15386  * from the base secret and the per_commitment_point.
15387  *
15388  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15389  * generated (ie our own).
15390  */
15391 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
15392
15393 /**
15394  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
15395  * from the base point and the per_commitment_key. This is the public equivalent of
15396  * derive_private_key - using only public keys to derive a public key instead of private keys.
15397  *
15398  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15399  * generated (ie our own).
15400  */
15401 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
15402
15403 /**
15404  * Derives a per-commitment-transaction revocation key from its constituent parts.
15405  *
15406  * Only the cheating participant owns a valid witness to propagate a revoked
15407  * commitment transaction, thus per_commitment_secret always come from cheater
15408  * and revocation_base_secret always come from punisher, which is the broadcaster
15409  * of the transaction spending with this key knowledge.
15410  *
15411  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15412  * generated (ie our own).
15413  */
15414 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
15415
15416 /**
15417  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
15418  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
15419  * public key instead of private keys.
15420  *
15421  * Only the cheating participant owns a valid witness to propagate a revoked
15422  * commitment transaction, thus per_commitment_point always come from cheater
15423  * and revocation_base_point always come from punisher, which is the broadcaster
15424  * of the transaction spending with this key knowledge.
15425  *
15426  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15427  * generated (ie our own).
15428  */
15429 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
15430
15431 /**
15432  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
15433  */
15434 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
15435
15436 /**
15437  * The broadcaster's per-commitment public key which was used to derive the other keys.
15438  */
15439 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15440
15441 /**
15442  * The broadcaster's per-commitment public key which was used to derive the other keys.
15443  */
15444 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15445
15446 /**
15447  * The revocation key which is used to allow the broadcaster of the commitment
15448  * transaction to provide their counterparty the ability to punish them if they broadcast
15449  * an old state.
15450  */
15451 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15452
15453 /**
15454  * The revocation key which is used to allow the broadcaster of the commitment
15455  * transaction to provide their counterparty the ability to punish them if they broadcast
15456  * an old state.
15457  */
15458 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15459
15460 /**
15461  * Broadcaster's HTLC Key
15462  */
15463 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15464
15465 /**
15466  * Broadcaster's HTLC Key
15467  */
15468 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15469
15470 /**
15471  * Countersignatory's HTLC Key
15472  */
15473 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15474
15475 /**
15476  * Countersignatory's HTLC Key
15477  */
15478 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15479
15480 /**
15481  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15482  */
15483 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15484
15485 /**
15486  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15487  */
15488 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15489
15490 /**
15491  * Constructs a new TxCreationKeys given each field
15492  */
15493 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);
15494
15495 /**
15496  * Creates a copy of the TxCreationKeys
15497  */
15498 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
15499
15500 /**
15501  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
15502  */
15503 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
15504
15505 /**
15506  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
15507  */
15508 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
15509
15510 /**
15511  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
15512  */
15513 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
15514
15515 /**
15516  * The public key which is used to sign all commitment transactions, as it appears in the
15517  * on-chain channel lock-in 2-of-2 multisig output.
15518  */
15519 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15520
15521 /**
15522  * The public key which is used to sign all commitment transactions, as it appears in the
15523  * on-chain channel lock-in 2-of-2 multisig output.
15524  */
15525 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15526
15527 /**
15528  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15529  * revocation keys. This is combined with the per-commitment-secret generated by the
15530  * counterparty to create a secret which the counterparty can reveal to revoke previous
15531  * states.
15532  */
15533 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15534
15535 /**
15536  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15537  * revocation keys. This is combined with the per-commitment-secret generated by the
15538  * counterparty to create a secret which the counterparty can reveal to revoke previous
15539  * states.
15540  */
15541 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15542
15543 /**
15544  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15545  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15546  * static across every commitment transaction.
15547  */
15548 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15549
15550 /**
15551  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15552  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15553  * static across every commitment transaction.
15554  */
15555 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15556
15557 /**
15558  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15559  * public key which receives non-HTLC-encumbered funds which are only available for spending
15560  * after some delay (or can be claimed via the revocation path).
15561  */
15562 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15563
15564 /**
15565  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15566  * public key which receives non-HTLC-encumbered funds which are only available for spending
15567  * after some delay (or can be claimed via the revocation path).
15568  */
15569 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15570
15571 /**
15572  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15573  * which is used to encumber HTLC-in-flight outputs.
15574  */
15575 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15576
15577 /**
15578  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15579  * which is used to encumber HTLC-in-flight outputs.
15580  */
15581 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15582
15583 /**
15584  * Constructs a new ChannelPublicKeys given each field
15585  */
15586 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);
15587
15588 /**
15589  * Creates a copy of the ChannelPublicKeys
15590  */
15591 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
15592
15593 /**
15594  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
15595  */
15596 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
15597
15598 /**
15599  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
15600  */
15601 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
15602
15603 /**
15604  * Create per-state keys from channel base points and the per-commitment point.
15605  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15606  */
15607 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);
15608
15609 /**
15610  * Generate per-state keys from channel static keys.
15611  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15612  */
15613 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);
15614
15615 /**
15616  * A script either spendable by the revocation
15617  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
15618  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
15619  */
15620 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
15621
15622 /**
15623  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
15624  */
15625 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
15626
15627 /**
15628  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15629  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15630  * need to compare this value to whether the commitment transaction in question is that of
15631  * the counterparty or our own.
15632  */
15633 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15634
15635 /**
15636  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15637  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15638  * need to compare this value to whether the commitment transaction in question is that of
15639  * the counterparty or our own.
15640  */
15641 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
15642
15643 /**
15644  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15645  * this divided by 1000.
15646  */
15647 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15648
15649 /**
15650  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15651  * this divided by 1000.
15652  */
15653 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
15654
15655 /**
15656  * The CLTV lock-time at which this HTLC expires.
15657  */
15658 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15659
15660 /**
15661  * The CLTV lock-time at which this HTLC expires.
15662  */
15663 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
15664
15665 /**
15666  * The hash of the preimage which unlocks this HTLC.
15667  */
15668 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
15669
15670 /**
15671  * The hash of the preimage which unlocks this HTLC.
15672  */
15673 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15674
15675 /**
15676  * The position within the commitment transactions' outputs. This may be None if the value is
15677  * below the dust limit (in which case no output appears in the commitment transaction and the
15678  * value is spent to additional transaction fees).
15679  */
15680 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15681
15682 /**
15683  * The position within the commitment transactions' outputs. This may be None if the value is
15684  * below the dust limit (in which case no output appears in the commitment transaction and the
15685  * value is spent to additional transaction fees).
15686  */
15687 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
15688
15689 /**
15690  * Constructs a new HTLCOutputInCommitment given each field
15691  */
15692 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);
15693
15694 /**
15695  * Creates a copy of the HTLCOutputInCommitment
15696  */
15697 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
15698
15699 /**
15700  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
15701  */
15702 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
15703
15704 /**
15705  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
15706  */
15707 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
15708
15709 /**
15710  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
15711  * does not need to have its previous_output_index filled.
15712  */
15713 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
15714
15715 /**
15716  * Gets the redeemscript for a funding output from the two funding public keys.
15717  * Note that the order of funding public keys does not matter.
15718  */
15719 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
15720
15721 /**
15722  * panics if htlc.transaction_output_index.is_none()!
15723  */
15724 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);
15725
15726 /**
15727  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15728  */
15729 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
15730
15731 /**
15732  * Holder public keys
15733  */
15734 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15735
15736 /**
15737  * Holder public keys
15738  */
15739 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15740
15741 /**
15742  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15743  */
15744 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15745
15746 /**
15747  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15748  */
15749 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15750
15751 /**
15752  * Whether the holder is the initiator of this channel.
15753  * This is an input to the commitment number obscure factor computation.
15754  */
15755 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15756
15757 /**
15758  * Whether the holder is the initiator of this channel.
15759  * This is an input to the commitment number obscure factor computation.
15760  */
15761 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
15762
15763 /**
15764  * The late-bound counterparty channel transaction parameters.
15765  * These parameters are populated at the point in the protocol where the counterparty provides them.
15766  */
15767 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15768
15769 /**
15770  * The late-bound counterparty channel transaction parameters.
15771  * These parameters are populated at the point in the protocol where the counterparty provides them.
15772  */
15773 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
15774
15775 /**
15776  * The late-bound funding outpoint
15777  */
15778 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15779
15780 /**
15781  * The late-bound funding outpoint
15782  */
15783 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15784
15785 /**
15786  * Constructs a new ChannelTransactionParameters given each field
15787  */
15788 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);
15789
15790 /**
15791  * Creates a copy of the ChannelTransactionParameters
15792  */
15793 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
15794
15795 /**
15796  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15797  */
15798 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
15799
15800 /**
15801  * Counter-party public keys
15802  */
15803 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15804
15805 /**
15806  * Counter-party public keys
15807  */
15808 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15809
15810 /**
15811  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15812  */
15813 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15814
15815 /**
15816  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15817  */
15818 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15819
15820 /**
15821  * Constructs a new CounterpartyChannelTransactionParameters given each field
15822  */
15823 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
15824
15825 /**
15826  * Creates a copy of the CounterpartyChannelTransactionParameters
15827  */
15828 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
15829
15830 /**
15831  * Whether the late bound parameters are populated.
15832  */
15833 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
15834
15835 /**
15836  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
15837  * given that the holder is the broadcaster.
15838  *
15839  * self.is_populated() must be true before calling this function.
15840  */
15841 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
15842
15843 /**
15844  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
15845  * given that the counterparty is the broadcaster.
15846  *
15847  * self.is_populated() must be true before calling this function.
15848  */
15849 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
15850
15851 /**
15852  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
15853  */
15854 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
15855
15856 /**
15857  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
15858  */
15859 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
15860
15861 /**
15862  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
15863  */
15864 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
15865
15866 /**
15867  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
15868  */
15869 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
15870
15871 /**
15872  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15873  */
15874 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
15875
15876 /**
15877  * Get the channel pubkeys for the broadcaster
15878  */
15879 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
15880
15881 /**
15882  * Get the channel pubkeys for the countersignatory
15883  */
15884 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
15885
15886 /**
15887  * Get the contest delay applicable to the transactions.
15888  * Note that the contest delay was selected by the countersignatory.
15889  */
15890 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
15891
15892 /**
15893  * Whether the channel is outbound from the broadcaster.
15894  *
15895  * The boolean representing the side that initiated the channel is
15896  * an input to the commitment number obscure factor computation.
15897  */
15898 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
15899
15900 /**
15901  * The funding outpoint
15902  */
15903 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
15904
15905 /**
15906  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
15907  */
15908 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
15909
15910 /**
15911  * Our counterparty's signature for the transaction
15912  */
15913 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
15914
15915 /**
15916  * Our counterparty's signature for the transaction
15917  */
15918 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
15919
15920 /**
15921  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
15922  */
15923 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
15924
15925 /**
15926  * Creates a copy of the HolderCommitmentTransaction
15927  */
15928 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
15929
15930 /**
15931  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
15932  */
15933 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
15934
15935 /**
15936  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
15937  */
15938 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
15939
15940 /**
15941  * Create a new holder transaction with the given counterparty signatures.
15942  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
15943  */
15944 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);
15945
15946 /**
15947  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
15948  */
15949 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
15950
15951 /**
15952  * The commitment transaction
15953  */
15954 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
15955
15956 /**
15957  * The commitment transaction
15958  */
15959 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
15960
15961 /**
15962  * The txid for the commitment transaction.
15963  *
15964  * This is provided as a performance optimization, instead of calling transaction.txid()
15965  * multiple times.
15966  */
15967 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
15968
15969 /**
15970  * The txid for the commitment transaction.
15971  *
15972  * This is provided as a performance optimization, instead of calling transaction.txid()
15973  * multiple times.
15974  */
15975 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15976
15977 /**
15978  * Constructs a new BuiltCommitmentTransaction given each field
15979  */
15980 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
15981
15982 /**
15983  * Creates a copy of the BuiltCommitmentTransaction
15984  */
15985 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
15986
15987 /**
15988  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
15989  */
15990 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
15991
15992 /**
15993  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
15994  */
15995 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
15996
15997 /**
15998  * Get the SIGHASH_ALL sighash value of the transaction.
15999  *
16000  * This can be used to verify a signature.
16001  */
16002 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);
16003
16004 /**
16005  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16006  * because we are about to broadcast a holder transaction.
16007  */
16008 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);
16009
16010 /**
16011  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16012  */
16013 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16014
16015 /**
16016  * Creates a copy of the CommitmentTransaction
16017  */
16018 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16019
16020 /**
16021  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16022  */
16023 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16024
16025 /**
16026  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16027  */
16028 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16029
16030 /**
16031  * The backwards-counting commitment number
16032  */
16033 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16034
16035 /**
16036  * The value to be sent to the broadcaster
16037  */
16038 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16039
16040 /**
16041  * The value to be sent to the counterparty
16042  */
16043 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16044
16045 /**
16046  * The feerate paid per 1000-weight-unit in this commitment transaction.
16047  */
16048 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16049
16050 /**
16051  * Trust our pre-built transaction and derived transaction creation public keys.
16052  *
16053  * Applies a wrapper which allows access to these fields.
16054  *
16055  * This should only be used if you fully trust the builder of this object.  It should not
16056  *\tbe used by an external signer - instead use the verify function.
16057  */
16058 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16059
16060 /**
16061  * Verify our pre-built transaction and derived transaction creation public keys.
16062  *
16063  * Applies a wrapper which allows access to these fields.
16064  *
16065  * An external validating signer must call this method before signing
16066  * or using the built transaction.
16067  */
16068 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);
16069
16070 /**
16071  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16072  */
16073 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16074
16075 /**
16076  * The transaction ID of the built Bitcoin transaction
16077  */
16078 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16079
16080 /**
16081  * The pre-built Bitcoin commitment transaction
16082  */
16083 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16084
16085 /**
16086  * The pre-calculated transaction creation public keys.
16087  */
16088 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16089
16090 /**
16091  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16092  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16093  *
16094  * The returned Vec has one entry for each HTLC, and in the same order.
16095  */
16096 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);
16097
16098 /**
16099  * Get the transaction number obscure factor
16100  */
16101 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16102
16103 /**
16104  * Creates a copy of the InitFeatures
16105  */
16106 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16107
16108 /**
16109  * Creates a copy of the NodeFeatures
16110  */
16111 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16112
16113 /**
16114  * Creates a copy of the ChannelFeatures
16115  */
16116 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16117
16118 /**
16119  * Creates a copy of the InvoiceFeatures
16120  */
16121 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16122
16123 /**
16124  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16125  */
16126 void InitFeatures_free(struct LDKInitFeatures this_obj);
16127
16128 /**
16129  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16130  */
16131 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16132
16133 /**
16134  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16135  */
16136 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16137
16138 /**
16139  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16140  */
16141 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16142
16143 /**
16144  * Create a blank Features with no features set
16145  */
16146 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16147
16148 /**
16149  * Creates a Features with the bits set which are known by the implementation
16150  */
16151 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16152
16153 /**
16154  * Create a blank Features with no features set
16155  */
16156 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16157
16158 /**
16159  * Creates a Features with the bits set which are known by the implementation
16160  */
16161 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16162
16163 /**
16164  * Create a blank Features with no features set
16165  */
16166 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16167
16168 /**
16169  * Creates a Features with the bits set which are known by the implementation
16170  */
16171 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16172
16173 /**
16174  * Create a blank Features with no features set
16175  */
16176 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16177
16178 /**
16179  * Creates a Features with the bits set which are known by the implementation
16180  */
16181 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16182
16183 /**
16184  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16185  */
16186 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16187
16188 /**
16189  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16190  */
16191 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16192
16193 /**
16194  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16195  */
16196 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16197
16198 /**
16199  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16200  */
16201 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16202
16203 /**
16204  * Read a InitFeatures from a byte array, created by InitFeatures_write
16205  */
16206 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16207
16208 /**
16209  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16210  */
16211 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16212
16213 /**
16214  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16215  */
16216 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16217
16218 /**
16219  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16220  */
16221 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16222
16223 /**
16224  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16225  */
16226 void RouteHop_free(struct LDKRouteHop this_obj);
16227
16228 /**
16229  * The node_id of the node at this hop.
16230  */
16231 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16232
16233 /**
16234  * The node_id of the node at this hop.
16235  */
16236 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16237
16238 /**
16239  * The node_announcement features of the node at this hop. For the last hop, these may be
16240  * amended to match the features present in the invoice this node generated.
16241  */
16242 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16243
16244 /**
16245  * The node_announcement features of the node at this hop. For the last hop, these may be
16246  * amended to match the features present in the invoice this node generated.
16247  */
16248 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16249
16250 /**
16251  * The channel that should be used from the previous hop to reach this node.
16252  */
16253 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16254
16255 /**
16256  * The channel that should be used from the previous hop to reach this node.
16257  */
16258 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16259
16260 /**
16261  * The channel_announcement features of the channel that should be used from the previous hop
16262  * to reach this node.
16263  */
16264 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16265
16266 /**
16267  * The channel_announcement features of the channel that should be used from the previous hop
16268  * to reach this node.
16269  */
16270 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16271
16272 /**
16273  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16274  * For the last hop, this should be the full value of the payment (might be more than
16275  * requested if we had to match htlc_minimum_msat).
16276  */
16277 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16278
16279 /**
16280  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16281  * For the last hop, this should be the full value of the payment (might be more than
16282  * requested if we had to match htlc_minimum_msat).
16283  */
16284 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16285
16286 /**
16287  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16288  * expected at the destination, in excess of the current block height.
16289  */
16290 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16291
16292 /**
16293  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16294  * expected at the destination, in excess of the current block height.
16295  */
16296 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
16297
16298 /**
16299  * Constructs a new RouteHop given each field
16300  */
16301 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);
16302
16303 /**
16304  * Creates a copy of the RouteHop
16305  */
16306 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
16307
16308 /**
16309  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
16310  */
16311 void Route_free(struct LDKRoute this_obj);
16312
16313 /**
16314  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
16315  * last RouteHop in each path must be the same.
16316  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
16317  * destination. Thus, this must always be at least length one. While the maximum length of any
16318  * given path is variable, keeping the length of any path to less than 20 should currently
16319  * ensure it is viable.
16320  */
16321 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
16322
16323 /**
16324  * Constructs a new Route given each field
16325  */
16326 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
16327
16328 /**
16329  * Creates a copy of the Route
16330  */
16331 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
16332
16333 /**
16334  * Serialize the Route object into a byte array which can be read by Route_read
16335  */
16336 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
16337
16338 /**
16339  * Read a Route from a byte array, created by Route_write
16340  */
16341 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
16342
16343 /**
16344  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
16345  */
16346 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
16347
16348 /**
16349  * The node_id of the non-target end of the route
16350  */
16351 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16352
16353 /**
16354  * The node_id of the non-target end of the route
16355  */
16356 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16357
16358 /**
16359  * The short_channel_id of this channel
16360  */
16361 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16362
16363 /**
16364  * The short_channel_id of this channel
16365  */
16366 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
16367
16368 /**
16369  * The fees which must be paid to use this channel
16370  */
16371 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16372
16373 /**
16374  * The fees which must be paid to use this channel
16375  */
16376 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16377
16378 /**
16379  * The difference in CLTV values between this node and the next node.
16380  */
16381 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16382
16383 /**
16384  * The difference in CLTV values between this node and the next node.
16385  */
16386 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
16387
16388 /**
16389  * The minimum value, in msat, which must be relayed to the next hop.
16390  */
16391 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16392
16393 /**
16394  * The minimum value, in msat, which must be relayed to the next hop.
16395  */
16396 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16397
16398 /**
16399  * The maximum value in msat available for routing with a single HTLC.
16400  */
16401 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16402
16403 /**
16404  * The maximum value in msat available for routing with a single HTLC.
16405  */
16406 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16407
16408 /**
16409  * Constructs a new RouteHintHop given each field
16410  */
16411 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);
16412
16413 /**
16414  * Creates a copy of the RouteHintHop
16415  */
16416 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
16417
16418 /**
16419  * Gets a route from us (payer) to the given target node (payee).
16420  *
16421  * If the payee provided features in their invoice, they should be provided via payee_features.
16422  * Without this, MPP will only be used if the payee's features are available in the network graph.
16423  *
16424  * Extra routing hops between known nodes and the target will be used if they are included in
16425  * last_hops.
16426  *
16427  * If some channels aren't announced, it may be useful to fill in a first_hops with the
16428  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
16429  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
16430  * in first_hops will be used.
16431  *
16432  * Panics if first_hops contains channels without short_channel_ids
16433  * (ChannelManager::list_usable_channels will never include such channels).
16434  *
16435  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
16436  * equal), however the enabled/disabled bit on such channels as well as the
16437  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
16438  */
16439 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);
16440
16441 /**
16442  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
16443  */
16444 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
16445
16446 /**
16447  * Creates a copy of the NetworkGraph
16448  */
16449 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
16450
16451 /**
16452  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
16453  */
16454 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
16455
16456 /**
16457  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
16458  */
16459 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
16460
16461 /**
16462  * Creates a new tracker of the actual state of the network of channels and nodes,
16463  * assuming a fresh network graph.
16464  * Chain monitor is used to make sure announced channels exist on-chain,
16465  * channel data is correct, and that the announcement is signed with
16466  * channel owners' keys.
16467  */
16468 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
16469
16470 /**
16471  * Creates a new tracker of the actual state of the network of channels and nodes,
16472  * assuming an existing Network Graph.
16473  */
16474 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
16475
16476 /**
16477  * Adds a provider used to check new announcements. Does not affect
16478  * existing announcements unless they are updated.
16479  * Add, update or remove the provider would replace the current one.
16480  */
16481 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
16482
16483 /**
16484  * Take a read lock on the network_graph and return it in the C-bindings
16485  * newtype helper. This is likely only useful when called via the C
16486  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
16487  * yourself.
16488  */
16489 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16490
16491 /**
16492  * Get a reference to the NetworkGraph which this read-lock contains.
16493  */
16494 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
16495
16496 /**
16497  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
16498  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
16499  */
16500 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16501
16502 /**
16503  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16504  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16505  */
16506 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16507
16508 /**
16509  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
16510  */
16511 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
16512
16513 /**
16514  * When the last update to the channel direction was issued.
16515  * Value is opaque, as set in the announcement.
16516  */
16517 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16518
16519 /**
16520  * When the last update to the channel direction was issued.
16521  * Value is opaque, as set in the announcement.
16522  */
16523 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
16524
16525 /**
16526  * Whether the channel can be currently used for payments (in this one direction).
16527  */
16528 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16529
16530 /**
16531  * Whether the channel can be currently used for payments (in this one direction).
16532  */
16533 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
16534
16535 /**
16536  * The difference in CLTV values that you must have when routing through this channel.
16537  */
16538 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16539
16540 /**
16541  * The difference in CLTV values that you must have when routing through this channel.
16542  */
16543 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
16544
16545 /**
16546  * The minimum value, which must be relayed to the next hop via the channel
16547  */
16548 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16549
16550 /**
16551  * The minimum value, which must be relayed to the next hop via the channel
16552  */
16553 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
16554
16555 /**
16556  * The maximum value which may be relayed to the next hop via the channel.
16557  */
16558 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16559
16560 /**
16561  * The maximum value which may be relayed to the next hop via the channel.
16562  */
16563 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16564
16565 /**
16566  * Fees charged when the channel is used for routing
16567  */
16568 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16569
16570 /**
16571  * Fees charged when the channel is used for routing
16572  */
16573 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16574
16575 /**
16576  * Most recent update for the channel received from the network
16577  * Mostly redundant with the data we store in fields explicitly.
16578  * Everything else is useful only for sending out for initial routing sync.
16579  * Not stored if contains excess data to prevent DoS.
16580  */
16581 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16582
16583 /**
16584  * Most recent update for the channel received from the network
16585  * Mostly redundant with the data we store in fields explicitly.
16586  * Everything else is useful only for sending out for initial routing sync.
16587  * Not stored if contains excess data to prevent DoS.
16588  */
16589 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
16590
16591 /**
16592  * Constructs a new DirectionalChannelInfo given each field
16593  */
16594 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);
16595
16596 /**
16597  * Creates a copy of the DirectionalChannelInfo
16598  */
16599 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
16600
16601 /**
16602  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
16603  */
16604 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
16605
16606 /**
16607  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
16608  */
16609 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
16610
16611 /**
16612  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
16613  */
16614 void ChannelInfo_free(struct LDKChannelInfo this_obj);
16615
16616 /**
16617  * Protocol features of a channel communicated during its announcement
16618  */
16619 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16620
16621 /**
16622  * Protocol features of a channel communicated during its announcement
16623  */
16624 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16625
16626 /**
16627  * Source node of the first direction of a channel
16628  */
16629 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16630
16631 /**
16632  * Source node of the first direction of a channel
16633  */
16634 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16635
16636 /**
16637  * Details about the first direction of a channel
16638  */
16639 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16640
16641 /**
16642  * Details about the first direction of a channel
16643  */
16644 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16645
16646 /**
16647  * Source node of the second direction of a channel
16648  */
16649 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16650
16651 /**
16652  * Source node of the second direction of a channel
16653  */
16654 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16655
16656 /**
16657  * Details about the second direction of a channel
16658  */
16659 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16660
16661 /**
16662  * Details about the second direction of a channel
16663  */
16664 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16665
16666 /**
16667  * The channel capacity as seen on-chain, if chain lookup is available.
16668  */
16669 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16670
16671 /**
16672  * The channel capacity as seen on-chain, if chain lookup is available.
16673  */
16674 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16675
16676 /**
16677  * An initial announcement of the channel
16678  * Mostly redundant with the data we store in fields explicitly.
16679  * Everything else is useful only for sending out for initial routing sync.
16680  * Not stored if contains excess data to prevent DoS.
16681  */
16682 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16683
16684 /**
16685  * An initial announcement of the channel
16686  * Mostly redundant with the data we store in fields explicitly.
16687  * Everything else is useful only for sending out for initial routing sync.
16688  * Not stored if contains excess data to prevent DoS.
16689  */
16690 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
16691
16692 /**
16693  * Constructs a new ChannelInfo given each field
16694  */
16695 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);
16696
16697 /**
16698  * Creates a copy of the ChannelInfo
16699  */
16700 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
16701
16702 /**
16703  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
16704  */
16705 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
16706
16707 /**
16708  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
16709  */
16710 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
16711
16712 /**
16713  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
16714  */
16715 void RoutingFees_free(struct LDKRoutingFees this_obj);
16716
16717 /**
16718  * Flat routing fee in satoshis
16719  */
16720 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16721
16722 /**
16723  * Flat routing fee in satoshis
16724  */
16725 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16726
16727 /**
16728  * Liquidity-based routing fee in millionths of a routed amount.
16729  * In other words, 10000 is 1%.
16730  */
16731 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16732
16733 /**
16734  * Liquidity-based routing fee in millionths of a routed amount.
16735  * In other words, 10000 is 1%.
16736  */
16737 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16738
16739 /**
16740  * Constructs a new RoutingFees given each field
16741  */
16742 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
16743
16744 /**
16745  * Creates a copy of the RoutingFees
16746  */
16747 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
16748
16749 /**
16750  * Read a RoutingFees from a byte array, created by RoutingFees_write
16751  */
16752 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
16753
16754 /**
16755  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
16756  */
16757 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
16758
16759 /**
16760  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
16761  */
16762 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
16763
16764 /**
16765  * Protocol features the node announced support for
16766  */
16767 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16768
16769 /**
16770  * Protocol features the node announced support for
16771  */
16772 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16773
16774 /**
16775  * When the last known update to the node state was issued.
16776  * Value is opaque, as set in the announcement.
16777  */
16778 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16779
16780 /**
16781  * When the last known update to the node state was issued.
16782  * Value is opaque, as set in the announcement.
16783  */
16784 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
16785
16786 /**
16787  * Color assigned to the node
16788  */
16789 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
16790
16791 /**
16792  * Color assigned to the node
16793  */
16794 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
16795
16796 /**
16797  * Moniker assigned to the node.
16798  * May be invalid or malicious (eg control chars),
16799  * should not be exposed to the user.
16800  */
16801 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
16802
16803 /**
16804  * Moniker assigned to the node.
16805  * May be invalid or malicious (eg control chars),
16806  * should not be exposed to the user.
16807  */
16808 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16809
16810 /**
16811  * Internet-level addresses via which one can connect to the node
16812  */
16813 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
16814
16815 /**
16816  * An initial announcement of the node
16817  * Mostly redundant with the data we store in fields explicitly.
16818  * Everything else is useful only for sending out for initial routing sync.
16819  * Not stored if contains excess data to prevent DoS.
16820  */
16821 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16822
16823 /**
16824  * An initial announcement of the node
16825  * Mostly redundant with the data we store in fields explicitly.
16826  * Everything else is useful only for sending out for initial routing sync.
16827  * Not stored if contains excess data to prevent DoS.
16828  */
16829 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
16830
16831 /**
16832  * Constructs a new NodeAnnouncementInfo given each field
16833  */
16834 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);
16835
16836 /**
16837  * Creates a copy of the NodeAnnouncementInfo
16838  */
16839 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
16840
16841 /**
16842  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
16843  */
16844 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
16845
16846 /**
16847  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
16848  */
16849 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
16850
16851 /**
16852  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
16853  */
16854 void NodeInfo_free(struct LDKNodeInfo this_obj);
16855
16856 /**
16857  * All valid channels a node has announced
16858  */
16859 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
16860
16861 /**
16862  * Lowest fees enabling routing via any of the enabled, known channels to a node.
16863  * The two fields (flat and proportional fee) are independent,
16864  * meaning they don't have to refer to the same channel.
16865  */
16866 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
16867
16868 /**
16869  * Lowest fees enabling routing via any of the enabled, known channels to a node.
16870  * The two fields (flat and proportional fee) are independent,
16871  * meaning they don't have to refer to the same channel.
16872  */
16873 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16874
16875 /**
16876  * More information about a node from node_announcement.
16877  * Optional because we store a Node entry after learning about it from
16878  * a channel announcement, but before receiving a node announcement.
16879  */
16880 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
16881
16882 /**
16883  * More information about a node from node_announcement.
16884  * Optional because we store a Node entry after learning about it from
16885  * a channel announcement, but before receiving a node announcement.
16886  */
16887 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
16888
16889 /**
16890  * Constructs a new NodeInfo given each field
16891  */
16892 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
16893
16894 /**
16895  * Creates a copy of the NodeInfo
16896  */
16897 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
16898
16899 /**
16900  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
16901  */
16902 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
16903
16904 /**
16905  * Read a NodeInfo from a byte array, created by NodeInfo_write
16906  */
16907 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
16908
16909 /**
16910  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
16911  */
16912 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
16913
16914 /**
16915  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
16916  */
16917 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
16918
16919 /**
16920  * Creates a new, empty, network graph.
16921  */
16922 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
16923
16924 /**
16925  * For an already known node (from channel announcements), update its stored properties from a
16926  * given node announcement.
16927  *
16928  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
16929  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
16930  * routing messages from a source using a protocol other than the lightning P2P protocol.
16931  */
16932 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
16933
16934 /**
16935  * For an already known node (from channel announcements), update its stored properties from a
16936  * given node announcement without verifying the associated signatures. Because we aren't
16937  * given the associated signatures here we cannot relay the node announcement to any of our
16938  * peers.
16939  */
16940 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
16941
16942 /**
16943  * Store or update channel info from a channel announcement.
16944  *
16945  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
16946  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
16947  * routing messages from a source using a protocol other than the lightning P2P protocol.
16948  *
16949  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
16950  * the corresponding UTXO exists on chain and is correctly-formatted.
16951  */
16952 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);
16953
16954 /**
16955  * Store or update channel info from a channel announcement without verifying the associated
16956  * signatures. Because we aren't given the associated signatures here we cannot relay the
16957  * channel announcement to any of our peers.
16958  *
16959  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
16960  * the corresponding UTXO exists on chain and is correctly-formatted.
16961  */
16962 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);
16963
16964 /**
16965  * Close a channel if a corresponding HTLC fail was sent.
16966  * If permanent, removes a channel from the local storage.
16967  * May cause the removal of nodes too, if this was their last channel.
16968  * If not permanent, makes channels unavailable for routing.
16969  */
16970 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
16971
16972 /**
16973  * For an already known (from announcement) channel, update info about one of the directions
16974  * of the channel.
16975  *
16976  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
16977  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
16978  * routing messages from a source using a protocol other than the lightning P2P protocol.
16979  */
16980 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
16981
16982 /**
16983  * For an already known (from announcement) channel, update info about one of the directions
16984  * of the channel without verifying the associated signatures. Because we aren't given the
16985  * associated signatures here we cannot relay the channel update to any of our peers.
16986  */
16987 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
16988
16989 /**
16990  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
16991  */
16992 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
16993
16994 /**
16995  * Initialize a new FilesystemPersister and set the path to the individual channels'
16996  * files.
16997  */
16998 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKCVec_u8Z path_to_channel_data);
16999
17000 /**
17001  * Get the directory which was provided when this persister was initialized.
17002  */
17003 MUST_USE_RES struct LDKCVec_u8Z FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17004
17005 /**
17006  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17007  * initialization, within a file called \"manager\".
17008  */
17009 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKCVec_u8Z data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17010
17011 /**
17012  * Read `ChannelMonitor`s from disk.
17013  */
17014 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17015
17016 /**
17017  * Constructs a new Persist which calls the relevant methods on this_arg.
17018  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17019  */
17020 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17021
17022 /**
17023  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17024  *
17025  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17026  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17027  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17028  * since this check is fast we recommend to do it anyway.
17029  *
17030  * If this function fails this is considered a bug. Please open an issue describing your
17031  * platform and stating your current system time.
17032  *
17033  * # Panics
17034  * If the check fails this function panics. By calling this function on startup you ensure that
17035  * this wont happen at an arbitrary later point in time.
17036  */
17037 void check_platform(void);
17038
17039 /**
17040  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17041  */
17042 void Invoice_free(struct LDKInvoice this_obj);
17043
17044 /**
17045  * Creates a copy of the Invoice
17046  */
17047 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17048
17049 /**
17050  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17051  */
17052 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17053
17054 /**
17055  * Creates a copy of the SignedRawInvoice
17056  */
17057 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17058
17059 /**
17060  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17061  */
17062 void RawInvoice_free(struct LDKRawInvoice this_obj);
17063
17064 /**
17065  * data part
17066  */
17067 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17068
17069 /**
17070  * data part
17071  */
17072 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17073
17074 /**
17075  * Creates a copy of the RawInvoice
17076  */
17077 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17078
17079 /**
17080  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17081  */
17082 void RawDataPart_free(struct LDKRawDataPart this_obj);
17083
17084 /**
17085  * generation time of the invoice
17086  */
17087 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17088
17089 /**
17090  * generation time of the invoice
17091  */
17092 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17093
17094 /**
17095  * tagged fields of the payment request
17096  */
17097 void RawDataPart_set_tagged_fields(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKCVec_RawTaggedFieldZ val);
17098
17099 /**
17100  * Constructs a new RawDataPart given each field
17101  */
17102 MUST_USE_RES struct LDKRawDataPart RawDataPart_new(struct LDKPositiveTimestamp timestamp_arg, struct LDKCVec_RawTaggedFieldZ tagged_fields_arg);
17103
17104 /**
17105  * Creates a copy of the RawDataPart
17106  */
17107 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17108
17109 /**
17110  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17111  */
17112 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17113
17114 /**
17115  * Creates a copy of the PositiveTimestamp
17116  */
17117 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17118
17119 /**
17120  * Creates a copy of the SiPrefix
17121  */
17122 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17123
17124 /**
17125  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17126  * This is effectively 10^12 * the prefix multiplier
17127  */
17128 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17129
17130 /**
17131  * Creates a copy of the Currency
17132  */
17133 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17134
17135 /**
17136  * Frees any resources used by the RawTaggedField
17137  */
17138 void RawTaggedField_free(struct LDKRawTaggedField this_ptr);
17139
17140 /**
17141  * Creates a copy of the RawTaggedField
17142  */
17143 struct LDKRawTaggedField RawTaggedField_clone(const struct LDKRawTaggedField *NONNULL_PTR orig);
17144
17145 /**
17146  * Frees any resources used by the TaggedField
17147  */
17148 void TaggedField_free(struct LDKTaggedField this_ptr);
17149
17150 /**
17151  * Creates a copy of the TaggedField
17152  */
17153 struct LDKTaggedField TaggedField_clone(const struct LDKTaggedField *NONNULL_PTR orig);
17154
17155 /**
17156  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17157  */
17158 void Sha256_free(struct LDKSha256 this_obj);
17159
17160 /**
17161  * Creates a copy of the Sha256
17162  */
17163 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17164
17165 /**
17166  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17167  */
17168 void Description_free(struct LDKDescription this_obj);
17169
17170 /**
17171  * Creates a copy of the Description
17172  */
17173 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17174
17175 /**
17176  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17177  */
17178 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17179
17180 /**
17181  * Creates a copy of the PayeePubKey
17182  */
17183 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17184
17185 /**
17186  * Frees any resources used by the PaymentSecret, if is_owned is set and inner is non-NULL.
17187  */
17188 void PaymentSecret_free(struct LDKPaymentSecret this_obj);
17189
17190 /**
17191  * Creates a copy of the PaymentSecret
17192  */
17193 struct LDKPaymentSecret PaymentSecret_clone(const struct LDKPaymentSecret *NONNULL_PTR orig);
17194
17195 /**
17196  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17197  */
17198 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17199
17200 /**
17201  * Creates a copy of the ExpiryTime
17202  */
17203 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
17204
17205 /**
17206  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
17207  */
17208 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
17209
17210 /**
17211  * Creates a copy of the MinFinalCltvExpiry
17212  */
17213 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
17214
17215 /**
17216  * Frees any resources used by the Fallback
17217  */
17218 void Fallback_free(struct LDKFallback this_ptr);
17219
17220 /**
17221  * Creates a copy of the Fallback
17222  */
17223 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
17224
17225 /**
17226  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
17227  */
17228 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
17229
17230 /**
17231  * Creates a copy of the InvoiceSignature
17232  */
17233 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
17234
17235 /**
17236  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17237  */
17238 void RouteHint_free(struct LDKRouteHint this_obj);
17239
17240 /**
17241  * Creates a copy of the RouteHint
17242  */
17243 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17244
17245 /**
17246  * Disassembles the `SignedRawInvoice` into its three parts:
17247  *  1. raw invoice
17248  *  2. hash of the raw invoice
17249  *  3. signature
17250  */
17251 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
17252
17253 /**
17254  * The `RawInvoice` which was signed.
17255  */
17256 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17257
17258 /**
17259  * The hash of the `RawInvoice` that was signed.
17260  */
17261 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
17262
17263 /**
17264  * InvoiceSignature for the invoice.
17265  */
17266 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17267
17268 /**
17269  * Recovers the public key used for signing the invoice from the recoverable signature.
17270  */
17271 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17272
17273 /**
17274  * Checks if the signature is valid for the included payee public key or if none exists if it's
17275  * valid for the recovered signature (which should always be true?).
17276  */
17277 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17278
17279 /**
17280  * Calculate the hash of the encoded `RawInvoice`
17281  */
17282 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17283
17284 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17285
17286 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17287
17288 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17289
17290 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17291
17292 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17293
17294 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17295
17296 MUST_USE_RES struct LDKPaymentSecret RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17297
17298 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17299
17300 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17301
17302 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17303
17304 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17305
17306 /**
17307  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
17308  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17309  * `CreationError::TimestampOutOfBounds`.
17310  */
17311 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
17312
17313 /**
17314  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
17315  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17316  * `CreationError::TimestampOutOfBounds`.
17317  */
17318 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
17319
17320 /**
17321  * Returns the UNIX timestamp representing the stored time
17322  */
17323 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17324
17325 /**
17326  * Returns a reference to the internal `SystemTime` time representation
17327  */
17328 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17329
17330 /**
17331  * Transform the `Invoice` into it's unchecked version
17332  */
17333 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
17334
17335 /**
17336  * Check that the invoice is signed correctly and that key recovery works
17337  */
17338 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
17339
17340 /**
17341  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
17342  * ```
17343  * use lightning_invoice::*;
17344  *
17345  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
17346  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
17347  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
17348  * \tky03ylcqca784w\";
17349  *
17350  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
17351  *
17352  * assert!(Invoice::from_signed(signed).is_ok());
17353  * ```
17354  */
17355 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
17356
17357 /**
17358  * Returns the `Invoice`'s timestamp (should equal it's creation time)
17359  */
17360 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
17361
17362 /**
17363  * Returns the hash to which we will receive the preimage on completion of the payment
17364  */
17365 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
17366
17367 /**
17368  * Get the payee's public key if one was included in the invoice
17369  */
17370 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17371
17372 /**
17373  * Get the payment secret if one was included in the invoice
17374  */
17375 MUST_USE_RES struct LDKPaymentSecret Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
17376
17377 /**
17378  * Get the invoice features if they were included in the invoice
17379  */
17380 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
17381
17382 /**
17383  * Recover the payee's public key (only to be used if none was included in the invoice)
17384  */
17385 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17386
17387 /**
17388  * Returns the invoice's expiry time if present
17389  */
17390 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
17391
17392 /**
17393  * Returns the invoice's `min_cltv_expiry` time if present
17394  */
17395 MUST_USE_RES struct LDKCOption_u64Z Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
17396
17397 /**
17398  * Returns a list of all routes included in the invoice
17399  */
17400 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
17401
17402 /**
17403  * Returns the currency for which the invoice was issued
17404  */
17405 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
17406
17407 /**
17408  * Returns the amount if specified in the invoice as pico <currency>.
17409  */
17410 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
17411
17412 /**
17413  * Numeric representation of the field's tag
17414  */
17415 MUST_USE_RES struct LDKu5 TaggedField_tag(const struct LDKTaggedField *NONNULL_PTR this_arg);
17416
17417 /**
17418  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
17419  * returns `CreationError::DescriptionTooLong` otherwise
17420  *
17421  * Please note that single characters may use more than one byte due to UTF8 encoding.
17422  */
17423 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKCVec_u8Z description);
17424
17425 /**
17426  * Returns the underlying description `String`
17427  */
17428 MUST_USE_RES struct LDKCVec_u8Z Description_into_inner(struct LDKDescription this_arg);
17429
17430 /**
17431  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
17432  * overflow on adding the `EpiryTime` to it then this function will return a
17433  * `CreationError::ExpiryTimeOutOfBounds`.
17434  */
17435 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
17436
17437 /**
17438  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
17439  * would overflow on adding the `EpiryTime` to it then this function will return a
17440  * `CreationError::ExpiryTimeOutOfBounds`.
17441  */
17442 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
17443
17444 /**
17445  * Returns the expiry time in seconds
17446  */
17447 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17448
17449 /**
17450  * Returns a reference to the underlying `Duration` (=expiry time)
17451  */
17452 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17453
17454 /**
17455  * Create a new (partial) route from a list of hops
17456  */
17457 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
17458
17459 /**
17460  * Returrn the underlying vector of hops
17461  */
17462 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
17463
17464 /**
17465  * Creates a copy of the CreationError
17466  */
17467 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
17468
17469 /**
17470  * Get the string representation of a CreationError object
17471  */
17472 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
17473
17474 /**
17475  * Creates a copy of the SemanticError
17476  */
17477 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
17478
17479 /**
17480  * Get the string representation of a SemanticError object
17481  */
17482 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
17483
17484 #endif /* LDK_C_BINDINGS_H */