Update auto-generated bindings (without new version files)
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <ldk_rust_types.h>
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet/signet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Must be last for serialization purposes
172     */
173    LDKCurrency_Sentinel,
174 } LDKCurrency;
175
176 /**
177  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
178  */
179 typedef enum LDKIOError {
180    LDKIOError_NotFound,
181    LDKIOError_PermissionDenied,
182    LDKIOError_ConnectionRefused,
183    LDKIOError_ConnectionReset,
184    LDKIOError_ConnectionAborted,
185    LDKIOError_NotConnected,
186    LDKIOError_AddrInUse,
187    LDKIOError_AddrNotAvailable,
188    LDKIOError_BrokenPipe,
189    LDKIOError_AlreadyExists,
190    LDKIOError_WouldBlock,
191    LDKIOError_InvalidInput,
192    LDKIOError_InvalidData,
193    LDKIOError_TimedOut,
194    LDKIOError_WriteZero,
195    LDKIOError_Interrupted,
196    LDKIOError_Other,
197    LDKIOError_UnexpectedEof,
198    /**
199     * Must be last for serialization purposes
200     */
201    LDKIOError_Sentinel,
202 } LDKIOError;
203
204 /**
205  * An enum representing the available verbosity levels of the logger.
206  */
207 typedef enum LDKLevel {
208    /**
209     *Designates logger being silent
210     */
211    LDKLevel_Off,
212    /**
213     * Designates very serious errors
214     */
215    LDKLevel_Error,
216    /**
217     * Designates hazardous situations
218     */
219    LDKLevel_Warn,
220    /**
221     * Designates useful information
222     */
223    LDKLevel_Info,
224    /**
225     * Designates lower priority information
226     */
227    LDKLevel_Debug,
228    /**
229     * Designates very low priority, often extremely verbose, information
230     */
231    LDKLevel_Trace,
232    /**
233     * Must be last for serialization purposes
234     */
235    LDKLevel_Sentinel,
236 } LDKLevel;
237
238 /**
239  * An enum representing the possible Bitcoin or test networks which we can run on
240  */
241 typedef enum LDKNetwork {
242    /**
243     * The main Bitcoin blockchain.
244     */
245    LDKNetwork_Bitcoin,
246    /**
247     * The testnet3 blockchain.
248     */
249    LDKNetwork_Testnet,
250    /**
251     * A local test blockchain.
252     */
253    LDKNetwork_Regtest,
254    /**
255     * A blockchain on which blocks are signed instead of mined.
256     */
257    LDKNetwork_Signet,
258    /**
259     * Must be last for serialization purposes
260     */
261    LDKNetwork_Sentinel,
262 } LDKNetwork;
263
264 /**
265  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
266  */
267 typedef enum LDKSecp256k1Error {
268    /**
269     * Signature failed verification
270     */
271    LDKSecp256k1Error_IncorrectSignature,
272    /**
273     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
274     */
275    LDKSecp256k1Error_InvalidMessage,
276    /**
277     * Bad public key
278     */
279    LDKSecp256k1Error_InvalidPublicKey,
280    /**
281     * Bad signature
282     */
283    LDKSecp256k1Error_InvalidSignature,
284    /**
285     * Bad secret key
286     */
287    LDKSecp256k1Error_InvalidSecretKey,
288    /**
289     * Bad recovery id
290     */
291    LDKSecp256k1Error_InvalidRecoveryId,
292    /**
293     * Invalid tweak for add_assign or mul_assign
294     */
295    LDKSecp256k1Error_InvalidTweak,
296    /**
297     * tweak_add_check failed on an xonly public key
298     */
299    LDKSecp256k1Error_TweakCheckFailed,
300    /**
301     * Didn't pass enough memory to context creation with preallocated memory
302     */
303    LDKSecp256k1Error_NotEnoughMemory,
304    /**
305     * Must be last for serialization purposes
306     */
307    LDKSecp256k1Error_Sentinel,
308 } LDKSecp256k1Error;
309
310 /**
311  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
312  * requirements sections in BOLT #11
313  */
314 typedef enum LDKSemanticError {
315    /**
316     * The invoice is missing the mandatory payment hash
317     */
318    LDKSemanticError_NoPaymentHash,
319    /**
320     * The invoice has multiple payment hashes which isn't allowed
321     */
322    LDKSemanticError_MultiplePaymentHashes,
323    /**
324     * No description or description hash are part of the invoice
325     */
326    LDKSemanticError_NoDescription,
327    /**
328     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
329     */
330    LDKSemanticError_MultipleDescriptions,
331    /**
332     * The 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 Rust str object, ie a reference to a UTF8-valid string.
373  * This is *not* null-terminated so cannot be used directly as a C string!
374  */
375 typedef struct LDKStr {
376    /**
377     * A pointer to the string's bytes, in UTF8 encoding
378     */
379    const uint8_t *chars;
380    /**
381     * The number of bytes (not characters!) pointed to by `chars`
382     */
383    uintptr_t len;
384    /**
385     * Whether the data pointed to by `chars` should be freed or not.
386     */
387    bool chars_is_owned;
388 } LDKStr;
389
390 /**
391  * A serialized transaction, in (pointer, length) form.
392  *
393  * This type optionally owns its own memory, and thus the semantics around access change based on
394  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
395  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
396  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
397  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
398  * you would be invalid.
399  *
400  * Note that, while it may change in the future, because transactions on the Rust side are stored
401  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
402  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
403  * `data_is_owned` either set or unset at your discretion.
404  */
405 typedef struct LDKTransaction {
406    /**
407     * The serialized transaction data.
408     *
409     * This is non-const for your convenience, an object passed to Rust is never written to.
410     */
411    uint8_t *data;
412    /**
413     * The length of the serialized transaction
414     */
415    uintptr_t datalen;
416    /**
417     * Whether the data pointed to by `data` should be freed or not.
418     */
419    bool data_is_owned;
420 } LDKTransaction;
421
422 /**
423  * A dynamically-allocated array of u8s of arbitrary size.
424  * This corresponds to std::vector in C++
425  */
426 typedef struct LDKCVec_u8Z {
427    /**
428     * The elements in the array.
429     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
430     */
431    uint8_t *data;
432    /**
433     * The number of elements pointed to by `data`.
434     */
435    uintptr_t datalen;
436 } LDKCVec_u8Z;
437
438 /**
439  * A transaction output including a scriptPubKey and value.
440  * This type *does* own its own memory, so must be free'd appropriately.
441  */
442 typedef struct LDKTxOut {
443    /**
444     * The script_pubkey in this output
445     */
446    struct LDKCVec_u8Z script_pubkey;
447    /**
448     * The value, in satoshis, of this output
449     */
450    uint64_t value;
451 } LDKTxOut;
452
453
454
455 /**
456  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
457  * with our counterparty.
458  */
459 typedef struct MUST_USE_STRUCT LDKChannelConfig {
460    /**
461     * A pointer to the opaque Rust object.
462     * Nearly everywhere, inner must be non-null, however in places where
463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
464     */
465    LDKnativeChannelConfig *inner;
466    /**
467     * Indicates that this is the only struct which contains the same pointer.
468     * Rust functions which take ownership of an object provided via an argument require
469     * this to be true and invalidate the object pointed to by inner.
470     */
471    bool is_owned;
472 } LDKChannelConfig;
473
474
475
476 /**
477  * An error in decoding a message or struct.
478  */
479 typedef struct MUST_USE_STRUCT LDKDecodeError {
480    /**
481     * A pointer to the opaque Rust object.
482     * Nearly everywhere, inner must be non-null, however in places where
483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
484     */
485    LDKnativeDecodeError *inner;
486    /**
487     * Indicates that this is the only struct which contains the same pointer.
488     * Rust functions which take ownership of an object provided via an argument require
489     * this to be true and invalidate the object pointed to by inner.
490     */
491    bool is_owned;
492 } LDKDecodeError;
493
494 /**
495  * The contents of CResult_ChannelConfigDecodeErrorZ
496  */
497 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
498    /**
499     * A pointer to the contents in the success state.
500     * Reading from this pointer when `result_ok` is not set is undefined.
501     */
502    struct LDKChannelConfig *result;
503    /**
504     * A pointer to the contents in the error state.
505     * Reading from this pointer when `result_ok` is set is undefined.
506     */
507    struct LDKDecodeError *err;
508 } LDKCResult_ChannelConfigDecodeErrorZPtr;
509
510 /**
511  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
512  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
513  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
514  */
515 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
516    /**
517     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
518     * `err` or `result` depending on the state of `result_ok`.
519     */
520    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
521    /**
522     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
523     */
524    bool result_ok;
525 } LDKCResult_ChannelConfigDecodeErrorZ;
526
527
528
529 /**
530  * A reference to a transaction output.
531  *
532  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
533  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
534  */
535 typedef struct MUST_USE_STRUCT LDKOutPoint {
536    /**
537     * A pointer to the opaque Rust object.
538     * Nearly everywhere, inner must be non-null, however in places where
539     * the Rust equivalent takes an Option, it may be set to null to indicate None.
540     */
541    LDKnativeOutPoint *inner;
542    /**
543     * Indicates that this is the only struct which contains the same pointer.
544     * Rust functions which take ownership of an object provided via an argument require
545     * this to be true and invalidate the object pointed to by inner.
546     */
547    bool is_owned;
548 } LDKOutPoint;
549
550 /**
551  * The contents of CResult_OutPointDecodeErrorZ
552  */
553 typedef union LDKCResult_OutPointDecodeErrorZPtr {
554    /**
555     * A pointer to the contents in the success state.
556     * Reading from this pointer when `result_ok` is not set is undefined.
557     */
558    struct LDKOutPoint *result;
559    /**
560     * A pointer to the contents in the error state.
561     * Reading from this pointer when `result_ok` is set is undefined.
562     */
563    struct LDKDecodeError *err;
564 } LDKCResult_OutPointDecodeErrorZPtr;
565
566 /**
567  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
568  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
570  */
571 typedef struct LDKCResult_OutPointDecodeErrorZ {
572    /**
573     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
574     * `err` or `result` depending on the state of `result_ok`.
575     */
576    union LDKCResult_OutPointDecodeErrorZPtr contents;
577    /**
578     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
579     */
580    bool result_ok;
581 } LDKCResult_OutPointDecodeErrorZ;
582
583 /**
584  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
585  */
586 typedef struct LDKSecretKey {
587    /**
588     * The bytes of the secret key
589     */
590    uint8_t bytes[32];
591 } LDKSecretKey;
592
593 /**
594  * The contents of CResult_SecretKeyErrorZ
595  */
596 typedef union LDKCResult_SecretKeyErrorZPtr {
597    /**
598     * A pointer to the contents in the success state.
599     * Reading from this pointer when `result_ok` is not set is undefined.
600     */
601    struct LDKSecretKey *result;
602    /**
603     * A pointer to the contents in the error state.
604     * Reading from this pointer when `result_ok` is set is undefined.
605     */
606    enum LDKSecp256k1Error *err;
607 } LDKCResult_SecretKeyErrorZPtr;
608
609 /**
610  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
611  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
612  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
613  */
614 typedef struct LDKCResult_SecretKeyErrorZ {
615    /**
616     * The contents of this CResult_SecretKeyErrorZ, accessible via either
617     * `err` or `result` depending on the state of `result_ok`.
618     */
619    union LDKCResult_SecretKeyErrorZPtr contents;
620    /**
621     * Whether this CResult_SecretKeyErrorZ represents a success state.
622     */
623    bool result_ok;
624 } LDKCResult_SecretKeyErrorZ;
625
626 /**
627  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
628  */
629 typedef struct LDKPublicKey {
630    /**
631     * The bytes of the public key
632     */
633    uint8_t compressed_form[33];
634 } LDKPublicKey;
635
636 /**
637  * The contents of CResult_PublicKeyErrorZ
638  */
639 typedef union LDKCResult_PublicKeyErrorZPtr {
640    /**
641     * A pointer to the contents in the success state.
642     * Reading from this pointer when `result_ok` is not set is undefined.
643     */
644    struct LDKPublicKey *result;
645    /**
646     * A pointer to the contents in the error state.
647     * Reading from this pointer when `result_ok` is set is undefined.
648     */
649    enum LDKSecp256k1Error *err;
650 } LDKCResult_PublicKeyErrorZPtr;
651
652 /**
653  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
654  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
656  */
657 typedef struct LDKCResult_PublicKeyErrorZ {
658    /**
659     * The contents of this CResult_PublicKeyErrorZ, accessible via either
660     * `err` or `result` depending on the state of `result_ok`.
661     */
662    union LDKCResult_PublicKeyErrorZPtr contents;
663    /**
664     * Whether this CResult_PublicKeyErrorZ represents a success state.
665     */
666    bool result_ok;
667 } LDKCResult_PublicKeyErrorZ;
668
669
670
671 /**
672  * The set of public keys which are used in the creation of one commitment transaction.
673  * These are derived from the channel base keys and per-commitment data.
674  *
675  * A broadcaster key is provided from potential broadcaster of the computed transaction.
676  * A countersignatory key is coming from a protocol participant unable to broadcast the
677  * transaction.
678  *
679  * These keys are assumed to be good, either because the code derived them from
680  * channel basepoints via the new function, or they were obtained via
681  * CommitmentTransaction.trust().keys() because we trusted the source of the
682  * pre-calculated keys.
683  */
684 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
685    /**
686     * A pointer to the opaque Rust object.
687     * Nearly everywhere, inner must be non-null, however in places where
688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
689     */
690    LDKnativeTxCreationKeys *inner;
691    /**
692     * Indicates that this is the only struct which contains the same pointer.
693     * Rust functions which take ownership of an object provided via an argument require
694     * this to be true and invalidate the object pointed to by inner.
695     */
696    bool is_owned;
697 } LDKTxCreationKeys;
698
699 /**
700  * The contents of CResult_TxCreationKeysDecodeErrorZ
701  */
702 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
703    /**
704     * A pointer to the contents in the success state.
705     * Reading from this pointer when `result_ok` is not set is undefined.
706     */
707    struct LDKTxCreationKeys *result;
708    /**
709     * A pointer to the contents in the error state.
710     * Reading from this pointer when `result_ok` is set is undefined.
711     */
712    struct LDKDecodeError *err;
713 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
714
715 /**
716  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
717  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
719  */
720 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
721    /**
722     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
723     * `err` or `result` depending on the state of `result_ok`.
724     */
725    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
726    /**
727     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
728     */
729    bool result_ok;
730 } LDKCResult_TxCreationKeysDecodeErrorZ;
731
732
733
734 /**
735  * One counterparty's public keys which do not change over the life of a channel.
736  */
737 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
738    /**
739     * A pointer to the opaque Rust object.
740     * Nearly everywhere, inner must be non-null, however in places where
741     * the Rust equivalent takes an Option, it may be set to null to indicate None.
742     */
743    LDKnativeChannelPublicKeys *inner;
744    /**
745     * Indicates that this is the only struct which contains the same pointer.
746     * Rust functions which take ownership of an object provided via an argument require
747     * this to be true and invalidate the object pointed to by inner.
748     */
749    bool is_owned;
750 } LDKChannelPublicKeys;
751
752 /**
753  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
754  */
755 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
756    /**
757     * A pointer to the contents in the success state.
758     * Reading from this pointer when `result_ok` is not set is undefined.
759     */
760    struct LDKChannelPublicKeys *result;
761    /**
762     * A pointer to the contents in the error state.
763     * Reading from this pointer when `result_ok` is set is undefined.
764     */
765    struct LDKDecodeError *err;
766 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
767
768 /**
769  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
770  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
771  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
772  */
773 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
774    /**
775     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
776     * `err` or `result` depending on the state of `result_ok`.
777     */
778    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
779    /**
780     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
781     */
782    bool result_ok;
783 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
784
785 /**
786  * The contents of CResult_TxCreationKeysErrorZ
787  */
788 typedef union LDKCResult_TxCreationKeysErrorZPtr {
789    /**
790     * A pointer to the contents in the success state.
791     * Reading from this pointer when `result_ok` is not set is undefined.
792     */
793    struct LDKTxCreationKeys *result;
794    /**
795     * A pointer to the contents in the error state.
796     * Reading from this pointer when `result_ok` is set is undefined.
797     */
798    enum LDKSecp256k1Error *err;
799 } LDKCResult_TxCreationKeysErrorZPtr;
800
801 /**
802  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
803  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
804  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
805  */
806 typedef struct LDKCResult_TxCreationKeysErrorZ {
807    /**
808     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
809     * `err` or `result` depending on the state of `result_ok`.
810     */
811    union LDKCResult_TxCreationKeysErrorZPtr contents;
812    /**
813     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
814     */
815    bool result_ok;
816 } LDKCResult_TxCreationKeysErrorZ;
817
818 /**
819  * An enum which can either contain a u32 or not
820  */
821 typedef enum LDKCOption_u32Z_Tag {
822    /**
823     * When we're in this state, this COption_u32Z contains a u32
824     */
825    LDKCOption_u32Z_Some,
826    /**
827     * When we're in this state, this COption_u32Z contains nothing
828     */
829    LDKCOption_u32Z_None,
830    /**
831     * Must be last for serialization purposes
832     */
833    LDKCOption_u32Z_Sentinel,
834 } LDKCOption_u32Z_Tag;
835
836 typedef struct LDKCOption_u32Z {
837    LDKCOption_u32Z_Tag tag;
838    union {
839       struct {
840          uint32_t some;
841       };
842    };
843 } LDKCOption_u32Z;
844
845
846
847 /**
848  * Information about an HTLC as it appears in a commitment transaction
849  */
850 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
851    /**
852     * A pointer to the opaque Rust object.
853     * Nearly everywhere, inner must be non-null, however in places where
854     * the Rust equivalent takes an Option, it may be set to null to indicate None.
855     */
856    LDKnativeHTLCOutputInCommitment *inner;
857    /**
858     * Indicates that this is the only struct which contains the same pointer.
859     * Rust functions which take ownership of an object provided via an argument require
860     * this to be true and invalidate the object pointed to by inner.
861     */
862    bool is_owned;
863 } LDKHTLCOutputInCommitment;
864
865 /**
866  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
867  */
868 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
869    /**
870     * A pointer to the contents in the success state.
871     * Reading from this pointer when `result_ok` is not set is undefined.
872     */
873    struct LDKHTLCOutputInCommitment *result;
874    /**
875     * A pointer to the contents in the error state.
876     * Reading from this pointer when `result_ok` is set is undefined.
877     */
878    struct LDKDecodeError *err;
879 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
880
881 /**
882  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
883  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
884  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
885  */
886 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
887    /**
888     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
889     * `err` or `result` depending on the state of `result_ok`.
890     */
891    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
892    /**
893     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
894     */
895    bool result_ok;
896 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
897
898
899
900 /**
901  * Late-bound per-channel counterparty data used to build transactions.
902  */
903 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
904    /**
905     * A pointer to the opaque Rust object.
906     * Nearly everywhere, inner must be non-null, however in places where
907     * the Rust equivalent takes an Option, it may be set to null to indicate None.
908     */
909    LDKnativeCounterpartyChannelTransactionParameters *inner;
910    /**
911     * Indicates that this is the only struct which contains the same pointer.
912     * Rust functions which take ownership of an object provided via an argument require
913     * this to be true and invalidate the object pointed to by inner.
914     */
915    bool is_owned;
916 } LDKCounterpartyChannelTransactionParameters;
917
918 /**
919  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
920  */
921 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
922    /**
923     * A pointer to the contents in the success state.
924     * Reading from this pointer when `result_ok` is not set is undefined.
925     */
926    struct LDKCounterpartyChannelTransactionParameters *result;
927    /**
928     * A pointer to the contents in the error state.
929     * Reading from this pointer when `result_ok` is set is undefined.
930     */
931    struct LDKDecodeError *err;
932 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
933
934 /**
935  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
936  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
938  */
939 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
940    /**
941     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
942     * `err` or `result` depending on the state of `result_ok`.
943     */
944    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
945    /**
946     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
947     */
948    bool result_ok;
949 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
950
951
952
953 /**
954  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
955  * The fields are organized by holder/counterparty.
956  *
957  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
958  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
959  */
960 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
961    /**
962     * A pointer to the opaque Rust object.
963     * Nearly everywhere, inner must be non-null, however in places where
964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
965     */
966    LDKnativeChannelTransactionParameters *inner;
967    /**
968     * Indicates that this is the only struct which contains the same pointer.
969     * Rust functions which take ownership of an object provided via an argument require
970     * this to be true and invalidate the object pointed to by inner.
971     */
972    bool is_owned;
973 } LDKChannelTransactionParameters;
974
975 /**
976  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
977  */
978 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
979    /**
980     * A pointer to the contents in the success state.
981     * Reading from this pointer when `result_ok` is not set is undefined.
982     */
983    struct LDKChannelTransactionParameters *result;
984    /**
985     * A pointer to the contents in the error state.
986     * Reading from this pointer when `result_ok` is set is undefined.
987     */
988    struct LDKDecodeError *err;
989 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
990
991 /**
992  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
993  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
994  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
995  */
996 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
997    /**
998     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
999     * `err` or `result` depending on the state of `result_ok`.
1000     */
1001    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1002    /**
1003     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1004     */
1005    bool result_ok;
1006 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1007
1008 /**
1009  * Represents a secp256k1 signature serialized as two 32-byte numbers
1010  */
1011 typedef struct LDKSignature {
1012    /**
1013     * The bytes of the signature in "compact" form
1014     */
1015    uint8_t compact_form[64];
1016 } LDKSignature;
1017
1018 /**
1019  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1020  * This corresponds to std::vector in C++
1021  */
1022 typedef struct LDKCVec_SignatureZ {
1023    /**
1024     * The elements in the array.
1025     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1026     */
1027    struct LDKSignature *data;
1028    /**
1029     * The number of elements pointed to by `data`.
1030     */
1031    uintptr_t datalen;
1032 } LDKCVec_SignatureZ;
1033
1034
1035
1036 /**
1037  * Information needed to build and sign a holder's commitment transaction.
1038  *
1039  * The transaction is only signed once we are ready to broadcast.
1040  */
1041 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1042    /**
1043     * A pointer to the opaque Rust object.
1044     * Nearly everywhere, inner must be non-null, however in places where
1045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1046     */
1047    LDKnativeHolderCommitmentTransaction *inner;
1048    /**
1049     * Indicates that this is the only struct which contains the same pointer.
1050     * Rust functions which take ownership of an object provided via an argument require
1051     * this to be true and invalidate the object pointed to by inner.
1052     */
1053    bool is_owned;
1054 } LDKHolderCommitmentTransaction;
1055
1056 /**
1057  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1058  */
1059 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1060    /**
1061     * A pointer to the contents in the success state.
1062     * Reading from this pointer when `result_ok` is not set is undefined.
1063     */
1064    struct LDKHolderCommitmentTransaction *result;
1065    /**
1066     * A pointer to the contents in the error state.
1067     * Reading from this pointer when `result_ok` is set is undefined.
1068     */
1069    struct LDKDecodeError *err;
1070 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1071
1072 /**
1073  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1074  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1076  */
1077 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1078    /**
1079     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1080     * `err` or `result` depending on the state of `result_ok`.
1081     */
1082    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1083    /**
1084     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1085     */
1086    bool result_ok;
1087 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1088
1089
1090
1091 /**
1092  * A pre-built Bitcoin commitment transaction and its txid.
1093  */
1094 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1095    /**
1096     * A pointer to the opaque Rust object.
1097     * Nearly everywhere, inner must be non-null, however in places where
1098     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1099     */
1100    LDKnativeBuiltCommitmentTransaction *inner;
1101    /**
1102     * Indicates that this is the only struct which contains the same pointer.
1103     * Rust functions which take ownership of an object provided via an argument require
1104     * this to be true and invalidate the object pointed to by inner.
1105     */
1106    bool is_owned;
1107 } LDKBuiltCommitmentTransaction;
1108
1109 /**
1110  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1111  */
1112 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1113    /**
1114     * A pointer to the contents in the success state.
1115     * Reading from this pointer when `result_ok` is not set is undefined.
1116     */
1117    struct LDKBuiltCommitmentTransaction *result;
1118    /**
1119     * A pointer to the contents in the error state.
1120     * Reading from this pointer when `result_ok` is set is undefined.
1121     */
1122    struct LDKDecodeError *err;
1123 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1124
1125 /**
1126  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1127  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1128  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1129  */
1130 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1131    /**
1132     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1133     * `err` or `result` depending on the state of `result_ok`.
1134     */
1135    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1136    /**
1137     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1138     */
1139    bool result_ok;
1140 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1141
1142
1143
1144 /**
1145  * This class tracks the per-transaction information needed to build a commitment transaction and to
1146  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1147  * and for transactions we sign for the counterparty.
1148  *
1149  * This class can be used inside a signer implementation to generate a signature given the relevant
1150  * secret key.
1151  */
1152 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1153    /**
1154     * A pointer to the opaque Rust object.
1155     * Nearly everywhere, inner must be non-null, however in places where
1156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1157     */
1158    LDKnativeCommitmentTransaction *inner;
1159    /**
1160     * Indicates that this is the only struct which contains the same pointer.
1161     * Rust functions which take ownership of an object provided via an argument require
1162     * this to be true and invalidate the object pointed to by inner.
1163     */
1164    bool is_owned;
1165 } LDKCommitmentTransaction;
1166
1167 /**
1168  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1169  */
1170 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1171    /**
1172     * A pointer to the contents in the success state.
1173     * Reading from this pointer when `result_ok` is not set is undefined.
1174     */
1175    struct LDKCommitmentTransaction *result;
1176    /**
1177     * A pointer to the contents in the error state.
1178     * Reading from this pointer when `result_ok` is set is undefined.
1179     */
1180    struct LDKDecodeError *err;
1181 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1182
1183 /**
1184  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1185  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1187  */
1188 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1189    /**
1190     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1191     * `err` or `result` depending on the state of `result_ok`.
1192     */
1193    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1194    /**
1195     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1196     */
1197    bool result_ok;
1198 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1199
1200
1201
1202 /**
1203  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1204  * transaction and the transaction creation keys) are trusted.
1205  *
1206  * See trust() and verify() functions on CommitmentTransaction.
1207  *
1208  * This structure implements Deref.
1209  */
1210 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1211    /**
1212     * A pointer to the opaque Rust object.
1213     * Nearly everywhere, inner must be non-null, however in places where
1214     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1215     */
1216    LDKnativeTrustedCommitmentTransaction *inner;
1217    /**
1218     * Indicates that this is the only struct which contains the same pointer.
1219     * Rust functions which take ownership of an object provided via an argument require
1220     * this to be true and invalidate the object pointed to by inner.
1221     */
1222    bool is_owned;
1223 } LDKTrustedCommitmentTransaction;
1224
1225 /**
1226  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1227  */
1228 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1229    /**
1230     * A pointer to the contents in the success state.
1231     * Reading from this pointer when `result_ok` is not set is undefined.
1232     */
1233    struct LDKTrustedCommitmentTransaction *result;
1234    /**
1235     * Note that this value is always NULL, as there are no contents in the Err variant
1236     */
1237    void *err;
1238 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1239
1240 /**
1241  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1242  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1243  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1244  */
1245 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1246    /**
1247     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1248     * `err` or `result` depending on the state of `result_ok`.
1249     */
1250    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1251    /**
1252     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1253     */
1254    bool result_ok;
1255 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1256
1257 /**
1258  * The contents of CResult_CVec_SignatureZNoneZ
1259  */
1260 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1261    /**
1262     * A pointer to the contents in the success state.
1263     * Reading from this pointer when `result_ok` is not set is undefined.
1264     */
1265    struct LDKCVec_SignatureZ *result;
1266    /**
1267     * Note that this value is always NULL, as there are no contents in the Err variant
1268     */
1269    void *err;
1270 } LDKCResult_CVec_SignatureZNoneZPtr;
1271
1272 /**
1273  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1274  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1275  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1276  */
1277 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1278    /**
1279     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1280     * `err` or `result` depending on the state of `result_ok`.
1281     */
1282    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1283    /**
1284     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1285     */
1286    bool result_ok;
1287 } LDKCResult_CVec_SignatureZNoneZ;
1288
1289 /**
1290  * The contents of CResult_SiPrefixNoneZ
1291  */
1292 typedef union LDKCResult_SiPrefixNoneZPtr {
1293    /**
1294     * A pointer to the contents in the success state.
1295     * Reading from this pointer when `result_ok` is not set is undefined.
1296     */
1297    enum LDKSiPrefix *result;
1298    /**
1299     * Note that this value is always NULL, as there are no contents in the Err variant
1300     */
1301    void *err;
1302 } LDKCResult_SiPrefixNoneZPtr;
1303
1304 /**
1305  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
1306  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
1307  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1308  */
1309 typedef struct LDKCResult_SiPrefixNoneZ {
1310    /**
1311     * The contents of this CResult_SiPrefixNoneZ, accessible via either
1312     * `err` or `result` depending on the state of `result_ok`.
1313     */
1314    union LDKCResult_SiPrefixNoneZPtr contents;
1315    /**
1316     * Whether this CResult_SiPrefixNoneZ represents a success state.
1317     */
1318    bool result_ok;
1319 } LDKCResult_SiPrefixNoneZ;
1320
1321
1322
1323 /**
1324  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
1325  *
1326  * There are three ways to construct an `Invoice`:
1327  *  1. using `InvoiceBuilder`
1328  *  2. using `Invoice::from_signed(SignedRawInvoice)`
1329  *  3. using `str::parse::<Invoice>(&str)`
1330  */
1331 typedef struct MUST_USE_STRUCT LDKInvoice {
1332    /**
1333     * A pointer to the opaque Rust object.
1334     * Nearly everywhere, inner must be non-null, however in places where
1335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1336     */
1337    LDKnativeInvoice *inner;
1338    /**
1339     * Indicates that this is the only struct which contains the same pointer.
1340     * Rust functions which take ownership of an object provided via an argument require
1341     * this to be true and invalidate the object pointed to by inner.
1342     */
1343    bool is_owned;
1344 } LDKInvoice;
1345
1346 /**
1347  * The contents of CResult_InvoiceNoneZ
1348  */
1349 typedef union LDKCResult_InvoiceNoneZPtr {
1350    /**
1351     * A pointer to the contents in the success state.
1352     * Reading from this pointer when `result_ok` is not set is undefined.
1353     */
1354    struct LDKInvoice *result;
1355    /**
1356     * Note that this value is always NULL, as there are no contents in the Err variant
1357     */
1358    void *err;
1359 } LDKCResult_InvoiceNoneZPtr;
1360
1361 /**
1362  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
1363  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
1364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1365  */
1366 typedef struct LDKCResult_InvoiceNoneZ {
1367    /**
1368     * The contents of this CResult_InvoiceNoneZ, accessible via either
1369     * `err` or `result` depending on the state of `result_ok`.
1370     */
1371    union LDKCResult_InvoiceNoneZPtr contents;
1372    /**
1373     * Whether this CResult_InvoiceNoneZ represents a success state.
1374     */
1375    bool result_ok;
1376 } LDKCResult_InvoiceNoneZ;
1377
1378
1379
1380 /**
1381  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
1382  * invalid.
1383  *
1384  * # Invariants
1385  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
1386  */
1387 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
1388    /**
1389     * A pointer to the opaque Rust object.
1390     * Nearly everywhere, inner must be non-null, however in places where
1391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1392     */
1393    LDKnativeSignedRawInvoice *inner;
1394    /**
1395     * Indicates that this is the only struct which contains the same pointer.
1396     * Rust functions which take ownership of an object provided via an argument require
1397     * this to be true and invalidate the object pointed to by inner.
1398     */
1399    bool is_owned;
1400 } LDKSignedRawInvoice;
1401
1402 /**
1403  * The contents of CResult_SignedRawInvoiceNoneZ
1404  */
1405 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
1406    /**
1407     * A pointer to the contents in the success state.
1408     * Reading from this pointer when `result_ok` is not set is undefined.
1409     */
1410    struct LDKSignedRawInvoice *result;
1411    /**
1412     * Note that this value is always NULL, as there are no contents in the Err variant
1413     */
1414    void *err;
1415 } LDKCResult_SignedRawInvoiceNoneZPtr;
1416
1417 /**
1418  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
1419  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
1420  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1421  */
1422 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
1423    /**
1424     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
1425     * `err` or `result` depending on the state of `result_ok`.
1426     */
1427    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
1428    /**
1429     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
1430     */
1431    bool result_ok;
1432 } LDKCResult_SignedRawInvoiceNoneZ;
1433
1434
1435
1436 /**
1437  * Represents an syntactically correct Invoice for a payment on the lightning network,
1438  * but without the signature information.
1439  * De- and encoding should not lead to information loss but may lead to different hashes.
1440  *
1441  * For methods without docs see the corresponding methods in `Invoice`.
1442  */
1443 typedef struct MUST_USE_STRUCT LDKRawInvoice {
1444    /**
1445     * A pointer to the opaque Rust object.
1446     * Nearly everywhere, inner must be non-null, however in places where
1447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1448     */
1449    LDKnativeRawInvoice *inner;
1450    /**
1451     * Indicates that this is the only struct which contains the same pointer.
1452     * Rust functions which take ownership of an object provided via an argument require
1453     * this to be true and invalidate the object pointed to by inner.
1454     */
1455    bool is_owned;
1456 } LDKRawInvoice;
1457
1458 /**
1459  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1460  * look up the corresponding function in rust-lightning's docs.
1461  */
1462 typedef struct LDKThirtyTwoBytes {
1463    /**
1464     * The thirty-two bytes
1465     */
1466    uint8_t data[32];
1467 } LDKThirtyTwoBytes;
1468
1469
1470
1471 /**
1472  * Recoverable signature
1473  */
1474 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
1475    /**
1476     * A pointer to the opaque Rust object.
1477     * Nearly everywhere, inner must be non-null, however in places where
1478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1479     */
1480    LDKnativeInvoiceSignature *inner;
1481    /**
1482     * Indicates that this is the only struct which contains the same pointer.
1483     * Rust functions which take ownership of an object provided via an argument require
1484     * this to be true and invalidate the object pointed to by inner.
1485     */
1486    bool is_owned;
1487 } LDKInvoiceSignature;
1488
1489 /**
1490  * A tuple of 3 elements. See the individual fields for the types contained.
1491  */
1492 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
1493    /**
1494     * The element at position 0
1495     */
1496    struct LDKRawInvoice a;
1497    /**
1498     * The element at position 1
1499     */
1500    struct LDKThirtyTwoBytes b;
1501    /**
1502     * The element at position 2
1503     */
1504    struct LDKInvoiceSignature c;
1505 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
1506
1507
1508
1509 /**
1510  * Payee public key
1511  */
1512 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
1513    /**
1514     * A pointer to the opaque Rust object.
1515     * Nearly everywhere, inner must be non-null, however in places where
1516     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1517     */
1518    LDKnativePayeePubKey *inner;
1519    /**
1520     * Indicates that this is the only struct which contains the same pointer.
1521     * Rust functions which take ownership of an object provided via an argument require
1522     * this to be true and invalidate the object pointed to by inner.
1523     */
1524    bool is_owned;
1525 } LDKPayeePubKey;
1526
1527 /**
1528  * The contents of CResult_PayeePubKeyErrorZ
1529  */
1530 typedef union LDKCResult_PayeePubKeyErrorZPtr {
1531    /**
1532     * A pointer to the contents in the success state.
1533     * Reading from this pointer when `result_ok` is not set is undefined.
1534     */
1535    struct LDKPayeePubKey *result;
1536    /**
1537     * A pointer to the contents in the error state.
1538     * Reading from this pointer when `result_ok` is set is undefined.
1539     */
1540    enum LDKSecp256k1Error *err;
1541 } LDKCResult_PayeePubKeyErrorZPtr;
1542
1543 /**
1544  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1545  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1547  */
1548 typedef struct LDKCResult_PayeePubKeyErrorZ {
1549    /**
1550     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1551     * `err` or `result` depending on the state of `result_ok`.
1552     */
1553    union LDKCResult_PayeePubKeyErrorZPtr contents;
1554    /**
1555     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
1556     */
1557    bool result_ok;
1558 } LDKCResult_PayeePubKeyErrorZ;
1559
1560
1561
1562 /**
1563  * Private routing information
1564  *
1565  * # Invariants
1566  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
1567  *
1568  */
1569 typedef struct MUST_USE_STRUCT LDKRouteHint {
1570    /**
1571     * A pointer to the opaque Rust object.
1572     * Nearly everywhere, inner must be non-null, however in places where
1573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1574     */
1575    LDKnativeRouteHint *inner;
1576    /**
1577     * Indicates that this is the only struct which contains the same pointer.
1578     * Rust functions which take ownership of an object provided via an argument require
1579     * this to be true and invalidate the object pointed to by inner.
1580     */
1581    bool is_owned;
1582 } LDKRouteHint;
1583
1584 /**
1585  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1586  * This corresponds to std::vector in C++
1587  */
1588 typedef struct LDKCVec_RouteHintZ {
1589    /**
1590     * The elements in the array.
1591     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1592     */
1593    struct LDKRouteHint *data;
1594    /**
1595     * The number of elements pointed to by `data`.
1596     */
1597    uintptr_t datalen;
1598 } LDKCVec_RouteHintZ;
1599
1600 /**
1601  * An enum which can either contain a u64 or not
1602  */
1603 typedef enum LDKCOption_u64Z_Tag {
1604    /**
1605     * When we're in this state, this COption_u64Z contains a u64
1606     */
1607    LDKCOption_u64Z_Some,
1608    /**
1609     * When we're in this state, this COption_u64Z contains nothing
1610     */
1611    LDKCOption_u64Z_None,
1612    /**
1613     * Must be last for serialization purposes
1614     */
1615    LDKCOption_u64Z_Sentinel,
1616 } LDKCOption_u64Z_Tag;
1617
1618 typedef struct LDKCOption_u64Z {
1619    LDKCOption_u64Z_Tag tag;
1620    union {
1621       struct {
1622          uint64_t some;
1623       };
1624    };
1625 } LDKCOption_u64Z;
1626
1627
1628
1629 /**
1630  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
1631  * timestamp is positive.
1632  *
1633  * # Invariants
1634  * The UNIX timestamp representing the stored time has to be positive and small enough so that
1635  * a `EpiryTime` can be added to it without an overflow.
1636  */
1637 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
1638    /**
1639     * A pointer to the opaque Rust object.
1640     * Nearly everywhere, inner must be non-null, however in places where
1641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1642     */
1643    LDKnativePositiveTimestamp *inner;
1644    /**
1645     * Indicates that this is the only struct which contains the same pointer.
1646     * Rust functions which take ownership of an object provided via an argument require
1647     * this to be true and invalidate the object pointed to by inner.
1648     */
1649    bool is_owned;
1650 } LDKPositiveTimestamp;
1651
1652 /**
1653  * The contents of CResult_PositiveTimestampCreationErrorZ
1654  */
1655 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
1656    /**
1657     * A pointer to the contents in the success state.
1658     * Reading from this pointer when `result_ok` is not set is undefined.
1659     */
1660    struct LDKPositiveTimestamp *result;
1661    /**
1662     * A pointer to the contents in the error state.
1663     * Reading from this pointer when `result_ok` is set is undefined.
1664     */
1665    enum LDKCreationError *err;
1666 } LDKCResult_PositiveTimestampCreationErrorZPtr;
1667
1668 /**
1669  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1670  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1672  */
1673 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
1674    /**
1675     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1676     * `err` or `result` depending on the state of `result_ok`.
1677     */
1678    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
1679    /**
1680     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1681     */
1682    bool result_ok;
1683 } LDKCResult_PositiveTimestampCreationErrorZ;
1684
1685 /**
1686  * The contents of CResult_NoneSemanticErrorZ
1687  */
1688 typedef union LDKCResult_NoneSemanticErrorZPtr {
1689    /**
1690     * Note that this value is always NULL, as there are no contents in the OK variant
1691     */
1692    void *result;
1693    /**
1694     * A pointer to the contents in the error state.
1695     * Reading from this pointer when `result_ok` is set is undefined.
1696     */
1697    enum LDKSemanticError *err;
1698 } LDKCResult_NoneSemanticErrorZPtr;
1699
1700 /**
1701  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1702  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1704  */
1705 typedef struct LDKCResult_NoneSemanticErrorZ {
1706    /**
1707     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
1708     * `err` or `result` depending on the state of `result_ok`.
1709     */
1710    union LDKCResult_NoneSemanticErrorZPtr contents;
1711    /**
1712     * Whether this CResult_NoneSemanticErrorZ represents a success state.
1713     */
1714    bool result_ok;
1715 } LDKCResult_NoneSemanticErrorZ;
1716
1717 /**
1718  * The contents of CResult_InvoiceSemanticErrorZ
1719  */
1720 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
1721    /**
1722     * A pointer to the contents in the success state.
1723     * Reading from this pointer when `result_ok` is not set is undefined.
1724     */
1725    struct LDKInvoice *result;
1726    /**
1727     * A pointer to the contents in the error state.
1728     * Reading from this pointer when `result_ok` is set is undefined.
1729     */
1730    enum LDKSemanticError *err;
1731 } LDKCResult_InvoiceSemanticErrorZPtr;
1732
1733 /**
1734  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1735  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1737  */
1738 typedef struct LDKCResult_InvoiceSemanticErrorZ {
1739    /**
1740     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1741     * `err` or `result` depending on the state of `result_ok`.
1742     */
1743    union LDKCResult_InvoiceSemanticErrorZPtr contents;
1744    /**
1745     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1746     */
1747    bool result_ok;
1748 } LDKCResult_InvoiceSemanticErrorZ;
1749
1750
1751
1752 /**
1753  * Description string
1754  *
1755  * # Invariants
1756  * The description can be at most 639 __bytes__ long
1757  */
1758 typedef struct MUST_USE_STRUCT LDKDescription {
1759    /**
1760     * A pointer to the opaque Rust object.
1761     * Nearly everywhere, inner must be non-null, however in places where
1762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1763     */
1764    LDKnativeDescription *inner;
1765    /**
1766     * Indicates that this is the only struct which contains the same pointer.
1767     * Rust functions which take ownership of an object provided via an argument require
1768     * this to be true and invalidate the object pointed to by inner.
1769     */
1770    bool is_owned;
1771 } LDKDescription;
1772
1773 /**
1774  * The contents of CResult_DescriptionCreationErrorZ
1775  */
1776 typedef union LDKCResult_DescriptionCreationErrorZPtr {
1777    /**
1778     * A pointer to the contents in the success state.
1779     * Reading from this pointer when `result_ok` is not set is undefined.
1780     */
1781    struct LDKDescription *result;
1782    /**
1783     * A pointer to the contents in the error state.
1784     * Reading from this pointer when `result_ok` is set is undefined.
1785     */
1786    enum LDKCreationError *err;
1787 } LDKCResult_DescriptionCreationErrorZPtr;
1788
1789 /**
1790  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1791  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1793  */
1794 typedef struct LDKCResult_DescriptionCreationErrorZ {
1795    /**
1796     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1797     * `err` or `result` depending on the state of `result_ok`.
1798     */
1799    union LDKCResult_DescriptionCreationErrorZPtr contents;
1800    /**
1801     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
1802     */
1803    bool result_ok;
1804 } LDKCResult_DescriptionCreationErrorZ;
1805
1806
1807
1808 /**
1809  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
1810  * expires
1811  *
1812  * # Invariants
1813  * The number of seconds this expiry time represents has to be in the range
1814  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
1815  * timestamp
1816  */
1817 typedef struct MUST_USE_STRUCT LDKExpiryTime {
1818    /**
1819     * A pointer to the opaque Rust object.
1820     * Nearly everywhere, inner must be non-null, however in places where
1821     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1822     */
1823    LDKnativeExpiryTime *inner;
1824    /**
1825     * Indicates that this is the only struct which contains the same pointer.
1826     * Rust functions which take ownership of an object provided via an argument require
1827     * this to be true and invalidate the object pointed to by inner.
1828     */
1829    bool is_owned;
1830 } LDKExpiryTime;
1831
1832 /**
1833  * The contents of CResult_ExpiryTimeCreationErrorZ
1834  */
1835 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
1836    /**
1837     * A pointer to the contents in the success state.
1838     * Reading from this pointer when `result_ok` is not set is undefined.
1839     */
1840    struct LDKExpiryTime *result;
1841    /**
1842     * A pointer to the contents in the error state.
1843     * Reading from this pointer when `result_ok` is set is undefined.
1844     */
1845    enum LDKCreationError *err;
1846 } LDKCResult_ExpiryTimeCreationErrorZPtr;
1847
1848 /**
1849  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
1850  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
1851  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1852  */
1853 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
1854    /**
1855     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
1856     * `err` or `result` depending on the state of `result_ok`.
1857     */
1858    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
1859    /**
1860     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
1861     */
1862    bool result_ok;
1863 } LDKCResult_ExpiryTimeCreationErrorZ;
1864
1865
1866
1867 /**
1868  * A channel descriptor which provides a last-hop route to get_route
1869  */
1870 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1871    /**
1872     * A pointer to the opaque Rust object.
1873     * Nearly everywhere, inner must be non-null, however in places where
1874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1875     */
1876    LDKnativeRouteHintHop *inner;
1877    /**
1878     * Indicates that this is the only struct which contains the same pointer.
1879     * Rust functions which take ownership of an object provided via an argument require
1880     * this to be true and invalidate the object pointed to by inner.
1881     */
1882    bool is_owned;
1883 } LDKRouteHintHop;
1884
1885 /**
1886  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1887  * This corresponds to std::vector in C++
1888  */
1889 typedef struct LDKCVec_RouteHintHopZ {
1890    /**
1891     * The elements in the array.
1892     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1893     */
1894    struct LDKRouteHintHop *data;
1895    /**
1896     * The number of elements pointed to by `data`.
1897     */
1898    uintptr_t datalen;
1899 } LDKCVec_RouteHintHopZ;
1900
1901 /**
1902  * The contents of CResult_RouteHintCreationErrorZ
1903  */
1904 typedef union LDKCResult_RouteHintCreationErrorZPtr {
1905    /**
1906     * A pointer to the contents in the success state.
1907     * Reading from this pointer when `result_ok` is not set is undefined.
1908     */
1909    struct LDKRouteHint *result;
1910    /**
1911     * A pointer to the contents in the error state.
1912     * Reading from this pointer when `result_ok` is set is undefined.
1913     */
1914    enum LDKCreationError *err;
1915 } LDKCResult_RouteHintCreationErrorZPtr;
1916
1917 /**
1918  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
1919  * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
1920  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1921  */
1922 typedef struct LDKCResult_RouteHintCreationErrorZ {
1923    /**
1924     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
1925     * `err` or `result` depending on the state of `result_ok`.
1926     */
1927    union LDKCResult_RouteHintCreationErrorZPtr contents;
1928    /**
1929     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
1930     */
1931    bool result_ok;
1932 } LDKCResult_RouteHintCreationErrorZ;
1933
1934 /**
1935  * The contents of CResult_StringErrorZ
1936  */
1937 typedef union LDKCResult_StringErrorZPtr {
1938    /**
1939     * A pointer to the contents in the success state.
1940     * Reading from this pointer when `result_ok` is not set is undefined.
1941     */
1942    struct LDKStr *result;
1943    /**
1944     * A pointer to the contents in the error state.
1945     * Reading from this pointer when `result_ok` is set is undefined.
1946     */
1947    enum LDKSecp256k1Error *err;
1948 } LDKCResult_StringErrorZPtr;
1949
1950 /**
1951  * A CResult_StringErrorZ represents the result of a fallible operation,
1952  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
1953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1954  */
1955 typedef struct LDKCResult_StringErrorZ {
1956    /**
1957     * The contents of this CResult_StringErrorZ, accessible via either
1958     * `err` or `result` depending on the state of `result_ok`.
1959     */
1960    union LDKCResult_StringErrorZPtr contents;
1961    /**
1962     * Whether this CResult_StringErrorZ represents a success state.
1963     */
1964    bool result_ok;
1965 } LDKCResult_StringErrorZ;
1966
1967
1968
1969 /**
1970  * An update generated by the underlying Channel itself which contains some new information the
1971  * ChannelMonitor should be made aware of.
1972  */
1973 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1974    /**
1975     * A pointer to the opaque Rust object.
1976     * Nearly everywhere, inner must be non-null, however in places where
1977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1978     */
1979    LDKnativeChannelMonitorUpdate *inner;
1980    /**
1981     * Indicates that this is the only struct which contains the same pointer.
1982     * Rust functions which take ownership of an object provided via an argument require
1983     * this to be true and invalidate the object pointed to by inner.
1984     */
1985    bool is_owned;
1986 } LDKChannelMonitorUpdate;
1987
1988 /**
1989  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1990  */
1991 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1992    /**
1993     * A pointer to the contents in the success state.
1994     * Reading from this pointer when `result_ok` is not set is undefined.
1995     */
1996    struct LDKChannelMonitorUpdate *result;
1997    /**
1998     * A pointer to the contents in the error state.
1999     * Reading from this pointer when `result_ok` is set is undefined.
2000     */
2001    struct LDKDecodeError *err;
2002 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
2003
2004 /**
2005  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2006  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2007  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2008  */
2009 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
2010    /**
2011     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2012     * `err` or `result` depending on the state of `result_ok`.
2013     */
2014    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
2015    /**
2016     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2017     */
2018    bool result_ok;
2019 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2020
2021
2022
2023 /**
2024  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2025  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2026  * preimage claim backward will lead to loss of funds.
2027  */
2028 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2029    /**
2030     * A pointer to the opaque Rust object.
2031     * Nearly everywhere, inner must be non-null, however in places where
2032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2033     */
2034    LDKnativeHTLCUpdate *inner;
2035    /**
2036     * Indicates that this is the only struct which contains the same pointer.
2037     * Rust functions which take ownership of an object provided via an argument require
2038     * this to be true and invalidate the object pointed to by inner.
2039     */
2040    bool is_owned;
2041 } LDKHTLCUpdate;
2042
2043 /**
2044  * The contents of CResult_HTLCUpdateDecodeErrorZ
2045  */
2046 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
2047    /**
2048     * A pointer to the contents in the success state.
2049     * Reading from this pointer when `result_ok` is not set is undefined.
2050     */
2051    struct LDKHTLCUpdate *result;
2052    /**
2053     * A pointer to the contents in the error state.
2054     * Reading from this pointer when `result_ok` is set is undefined.
2055     */
2056    struct LDKDecodeError *err;
2057 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
2058
2059 /**
2060  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2061  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2063  */
2064 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
2065    /**
2066     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2067     * `err` or `result` depending on the state of `result_ok`.
2068     */
2069    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
2070    /**
2071     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2072     */
2073    bool result_ok;
2074 } LDKCResult_HTLCUpdateDecodeErrorZ;
2075
2076
2077
2078 /**
2079  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
2080  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
2081  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
2082  * corrupted.
2083  * Contains a developer-readable error message.
2084  */
2085 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
2086    /**
2087     * A pointer to the opaque Rust object.
2088     * Nearly everywhere, inner must be non-null, however in places where
2089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2090     */
2091    LDKnativeMonitorUpdateError *inner;
2092    /**
2093     * Indicates that this is the only struct which contains the same pointer.
2094     * Rust functions which take ownership of an object provided via an argument require
2095     * this to be true and invalidate the object pointed to by inner.
2096     */
2097    bool is_owned;
2098 } LDKMonitorUpdateError;
2099
2100 /**
2101  * The contents of CResult_NoneMonitorUpdateErrorZ
2102  */
2103 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
2104    /**
2105     * Note that this value is always NULL, as there are no contents in the OK variant
2106     */
2107    void *result;
2108    /**
2109     * A pointer to the contents in the error state.
2110     * Reading from this pointer when `result_ok` is set is undefined.
2111     */
2112    struct LDKMonitorUpdateError *err;
2113 } LDKCResult_NoneMonitorUpdateErrorZPtr;
2114
2115 /**
2116  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2117  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2119  */
2120 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
2121    /**
2122     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2123     * `err` or `result` depending on the state of `result_ok`.
2124     */
2125    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
2126    /**
2127     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2128     */
2129    bool result_ok;
2130 } LDKCResult_NoneMonitorUpdateErrorZ;
2131
2132 /**
2133  * A tuple of 2 elements. See the individual fields for the types contained.
2134  */
2135 typedef struct LDKC2Tuple_OutPointScriptZ {
2136    /**
2137     * The element at position 0
2138     */
2139    struct LDKOutPoint a;
2140    /**
2141     * The element at position 1
2142     */
2143    struct LDKCVec_u8Z b;
2144 } LDKC2Tuple_OutPointScriptZ;
2145
2146 /**
2147  * A tuple of 2 elements. See the individual fields for the types contained.
2148  */
2149 typedef struct LDKC2Tuple_u32ScriptZ {
2150    /**
2151     * The element at position 0
2152     */
2153    uint32_t a;
2154    /**
2155     * The element at position 1
2156     */
2157    struct LDKCVec_u8Z b;
2158 } LDKC2Tuple_u32ScriptZ;
2159
2160 /**
2161  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2162  * This corresponds to std::vector in C++
2163  */
2164 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
2165    /**
2166     * The elements in the array.
2167     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2168     */
2169    struct LDKC2Tuple_u32ScriptZ *data;
2170    /**
2171     * The number of elements pointed to by `data`.
2172     */
2173    uintptr_t datalen;
2174 } LDKCVec_C2Tuple_u32ScriptZZ;
2175
2176 /**
2177  * A tuple of 2 elements. See the individual fields for the types contained.
2178  */
2179 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2180    /**
2181     * The element at position 0
2182     */
2183    struct LDKThirtyTwoBytes a;
2184    /**
2185     * The element at position 1
2186     */
2187    struct LDKCVec_C2Tuple_u32ScriptZZ b;
2188 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
2189
2190 /**
2191  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2192  * This corresponds to std::vector in C++
2193  */
2194 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2195    /**
2196     * The elements in the array.
2197     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2198     */
2199    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
2200    /**
2201     * The number of elements pointed to by `data`.
2202     */
2203    uintptr_t datalen;
2204 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
2205
2206 /**
2207  * An event to be processed by the ChannelManager.
2208  */
2209 typedef enum LDKMonitorEvent_Tag {
2210    /**
2211     * A monitor event containing an HTLCUpdate.
2212     */
2213    LDKMonitorEvent_HTLCEvent,
2214    /**
2215     * A monitor event that the Channel's commitment transaction was broadcasted.
2216     */
2217    LDKMonitorEvent_CommitmentTxBroadcasted,
2218    /**
2219     * Must be last for serialization purposes
2220     */
2221    LDKMonitorEvent_Sentinel,
2222 } LDKMonitorEvent_Tag;
2223
2224 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2225    LDKMonitorEvent_Tag tag;
2226    union {
2227       struct {
2228          struct LDKHTLCUpdate htlc_event;
2229       };
2230       struct {
2231          struct LDKOutPoint commitment_tx_broadcasted;
2232       };
2233    };
2234 } LDKMonitorEvent;
2235
2236 /**
2237  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2238  * This corresponds to std::vector in C++
2239  */
2240 typedef struct LDKCVec_MonitorEventZ {
2241    /**
2242     * The elements in the array.
2243     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2244     */
2245    struct LDKMonitorEvent *data;
2246    /**
2247     * The number of elements pointed to by `data`.
2248     */
2249    uintptr_t datalen;
2250 } LDKCVec_MonitorEventZ;
2251
2252
2253
2254 /**
2255  * Information about a spendable output to a P2WSH script. See
2256  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2257  */
2258 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2259    /**
2260     * A pointer to the opaque Rust object.
2261     * Nearly everywhere, inner must be non-null, however in places where
2262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2263     */
2264    LDKnativeDelayedPaymentOutputDescriptor *inner;
2265    /**
2266     * Indicates that this is the only struct which contains the same pointer.
2267     * Rust functions which take ownership of an object provided via an argument require
2268     * this to be true and invalidate the object pointed to by inner.
2269     */
2270    bool is_owned;
2271 } LDKDelayedPaymentOutputDescriptor;
2272
2273
2274
2275 /**
2276  * Information about a spendable output to our \"payment key\". See
2277  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2278  */
2279 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2280    /**
2281     * A pointer to the opaque Rust object.
2282     * Nearly everywhere, inner must be non-null, however in places where
2283     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2284     */
2285    LDKnativeStaticPaymentOutputDescriptor *inner;
2286    /**
2287     * Indicates that this is the only struct which contains the same pointer.
2288     * Rust functions which take ownership of an object provided via an argument require
2289     * this to be true and invalidate the object pointed to by inner.
2290     */
2291    bool is_owned;
2292 } LDKStaticPaymentOutputDescriptor;
2293
2294 /**
2295  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2296  * claim at any point in the future) an event is generated which you must track and be able to
2297  * spend on-chain. The information needed to do this is provided in this enum, including the
2298  * outpoint describing which txid and output index is available, the full output which exists at
2299  * that txid/index, and any keys or other information required to sign.
2300  */
2301 typedef enum LDKSpendableOutputDescriptor_Tag {
2302    /**
2303     * An output to a script which was provided via KeysInterface directly, either from
2304     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
2305     * spend it. No secret keys are provided as rust-lightning was never given any key.
2306     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2307     * on-chain using the payment preimage or after it has timed out.
2308     */
2309    LDKSpendableOutputDescriptor_StaticOutput,
2310    /**
2311     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2312     *
2313     * The witness in the spending input should be:
2314     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2315     *
2316     * Note that the nSequence field in the spending input must be set to to_self_delay
2317     * (which means the transaction is not broadcastable until at least to_self_delay
2318     * blocks after the outpoint confirms).
2319     *
2320     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2321     * it is an output from an old state which we broadcast (which should never happen).
2322     *
2323     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2324     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2325     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2326     * chan_utils::derive_private_key. The public key can be generated without the secret key
2327     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2328     * Sign::pubkeys().
2329     *
2330     * To derive the revocation_pubkey provided here (which is used in the witness
2331     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2332     * call to Sign::ready_channel) and the provided per_commitment point
2333     * to chan_utils::derive_public_revocation_key.
2334     *
2335     * The witness script which is hashed and included in the output script_pubkey may be
2336     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2337     * (derived as above), and the to_self_delay contained here to
2338     * chan_utils::get_revokeable_redeemscript.
2339     */
2340    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2341    /**
2342     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2343     * corresponds to the public key in Sign::pubkeys().payment_point).
2344     * The witness in the spending input, is, thus, simply:
2345     * <BIP 143 signature> <payment key>
2346     *
2347     * These are generally the result of our counterparty having broadcast the current state,
2348     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2349     */
2350    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2351    /**
2352     * Must be last for serialization purposes
2353     */
2354    LDKSpendableOutputDescriptor_Sentinel,
2355 } LDKSpendableOutputDescriptor_Tag;
2356
2357 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2358    /**
2359     * The outpoint which is spendable
2360     */
2361    struct LDKOutPoint outpoint;
2362    /**
2363     * The output which is referenced by the given outpoint.
2364     */
2365    struct LDKTxOut output;
2366 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2367
2368 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2369    LDKSpendableOutputDescriptor_Tag tag;
2370    union {
2371       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2372       struct {
2373          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2374       };
2375       struct {
2376          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2377       };
2378    };
2379 } LDKSpendableOutputDescriptor;
2380
2381 /**
2382  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2383  * This corresponds to std::vector in C++
2384  */
2385 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2386    /**
2387     * The elements in the array.
2388     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2389     */
2390    struct LDKSpendableOutputDescriptor *data;
2391    /**
2392     * The number of elements pointed to by `data`.
2393     */
2394    uintptr_t datalen;
2395 } LDKCVec_SpendableOutputDescriptorZ;
2396
2397 /**
2398  * An Event which you should probably take some action in response to.
2399  *
2400  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2401  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2402  * written as it makes no sense to respond to it after reconnecting to peers).
2403  */
2404 typedef enum LDKEvent_Tag {
2405    /**
2406     * Used to indicate that the client should generate a funding transaction with the given
2407     * parameters and then call ChannelManager::funding_transaction_generated.
2408     * Generated in ChannelManager message handling.
2409     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2410     * counterparty can steal your funds!
2411     */
2412    LDKEvent_FundingGenerationReady,
2413    /**
2414     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2415     * ChannelManager::claim_funds to get it....
2416     * Note that if the preimage is not known or the amount paid is incorrect, you should call
2417     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2418     * network congestion.
2419     * The amount paid should be considered 'incorrect' when it is less than or more than twice
2420     * the amount expected.
2421     * If you fail to call either ChannelManager::claim_funds or
2422     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2423     * automatically failed.
2424     */
2425    LDKEvent_PaymentReceived,
2426    /**
2427     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2428     * and we got back the payment preimage for it).
2429     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
2430     * deduplicate them by payment_preimage (which MUST be unique)!
2431     */
2432    LDKEvent_PaymentSent,
2433    /**
2434     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2435     * something. You may wish to retry with a different route.
2436     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
2437     * deduplicate them by payment_hash (which MUST be unique)!
2438     */
2439    LDKEvent_PaymentFailed,
2440    /**
2441     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2442     * time in the future.
2443     */
2444    LDKEvent_PendingHTLCsForwardable,
2445    /**
2446     * Used to indicate that an output was generated on-chain which you should know how to spend.
2447     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2448     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2449     * somewhere and spend them when you create on-chain transactions.
2450     */
2451    LDKEvent_SpendableOutputs,
2452    /**
2453     * Must be last for serialization purposes
2454     */
2455    LDKEvent_Sentinel,
2456 } LDKEvent_Tag;
2457
2458 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2459    /**
2460     * The random channel_id we picked which you'll need to pass into
2461     * ChannelManager::funding_transaction_generated.
2462     */
2463    struct LDKThirtyTwoBytes temporary_channel_id;
2464    /**
2465     * The value, in satoshis, that the output should have.
2466     */
2467    uint64_t channel_value_satoshis;
2468    /**
2469     * The script which should be used in the transaction output.
2470     */
2471    struct LDKCVec_u8Z output_script;
2472    /**
2473     * The value passed in to ChannelManager::create_channel
2474     */
2475    uint64_t user_channel_id;
2476 } LDKEvent_LDKFundingGenerationReady_Body;
2477
2478 typedef struct LDKEvent_LDKPaymentReceived_Body {
2479    /**
2480     * The hash for which the preimage should be handed to the ChannelManager.
2481     */
2482    struct LDKThirtyTwoBytes payment_hash;
2483    /**
2484     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2485     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2486     * [`ChannelManager::claim_funds`].
2487     *
2488     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2489     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2490     */
2491    struct LDKThirtyTwoBytes payment_preimage;
2492    /**
2493     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2494     * number of deanonymization attacks during the routing process.
2495     * It is provided here for your reference, however its accuracy is enforced directly by
2496     * [`ChannelManager`] using the values you previously provided to
2497     * [`ChannelManager::create_inbound_payment`] or
2498     * [`ChannelManager::create_inbound_payment_for_hash`].
2499     *
2500     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2501     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2502     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2503     */
2504    struct LDKThirtyTwoBytes payment_secret;
2505    /**
2506     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
2507     * compare this to the expected value before accepting the payment (as otherwise you are
2508     * providing proof-of-payment for less than the value you expected!).
2509     */
2510    uint64_t amt;
2511    /**
2512     * This is the `user_payment_id` which was provided to
2513     * [`ChannelManager::create_inbound_payment_for_hash`] or
2514     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
2515     * simply copied here. It may be used to correlate PaymentReceived events with invoice
2516     * metadata stored elsewhere.
2517     *
2518     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2519     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2520     */
2521    uint64_t user_payment_id;
2522 } LDKEvent_LDKPaymentReceived_Body;
2523
2524 typedef struct LDKEvent_LDKPaymentSent_Body {
2525    /**
2526     * The preimage to the hash given to ChannelManager::send_payment.
2527     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2528     * store it somehow!
2529     */
2530    struct LDKThirtyTwoBytes payment_preimage;
2531 } LDKEvent_LDKPaymentSent_Body;
2532
2533 typedef struct LDKEvent_LDKPaymentFailed_Body {
2534    /**
2535     * The hash which was given to ChannelManager::send_payment.
2536     */
2537    struct LDKThirtyTwoBytes payment_hash;
2538    /**
2539     * Indicates the payment was rejected for some reason by the recipient. This implies that
2540     * the payment has failed, not just the route in question. If this is not set, you may
2541     * retry the payment via a different route.
2542     */
2543    bool rejected_by_dest;
2544 } LDKEvent_LDKPaymentFailed_Body;
2545
2546 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2547    /**
2548     * The minimum amount of time that should be waited prior to calling
2549     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2550     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2551     * now + 5*time_forwardable).
2552     */
2553    uint64_t time_forwardable;
2554 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2555
2556 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2557    /**
2558     * The outputs which you should store as spendable by you.
2559     */
2560    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2561 } LDKEvent_LDKSpendableOutputs_Body;
2562
2563 typedef struct MUST_USE_STRUCT LDKEvent {
2564    LDKEvent_Tag tag;
2565    union {
2566       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2567       LDKEvent_LDKPaymentReceived_Body payment_received;
2568       LDKEvent_LDKPaymentSent_Body payment_sent;
2569       LDKEvent_LDKPaymentFailed_Body payment_failed;
2570       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2571       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2572    };
2573 } LDKEvent;
2574
2575 /**
2576  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2577  * This corresponds to std::vector in C++
2578  */
2579 typedef struct LDKCVec_EventZ {
2580    /**
2581     * The elements in the array.
2582     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2583     */
2584    struct LDKEvent *data;
2585    /**
2586     * The number of elements pointed to by `data`.
2587     */
2588    uintptr_t datalen;
2589 } LDKCVec_EventZ;
2590
2591 /**
2592  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2593  * This corresponds to std::vector in C++
2594  */
2595 typedef struct LDKCVec_TransactionZ {
2596    /**
2597     * The elements in the array.
2598     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2599     */
2600    struct LDKTransaction *data;
2601    /**
2602     * The number of elements pointed to by `data`.
2603     */
2604    uintptr_t datalen;
2605 } LDKCVec_TransactionZ;
2606
2607 /**
2608  * A tuple of 2 elements. See the individual fields for the types contained.
2609  */
2610 typedef struct LDKC2Tuple_usizeTransactionZ {
2611    /**
2612     * The element at position 0
2613     */
2614    uintptr_t a;
2615    /**
2616     * The element at position 1
2617     */
2618    struct LDKTransaction b;
2619 } LDKC2Tuple_usizeTransactionZ;
2620
2621 /**
2622  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2623  * This corresponds to std::vector in C++
2624  */
2625 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2626    /**
2627     * The elements in the array.
2628     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2629     */
2630    struct LDKC2Tuple_usizeTransactionZ *data;
2631    /**
2632     * The number of elements pointed to by `data`.
2633     */
2634    uintptr_t datalen;
2635 } LDKCVec_C2Tuple_usizeTransactionZZ;
2636
2637 /**
2638  * A tuple of 2 elements. See the individual fields for the types contained.
2639  */
2640 typedef struct LDKC2Tuple_u32TxOutZ {
2641    /**
2642     * The element at position 0
2643     */
2644    uint32_t a;
2645    /**
2646     * The element at position 1
2647     */
2648    struct LDKTxOut b;
2649 } LDKC2Tuple_u32TxOutZ;
2650
2651 /**
2652  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2653  * This corresponds to std::vector in C++
2654  */
2655 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
2656    /**
2657     * The elements in the array.
2658     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2659     */
2660    struct LDKC2Tuple_u32TxOutZ *data;
2661    /**
2662     * The number of elements pointed to by `data`.
2663     */
2664    uintptr_t datalen;
2665 } LDKCVec_C2Tuple_u32TxOutZZ;
2666
2667 /**
2668  * A tuple of 2 elements. See the individual fields for the types contained.
2669  */
2670 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2671    /**
2672     * The element at position 0
2673     */
2674    struct LDKThirtyTwoBytes a;
2675    /**
2676     * The element at position 1
2677     */
2678    struct LDKCVec_C2Tuple_u32TxOutZZ b;
2679 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
2680
2681 /**
2682  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2683  * This corresponds to std::vector in C++
2684  */
2685 typedef struct LDKCVec_TransactionOutputsZ {
2686    /**
2687     * The elements in the array.
2688     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2689     */
2690    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
2691    /**
2692     * The number of elements pointed to by `data`.
2693     */
2694    uintptr_t datalen;
2695 } LDKCVec_TransactionOutputsZ;
2696
2697 /**
2698  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2699  * This corresponds to std::vector in C++
2700  */
2701 typedef struct LDKCVec_TxidZ {
2702    /**
2703     * The elements in the array.
2704     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2705     */
2706    struct LDKThirtyTwoBytes *data;
2707    /**
2708     * The number of elements pointed to by `data`.
2709     */
2710    uintptr_t datalen;
2711 } LDKCVec_TxidZ;
2712
2713 /**
2714  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2715  */
2716 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2717    /**
2718     * Note that this value is always NULL, as there are no contents in the OK variant
2719     */
2720    void *result;
2721    /**
2722     * A pointer to the contents in the error state.
2723     * Reading from this pointer when `result_ok` is set is undefined.
2724     */
2725    enum LDKChannelMonitorUpdateErr *err;
2726 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2727
2728 /**
2729  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2730  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2731  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2732  */
2733 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2734    /**
2735     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2736     * `err` or `result` depending on the state of `result_ok`.
2737     */
2738    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2739    /**
2740     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2741     */
2742    bool result_ok;
2743 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2744
2745 /**
2746  * A tuple of 2 elements. See the individual fields for the types contained.
2747  */
2748 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2749    /**
2750     * The element at position 0
2751     */
2752    struct LDKSignature a;
2753    /**
2754     * The element at position 1
2755     */
2756    struct LDKCVec_SignatureZ b;
2757 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2758
2759 /**
2760  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2761  */
2762 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2763    /**
2764     * A pointer to the contents in the success state.
2765     * Reading from this pointer when `result_ok` is not set is undefined.
2766     */
2767    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2768    /**
2769     * Note that this value is always NULL, as there are no contents in the Err variant
2770     */
2771    void *err;
2772 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2773
2774 /**
2775  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2776  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2778  */
2779 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2780    /**
2781     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2782     * `err` or `result` depending on the state of `result_ok`.
2783     */
2784    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2785    /**
2786     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2787     */
2788    bool result_ok;
2789 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2790
2791 /**
2792  * The contents of CResult_SignatureNoneZ
2793  */
2794 typedef union LDKCResult_SignatureNoneZPtr {
2795    /**
2796     * A pointer to the contents in the success state.
2797     * Reading from this pointer when `result_ok` is not set is undefined.
2798     */
2799    struct LDKSignature *result;
2800    /**
2801     * Note that this value is always NULL, as there are no contents in the Err variant
2802     */
2803    void *err;
2804 } LDKCResult_SignatureNoneZPtr;
2805
2806 /**
2807  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2808  * containing a crate::c_types::Signature on success and a () on failure.
2809  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2810  */
2811 typedef struct LDKCResult_SignatureNoneZ {
2812    /**
2813     * The contents of this CResult_SignatureNoneZ, accessible via either
2814     * `err` or `result` depending on the state of `result_ok`.
2815     */
2816    union LDKCResult_SignatureNoneZPtr contents;
2817    /**
2818     * Whether this CResult_SignatureNoneZ represents a success state.
2819     */
2820    bool result_ok;
2821 } LDKCResult_SignatureNoneZ;
2822
2823
2824
2825 /**
2826  * The unsigned part of a channel_announcement
2827  */
2828 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2829    /**
2830     * A pointer to the opaque Rust object.
2831     * Nearly everywhere, inner must be non-null, however in places where
2832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2833     */
2834    LDKnativeUnsignedChannelAnnouncement *inner;
2835    /**
2836     * Indicates that this is the only struct which contains the same pointer.
2837     * Rust functions which take ownership of an object provided via an argument require
2838     * this to be true and invalidate the object pointed to by inner.
2839     */
2840    bool is_owned;
2841 } LDKUnsignedChannelAnnouncement;
2842
2843 /**
2844  * A trait to sign lightning channel transactions as described in BOLT 3.
2845  *
2846  * Signing services could be implemented on a hardware wallet. In this case,
2847  * the current Sign would be a front-end on top of a communication
2848  * channel connected to your secure device and lightning key material wouldn't
2849  * reside on a hot server. Nevertheless, a this deployment would still need
2850  * to trust the ChannelManager to avoid loss of funds as this latest component
2851  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2852  *
2853  * A more secure iteration would be to use hashlock (or payment points) to pair
2854  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2855  * at the price of more state and computation on the hardware wallet side. In the future,
2856  * we are looking forward to design such interface.
2857  *
2858  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2859  * to act, as liveness and breach reply correctness are always going to be hard requirements
2860  * of LN security model, orthogonal of key management issues.
2861  */
2862 typedef struct LDKBaseSign {
2863    /**
2864     * An opaque pointer which is passed to your function implementations as an argument.
2865     * This has no meaning in the LDK, and can be NULL or any other value.
2866     */
2867    void *this_arg;
2868    /**
2869     * Gets the per-commitment point for a specific commitment number
2870     *
2871     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2872     */
2873    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2874    /**
2875     * Gets the commitment secret for a specific commitment number as part of the revocation process
2876     *
2877     * An external signer implementation should error here if the commitment was already signed
2878     * and should refuse to sign it in the future.
2879     *
2880     * May be called more than once for the same index.
2881     *
2882     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2883     */
2884    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2885    /**
2886     * Gets the holder's channel public keys and basepoints
2887     */
2888    struct LDKChannelPublicKeys pubkeys;
2889    /**
2890     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2891     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2892     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2893     */
2894    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2895    /**
2896     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2897     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2898     * Sign object uniquely and lookup or re-derive its keys.
2899     */
2900    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2901    /**
2902     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2903     *
2904     * Note that if signing fails or is rejected, the channel will be force-closed.
2905     */
2906    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2907    /**
2908     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2909     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2910     * latest commitment_tx when we initiate a force-close.
2911     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2912     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2913     * the latest.
2914     * This may be called multiple times for the same transaction.
2915     *
2916     * An external signer implementation should check that the commitment has not been revoked.
2917     *
2918     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2919     */
2920    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2921    /**
2922     * Create a signature for the given input in a transaction spending an HTLC or commitment
2923     * transaction output when our counterparty broadcasts an old state.
2924     *
2925     * A justice transaction may claim multiples outputs at the same time if timelocks are
2926     * similar, but only a signature for the input at index `input` should be signed for here.
2927     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2928     * to an upcoming timelock expiration.
2929     *
2930     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2931     *
2932     * per_commitment_key is revocation secret which was provided by our counterparty when they
2933     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2934     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2935     * so).
2936     *
2937     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2938     * changing the format of the witness script (which is committed to in the BIP 143
2939     * signatures).
2940     */
2941    struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
2942    /**
2943     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2944     * transaction, either offered or received.
2945     *
2946     * Such a transaction may claim multiples offered outputs at same time if we know the
2947     * preimage for each when we create it, but only the input at index `input` should be
2948     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2949     * needed with regards to an upcoming timelock expiration.
2950     *
2951     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2952     * outputs.
2953     *
2954     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2955     *
2956     * Per_commitment_point is the dynamic point corresponding to the channel state
2957     * detected onchain. It has been generated by our counterparty and is used to derive
2958     * channel state keys, which are then included in the witness script and committed to in the
2959     * BIP 143 signature.
2960     */
2961    struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
2962    /**
2963     * Create a signature for a (proposed) closing transaction.
2964     *
2965     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2966     * chosen to forgo their output as dust.
2967     */
2968    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2969    /**
2970     * Signs a channel announcement message with our funding key, proving it comes from one
2971     * of the channel participants.
2972     *
2973     * Note that if this fails or is rejected, the channel will not be publicly announced and
2974     * our counterparty may (though likely will not) close the channel on us for violating the
2975     * protocol.
2976     */
2977    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2978    /**
2979     * Set the counterparty static channel data, including basepoints,
2980     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2981     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2982     * they MUST NOT be allowed to change to different values once set.
2983     *
2984     * channel_parameters.is_populated() MUST be true.
2985     *
2986     * We bind holder_selected_contest_delay late here for API convenience.
2987     *
2988     * Will be called before any signatures are applied.
2989     */
2990    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2991    /**
2992     * Frees any resources associated with this object given its this_arg pointer.
2993     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2994     */
2995    void (*free)(void *this_arg);
2996 } LDKBaseSign;
2997
2998 /**
2999  * A cloneable signer.
3000  *
3001  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3002  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3003  * which implies Sized, into this derived trait.
3004  */
3005 typedef struct LDKSign {
3006    /**
3007     * An opaque pointer which is passed to your function implementations as an argument.
3008     * This has no meaning in the LDK, and can be NULL or any other value.
3009     */
3010    void *this_arg;
3011    /**
3012     * Implementation of BaseSign for this object.
3013     */
3014    struct LDKBaseSign BaseSign;
3015    /**
3016     * Creates a copy of the BaseSign, for a copy of this Sign.
3017     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3018     */
3019    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3020    /**
3021     * Serialize the object into a byte array
3022     */
3023    struct LDKCVec_u8Z (*write)(const void *this_arg);
3024    /**
3025     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3026     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3027     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3028     */
3029    void *(*clone)(const void *this_arg);
3030    /**
3031     * Frees any resources associated with this object given its this_arg pointer.
3032     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3033     */
3034    void (*free)(void *this_arg);
3035 } LDKSign;
3036
3037
3038
3039 /**
3040  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3041  * on-chain transactions to ensure no loss of funds occurs.
3042  *
3043  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3044  * information and are actively monitoring the chain.
3045  *
3046  * Pending Events or updated HTLCs which have not yet been read out by
3047  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3048  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3049  * gotten are fully handled before re-serializing the new state.
3050  *
3051  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3052  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3053  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3054  * returned block hash and the the current chain and then reconnecting blocks to get to the
3055  * best chain) upon deserializing the object!
3056  */
3057 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3058    /**
3059     * A pointer to the opaque Rust object.
3060     * Nearly everywhere, inner must be non-null, however in places where
3061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3062     */
3063    LDKnativeChannelMonitor *inner;
3064    /**
3065     * Indicates that this is the only struct which contains the same pointer.
3066     * Rust functions which take ownership of an object provided via an argument require
3067     * this to be true and invalidate the object pointed to by inner.
3068     */
3069    bool is_owned;
3070 } LDKChannelMonitor;
3071
3072 /**
3073  * A tuple of 2 elements. See the individual fields for the types contained.
3074  */
3075 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3076    /**
3077     * The element at position 0
3078     */
3079    struct LDKThirtyTwoBytes a;
3080    /**
3081     * The element at position 1
3082     */
3083    struct LDKChannelMonitor b;
3084 } LDKC2Tuple_BlockHashChannelMonitorZ;
3085
3086 /**
3087  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3088  */
3089 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3090    /**
3091     * A pointer to the contents in the success state.
3092     * Reading from this pointer when `result_ok` is not set is undefined.
3093     */
3094    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
3095    /**
3096     * A pointer to the contents in the error state.
3097     * Reading from this pointer when `result_ok` is set is undefined.
3098     */
3099    struct LDKDecodeError *err;
3100 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
3101
3102 /**
3103  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3104  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3106  */
3107 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3108    /**
3109     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3110     * `err` or `result` depending on the state of `result_ok`.
3111     */
3112    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
3113    /**
3114     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3115     */
3116    bool result_ok;
3117 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
3118
3119
3120
3121 /**
3122  * A hop in a route
3123  */
3124 typedef struct MUST_USE_STRUCT LDKRouteHop {
3125    /**
3126     * A pointer to the opaque Rust object.
3127     * Nearly everywhere, inner must be non-null, however in places where
3128     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3129     */
3130    LDKnativeRouteHop *inner;
3131    /**
3132     * Indicates that this is the only struct which contains the same pointer.
3133     * Rust functions which take ownership of an object provided via an argument require
3134     * this to be true and invalidate the object pointed to by inner.
3135     */
3136    bool is_owned;
3137 } LDKRouteHop;
3138
3139 /**
3140  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3141  * This corresponds to std::vector in C++
3142  */
3143 typedef struct LDKCVec_RouteHopZ {
3144    /**
3145     * The elements in the array.
3146     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3147     */
3148    struct LDKRouteHop *data;
3149    /**
3150     * The number of elements pointed to by `data`.
3151     */
3152    uintptr_t datalen;
3153 } LDKCVec_RouteHopZ;
3154
3155 /**
3156  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3157  * This corresponds to std::vector in C++
3158  */
3159 typedef struct LDKCVec_CVec_RouteHopZZ {
3160    /**
3161     * The elements in the array.
3162     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3163     */
3164    struct LDKCVec_RouteHopZ *data;
3165    /**
3166     * The number of elements pointed to by `data`.
3167     */
3168    uintptr_t datalen;
3169 } LDKCVec_CVec_RouteHopZZ;
3170
3171
3172
3173 /**
3174  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3175  * it can take multiple paths. Each path is composed of one or more hops through the network.
3176  */
3177 typedef struct MUST_USE_STRUCT LDKRoute {
3178    /**
3179     * A pointer to the opaque Rust object.
3180     * Nearly everywhere, inner must be non-null, however in places where
3181     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3182     */
3183    LDKnativeRoute *inner;
3184    /**
3185     * Indicates that this is the only struct which contains the same pointer.
3186     * Rust functions which take ownership of an object provided via an argument require
3187     * this to be true and invalidate the object pointed to by inner.
3188     */
3189    bool is_owned;
3190 } LDKRoute;
3191
3192 /**
3193  * The contents of CResult_RouteDecodeErrorZ
3194  */
3195 typedef union LDKCResult_RouteDecodeErrorZPtr {
3196    /**
3197     * A pointer to the contents in the success state.
3198     * Reading from this pointer when `result_ok` is not set is undefined.
3199     */
3200    struct LDKRoute *result;
3201    /**
3202     * A pointer to the contents in the error state.
3203     * Reading from this pointer when `result_ok` is set is undefined.
3204     */
3205    struct LDKDecodeError *err;
3206 } LDKCResult_RouteDecodeErrorZPtr;
3207
3208 /**
3209  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3210  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3212  */
3213 typedef struct LDKCResult_RouteDecodeErrorZ {
3214    /**
3215     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3216     * `err` or `result` depending on the state of `result_ok`.
3217     */
3218    union LDKCResult_RouteDecodeErrorZPtr contents;
3219    /**
3220     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3221     */
3222    bool result_ok;
3223 } LDKCResult_RouteDecodeErrorZ;
3224
3225
3226
3227 /**
3228  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
3229  */
3230 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3231    /**
3232     * A pointer to the opaque Rust object.
3233     * Nearly everywhere, inner must be non-null, however in places where
3234     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3235     */
3236    LDKnativeChannelDetails *inner;
3237    /**
3238     * Indicates that this is the only struct which contains the same pointer.
3239     * Rust functions which take ownership of an object provided via an argument require
3240     * this to be true and invalidate the object pointed to by inner.
3241     */
3242    bool is_owned;
3243 } LDKChannelDetails;
3244
3245 /**
3246  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3247  * This corresponds to std::vector in C++
3248  */
3249 typedef struct LDKCVec_ChannelDetailsZ {
3250    /**
3251     * The elements in the array.
3252     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3253     */
3254    struct LDKChannelDetails *data;
3255    /**
3256     * The number of elements pointed to by `data`.
3257     */
3258    uintptr_t datalen;
3259 } LDKCVec_ChannelDetailsZ;
3260
3261
3262
3263 /**
3264  * An Err type for failure to process messages.
3265  */
3266 typedef struct MUST_USE_STRUCT LDKLightningError {
3267    /**
3268     * A pointer to the opaque Rust object.
3269     * Nearly everywhere, inner must be non-null, however in places where
3270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3271     */
3272    LDKnativeLightningError *inner;
3273    /**
3274     * Indicates that this is the only struct which contains the same pointer.
3275     * Rust functions which take ownership of an object provided via an argument require
3276     * this to be true and invalidate the object pointed to by inner.
3277     */
3278    bool is_owned;
3279 } LDKLightningError;
3280
3281 /**
3282  * The contents of CResult_RouteLightningErrorZ
3283  */
3284 typedef union LDKCResult_RouteLightningErrorZPtr {
3285    /**
3286     * A pointer to the contents in the success state.
3287     * Reading from this pointer when `result_ok` is not set is undefined.
3288     */
3289    struct LDKRoute *result;
3290    /**
3291     * A pointer to the contents in the error state.
3292     * Reading from this pointer when `result_ok` is set is undefined.
3293     */
3294    struct LDKLightningError *err;
3295 } LDKCResult_RouteLightningErrorZPtr;
3296
3297 /**
3298  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3299  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3300  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3301  */
3302 typedef struct LDKCResult_RouteLightningErrorZ {
3303    /**
3304     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3305     * `err` or `result` depending on the state of `result_ok`.
3306     */
3307    union LDKCResult_RouteLightningErrorZPtr contents;
3308    /**
3309     * Whether this CResult_RouteLightningErrorZ represents a success state.
3310     */
3311    bool result_ok;
3312 } LDKCResult_RouteLightningErrorZ;
3313
3314
3315
3316 /**
3317  * An accept_channel message to be sent or received from a peer
3318  */
3319 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3320    /**
3321     * A pointer to the opaque Rust object.
3322     * Nearly everywhere, inner must be non-null, however in places where
3323     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3324     */
3325    LDKnativeAcceptChannel *inner;
3326    /**
3327     * Indicates that this is the only struct which contains the same pointer.
3328     * Rust functions which take ownership of an object provided via an argument require
3329     * this to be true and invalidate the object pointed to by inner.
3330     */
3331    bool is_owned;
3332 } LDKAcceptChannel;
3333
3334
3335
3336 /**
3337  * An open_channel message to be sent or received from a peer
3338  */
3339 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3340    /**
3341     * A pointer to the opaque Rust object.
3342     * Nearly everywhere, inner must be non-null, however in places where
3343     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3344     */
3345    LDKnativeOpenChannel *inner;
3346    /**
3347     * Indicates that this is the only struct which contains the same pointer.
3348     * Rust functions which take ownership of an object provided via an argument require
3349     * this to be true and invalidate the object pointed to by inner.
3350     */
3351    bool is_owned;
3352 } LDKOpenChannel;
3353
3354
3355
3356 /**
3357  * A funding_created message to be sent or received from a peer
3358  */
3359 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3360    /**
3361     * A pointer to the opaque Rust object.
3362     * Nearly everywhere, inner must be non-null, however in places where
3363     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3364     */
3365    LDKnativeFundingCreated *inner;
3366    /**
3367     * Indicates that this is the only struct which contains the same pointer.
3368     * Rust functions which take ownership of an object provided via an argument require
3369     * this to be true and invalidate the object pointed to by inner.
3370     */
3371    bool is_owned;
3372 } LDKFundingCreated;
3373
3374
3375
3376 /**
3377  * A funding_signed message to be sent or received from a peer
3378  */
3379 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3380    /**
3381     * A pointer to the opaque Rust object.
3382     * Nearly everywhere, inner must be non-null, however in places where
3383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3384     */
3385    LDKnativeFundingSigned *inner;
3386    /**
3387     * Indicates that this is the only struct which contains the same pointer.
3388     * Rust functions which take ownership of an object provided via an argument require
3389     * this to be true and invalidate the object pointed to by inner.
3390     */
3391    bool is_owned;
3392 } LDKFundingSigned;
3393
3394
3395
3396 /**
3397  * A funding_locked message to be sent or received from a peer
3398  */
3399 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3400    /**
3401     * A pointer to the opaque Rust object.
3402     * Nearly everywhere, inner must be non-null, however in places where
3403     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3404     */
3405    LDKnativeFundingLocked *inner;
3406    /**
3407     * Indicates that this is the only struct which contains the same pointer.
3408     * Rust functions which take ownership of an object provided via an argument require
3409     * this to be true and invalidate the object pointed to by inner.
3410     */
3411    bool is_owned;
3412 } LDKFundingLocked;
3413
3414
3415
3416 /**
3417  * An announcement_signatures message to be sent or received from a peer
3418  */
3419 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3420    /**
3421     * A pointer to the opaque Rust object.
3422     * Nearly everywhere, inner must be non-null, however in places where
3423     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3424     */
3425    LDKnativeAnnouncementSignatures *inner;
3426    /**
3427     * Indicates that this is the only struct which contains the same pointer.
3428     * Rust functions which take ownership of an object provided via an argument require
3429     * this to be true and invalidate the object pointed to by inner.
3430     */
3431    bool is_owned;
3432 } LDKAnnouncementSignatures;
3433
3434
3435
3436 /**
3437  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3438  * transaction updates if they were pending.
3439  */
3440 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3441    /**
3442     * A pointer to the opaque Rust object.
3443     * Nearly everywhere, inner must be non-null, however in places where
3444     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3445     */
3446    LDKnativeCommitmentUpdate *inner;
3447    /**
3448     * Indicates that this is the only struct which contains the same pointer.
3449     * Rust functions which take ownership of an object provided via an argument require
3450     * this to be true and invalidate the object pointed to by inner.
3451     */
3452    bool is_owned;
3453 } LDKCommitmentUpdate;
3454
3455
3456
3457 /**
3458  * A revoke_and_ack message to be sent or received from a peer
3459  */
3460 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3461    /**
3462     * A pointer to the opaque Rust object.
3463     * Nearly everywhere, inner must be non-null, however in places where
3464     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3465     */
3466    LDKnativeRevokeAndACK *inner;
3467    /**
3468     * Indicates that this is the only struct which contains the same pointer.
3469     * Rust functions which take ownership of an object provided via an argument require
3470     * this to be true and invalidate the object pointed to by inner.
3471     */
3472    bool is_owned;
3473 } LDKRevokeAndACK;
3474
3475
3476
3477 /**
3478  * A closing_signed message to be sent or received from a peer
3479  */
3480 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3481    /**
3482     * A pointer to the opaque Rust object.
3483     * Nearly everywhere, inner must be non-null, however in places where
3484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3485     */
3486    LDKnativeClosingSigned *inner;
3487    /**
3488     * Indicates that this is the only struct which contains the same pointer.
3489     * Rust functions which take ownership of an object provided via an argument require
3490     * this to be true and invalidate the object pointed to by inner.
3491     */
3492    bool is_owned;
3493 } LDKClosingSigned;
3494
3495
3496
3497 /**
3498  * A shutdown message to be sent or received from a peer
3499  */
3500 typedef struct MUST_USE_STRUCT LDKShutdown {
3501    /**
3502     * A pointer to the opaque Rust object.
3503     * Nearly everywhere, inner must be non-null, however in places where
3504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3505     */
3506    LDKnativeShutdown *inner;
3507    /**
3508     * Indicates that this is the only struct which contains the same pointer.
3509     * Rust functions which take ownership of an object provided via an argument require
3510     * this to be true and invalidate the object pointed to by inner.
3511     */
3512    bool is_owned;
3513 } LDKShutdown;
3514
3515
3516
3517 /**
3518  * A channel_reestablish message to be sent or received from a peer
3519  */
3520 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3521    /**
3522     * A pointer to the opaque Rust object.
3523     * Nearly everywhere, inner must be non-null, however in places where
3524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3525     */
3526    LDKnativeChannelReestablish *inner;
3527    /**
3528     * Indicates that this is the only struct which contains the same pointer.
3529     * Rust functions which take ownership of an object provided via an argument require
3530     * this to be true and invalidate the object pointed to by inner.
3531     */
3532    bool is_owned;
3533 } LDKChannelReestablish;
3534
3535
3536
3537 /**
3538  * A channel_announcement message to be sent or received from a peer
3539  */
3540 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3541    /**
3542     * A pointer to the opaque Rust object.
3543     * Nearly everywhere, inner must be non-null, however in places where
3544     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3545     */
3546    LDKnativeChannelAnnouncement *inner;
3547    /**
3548     * Indicates that this is the only struct which contains the same pointer.
3549     * Rust functions which take ownership of an object provided via an argument require
3550     * this to be true and invalidate the object pointed to by inner.
3551     */
3552    bool is_owned;
3553 } LDKChannelAnnouncement;
3554
3555
3556
3557 /**
3558  * A channel_update message to be sent or received from a peer
3559  */
3560 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
3561    /**
3562     * A pointer to the opaque Rust object.
3563     * Nearly everywhere, inner must be non-null, however in places where
3564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3565     */
3566    LDKnativeChannelUpdate *inner;
3567    /**
3568     * Indicates that this is the only struct which contains the same pointer.
3569     * Rust functions which take ownership of an object provided via an argument require
3570     * this to be true and invalidate the object pointed to by inner.
3571     */
3572    bool is_owned;
3573 } LDKChannelUpdate;
3574
3575
3576
3577 /**
3578  * A node_announcement message to be sent or received from a peer
3579  */
3580 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3581    /**
3582     * A pointer to the opaque Rust object.
3583     * Nearly everywhere, inner must be non-null, however in places where
3584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3585     */
3586    LDKnativeNodeAnnouncement *inner;
3587    /**
3588     * Indicates that this is the only struct which contains the same pointer.
3589     * Rust functions which take ownership of an object provided via an argument require
3590     * this to be true and invalidate the object pointed to by inner.
3591     */
3592    bool is_owned;
3593 } LDKNodeAnnouncement;
3594
3595
3596
3597 /**
3598  * An error message to be sent or received from a peer
3599  */
3600 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3601    /**
3602     * A pointer to the opaque Rust object.
3603     * Nearly everywhere, inner must be non-null, however in places where
3604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3605     */
3606    LDKnativeErrorMessage *inner;
3607    /**
3608     * Indicates that this is the only struct which contains the same pointer.
3609     * Rust functions which take ownership of an object provided via an argument require
3610     * this to be true and invalidate the object pointed to by inner.
3611     */
3612    bool is_owned;
3613 } LDKErrorMessage;
3614
3615 /**
3616  * Used to put an error message in a LightningError
3617  */
3618 typedef enum LDKErrorAction_Tag {
3619    /**
3620     * The peer took some action which made us think they were useless. Disconnect them.
3621     */
3622    LDKErrorAction_DisconnectPeer,
3623    /**
3624     * The peer did something harmless that we weren't able to process, just log and ignore
3625     */
3626    LDKErrorAction_IgnoreError,
3627    /**
3628     * The peer did something incorrect. Tell them.
3629     */
3630    LDKErrorAction_SendErrorMessage,
3631    /**
3632     * Must be last for serialization purposes
3633     */
3634    LDKErrorAction_Sentinel,
3635 } LDKErrorAction_Tag;
3636
3637 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3638    /**
3639     * An error message which we should make an effort to send before we disconnect.
3640     */
3641    struct LDKErrorMessage msg;
3642 } LDKErrorAction_LDKDisconnectPeer_Body;
3643
3644 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3645    /**
3646     * The message to send.
3647     */
3648    struct LDKErrorMessage msg;
3649 } LDKErrorAction_LDKSendErrorMessage_Body;
3650
3651 typedef struct MUST_USE_STRUCT LDKErrorAction {
3652    LDKErrorAction_Tag tag;
3653    union {
3654       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3655       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3656    };
3657 } LDKErrorAction;
3658
3659 /**
3660  * The information we received from a peer along the route of a payment we originated. This is
3661  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3662  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3663  */
3664 typedef enum LDKHTLCFailChannelUpdate_Tag {
3665    /**
3666     * We received an error which included a full ChannelUpdate message.
3667     */
3668    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
3669    /**
3670     * We received an error which indicated only that a channel has been closed
3671     */
3672    LDKHTLCFailChannelUpdate_ChannelClosed,
3673    /**
3674     * We received an error which indicated only that a node has failed
3675     */
3676    LDKHTLCFailChannelUpdate_NodeFailure,
3677    /**
3678     * Must be last for serialization purposes
3679     */
3680    LDKHTLCFailChannelUpdate_Sentinel,
3681 } LDKHTLCFailChannelUpdate_Tag;
3682
3683 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
3684    /**
3685     * The unwrapped message we received
3686     */
3687    struct LDKChannelUpdate msg;
3688 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
3689
3690 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
3691    /**
3692     * The short_channel_id which has now closed.
3693     */
3694    uint64_t short_channel_id;
3695    /**
3696     * when this true, this channel should be permanently removed from the
3697     * consideration. Otherwise, this channel can be restored as new channel_update is received
3698     */
3699    bool is_permanent;
3700 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
3701
3702 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
3703    /**
3704     * The node_id that has failed.
3705     */
3706    struct LDKPublicKey node_id;
3707    /**
3708     * when this true, node should be permanently removed from the
3709     * consideration. Otherwise, the channels connected to this node can be
3710     * restored as new channel_update is received
3711     */
3712    bool is_permanent;
3713 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
3714
3715 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
3716    LDKHTLCFailChannelUpdate_Tag tag;
3717    union {
3718       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3719       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
3720       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
3721    };
3722 } LDKHTLCFailChannelUpdate;
3723
3724
3725
3726 /**
3727  * A query_channel_range message is used to query a peer for channel
3728  * UTXOs in a range of blocks. The recipient of a query makes a best
3729  * effort to reply to the query using one or more reply_channel_range
3730  * messages.
3731  */
3732 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3733    /**
3734     * A pointer to the opaque Rust object.
3735     * Nearly everywhere, inner must be non-null, however in places where
3736     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3737     */
3738    LDKnativeQueryChannelRange *inner;
3739    /**
3740     * Indicates that this is the only struct which contains the same pointer.
3741     * Rust functions which take ownership of an object provided via an argument require
3742     * this to be true and invalidate the object pointed to by inner.
3743     */
3744    bool is_owned;
3745 } LDKQueryChannelRange;
3746
3747
3748
3749 /**
3750  * A query_short_channel_ids message is used to query a peer for
3751  * routing gossip messages related to one or more short_channel_ids.
3752  * The query recipient will reply with the latest, if available,
3753  * channel_announcement, channel_update and node_announcement messages
3754  * it maintains for the requested short_channel_ids followed by a
3755  * reply_short_channel_ids_end message. The short_channel_ids sent in
3756  * this query are encoded. We only support encoding_type=0 uncompressed
3757  * serialization and do not support encoding_type=1 zlib serialization.
3758  */
3759 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3760    /**
3761     * A pointer to the opaque Rust object.
3762     * Nearly everywhere, inner must be non-null, however in places where
3763     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3764     */
3765    LDKnativeQueryShortChannelIds *inner;
3766    /**
3767     * Indicates that this is the only struct which contains the same pointer.
3768     * Rust functions which take ownership of an object provided via an argument require
3769     * this to be true and invalidate the object pointed to by inner.
3770     */
3771    bool is_owned;
3772 } LDKQueryShortChannelIds;
3773
3774
3775
3776 /**
3777  * A reply_channel_range message is a reply to a query_channel_range
3778  * message. Multiple reply_channel_range messages can be sent in reply
3779  * to a single query_channel_range message. The query recipient makes a
3780  * best effort to respond based on their local network view which may
3781  * not be a perfect view of the network. The short_channel_ids in the
3782  * reply are encoded. We only support encoding_type=0 uncompressed
3783  * serialization and do not support encoding_type=1 zlib serialization.
3784  */
3785 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3786    /**
3787     * A pointer to the opaque Rust object.
3788     * Nearly everywhere, inner must be non-null, however in places where
3789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3790     */
3791    LDKnativeReplyChannelRange *inner;
3792    /**
3793     * Indicates that this is the only struct which contains the same pointer.
3794     * Rust functions which take ownership of an object provided via an argument require
3795     * this to be true and invalidate the object pointed to by inner.
3796     */
3797    bool is_owned;
3798 } LDKReplyChannelRange;
3799
3800 /**
3801  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3802  * broadcast to most peers).
3803  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3804  */
3805 typedef enum LDKMessageSendEvent_Tag {
3806    /**
3807     * Used to indicate that we've accepted a channel open and should send the accept_channel
3808     * message provided to the given peer.
3809     */
3810    LDKMessageSendEvent_SendAcceptChannel,
3811    /**
3812     * Used to indicate that we've initiated a channel open and should send the open_channel
3813     * message provided to the given peer.
3814     */
3815    LDKMessageSendEvent_SendOpenChannel,
3816    /**
3817     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3818     */
3819    LDKMessageSendEvent_SendFundingCreated,
3820    /**
3821     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3822     */
3823    LDKMessageSendEvent_SendFundingSigned,
3824    /**
3825     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3826     */
3827    LDKMessageSendEvent_SendFundingLocked,
3828    /**
3829     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3830     */
3831    LDKMessageSendEvent_SendAnnouncementSignatures,
3832    /**
3833     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3834     * message should be sent to the peer with the given node_id.
3835     */
3836    LDKMessageSendEvent_UpdateHTLCs,
3837    /**
3838     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3839     */
3840    LDKMessageSendEvent_SendRevokeAndACK,
3841    /**
3842     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3843     */
3844    LDKMessageSendEvent_SendClosingSigned,
3845    /**
3846     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3847     */
3848    LDKMessageSendEvent_SendShutdown,
3849    /**
3850     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3851     */
3852    LDKMessageSendEvent_SendChannelReestablish,
3853    /**
3854     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3855     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3856     *
3857     * Note that after doing so, you very likely (unless you did so very recently) want to call
3858     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3859     * This ensures that any nodes which see our channel_announcement also have a relevant
3860     * node_announcement, including relevant feature flags which may be important for routing
3861     * through or to us.
3862     */
3863    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3864    /**
3865     * Used to indicate that a node_announcement should be broadcast to all peers.
3866     */
3867    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3868    /**
3869     * Used to indicate that a channel_update should be broadcast to all peers.
3870     */
3871    LDKMessageSendEvent_BroadcastChannelUpdate,
3872    /**
3873     * Broadcast an error downstream to be handled
3874     */
3875    LDKMessageSendEvent_HandleError,
3876    /**
3877     * When a payment fails we may receive updates back from the hop where it failed. In such
3878     * cases this event is generated so that we can inform the network graph of this information.
3879     */
3880    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3881    /**
3882     * Query a peer for channels with funding transaction UTXOs in a block range.
3883     */
3884    LDKMessageSendEvent_SendChannelRangeQuery,
3885    /**
3886     * Request routing gossip messages from a peer for a list of channels identified by
3887     * their short_channel_ids.
3888     */
3889    LDKMessageSendEvent_SendShortIdsQuery,
3890    /**
3891     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3892     * emitted during processing of the query.
3893     */
3894    LDKMessageSendEvent_SendReplyChannelRange,
3895    /**
3896     * Must be last for serialization purposes
3897     */
3898    LDKMessageSendEvent_Sentinel,
3899 } LDKMessageSendEvent_Tag;
3900
3901 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3902    /**
3903     * The node_id of the node which should receive this message
3904     */
3905    struct LDKPublicKey node_id;
3906    /**
3907     * The message which should be sent.
3908     */
3909    struct LDKAcceptChannel msg;
3910 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3911
3912 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3913    /**
3914     * The node_id of the node which should receive this message
3915     */
3916    struct LDKPublicKey node_id;
3917    /**
3918     * The message which should be sent.
3919     */
3920    struct LDKOpenChannel msg;
3921 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3922
3923 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3924    /**
3925     * The node_id of the node which should receive this message
3926     */
3927    struct LDKPublicKey node_id;
3928    /**
3929     * The message which should be sent.
3930     */
3931    struct LDKFundingCreated msg;
3932 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3933
3934 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3935    /**
3936     * The node_id of the node which should receive this message
3937     */
3938    struct LDKPublicKey node_id;
3939    /**
3940     * The message which should be sent.
3941     */
3942    struct LDKFundingSigned msg;
3943 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3944
3945 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3946    /**
3947     * The node_id of the node which should receive these message(s)
3948     */
3949    struct LDKPublicKey node_id;
3950    /**
3951     * The funding_locked message which should be sent.
3952     */
3953    struct LDKFundingLocked msg;
3954 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3955
3956 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3957    /**
3958     * The node_id of the node which should receive these message(s)
3959     */
3960    struct LDKPublicKey node_id;
3961    /**
3962     * The announcement_signatures message which should be sent.
3963     */
3964    struct LDKAnnouncementSignatures msg;
3965 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3966
3967 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3968    /**
3969     * The node_id of the node which should receive these message(s)
3970     */
3971    struct LDKPublicKey node_id;
3972    /**
3973     * The update messages which should be sent. ALL messages in the struct should be sent!
3974     */
3975    struct LDKCommitmentUpdate updates;
3976 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3977
3978 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3979    /**
3980     * The node_id of the node which should receive this message
3981     */
3982    struct LDKPublicKey node_id;
3983    /**
3984     * The message which should be sent.
3985     */
3986    struct LDKRevokeAndACK msg;
3987 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3988
3989 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3990    /**
3991     * The node_id of the node which should receive this message
3992     */
3993    struct LDKPublicKey node_id;
3994    /**
3995     * The message which should be sent.
3996     */
3997    struct LDKClosingSigned msg;
3998 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3999
4000 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4001    /**
4002     * The node_id of the node which should receive this message
4003     */
4004    struct LDKPublicKey node_id;
4005    /**
4006     * The message which should be sent.
4007     */
4008    struct LDKShutdown msg;
4009 } LDKMessageSendEvent_LDKSendShutdown_Body;
4010
4011 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4012    /**
4013     * The node_id of the node which should receive this message
4014     */
4015    struct LDKPublicKey node_id;
4016    /**
4017     * The message which should be sent.
4018     */
4019    struct LDKChannelReestablish msg;
4020 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4021
4022 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4023    /**
4024     * The channel_announcement which should be sent.
4025     */
4026    struct LDKChannelAnnouncement msg;
4027    /**
4028     * The followup channel_update which should be sent.
4029     */
4030    struct LDKChannelUpdate update_msg;
4031 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4032
4033 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4034    /**
4035     * The node_announcement which should be sent.
4036     */
4037    struct LDKNodeAnnouncement msg;
4038 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4039
4040 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4041    /**
4042     * The channel_update which should be sent.
4043     */
4044    struct LDKChannelUpdate msg;
4045 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4046
4047 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4048    /**
4049     * The node_id of the node which should receive this message
4050     */
4051    struct LDKPublicKey node_id;
4052    /**
4053     * The action which should be taken.
4054     */
4055    struct LDKErrorAction action;
4056 } LDKMessageSendEvent_LDKHandleError_Body;
4057
4058 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
4059    /**
4060     * The channel/node update which should be sent to NetGraphMsgHandler
4061     */
4062    struct LDKHTLCFailChannelUpdate update;
4063 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
4064
4065 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4066    /**
4067     * The node_id of this message recipient
4068     */
4069    struct LDKPublicKey node_id;
4070    /**
4071     * The query_channel_range which should be sent.
4072     */
4073    struct LDKQueryChannelRange msg;
4074 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4075
4076 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4077    /**
4078     * The node_id of this message recipient
4079     */
4080    struct LDKPublicKey node_id;
4081    /**
4082     * The query_short_channel_ids which should be sent.
4083     */
4084    struct LDKQueryShortChannelIds msg;
4085 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4086
4087 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4088    /**
4089     * The node_id of this message recipient
4090     */
4091    struct LDKPublicKey node_id;
4092    /**
4093     * The reply_channel_range which should be sent.
4094     */
4095    struct LDKReplyChannelRange msg;
4096 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4097
4098 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4099    LDKMessageSendEvent_Tag tag;
4100    union {
4101       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4102       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4103       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4104       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4105       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4106       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4107       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4108       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4109       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4110       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4111       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4112       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4113       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4114       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4115       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4116       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
4117       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4118       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4119       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4120    };
4121 } LDKMessageSendEvent;
4122
4123 /**
4124  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4125  * This corresponds to std::vector in C++
4126  */
4127 typedef struct LDKCVec_MessageSendEventZ {
4128    /**
4129     * The elements in the array.
4130     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4131     */
4132    struct LDKMessageSendEvent *data;
4133    /**
4134     * The number of elements pointed to by `data`.
4135     */
4136    uintptr_t datalen;
4137 } LDKCVec_MessageSendEventZ;
4138
4139 /**
4140  * The contents of CResult_boolLightningErrorZ
4141  */
4142 typedef union LDKCResult_boolLightningErrorZPtr {
4143    /**
4144     * A pointer to the contents in the success state.
4145     * Reading from this pointer when `result_ok` is not set is undefined.
4146     */
4147    bool *result;
4148    /**
4149     * A pointer to the contents in the error state.
4150     * Reading from this pointer when `result_ok` is set is undefined.
4151     */
4152    struct LDKLightningError *err;
4153 } LDKCResult_boolLightningErrorZPtr;
4154
4155 /**
4156  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4157  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4158  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4159  */
4160 typedef struct LDKCResult_boolLightningErrorZ {
4161    /**
4162     * The contents of this CResult_boolLightningErrorZ, accessible via either
4163     * `err` or `result` depending on the state of `result_ok`.
4164     */
4165    union LDKCResult_boolLightningErrorZPtr contents;
4166    /**
4167     * Whether this CResult_boolLightningErrorZ represents a success state.
4168     */
4169    bool result_ok;
4170 } LDKCResult_boolLightningErrorZ;
4171
4172 /**
4173  * A tuple of 3 elements. See the individual fields for the types contained.
4174  */
4175 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4176    /**
4177     * The element at position 0
4178     */
4179    struct LDKChannelAnnouncement a;
4180    /**
4181     * The element at position 1
4182     */
4183    struct LDKChannelUpdate b;
4184    /**
4185     * The element at position 2
4186     */
4187    struct LDKChannelUpdate c;
4188 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4189
4190 /**
4191  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4192  * This corresponds to std::vector in C++
4193  */
4194 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4195    /**
4196     * The elements in the array.
4197     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4198     */
4199    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4200    /**
4201     * The number of elements pointed to by `data`.
4202     */
4203    uintptr_t datalen;
4204 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
4205
4206 /**
4207  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4208  * This corresponds to std::vector in C++
4209  */
4210 typedef struct LDKCVec_NodeAnnouncementZ {
4211    /**
4212     * The elements in the array.
4213     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4214     */
4215    struct LDKNodeAnnouncement *data;
4216    /**
4217     * The number of elements pointed to by `data`.
4218     */
4219    uintptr_t datalen;
4220 } LDKCVec_NodeAnnouncementZ;
4221
4222 /**
4223  * The contents of CResult_NoneLightningErrorZ
4224  */
4225 typedef union LDKCResult_NoneLightningErrorZPtr {
4226    /**
4227     * Note that this value is always NULL, as there are no contents in the OK variant
4228     */
4229    void *result;
4230    /**
4231     * A pointer to the contents in the error state.
4232     * Reading from this pointer when `result_ok` is set is undefined.
4233     */
4234    struct LDKLightningError *err;
4235 } LDKCResult_NoneLightningErrorZPtr;
4236
4237 /**
4238  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4239  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4241  */
4242 typedef struct LDKCResult_NoneLightningErrorZ {
4243    /**
4244     * The contents of this CResult_NoneLightningErrorZ, accessible via either
4245     * `err` or `result` depending on the state of `result_ok`.
4246     */
4247    union LDKCResult_NoneLightningErrorZPtr contents;
4248    /**
4249     * Whether this CResult_NoneLightningErrorZ represents a success state.
4250     */
4251    bool result_ok;
4252 } LDKCResult_NoneLightningErrorZ;
4253
4254 /**
4255  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4256  * This corresponds to std::vector in C++
4257  */
4258 typedef struct LDKCVec_PublicKeyZ {
4259    /**
4260     * The elements in the array.
4261     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4262     */
4263    struct LDKPublicKey *data;
4264    /**
4265     * The number of elements pointed to by `data`.
4266     */
4267    uintptr_t datalen;
4268 } LDKCVec_PublicKeyZ;
4269
4270
4271
4272 /**
4273  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
4274  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
4275  * descriptor.
4276  */
4277 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
4278    /**
4279     * A pointer to the opaque Rust object.
4280     * Nearly everywhere, inner must be non-null, however in places where
4281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4282     */
4283    LDKnativePeerHandleError *inner;
4284    /**
4285     * Indicates that this is the only struct which contains the same pointer.
4286     * Rust functions which take ownership of an object provided via an argument require
4287     * this to be true and invalidate the object pointed to by inner.
4288     */
4289    bool is_owned;
4290 } LDKPeerHandleError;
4291
4292 /**
4293  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
4294  */
4295 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
4296    /**
4297     * A pointer to the contents in the success state.
4298     * Reading from this pointer when `result_ok` is not set is undefined.
4299     */
4300    struct LDKCVec_u8Z *result;
4301    /**
4302     * A pointer to the contents in the error state.
4303     * Reading from this pointer when `result_ok` is set is undefined.
4304     */
4305    struct LDKPeerHandleError *err;
4306 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
4307
4308 /**
4309  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4310  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4311  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4312  */
4313 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
4314    /**
4315     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4316     * `err` or `result` depending on the state of `result_ok`.
4317     */
4318    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
4319    /**
4320     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4321     */
4322    bool result_ok;
4323 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
4324
4325 /**
4326  * The contents of CResult_NonePeerHandleErrorZ
4327  */
4328 typedef union LDKCResult_NonePeerHandleErrorZPtr {
4329    /**
4330     * Note that this value is always NULL, as there are no contents in the OK variant
4331     */
4332    void *result;
4333    /**
4334     * A pointer to the contents in the error state.
4335     * Reading from this pointer when `result_ok` is set is undefined.
4336     */
4337    struct LDKPeerHandleError *err;
4338 } LDKCResult_NonePeerHandleErrorZPtr;
4339
4340 /**
4341  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4342  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4344  */
4345 typedef struct LDKCResult_NonePeerHandleErrorZ {
4346    /**
4347     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4348     * `err` or `result` depending on the state of `result_ok`.
4349     */
4350    union LDKCResult_NonePeerHandleErrorZPtr contents;
4351    /**
4352     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
4353     */
4354    bool result_ok;
4355 } LDKCResult_NonePeerHandleErrorZ;
4356
4357 /**
4358  * The contents of CResult_boolPeerHandleErrorZ
4359  */
4360 typedef union LDKCResult_boolPeerHandleErrorZPtr {
4361    /**
4362     * A pointer to the contents in the success state.
4363     * Reading from this pointer when `result_ok` is not set is undefined.
4364     */
4365    bool *result;
4366    /**
4367     * A pointer to the contents in the error state.
4368     * Reading from this pointer when `result_ok` is set is undefined.
4369     */
4370    struct LDKPeerHandleError *err;
4371 } LDKCResult_boolPeerHandleErrorZPtr;
4372
4373 /**
4374  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4375  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4376  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4377  */
4378 typedef struct LDKCResult_boolPeerHandleErrorZ {
4379    /**
4380     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4381     * `err` or `result` depending on the state of `result_ok`.
4382     */
4383    union LDKCResult_boolPeerHandleErrorZPtr contents;
4384    /**
4385     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
4386     */
4387    bool result_ok;
4388 } LDKCResult_boolPeerHandleErrorZ;
4389
4390 /**
4391  * The contents of CResult_TxOutAccessErrorZ
4392  */
4393 typedef union LDKCResult_TxOutAccessErrorZPtr {
4394    /**
4395     * A pointer to the contents in the success state.
4396     * Reading from this pointer when `result_ok` is not set is undefined.
4397     */
4398    struct LDKTxOut *result;
4399    /**
4400     * A pointer to the contents in the error state.
4401     * Reading from this pointer when `result_ok` is set is undefined.
4402     */
4403    enum LDKAccessError *err;
4404 } LDKCResult_TxOutAccessErrorZPtr;
4405
4406 /**
4407  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4408  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4409  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410  */
4411 typedef struct LDKCResult_TxOutAccessErrorZ {
4412    /**
4413     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4414     * `err` or `result` depending on the state of `result_ok`.
4415     */
4416    union LDKCResult_TxOutAccessErrorZPtr contents;
4417    /**
4418     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4419     */
4420    bool result_ok;
4421 } LDKCResult_TxOutAccessErrorZ;
4422
4423 /**
4424  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4425  */
4426 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4427    /**
4428     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4429     */
4430    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4431    /**
4432     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4433     */
4434    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4435    /**
4436     * Must be last for serialization purposes
4437     */
4438    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4439 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4440
4441 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4442    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4443    union {
4444       struct {
4445          struct LDKC2Tuple_usizeTransactionZ some;
4446       };
4447    };
4448 } LDKCOption_C2Tuple_usizeTransactionZZ;
4449
4450
4451
4452 /**
4453  * Details about one direction of a channel. Received
4454  * within a channel update.
4455  */
4456 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
4457    /**
4458     * A pointer to the opaque Rust object.
4459     * Nearly everywhere, inner must be non-null, however in places where
4460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4461     */
4462    LDKnativeDirectionalChannelInfo *inner;
4463    /**
4464     * Indicates that this is the only struct which contains the same pointer.
4465     * Rust functions which take ownership of an object provided via an argument require
4466     * this to be true and invalidate the object pointed to by inner.
4467     */
4468    bool is_owned;
4469 } LDKDirectionalChannelInfo;
4470
4471 /**
4472  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4473  */
4474 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
4475    /**
4476     * A pointer to the contents in the success state.
4477     * Reading from this pointer when `result_ok` is not set is undefined.
4478     */
4479    struct LDKDirectionalChannelInfo *result;
4480    /**
4481     * A pointer to the contents in the error state.
4482     * Reading from this pointer when `result_ok` is set is undefined.
4483     */
4484    struct LDKDecodeError *err;
4485 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
4486
4487 /**
4488  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4489  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4491  */
4492 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
4493    /**
4494     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4495     * `err` or `result` depending on the state of `result_ok`.
4496     */
4497    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
4498    /**
4499     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4500     */
4501    bool result_ok;
4502 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
4503
4504
4505
4506 /**
4507  * Details about a channel (both directions).
4508  * Received within a channel announcement.
4509  */
4510 typedef struct MUST_USE_STRUCT LDKChannelInfo {
4511    /**
4512     * A pointer to the opaque Rust object.
4513     * Nearly everywhere, inner must be non-null, however in places where
4514     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4515     */
4516    LDKnativeChannelInfo *inner;
4517    /**
4518     * Indicates that this is the only struct which contains the same pointer.
4519     * Rust functions which take ownership of an object provided via an argument require
4520     * this to be true and invalidate the object pointed to by inner.
4521     */
4522    bool is_owned;
4523 } LDKChannelInfo;
4524
4525 /**
4526  * The contents of CResult_ChannelInfoDecodeErrorZ
4527  */
4528 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
4529    /**
4530     * A pointer to the contents in the success state.
4531     * Reading from this pointer when `result_ok` is not set is undefined.
4532     */
4533    struct LDKChannelInfo *result;
4534    /**
4535     * A pointer to the contents in the error state.
4536     * Reading from this pointer when `result_ok` is set is undefined.
4537     */
4538    struct LDKDecodeError *err;
4539 } LDKCResult_ChannelInfoDecodeErrorZPtr;
4540
4541 /**
4542  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4543  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4544  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4545  */
4546 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
4547    /**
4548     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4549     * `err` or `result` depending on the state of `result_ok`.
4550     */
4551    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
4552    /**
4553     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4554     */
4555    bool result_ok;
4556 } LDKCResult_ChannelInfoDecodeErrorZ;
4557
4558
4559
4560 /**
4561  * Fees for routing via a given channel or a node
4562  */
4563 typedef struct MUST_USE_STRUCT LDKRoutingFees {
4564    /**
4565     * A pointer to the opaque Rust object.
4566     * Nearly everywhere, inner must be non-null, however in places where
4567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4568     */
4569    LDKnativeRoutingFees *inner;
4570    /**
4571     * Indicates that this is the only struct which contains the same pointer.
4572     * Rust functions which take ownership of an object provided via an argument require
4573     * this to be true and invalidate the object pointed to by inner.
4574     */
4575    bool is_owned;
4576 } LDKRoutingFees;
4577
4578 /**
4579  * The contents of CResult_RoutingFeesDecodeErrorZ
4580  */
4581 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
4582    /**
4583     * A pointer to the contents in the success state.
4584     * Reading from this pointer when `result_ok` is not set is undefined.
4585     */
4586    struct LDKRoutingFees *result;
4587    /**
4588     * A pointer to the contents in the error state.
4589     * Reading from this pointer when `result_ok` is set is undefined.
4590     */
4591    struct LDKDecodeError *err;
4592 } LDKCResult_RoutingFeesDecodeErrorZPtr;
4593
4594 /**
4595  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4596  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4598  */
4599 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
4600    /**
4601     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4602     * `err` or `result` depending on the state of `result_ok`.
4603     */
4604    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
4605    /**
4606     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4607     */
4608    bool result_ok;
4609 } LDKCResult_RoutingFeesDecodeErrorZ;
4610
4611 /**
4612  * A 4-byte byte array.
4613  */
4614 typedef struct LDKFourBytes {
4615    /**
4616     * The four bytes
4617     */
4618    uint8_t data[4];
4619 } LDKFourBytes;
4620
4621 /**
4622  * A 16-byte byte array.
4623  */
4624 typedef struct LDKSixteenBytes {
4625    /**
4626     * The sixteen bytes
4627     */
4628    uint8_t data[16];
4629 } LDKSixteenBytes;
4630
4631 /**
4632  * A 10-byte byte array.
4633  */
4634 typedef struct LDKTenBytes {
4635    /**
4636     * The ten bytes
4637     */
4638    uint8_t data[10];
4639 } LDKTenBytes;
4640
4641 /**
4642  * An address which can be used to connect to a remote peer
4643  */
4644 typedef enum LDKNetAddress_Tag {
4645    /**
4646     * An IPv4 address/port on which the peer is listening.
4647     */
4648    LDKNetAddress_IPv4,
4649    /**
4650     * An IPv6 address/port on which the peer is listening.
4651     */
4652    LDKNetAddress_IPv6,
4653    /**
4654     * An old-style Tor onion address/port on which the peer is listening.
4655     */
4656    LDKNetAddress_OnionV2,
4657    /**
4658     * A new-style Tor onion address/port on which the peer is listening.
4659     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4660     * wrap as base32 and append \".onion\".
4661     */
4662    LDKNetAddress_OnionV3,
4663    /**
4664     * Must be last for serialization purposes
4665     */
4666    LDKNetAddress_Sentinel,
4667 } LDKNetAddress_Tag;
4668
4669 typedef struct LDKNetAddress_LDKIPv4_Body {
4670    /**
4671     * The 4-byte IPv4 address
4672     */
4673    struct LDKFourBytes addr;
4674    /**
4675     * The port on which the node is listening
4676     */
4677    uint16_t port;
4678 } LDKNetAddress_LDKIPv4_Body;
4679
4680 typedef struct LDKNetAddress_LDKIPv6_Body {
4681    /**
4682     * The 16-byte IPv6 address
4683     */
4684    struct LDKSixteenBytes addr;
4685    /**
4686     * The port on which the node is listening
4687     */
4688    uint16_t port;
4689 } LDKNetAddress_LDKIPv6_Body;
4690
4691 typedef struct LDKNetAddress_LDKOnionV2_Body {
4692    /**
4693     * The bytes (usually encoded in base32 with \".onion\" appended)
4694     */
4695    struct LDKTenBytes addr;
4696    /**
4697     * The port on which the node is listening
4698     */
4699    uint16_t port;
4700 } LDKNetAddress_LDKOnionV2_Body;
4701
4702 typedef struct LDKNetAddress_LDKOnionV3_Body {
4703    /**
4704     * The ed25519 long-term public key of the peer
4705     */
4706    struct LDKThirtyTwoBytes ed25519_pubkey;
4707    /**
4708     * The checksum of the pubkey and version, as included in the onion address
4709     */
4710    uint16_t checksum;
4711    /**
4712     * The version byte, as defined by the Tor Onion v3 spec.
4713     */
4714    uint8_t version;
4715    /**
4716     * The port on which the node is listening
4717     */
4718    uint16_t port;
4719 } LDKNetAddress_LDKOnionV3_Body;
4720
4721 typedef struct MUST_USE_STRUCT LDKNetAddress {
4722    LDKNetAddress_Tag tag;
4723    union {
4724       LDKNetAddress_LDKIPv4_Body i_pv4;
4725       LDKNetAddress_LDKIPv6_Body i_pv6;
4726       LDKNetAddress_LDKOnionV2_Body onion_v2;
4727       LDKNetAddress_LDKOnionV3_Body onion_v3;
4728    };
4729 } LDKNetAddress;
4730
4731 /**
4732  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4733  * This corresponds to std::vector in C++
4734  */
4735 typedef struct LDKCVec_NetAddressZ {
4736    /**
4737     * The elements in the array.
4738     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4739     */
4740    struct LDKNetAddress *data;
4741    /**
4742     * The number of elements pointed to by `data`.
4743     */
4744    uintptr_t datalen;
4745 } LDKCVec_NetAddressZ;
4746
4747
4748
4749 /**
4750  * Information received in the latest node_announcement from this node.
4751  */
4752 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4753    /**
4754     * A pointer to the opaque Rust object.
4755     * Nearly everywhere, inner must be non-null, however in places where
4756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4757     */
4758    LDKnativeNodeAnnouncementInfo *inner;
4759    /**
4760     * Indicates that this is the only struct which contains the same pointer.
4761     * Rust functions which take ownership of an object provided via an argument require
4762     * this to be true and invalidate the object pointed to by inner.
4763     */
4764    bool is_owned;
4765 } LDKNodeAnnouncementInfo;
4766
4767 /**
4768  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4769  */
4770 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4771    /**
4772     * A pointer to the contents in the success state.
4773     * Reading from this pointer when `result_ok` is not set is undefined.
4774     */
4775    struct LDKNodeAnnouncementInfo *result;
4776    /**
4777     * A pointer to the contents in the error state.
4778     * Reading from this pointer when `result_ok` is set is undefined.
4779     */
4780    struct LDKDecodeError *err;
4781 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4782
4783 /**
4784  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4785  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4787  */
4788 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4789    /**
4790     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4791     * `err` or `result` depending on the state of `result_ok`.
4792     */
4793    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4794    /**
4795     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4796     */
4797    bool result_ok;
4798 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4799
4800 /**
4801  * A dynamically-allocated array of u64s of arbitrary size.
4802  * This corresponds to std::vector in C++
4803  */
4804 typedef struct LDKCVec_u64Z {
4805    /**
4806     * The elements in the array.
4807     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4808     */
4809    uint64_t *data;
4810    /**
4811     * The number of elements pointed to by `data`.
4812     */
4813    uintptr_t datalen;
4814 } LDKCVec_u64Z;
4815
4816
4817
4818 /**
4819  * Details about a node in the network, known from the network announcement.
4820  */
4821 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4822    /**
4823     * A pointer to the opaque Rust object.
4824     * Nearly everywhere, inner must be non-null, however in places where
4825     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4826     */
4827    LDKnativeNodeInfo *inner;
4828    /**
4829     * Indicates that this is the only struct which contains the same pointer.
4830     * Rust functions which take ownership of an object provided via an argument require
4831     * this to be true and invalidate the object pointed to by inner.
4832     */
4833    bool is_owned;
4834 } LDKNodeInfo;
4835
4836 /**
4837  * The contents of CResult_NodeInfoDecodeErrorZ
4838  */
4839 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4840    /**
4841     * A pointer to the contents in the success state.
4842     * Reading from this pointer when `result_ok` is not set is undefined.
4843     */
4844    struct LDKNodeInfo *result;
4845    /**
4846     * A pointer to the contents in the error state.
4847     * Reading from this pointer when `result_ok` is set is undefined.
4848     */
4849    struct LDKDecodeError *err;
4850 } LDKCResult_NodeInfoDecodeErrorZPtr;
4851
4852 /**
4853  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4854  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4856  */
4857 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4858    /**
4859     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4860     * `err` or `result` depending on the state of `result_ok`.
4861     */
4862    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4863    /**
4864     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4865     */
4866    bool result_ok;
4867 } LDKCResult_NodeInfoDecodeErrorZ;
4868
4869
4870
4871 /**
4872  * Represents the network as nodes and channels between them
4873  */
4874 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4875    /**
4876     * A pointer to the opaque Rust object.
4877     * Nearly everywhere, inner must be non-null, however in places where
4878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4879     */
4880    LDKnativeNetworkGraph *inner;
4881    /**
4882     * Indicates that this is the only struct which contains the same pointer.
4883     * Rust functions which take ownership of an object provided via an argument require
4884     * this to be true and invalidate the object pointed to by inner.
4885     */
4886    bool is_owned;
4887 } LDKNetworkGraph;
4888
4889 /**
4890  * The contents of CResult_NetworkGraphDecodeErrorZ
4891  */
4892 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4893    /**
4894     * A pointer to the contents in the success state.
4895     * Reading from this pointer when `result_ok` is not set is undefined.
4896     */
4897    struct LDKNetworkGraph *result;
4898    /**
4899     * A pointer to the contents in the error state.
4900     * Reading from this pointer when `result_ok` is set is undefined.
4901     */
4902    struct LDKDecodeError *err;
4903 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4904
4905 /**
4906  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4907  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4909  */
4910 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4911    /**
4912     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4913     * `err` or `result` depending on the state of `result_ok`.
4914     */
4915    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4916    /**
4917     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4918     */
4919    bool result_ok;
4920 } LDKCResult_NetworkGraphDecodeErrorZ;
4921
4922
4923
4924 /**
4925  * Features used within an `init` message.
4926  */
4927 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4928    /**
4929     * A pointer to the opaque Rust object.
4930     * Nearly everywhere, inner must be non-null, however in places where
4931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4932     */
4933    LDKnativeInitFeatures *inner;
4934    /**
4935     * Indicates that this is the only struct which contains the same pointer.
4936     * Rust functions which take ownership of an object provided via an argument require
4937     * this to be true and invalidate the object pointed to by inner.
4938     */
4939    bool is_owned;
4940 } LDKInitFeatures;
4941
4942 /**
4943  * The contents of CResult_InitFeaturesDecodeErrorZ
4944  */
4945 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4946    /**
4947     * A pointer to the contents in the success state.
4948     * Reading from this pointer when `result_ok` is not set is undefined.
4949     */
4950    struct LDKInitFeatures *result;
4951    /**
4952     * A pointer to the contents in the error state.
4953     * Reading from this pointer when `result_ok` is set is undefined.
4954     */
4955    struct LDKDecodeError *err;
4956 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4957
4958 /**
4959  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4960  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4962  */
4963 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4964    /**
4965     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4966     * `err` or `result` depending on the state of `result_ok`.
4967     */
4968    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4969    /**
4970     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4971     */
4972    bool result_ok;
4973 } LDKCResult_InitFeaturesDecodeErrorZ;
4974
4975
4976
4977 /**
4978  * Features used within a `node_announcement` message.
4979  */
4980 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4981    /**
4982     * A pointer to the opaque Rust object.
4983     * Nearly everywhere, inner must be non-null, however in places where
4984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4985     */
4986    LDKnativeNodeFeatures *inner;
4987    /**
4988     * Indicates that this is the only struct which contains the same pointer.
4989     * Rust functions which take ownership of an object provided via an argument require
4990     * this to be true and invalidate the object pointed to by inner.
4991     */
4992    bool is_owned;
4993 } LDKNodeFeatures;
4994
4995 /**
4996  * The contents of CResult_NodeFeaturesDecodeErrorZ
4997  */
4998 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4999    /**
5000     * A pointer to the contents in the success state.
5001     * Reading from this pointer when `result_ok` is not set is undefined.
5002     */
5003    struct LDKNodeFeatures *result;
5004    /**
5005     * A pointer to the contents in the error state.
5006     * Reading from this pointer when `result_ok` is set is undefined.
5007     */
5008    struct LDKDecodeError *err;
5009 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5010
5011 /**
5012  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5013  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5014  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5015  */
5016 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5017    /**
5018     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5019     * `err` or `result` depending on the state of `result_ok`.
5020     */
5021    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5022    /**
5023     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5024     */
5025    bool result_ok;
5026 } LDKCResult_NodeFeaturesDecodeErrorZ;
5027
5028
5029
5030 /**
5031  * Features used within a `channel_announcement` message.
5032  */
5033 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5034    /**
5035     * A pointer to the opaque Rust object.
5036     * Nearly everywhere, inner must be non-null, however in places where
5037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5038     */
5039    LDKnativeChannelFeatures *inner;
5040    /**
5041     * Indicates that this is the only struct which contains the same pointer.
5042     * Rust functions which take ownership of an object provided via an argument require
5043     * this to be true and invalidate the object pointed to by inner.
5044     */
5045    bool is_owned;
5046 } LDKChannelFeatures;
5047
5048 /**
5049  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5050  */
5051 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5052    /**
5053     * A pointer to the contents in the success state.
5054     * Reading from this pointer when `result_ok` is not set is undefined.
5055     */
5056    struct LDKChannelFeatures *result;
5057    /**
5058     * A pointer to the contents in the error state.
5059     * Reading from this pointer when `result_ok` is set is undefined.
5060     */
5061    struct LDKDecodeError *err;
5062 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5063
5064 /**
5065  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5066  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5068  */
5069 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5070    /**
5071     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5072     * `err` or `result` depending on the state of `result_ok`.
5073     */
5074    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5075    /**
5076     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5077     */
5078    bool result_ok;
5079 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5080
5081
5082
5083 /**
5084  * Features used within an invoice.
5085  */
5086 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5087    /**
5088     * A pointer to the opaque Rust object.
5089     * Nearly everywhere, inner must be non-null, however in places where
5090     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5091     */
5092    LDKnativeInvoiceFeatures *inner;
5093    /**
5094     * Indicates that this is the only struct which contains the same pointer.
5095     * Rust functions which take ownership of an object provided via an argument require
5096     * this to be true and invalidate the object pointed to by inner.
5097     */
5098    bool is_owned;
5099 } LDKInvoiceFeatures;
5100
5101 /**
5102  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5103  */
5104 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5105    /**
5106     * A pointer to the contents in the success state.
5107     * Reading from this pointer when `result_ok` is not set is undefined.
5108     */
5109    struct LDKInvoiceFeatures *result;
5110    /**
5111     * A pointer to the contents in the error state.
5112     * Reading from this pointer when `result_ok` is set is undefined.
5113     */
5114    struct LDKDecodeError *err;
5115 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5116
5117 /**
5118  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5119  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121  */
5122 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5123    /**
5124     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5125     * `err` or `result` depending on the state of `result_ok`.
5126     */
5127    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5128    /**
5129     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5130     */
5131    bool result_ok;
5132 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5133
5134 /**
5135  * The contents of CResult_NetAddressu8Z
5136  */
5137 typedef union LDKCResult_NetAddressu8ZPtr {
5138    /**
5139     * A pointer to the contents in the success state.
5140     * Reading from this pointer when `result_ok` is not set is undefined.
5141     */
5142    struct LDKNetAddress *result;
5143    /**
5144     * A pointer to the contents in the error state.
5145     * Reading from this pointer when `result_ok` is set is undefined.
5146     */
5147    uint8_t *err;
5148 } LDKCResult_NetAddressu8ZPtr;
5149
5150 /**
5151  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5152  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5154  */
5155 typedef struct LDKCResult_NetAddressu8Z {
5156    /**
5157     * The contents of this CResult_NetAddressu8Z, accessible via either
5158     * `err` or `result` depending on the state of `result_ok`.
5159     */
5160    union LDKCResult_NetAddressu8ZPtr contents;
5161    /**
5162     * Whether this CResult_NetAddressu8Z represents a success state.
5163     */
5164    bool result_ok;
5165 } LDKCResult_NetAddressu8Z;
5166
5167 /**
5168  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5169  */
5170 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5171    /**
5172     * A pointer to the contents in the success state.
5173     * Reading from this pointer when `result_ok` is not set is undefined.
5174     */
5175    struct LDKCResult_NetAddressu8Z *result;
5176    /**
5177     * A pointer to the contents in the error state.
5178     * Reading from this pointer when `result_ok` is set is undefined.
5179     */
5180    struct LDKDecodeError *err;
5181 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5182
5183 /**
5184  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5185  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5187  */
5188 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5189    /**
5190     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5191     * `err` or `result` depending on the state of `result_ok`.
5192     */
5193    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5194    /**
5195     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5196     */
5197    bool result_ok;
5198 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5199
5200
5201
5202 /**
5203  * An update_add_htlc message to be sent or received from a peer
5204  */
5205 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
5206    /**
5207     * A pointer to the opaque Rust object.
5208     * Nearly everywhere, inner must be non-null, however in places where
5209     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5210     */
5211    LDKnativeUpdateAddHTLC *inner;
5212    /**
5213     * Indicates that this is the only struct which contains the same pointer.
5214     * Rust functions which take ownership of an object provided via an argument require
5215     * this to be true and invalidate the object pointed to by inner.
5216     */
5217    bool is_owned;
5218 } LDKUpdateAddHTLC;
5219
5220 /**
5221  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5222  * This corresponds to std::vector in C++
5223  */
5224 typedef struct LDKCVec_UpdateAddHTLCZ {
5225    /**
5226     * The elements in the array.
5227     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5228     */
5229    struct LDKUpdateAddHTLC *data;
5230    /**
5231     * The number of elements pointed to by `data`.
5232     */
5233    uintptr_t datalen;
5234 } LDKCVec_UpdateAddHTLCZ;
5235
5236
5237
5238 /**
5239  * An update_fulfill_htlc message to be sent or received from a peer
5240  */
5241 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5242    /**
5243     * A pointer to the opaque Rust object.
5244     * Nearly everywhere, inner must be non-null, however in places where
5245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5246     */
5247    LDKnativeUpdateFulfillHTLC *inner;
5248    /**
5249     * Indicates that this is the only struct which contains the same pointer.
5250     * Rust functions which take ownership of an object provided via an argument require
5251     * this to be true and invalidate the object pointed to by inner.
5252     */
5253    bool is_owned;
5254 } LDKUpdateFulfillHTLC;
5255
5256 /**
5257  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5258  * This corresponds to std::vector in C++
5259  */
5260 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5261    /**
5262     * The elements in the array.
5263     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5264     */
5265    struct LDKUpdateFulfillHTLC *data;
5266    /**
5267     * The number of elements pointed to by `data`.
5268     */
5269    uintptr_t datalen;
5270 } LDKCVec_UpdateFulfillHTLCZ;
5271
5272
5273
5274 /**
5275  * An update_fail_htlc message to be sent or received from a peer
5276  */
5277 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5278    /**
5279     * A pointer to the opaque Rust object.
5280     * Nearly everywhere, inner must be non-null, however in places where
5281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5282     */
5283    LDKnativeUpdateFailHTLC *inner;
5284    /**
5285     * Indicates that this is the only struct which contains the same pointer.
5286     * Rust functions which take ownership of an object provided via an argument require
5287     * this to be true and invalidate the object pointed to by inner.
5288     */
5289    bool is_owned;
5290 } LDKUpdateFailHTLC;
5291
5292 /**
5293  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5294  * This corresponds to std::vector in C++
5295  */
5296 typedef struct LDKCVec_UpdateFailHTLCZ {
5297    /**
5298     * The elements in the array.
5299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5300     */
5301    struct LDKUpdateFailHTLC *data;
5302    /**
5303     * The number of elements pointed to by `data`.
5304     */
5305    uintptr_t datalen;
5306 } LDKCVec_UpdateFailHTLCZ;
5307
5308
5309
5310 /**
5311  * An update_fail_malformed_htlc message to be sent or received from a peer
5312  */
5313 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5314    /**
5315     * A pointer to the opaque Rust object.
5316     * Nearly everywhere, inner must be non-null, however in places where
5317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5318     */
5319    LDKnativeUpdateFailMalformedHTLC *inner;
5320    /**
5321     * Indicates that this is the only struct which contains the same pointer.
5322     * Rust functions which take ownership of an object provided via an argument require
5323     * this to be true and invalidate the object pointed to by inner.
5324     */
5325    bool is_owned;
5326 } LDKUpdateFailMalformedHTLC;
5327
5328 /**
5329  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5330  * This corresponds to std::vector in C++
5331  */
5332 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5333    /**
5334     * The elements in the array.
5335     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5336     */
5337    struct LDKUpdateFailMalformedHTLC *data;
5338    /**
5339     * The number of elements pointed to by `data`.
5340     */
5341    uintptr_t datalen;
5342 } LDKCVec_UpdateFailMalformedHTLCZ;
5343
5344 /**
5345  * The contents of CResult_AcceptChannelDecodeErrorZ
5346  */
5347 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5348    /**
5349     * A pointer to the contents in the success state.
5350     * Reading from this pointer when `result_ok` is not set is undefined.
5351     */
5352    struct LDKAcceptChannel *result;
5353    /**
5354     * A pointer to the contents in the error state.
5355     * Reading from this pointer when `result_ok` is set is undefined.
5356     */
5357    struct LDKDecodeError *err;
5358 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5359
5360 /**
5361  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5362  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5364  */
5365 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5366    /**
5367     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5368     * `err` or `result` depending on the state of `result_ok`.
5369     */
5370    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5371    /**
5372     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5373     */
5374    bool result_ok;
5375 } LDKCResult_AcceptChannelDecodeErrorZ;
5376
5377 /**
5378  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5379  */
5380 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
5381    /**
5382     * A pointer to the contents in the success state.
5383     * Reading from this pointer when `result_ok` is not set is undefined.
5384     */
5385    struct LDKAnnouncementSignatures *result;
5386    /**
5387     * A pointer to the contents in the error state.
5388     * Reading from this pointer when `result_ok` is set is undefined.
5389     */
5390    struct LDKDecodeError *err;
5391 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
5392
5393 /**
5394  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5395  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5397  */
5398 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
5399    /**
5400     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5401     * `err` or `result` depending on the state of `result_ok`.
5402     */
5403    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5404    /**
5405     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5406     */
5407    bool result_ok;
5408 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5409
5410 /**
5411  * The contents of CResult_ChannelReestablishDecodeErrorZ
5412  */
5413 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
5414    /**
5415     * A pointer to the contents in the success state.
5416     * Reading from this pointer when `result_ok` is not set is undefined.
5417     */
5418    struct LDKChannelReestablish *result;
5419    /**
5420     * A pointer to the contents in the error state.
5421     * Reading from this pointer when `result_ok` is set is undefined.
5422     */
5423    struct LDKDecodeError *err;
5424 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
5425
5426 /**
5427  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5428  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5429  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5430  */
5431 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
5432    /**
5433     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5434     * `err` or `result` depending on the state of `result_ok`.
5435     */
5436    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5437    /**
5438     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5439     */
5440    bool result_ok;
5441 } LDKCResult_ChannelReestablishDecodeErrorZ;
5442
5443 /**
5444  * The contents of CResult_ClosingSignedDecodeErrorZ
5445  */
5446 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
5447    /**
5448     * A pointer to the contents in the success state.
5449     * Reading from this pointer when `result_ok` is not set is undefined.
5450     */
5451    struct LDKClosingSigned *result;
5452    /**
5453     * A pointer to the contents in the error state.
5454     * Reading from this pointer when `result_ok` is set is undefined.
5455     */
5456    struct LDKDecodeError *err;
5457 } LDKCResult_ClosingSignedDecodeErrorZPtr;
5458
5459 /**
5460  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5461  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5462  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5463  */
5464 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
5465    /**
5466     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5467     * `err` or `result` depending on the state of `result_ok`.
5468     */
5469    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5470    /**
5471     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5472     */
5473    bool result_ok;
5474 } LDKCResult_ClosingSignedDecodeErrorZ;
5475
5476
5477
5478 /**
5479  * A commitment_signed message to be sent or received from a peer
5480  */
5481 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5482    /**
5483     * A pointer to the opaque Rust object.
5484     * Nearly everywhere, inner must be non-null, however in places where
5485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5486     */
5487    LDKnativeCommitmentSigned *inner;
5488    /**
5489     * Indicates that this is the only struct which contains the same pointer.
5490     * Rust functions which take ownership of an object provided via an argument require
5491     * this to be true and invalidate the object pointed to by inner.
5492     */
5493    bool is_owned;
5494 } LDKCommitmentSigned;
5495
5496 /**
5497  * The contents of CResult_CommitmentSignedDecodeErrorZ
5498  */
5499 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
5500    /**
5501     * A pointer to the contents in the success state.
5502     * Reading from this pointer when `result_ok` is not set is undefined.
5503     */
5504    struct LDKCommitmentSigned *result;
5505    /**
5506     * A pointer to the contents in the error state.
5507     * Reading from this pointer when `result_ok` is set is undefined.
5508     */
5509    struct LDKDecodeError *err;
5510 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
5511
5512 /**
5513  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5514  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5515  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5516  */
5517 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
5518    /**
5519     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5520     * `err` or `result` depending on the state of `result_ok`.
5521     */
5522    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5523    /**
5524     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5525     */
5526    bool result_ok;
5527 } LDKCResult_CommitmentSignedDecodeErrorZ;
5528
5529 /**
5530  * The contents of CResult_FundingCreatedDecodeErrorZ
5531  */
5532 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
5533    /**
5534     * A pointer to the contents in the success state.
5535     * Reading from this pointer when `result_ok` is not set is undefined.
5536     */
5537    struct LDKFundingCreated *result;
5538    /**
5539     * A pointer to the contents in the error state.
5540     * Reading from this pointer when `result_ok` is set is undefined.
5541     */
5542    struct LDKDecodeError *err;
5543 } LDKCResult_FundingCreatedDecodeErrorZPtr;
5544
5545 /**
5546  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5547  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5549  */
5550 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
5551    /**
5552     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5553     * `err` or `result` depending on the state of `result_ok`.
5554     */
5555    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5556    /**
5557     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5558     */
5559    bool result_ok;
5560 } LDKCResult_FundingCreatedDecodeErrorZ;
5561
5562 /**
5563  * The contents of CResult_FundingSignedDecodeErrorZ
5564  */
5565 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
5566    /**
5567     * A pointer to the contents in the success state.
5568     * Reading from this pointer when `result_ok` is not set is undefined.
5569     */
5570    struct LDKFundingSigned *result;
5571    /**
5572     * A pointer to the contents in the error state.
5573     * Reading from this pointer when `result_ok` is set is undefined.
5574     */
5575    struct LDKDecodeError *err;
5576 } LDKCResult_FundingSignedDecodeErrorZPtr;
5577
5578 /**
5579  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5580  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5582  */
5583 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
5584    /**
5585     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5586     * `err` or `result` depending on the state of `result_ok`.
5587     */
5588    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5589    /**
5590     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5591     */
5592    bool result_ok;
5593 } LDKCResult_FundingSignedDecodeErrorZ;
5594
5595 /**
5596  * The contents of CResult_FundingLockedDecodeErrorZ
5597  */
5598 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
5599    /**
5600     * A pointer to the contents in the success state.
5601     * Reading from this pointer when `result_ok` is not set is undefined.
5602     */
5603    struct LDKFundingLocked *result;
5604    /**
5605     * A pointer to the contents in the error state.
5606     * Reading from this pointer when `result_ok` is set is undefined.
5607     */
5608    struct LDKDecodeError *err;
5609 } LDKCResult_FundingLockedDecodeErrorZPtr;
5610
5611 /**
5612  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5613  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5615  */
5616 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
5617    /**
5618     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5619     * `err` or `result` depending on the state of `result_ok`.
5620     */
5621    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5622    /**
5623     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5624     */
5625    bool result_ok;
5626 } LDKCResult_FundingLockedDecodeErrorZ;
5627
5628
5629
5630 /**
5631  * An init message to be sent or received from a peer
5632  */
5633 typedef struct MUST_USE_STRUCT LDKInit {
5634    /**
5635     * A pointer to the opaque Rust object.
5636     * Nearly everywhere, inner must be non-null, however in places where
5637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5638     */
5639    LDKnativeInit *inner;
5640    /**
5641     * Indicates that this is the only struct which contains the same pointer.
5642     * Rust functions which take ownership of an object provided via an argument require
5643     * this to be true and invalidate the object pointed to by inner.
5644     */
5645    bool is_owned;
5646 } LDKInit;
5647
5648 /**
5649  * The contents of CResult_InitDecodeErrorZ
5650  */
5651 typedef union LDKCResult_InitDecodeErrorZPtr {
5652    /**
5653     * A pointer to the contents in the success state.
5654     * Reading from this pointer when `result_ok` is not set is undefined.
5655     */
5656    struct LDKInit *result;
5657    /**
5658     * A pointer to the contents in the error state.
5659     * Reading from this pointer when `result_ok` is set is undefined.
5660     */
5661    struct LDKDecodeError *err;
5662 } LDKCResult_InitDecodeErrorZPtr;
5663
5664 /**
5665  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5666  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5667  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5668  */
5669 typedef struct LDKCResult_InitDecodeErrorZ {
5670    /**
5671     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5672     * `err` or `result` depending on the state of `result_ok`.
5673     */
5674    union LDKCResult_InitDecodeErrorZPtr contents;
5675    /**
5676     * Whether this CResult_InitDecodeErrorZ represents a success state.
5677     */
5678    bool result_ok;
5679 } LDKCResult_InitDecodeErrorZ;
5680
5681 /**
5682  * The contents of CResult_OpenChannelDecodeErrorZ
5683  */
5684 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
5685    /**
5686     * A pointer to the contents in the success state.
5687     * Reading from this pointer when `result_ok` is not set is undefined.
5688     */
5689    struct LDKOpenChannel *result;
5690    /**
5691     * A pointer to the contents in the error state.
5692     * Reading from this pointer when `result_ok` is set is undefined.
5693     */
5694    struct LDKDecodeError *err;
5695 } LDKCResult_OpenChannelDecodeErrorZPtr;
5696
5697 /**
5698  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5699  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5700  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5701  */
5702 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
5703    /**
5704     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5705     * `err` or `result` depending on the state of `result_ok`.
5706     */
5707    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5708    /**
5709     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5710     */
5711    bool result_ok;
5712 } LDKCResult_OpenChannelDecodeErrorZ;
5713
5714 /**
5715  * The contents of CResult_RevokeAndACKDecodeErrorZ
5716  */
5717 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
5718    /**
5719     * A pointer to the contents in the success state.
5720     * Reading from this pointer when `result_ok` is not set is undefined.
5721     */
5722    struct LDKRevokeAndACK *result;
5723    /**
5724     * A pointer to the contents in the error state.
5725     * Reading from this pointer when `result_ok` is set is undefined.
5726     */
5727    struct LDKDecodeError *err;
5728 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5729
5730 /**
5731  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5732  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5733  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5734  */
5735 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5736    /**
5737     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5738     * `err` or `result` depending on the state of `result_ok`.
5739     */
5740    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5741    /**
5742     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5743     */
5744    bool result_ok;
5745 } LDKCResult_RevokeAndACKDecodeErrorZ;
5746
5747 /**
5748  * The contents of CResult_ShutdownDecodeErrorZ
5749  */
5750 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5751    /**
5752     * A pointer to the contents in the success state.
5753     * Reading from this pointer when `result_ok` is not set is undefined.
5754     */
5755    struct LDKShutdown *result;
5756    /**
5757     * A pointer to the contents in the error state.
5758     * Reading from this pointer when `result_ok` is set is undefined.
5759     */
5760    struct LDKDecodeError *err;
5761 } LDKCResult_ShutdownDecodeErrorZPtr;
5762
5763 /**
5764  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5765  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5766  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5767  */
5768 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5769    /**
5770     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5771     * `err` or `result` depending on the state of `result_ok`.
5772     */
5773    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5774    /**
5775     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5776     */
5777    bool result_ok;
5778 } LDKCResult_ShutdownDecodeErrorZ;
5779
5780 /**
5781  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5782  */
5783 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5784    /**
5785     * A pointer to the contents in the success state.
5786     * Reading from this pointer when `result_ok` is not set is undefined.
5787     */
5788    struct LDKUpdateFailHTLC *result;
5789    /**
5790     * A pointer to the contents in the error state.
5791     * Reading from this pointer when `result_ok` is set is undefined.
5792     */
5793    struct LDKDecodeError *err;
5794 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5795
5796 /**
5797  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5798  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5799  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5800  */
5801 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5802    /**
5803     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5804     * `err` or `result` depending on the state of `result_ok`.
5805     */
5806    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5807    /**
5808     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5809     */
5810    bool result_ok;
5811 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5812
5813 /**
5814  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5815  */
5816 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5817    /**
5818     * A pointer to the contents in the success state.
5819     * Reading from this pointer when `result_ok` is not set is undefined.
5820     */
5821    struct LDKUpdateFailMalformedHTLC *result;
5822    /**
5823     * A pointer to the contents in the error state.
5824     * Reading from this pointer when `result_ok` is set is undefined.
5825     */
5826    struct LDKDecodeError *err;
5827 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5828
5829 /**
5830  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5831  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5832  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5833  */
5834 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5835    /**
5836     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5837     * `err` or `result` depending on the state of `result_ok`.
5838     */
5839    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5840    /**
5841     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5842     */
5843    bool result_ok;
5844 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5845
5846
5847
5848 /**
5849  * An update_fee message to be sent or received from a peer
5850  */
5851 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5852    /**
5853     * A pointer to the opaque Rust object.
5854     * Nearly everywhere, inner must be non-null, however in places where
5855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5856     */
5857    LDKnativeUpdateFee *inner;
5858    /**
5859     * Indicates that this is the only struct which contains the same pointer.
5860     * Rust functions which take ownership of an object provided via an argument require
5861     * this to be true and invalidate the object pointed to by inner.
5862     */
5863    bool is_owned;
5864 } LDKUpdateFee;
5865
5866 /**
5867  * The contents of CResult_UpdateFeeDecodeErrorZ
5868  */
5869 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5870    /**
5871     * A pointer to the contents in the success state.
5872     * Reading from this pointer when `result_ok` is not set is undefined.
5873     */
5874    struct LDKUpdateFee *result;
5875    /**
5876     * A pointer to the contents in the error state.
5877     * Reading from this pointer when `result_ok` is set is undefined.
5878     */
5879    struct LDKDecodeError *err;
5880 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5881
5882 /**
5883  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5884  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886  */
5887 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5888    /**
5889     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5890     * `err` or `result` depending on the state of `result_ok`.
5891     */
5892    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5893    /**
5894     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5895     */
5896    bool result_ok;
5897 } LDKCResult_UpdateFeeDecodeErrorZ;
5898
5899 /**
5900  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5901  */
5902 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5903    /**
5904     * A pointer to the contents in the success state.
5905     * Reading from this pointer when `result_ok` is not set is undefined.
5906     */
5907    struct LDKUpdateFulfillHTLC *result;
5908    /**
5909     * A pointer to the contents in the error state.
5910     * Reading from this pointer when `result_ok` is set is undefined.
5911     */
5912    struct LDKDecodeError *err;
5913 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5914
5915 /**
5916  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5917  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5919  */
5920 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5921    /**
5922     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5923     * `err` or `result` depending on the state of `result_ok`.
5924     */
5925    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5926    /**
5927     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5928     */
5929    bool result_ok;
5930 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5931
5932 /**
5933  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5934  */
5935 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5936    /**
5937     * A pointer to the contents in the success state.
5938     * Reading from this pointer when `result_ok` is not set is undefined.
5939     */
5940    struct LDKUpdateAddHTLC *result;
5941    /**
5942     * A pointer to the contents in the error state.
5943     * Reading from this pointer when `result_ok` is set is undefined.
5944     */
5945    struct LDKDecodeError *err;
5946 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5947
5948 /**
5949  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5950  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5951  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5952  */
5953 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5954    /**
5955     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5956     * `err` or `result` depending on the state of `result_ok`.
5957     */
5958    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5959    /**
5960     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5961     */
5962    bool result_ok;
5963 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5964
5965
5966
5967 /**
5968  * A ping message to be sent or received from a peer
5969  */
5970 typedef struct MUST_USE_STRUCT LDKPing {
5971    /**
5972     * A pointer to the opaque Rust object.
5973     * Nearly everywhere, inner must be non-null, however in places where
5974     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5975     */
5976    LDKnativePing *inner;
5977    /**
5978     * Indicates that this is the only struct which contains the same pointer.
5979     * Rust functions which take ownership of an object provided via an argument require
5980     * this to be true and invalidate the object pointed to by inner.
5981     */
5982    bool is_owned;
5983 } LDKPing;
5984
5985 /**
5986  * The contents of CResult_PingDecodeErrorZ
5987  */
5988 typedef union LDKCResult_PingDecodeErrorZPtr {
5989    /**
5990     * A pointer to the contents in the success state.
5991     * Reading from this pointer when `result_ok` is not set is undefined.
5992     */
5993    struct LDKPing *result;
5994    /**
5995     * A pointer to the contents in the error state.
5996     * Reading from this pointer when `result_ok` is set is undefined.
5997     */
5998    struct LDKDecodeError *err;
5999 } LDKCResult_PingDecodeErrorZPtr;
6000
6001 /**
6002  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6003  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6004  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6005  */
6006 typedef struct LDKCResult_PingDecodeErrorZ {
6007    /**
6008     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6009     * `err` or `result` depending on the state of `result_ok`.
6010     */
6011    union LDKCResult_PingDecodeErrorZPtr contents;
6012    /**
6013     * Whether this CResult_PingDecodeErrorZ represents a success state.
6014     */
6015    bool result_ok;
6016 } LDKCResult_PingDecodeErrorZ;
6017
6018
6019
6020 /**
6021  * A pong message to be sent or received from a peer
6022  */
6023 typedef struct MUST_USE_STRUCT LDKPong {
6024    /**
6025     * A pointer to the opaque Rust object.
6026     * Nearly everywhere, inner must be non-null, however in places where
6027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6028     */
6029    LDKnativePong *inner;
6030    /**
6031     * Indicates that this is the only struct which contains the same pointer.
6032     * Rust functions which take ownership of an object provided via an argument require
6033     * this to be true and invalidate the object pointed to by inner.
6034     */
6035    bool is_owned;
6036 } LDKPong;
6037
6038 /**
6039  * The contents of CResult_PongDecodeErrorZ
6040  */
6041 typedef union LDKCResult_PongDecodeErrorZPtr {
6042    /**
6043     * A pointer to the contents in the success state.
6044     * Reading from this pointer when `result_ok` is not set is undefined.
6045     */
6046    struct LDKPong *result;
6047    /**
6048     * A pointer to the contents in the error state.
6049     * Reading from this pointer when `result_ok` is set is undefined.
6050     */
6051    struct LDKDecodeError *err;
6052 } LDKCResult_PongDecodeErrorZPtr;
6053
6054 /**
6055  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6056  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058  */
6059 typedef struct LDKCResult_PongDecodeErrorZ {
6060    /**
6061     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6062     * `err` or `result` depending on the state of `result_ok`.
6063     */
6064    union LDKCResult_PongDecodeErrorZPtr contents;
6065    /**
6066     * Whether this CResult_PongDecodeErrorZ represents a success state.
6067     */
6068    bool result_ok;
6069 } LDKCResult_PongDecodeErrorZ;
6070
6071 /**
6072  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6073  */
6074 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6075    /**
6076     * A pointer to the contents in the success state.
6077     * Reading from this pointer when `result_ok` is not set is undefined.
6078     */
6079    struct LDKUnsignedChannelAnnouncement *result;
6080    /**
6081     * A pointer to the contents in the error state.
6082     * Reading from this pointer when `result_ok` is set is undefined.
6083     */
6084    struct LDKDecodeError *err;
6085 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
6086
6087 /**
6088  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6089  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6091  */
6092 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
6093    /**
6094     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6095     * `err` or `result` depending on the state of `result_ok`.
6096     */
6097    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6098    /**
6099     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6100     */
6101    bool result_ok;
6102 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6103
6104 /**
6105  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6106  */
6107 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
6108    /**
6109     * A pointer to the contents in the success state.
6110     * Reading from this pointer when `result_ok` is not set is undefined.
6111     */
6112    struct LDKChannelAnnouncement *result;
6113    /**
6114     * A pointer to the contents in the error state.
6115     * Reading from this pointer when `result_ok` is set is undefined.
6116     */
6117    struct LDKDecodeError *err;
6118 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
6119
6120 /**
6121  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6122  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6123  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6124  */
6125 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
6126    /**
6127     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6128     * `err` or `result` depending on the state of `result_ok`.
6129     */
6130    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6131    /**
6132     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6133     */
6134    bool result_ok;
6135 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6136
6137
6138
6139 /**
6140  * The unsigned part of a channel_update
6141  */
6142 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6143    /**
6144     * A pointer to the opaque Rust object.
6145     * Nearly everywhere, inner must be non-null, however in places where
6146     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6147     */
6148    LDKnativeUnsignedChannelUpdate *inner;
6149    /**
6150     * Indicates that this is the only struct which contains the same pointer.
6151     * Rust functions which take ownership of an object provided via an argument require
6152     * this to be true and invalidate the object pointed to by inner.
6153     */
6154    bool is_owned;
6155 } LDKUnsignedChannelUpdate;
6156
6157 /**
6158  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6159  */
6160 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
6161    /**
6162     * A pointer to the contents in the success state.
6163     * Reading from this pointer when `result_ok` is not set is undefined.
6164     */
6165    struct LDKUnsignedChannelUpdate *result;
6166    /**
6167     * A pointer to the contents in the error state.
6168     * Reading from this pointer when `result_ok` is set is undefined.
6169     */
6170    struct LDKDecodeError *err;
6171 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
6172
6173 /**
6174  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6175  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6176  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6177  */
6178 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
6179    /**
6180     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6181     * `err` or `result` depending on the state of `result_ok`.
6182     */
6183    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6184    /**
6185     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6186     */
6187    bool result_ok;
6188 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6189
6190 /**
6191  * The contents of CResult_ChannelUpdateDecodeErrorZ
6192  */
6193 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
6194    /**
6195     * A pointer to the contents in the success state.
6196     * Reading from this pointer when `result_ok` is not set is undefined.
6197     */
6198    struct LDKChannelUpdate *result;
6199    /**
6200     * A pointer to the contents in the error state.
6201     * Reading from this pointer when `result_ok` is set is undefined.
6202     */
6203    struct LDKDecodeError *err;
6204 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
6205
6206 /**
6207  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6208  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6210  */
6211 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
6212    /**
6213     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6214     * `err` or `result` depending on the state of `result_ok`.
6215     */
6216    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6217    /**
6218     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6219     */
6220    bool result_ok;
6221 } LDKCResult_ChannelUpdateDecodeErrorZ;
6222
6223 /**
6224  * The contents of CResult_ErrorMessageDecodeErrorZ
6225  */
6226 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
6227    /**
6228     * A pointer to the contents in the success state.
6229     * Reading from this pointer when `result_ok` is not set is undefined.
6230     */
6231    struct LDKErrorMessage *result;
6232    /**
6233     * A pointer to the contents in the error state.
6234     * Reading from this pointer when `result_ok` is set is undefined.
6235     */
6236    struct LDKDecodeError *err;
6237 } LDKCResult_ErrorMessageDecodeErrorZPtr;
6238
6239 /**
6240  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6241  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
6242  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6243  */
6244 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
6245    /**
6246     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6247     * `err` or `result` depending on the state of `result_ok`.
6248     */
6249    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6250    /**
6251     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6252     */
6253    bool result_ok;
6254 } LDKCResult_ErrorMessageDecodeErrorZ;
6255
6256
6257
6258 /**
6259  * The unsigned part of a node_announcement
6260  */
6261 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6262    /**
6263     * A pointer to the opaque Rust object.
6264     * Nearly everywhere, inner must be non-null, however in places where
6265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6266     */
6267    LDKnativeUnsignedNodeAnnouncement *inner;
6268    /**
6269     * Indicates that this is the only struct which contains the same pointer.
6270     * Rust functions which take ownership of an object provided via an argument require
6271     * this to be true and invalidate the object pointed to by inner.
6272     */
6273    bool is_owned;
6274 } LDKUnsignedNodeAnnouncement;
6275
6276 /**
6277  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6278  */
6279 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6280    /**
6281     * A pointer to the contents in the success state.
6282     * Reading from this pointer when `result_ok` is not set is undefined.
6283     */
6284    struct LDKUnsignedNodeAnnouncement *result;
6285    /**
6286     * A pointer to the contents in the error state.
6287     * Reading from this pointer when `result_ok` is set is undefined.
6288     */
6289    struct LDKDecodeError *err;
6290 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
6291
6292 /**
6293  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6294  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6295  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6296  */
6297 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
6298    /**
6299     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6300     * `err` or `result` depending on the state of `result_ok`.
6301     */
6302    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6303    /**
6304     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6305     */
6306    bool result_ok;
6307 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6308
6309 /**
6310  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6311  */
6312 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
6313    /**
6314     * A pointer to the contents in the success state.
6315     * Reading from this pointer when `result_ok` is not set is undefined.
6316     */
6317    struct LDKNodeAnnouncement *result;
6318    /**
6319     * A pointer to the contents in the error state.
6320     * Reading from this pointer when `result_ok` is set is undefined.
6321     */
6322    struct LDKDecodeError *err;
6323 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
6324
6325 /**
6326  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6327  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6329  */
6330 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
6331    /**
6332     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6333     * `err` or `result` depending on the state of `result_ok`.
6334     */
6335    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6336    /**
6337     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6338     */
6339    bool result_ok;
6340 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6341
6342 /**
6343  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6344  */
6345 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
6346    /**
6347     * A pointer to the contents in the success state.
6348     * Reading from this pointer when `result_ok` is not set is undefined.
6349     */
6350    struct LDKQueryShortChannelIds *result;
6351    /**
6352     * A pointer to the contents in the error state.
6353     * Reading from this pointer when `result_ok` is set is undefined.
6354     */
6355    struct LDKDecodeError *err;
6356 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
6357
6358 /**
6359  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6360  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
6361  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6362  */
6363 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
6364    /**
6365     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6366     * `err` or `result` depending on the state of `result_ok`.
6367     */
6368    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6369    /**
6370     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6371     */
6372    bool result_ok;
6373 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6374
6375
6376
6377 /**
6378  * A reply_short_channel_ids_end message is sent as a reply to a
6379  * query_short_channel_ids message. The query recipient makes a best
6380  * effort to respond based on their local network view which may not be
6381  * a perfect view of the network.
6382  */
6383 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6384    /**
6385     * A pointer to the opaque Rust object.
6386     * Nearly everywhere, inner must be non-null, however in places where
6387     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6388     */
6389    LDKnativeReplyShortChannelIdsEnd *inner;
6390    /**
6391     * Indicates that this is the only struct which contains the same pointer.
6392     * Rust functions which take ownership of an object provided via an argument require
6393     * this to be true and invalidate the object pointed to by inner.
6394     */
6395    bool is_owned;
6396 } LDKReplyShortChannelIdsEnd;
6397
6398 /**
6399  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6400  */
6401 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6402    /**
6403     * A pointer to the contents in the success state.
6404     * Reading from this pointer when `result_ok` is not set is undefined.
6405     */
6406    struct LDKReplyShortChannelIdsEnd *result;
6407    /**
6408     * A pointer to the contents in the error state.
6409     * Reading from this pointer when `result_ok` is set is undefined.
6410     */
6411    struct LDKDecodeError *err;
6412 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6413
6414 /**
6415  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6416  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
6417  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6418  */
6419 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6420    /**
6421     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6422     * `err` or `result` depending on the state of `result_ok`.
6423     */
6424    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6425    /**
6426     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6427     */
6428    bool result_ok;
6429 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6430
6431 /**
6432  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6433  */
6434 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
6435    /**
6436     * A pointer to the contents in the success state.
6437     * Reading from this pointer when `result_ok` is not set is undefined.
6438     */
6439    struct LDKQueryChannelRange *result;
6440    /**
6441     * A pointer to the contents in the error state.
6442     * Reading from this pointer when `result_ok` is set is undefined.
6443     */
6444    struct LDKDecodeError *err;
6445 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
6446
6447 /**
6448  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6449  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6450  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6451  */
6452 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
6453    /**
6454     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6455     * `err` or `result` depending on the state of `result_ok`.
6456     */
6457    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6458    /**
6459     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6460     */
6461    bool result_ok;
6462 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6463
6464 /**
6465  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6466  */
6467 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
6468    /**
6469     * A pointer to the contents in the success state.
6470     * Reading from this pointer when `result_ok` is not set is undefined.
6471     */
6472    struct LDKReplyChannelRange *result;
6473    /**
6474     * A pointer to the contents in the error state.
6475     * Reading from this pointer when `result_ok` is set is undefined.
6476     */
6477    struct LDKDecodeError *err;
6478 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
6479
6480 /**
6481  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6482  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6483  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6484  */
6485 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
6486    /**
6487     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6488     * `err` or `result` depending on the state of `result_ok`.
6489     */
6490    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6491    /**
6492     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6493     */
6494    bool result_ok;
6495 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6496
6497
6498
6499 /**
6500  * A gossip_timestamp_filter message is used by a node to request
6501  * gossip relay for messages in the requested time range when the
6502  * gossip_queries feature has been negotiated.
6503  */
6504 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6505    /**
6506     * A pointer to the opaque Rust object.
6507     * Nearly everywhere, inner must be non-null, however in places where
6508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6509     */
6510    LDKnativeGossipTimestampFilter *inner;
6511    /**
6512     * Indicates that this is the only struct which contains the same pointer.
6513     * Rust functions which take ownership of an object provided via an argument require
6514     * this to be true and invalidate the object pointed to by inner.
6515     */
6516    bool is_owned;
6517 } LDKGossipTimestampFilter;
6518
6519 /**
6520  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6521  */
6522 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6523    /**
6524     * A pointer to the contents in the success state.
6525     * Reading from this pointer when `result_ok` is not set is undefined.
6526     */
6527    struct LDKGossipTimestampFilter *result;
6528    /**
6529     * A pointer to the contents in the error state.
6530     * Reading from this pointer when `result_ok` is set is undefined.
6531     */
6532    struct LDKDecodeError *err;
6533 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6534
6535 /**
6536  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6537  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
6538  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6539  */
6540 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6541    /**
6542     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6543     * `err` or `result` depending on the state of `result_ok`.
6544     */
6545    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6546    /**
6547     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6548     */
6549    bool result_ok;
6550 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6551
6552 /**
6553  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
6554  * may occur.
6555  */
6556 typedef enum LDKSignOrCreationError_Tag {
6557    /**
6558     * An error occurred during signing
6559     */
6560    LDKSignOrCreationError_SignError,
6561    /**
6562     * An error occurred while building the transaction
6563     */
6564    LDKSignOrCreationError_CreationError,
6565    /**
6566     * Must be last for serialization purposes
6567     */
6568    LDKSignOrCreationError_Sentinel,
6569 } LDKSignOrCreationError_Tag;
6570
6571 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
6572    LDKSignOrCreationError_Tag tag;
6573    union {
6574       struct {
6575          enum LDKCreationError creation_error;
6576       };
6577    };
6578 } LDKSignOrCreationError;
6579
6580 /**
6581  * The contents of CResult_InvoiceSignOrCreationErrorZ
6582  */
6583 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
6584    /**
6585     * A pointer to the contents in the success state.
6586     * Reading from this pointer when `result_ok` is not set is undefined.
6587     */
6588    struct LDKInvoice *result;
6589    /**
6590     * A pointer to the contents in the error state.
6591     * Reading from this pointer when `result_ok` is set is undefined.
6592     */
6593    struct LDKSignOrCreationError *err;
6594 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
6595
6596 /**
6597  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
6598  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
6599  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6600  */
6601 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
6602    /**
6603     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
6604     * `err` or `result` depending on the state of `result_ok`.
6605     */
6606    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
6607    /**
6608     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
6609     */
6610    bool result_ok;
6611 } LDKCResult_InvoiceSignOrCreationErrorZ;
6612
6613 /**
6614  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6615  */
6616 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6617    /**
6618     * A pointer to the contents in the success state.
6619     * Reading from this pointer when `result_ok` is not set is undefined.
6620     */
6621    struct LDKSpendableOutputDescriptor *result;
6622    /**
6623     * A pointer to the contents in the error state.
6624     * Reading from this pointer when `result_ok` is set is undefined.
6625     */
6626    struct LDKDecodeError *err;
6627 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6628
6629 /**
6630  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6631  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6633  */
6634 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6635    /**
6636     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6637     * `err` or `result` depending on the state of `result_ok`.
6638     */
6639    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6640    /**
6641     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6642     */
6643    bool result_ok;
6644 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6645
6646 /**
6647  * The contents of CResult_SignDecodeErrorZ
6648  */
6649 typedef union LDKCResult_SignDecodeErrorZPtr {
6650    /**
6651     * A pointer to the contents in the success state.
6652     * Reading from this pointer when `result_ok` is not set is undefined.
6653     */
6654    struct LDKSign *result;
6655    /**
6656     * A pointer to the contents in the error state.
6657     * Reading from this pointer when `result_ok` is set is undefined.
6658     */
6659    struct LDKDecodeError *err;
6660 } LDKCResult_SignDecodeErrorZPtr;
6661
6662 /**
6663  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6664  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6666  */
6667 typedef struct LDKCResult_SignDecodeErrorZ {
6668    /**
6669     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6670     * `err` or `result` depending on the state of `result_ok`.
6671     */
6672    union LDKCResult_SignDecodeErrorZPtr contents;
6673    /**
6674     * Whether this CResult_SignDecodeErrorZ represents a success state.
6675     */
6676    bool result_ok;
6677 } LDKCResult_SignDecodeErrorZ;
6678
6679 /**
6680  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6681  * allows recovering the exact public key which created the signature given the message.
6682  */
6683 typedef struct LDKRecoverableSignature {
6684    /**
6685     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6686     * recovery.
6687     */
6688    uint8_t serialized_form[68];
6689 } LDKRecoverableSignature;
6690
6691 /**
6692  * The contents of CResult_RecoverableSignatureNoneZ
6693  */
6694 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6695    /**
6696     * A pointer to the contents in the success state.
6697     * Reading from this pointer when `result_ok` is not set is undefined.
6698     */
6699    struct LDKRecoverableSignature *result;
6700    /**
6701     * Note that this value is always NULL, as there are no contents in the Err variant
6702     */
6703    void *err;
6704 } LDKCResult_RecoverableSignatureNoneZPtr;
6705
6706 /**
6707  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6708  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6710  */
6711 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6712    /**
6713     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6714     * `err` or `result` depending on the state of `result_ok`.
6715     */
6716    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6717    /**
6718     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6719     */
6720    bool result_ok;
6721 } LDKCResult_RecoverableSignatureNoneZ;
6722
6723 /**
6724  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6725  * This corresponds to std::vector in C++
6726  */
6727 typedef struct LDKCVec_CVec_u8ZZ {
6728    /**
6729     * The elements in the array.
6730     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6731     */
6732    struct LDKCVec_u8Z *data;
6733    /**
6734     * The number of elements pointed to by `data`.
6735     */
6736    uintptr_t datalen;
6737 } LDKCVec_CVec_u8ZZ;
6738
6739 /**
6740  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6741  */
6742 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6743    /**
6744     * A pointer to the contents in the success state.
6745     * Reading from this pointer when `result_ok` is not set is undefined.
6746     */
6747    struct LDKCVec_CVec_u8ZZ *result;
6748    /**
6749     * Note that this value is always NULL, as there are no contents in the Err variant
6750     */
6751    void *err;
6752 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6753
6754 /**
6755  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6756  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6757  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6758  */
6759 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6760    /**
6761     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6762     * `err` or `result` depending on the state of `result_ok`.
6763     */
6764    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6765    /**
6766     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6767     */
6768    bool result_ok;
6769 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6770
6771
6772
6773 /**
6774  * A simple implementation of Sign that just keeps the private keys in memory.
6775  *
6776  * This implementation performs no policy checks and is insufficient by itself as
6777  * a secure external signer.
6778  */
6779 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6780    /**
6781     * A pointer to the opaque Rust object.
6782     * Nearly everywhere, inner must be non-null, however in places where
6783     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6784     */
6785    LDKnativeInMemorySigner *inner;
6786    /**
6787     * Indicates that this is the only struct which contains the same pointer.
6788     * Rust functions which take ownership of an object provided via an argument require
6789     * this to be true and invalidate the object pointed to by inner.
6790     */
6791    bool is_owned;
6792 } LDKInMemorySigner;
6793
6794 /**
6795  * The contents of CResult_InMemorySignerDecodeErrorZ
6796  */
6797 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6798    /**
6799     * A pointer to the contents in the success state.
6800     * Reading from this pointer when `result_ok` is not set is undefined.
6801     */
6802    struct LDKInMemorySigner *result;
6803    /**
6804     * A pointer to the contents in the error state.
6805     * Reading from this pointer when `result_ok` is set is undefined.
6806     */
6807    struct LDKDecodeError *err;
6808 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6809
6810 /**
6811  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6812  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6813  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6814  */
6815 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6816    /**
6817     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6818     * `err` or `result` depending on the state of `result_ok`.
6819     */
6820    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6821    /**
6822     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6823     */
6824    bool result_ok;
6825 } LDKCResult_InMemorySignerDecodeErrorZ;
6826
6827 /**
6828  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6829  * This corresponds to std::vector in C++
6830  */
6831 typedef struct LDKCVec_TxOutZ {
6832    /**
6833     * The elements in the array.
6834     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6835     */
6836    struct LDKTxOut *data;
6837    /**
6838     * The number of elements pointed to by `data`.
6839     */
6840    uintptr_t datalen;
6841 } LDKCVec_TxOutZ;
6842
6843 /**
6844  * The contents of CResult_TransactionNoneZ
6845  */
6846 typedef union LDKCResult_TransactionNoneZPtr {
6847    /**
6848     * A pointer to the contents in the success state.
6849     * Reading from this pointer when `result_ok` is not set is undefined.
6850     */
6851    struct LDKTransaction *result;
6852    /**
6853     * Note that this value is always NULL, as there are no contents in the Err variant
6854     */
6855    void *err;
6856 } LDKCResult_TransactionNoneZPtr;
6857
6858 /**
6859  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6860  * containing a crate::c_types::Transaction on success and a () on failure.
6861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6862  */
6863 typedef struct LDKCResult_TransactionNoneZ {
6864    /**
6865     * The contents of this CResult_TransactionNoneZ, accessible via either
6866     * `err` or `result` depending on the state of `result_ok`.
6867     */
6868    union LDKCResult_TransactionNoneZPtr contents;
6869    /**
6870     * Whether this CResult_TransactionNoneZ represents a success state.
6871     */
6872    bool result_ok;
6873 } LDKCResult_TransactionNoneZ;
6874
6875 /**
6876  * The contents of CResult_NoneErrorZ
6877  */
6878 typedef union LDKCResult_NoneErrorZPtr {
6879    /**
6880     * Note that this value is always NULL, as there are no contents in the OK variant
6881     */
6882    void *result;
6883    /**
6884     * A pointer to the contents in the error state.
6885     * Reading from this pointer when `result_ok` is set is undefined.
6886     */
6887    enum LDKIOError *err;
6888 } LDKCResult_NoneErrorZPtr;
6889
6890 /**
6891  * A CResult_NoneErrorZ represents the result of a fallible operation,
6892  * containing a () on success and a crate::c_types::IOError on failure.
6893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6894  */
6895 typedef struct LDKCResult_NoneErrorZ {
6896    /**
6897     * The contents of this CResult_NoneErrorZ, accessible via either
6898     * `err` or `result` depending on the state of `result_ok`.
6899     */
6900    union LDKCResult_NoneErrorZPtr contents;
6901    /**
6902     * Whether this CResult_NoneErrorZ represents a success state.
6903     */
6904    bool result_ok;
6905 } LDKCResult_NoneErrorZ;
6906
6907 /**
6908  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6909  * This corresponds to std::vector in C++
6910  */
6911 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6912    /**
6913     * The elements in the array.
6914     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6915     */
6916    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6917    /**
6918     * The number of elements pointed to by `data`.
6919     */
6920    uintptr_t datalen;
6921 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6922
6923 /**
6924  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6925  */
6926 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6927    /**
6928     * A pointer to the contents in the success state.
6929     * Reading from this pointer when `result_ok` is not set is undefined.
6930     */
6931    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6932    /**
6933     * A pointer to the contents in the error state.
6934     * Reading from this pointer when `result_ok` is set is undefined.
6935     */
6936    enum LDKIOError *err;
6937 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6938
6939 /**
6940  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6941  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6943  */
6944 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6945    /**
6946     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6947     * `err` or `result` depending on the state of `result_ok`.
6948     */
6949    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6950    /**
6951     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6952     */
6953    bool result_ok;
6954 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6955
6956 /**
6957  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6958  * too-high values)
6959  */
6960 typedef enum LDKAPIError_Tag {
6961    /**
6962     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6963     * are documented, but generally indicates some precondition of a function was violated.
6964     */
6965    LDKAPIError_APIMisuseError,
6966    /**
6967     * Due to a high feerate, we were unable to complete the request.
6968     * For example, this may be returned if the feerate implies we cannot open a channel at the
6969     * requested value, but opening a larger channel would succeed.
6970     */
6971    LDKAPIError_FeeRateTooHigh,
6972    /**
6973     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6974     * too-many-hops, etc).
6975     */
6976    LDKAPIError_RouteError,
6977    /**
6978     * We were unable to complete the request as the Channel required to do so is unable to
6979     * complete the request (or was not found). This can take many forms, including disconnected
6980     * peer, channel at capacity, channel shutting down, etc.
6981     */
6982    LDKAPIError_ChannelUnavailable,
6983    /**
6984     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6985     * attempted action to fail.
6986     */
6987    LDKAPIError_MonitorUpdateFailed,
6988    /**
6989     * Must be last for serialization purposes
6990     */
6991    LDKAPIError_Sentinel,
6992 } LDKAPIError_Tag;
6993
6994 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6995    /**
6996     * A human-readable error message
6997     */
6998    struct LDKStr err;
6999 } LDKAPIError_LDKAPIMisuseError_Body;
7000
7001 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7002    /**
7003     * A human-readable error message
7004     */
7005    struct LDKStr err;
7006    /**
7007     * The feerate which was too high.
7008     */
7009    uint32_t feerate;
7010 } LDKAPIError_LDKFeeRateTooHigh_Body;
7011
7012 typedef struct LDKAPIError_LDKRouteError_Body {
7013    /**
7014     * A human-readable error message
7015     */
7016    struct LDKStr err;
7017 } LDKAPIError_LDKRouteError_Body;
7018
7019 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7020    /**
7021     * A human-readable error message
7022     */
7023    struct LDKStr err;
7024 } LDKAPIError_LDKChannelUnavailable_Body;
7025
7026 typedef struct MUST_USE_STRUCT LDKAPIError {
7027    LDKAPIError_Tag tag;
7028    union {
7029       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7030       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7031       LDKAPIError_LDKRouteError_Body route_error;
7032       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7033    };
7034 } LDKAPIError;
7035
7036 /**
7037  * The contents of CResult_NoneAPIErrorZ
7038  */
7039 typedef union LDKCResult_NoneAPIErrorZPtr {
7040    /**
7041     * Note that this value is always NULL, as there are no contents in the OK variant
7042     */
7043    void *result;
7044    /**
7045     * A pointer to the contents in the error state.
7046     * Reading from this pointer when `result_ok` is set is undefined.
7047     */
7048    struct LDKAPIError *err;
7049 } LDKCResult_NoneAPIErrorZPtr;
7050
7051 /**
7052  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7053  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7055  */
7056 typedef struct LDKCResult_NoneAPIErrorZ {
7057    /**
7058     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7059     * `err` or `result` depending on the state of `result_ok`.
7060     */
7061    union LDKCResult_NoneAPIErrorZPtr contents;
7062    /**
7063     * Whether this CResult_NoneAPIErrorZ represents a success state.
7064     */
7065    bool result_ok;
7066 } LDKCResult_NoneAPIErrorZ;
7067
7068 /**
7069  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7070  * This corresponds to std::vector in C++
7071  */
7072 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7073    /**
7074     * The elements in the array.
7075     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7076     */
7077    struct LDKCResult_NoneAPIErrorZ *data;
7078    /**
7079     * The number of elements pointed to by `data`.
7080     */
7081    uintptr_t datalen;
7082 } LDKCVec_CResult_NoneAPIErrorZZ;
7083
7084 /**
7085  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7086  * This corresponds to std::vector in C++
7087  */
7088 typedef struct LDKCVec_APIErrorZ {
7089    /**
7090     * The elements in the array.
7091     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7092     */
7093    struct LDKAPIError *data;
7094    /**
7095     * The number of elements pointed to by `data`.
7096     */
7097    uintptr_t datalen;
7098 } LDKCVec_APIErrorZ;
7099
7100 /**
7101  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7102  * Err() type describing which state the payment is in, see the description of individual enum
7103  * states for more.
7104  */
7105 typedef enum LDKPaymentSendFailure_Tag {
7106    /**
7107     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7108     * send the payment at all. No channel state has been changed or messages sent to peers, and
7109     * once you've changed the parameter at error, you can freely retry the payment in full.
7110     */
7111    LDKPaymentSendFailure_ParameterError,
7112    /**
7113     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7114     * from attempting to send the payment at all. No channel state has been changed or messages
7115     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7116     * payment in full.
7117     *
7118     * The results here are ordered the same as the paths in the route object which was passed to
7119     * send_payment.
7120     */
7121    LDKPaymentSendFailure_PathParameterError,
7122    /**
7123     * All paths which were attempted failed to send, with no channel state change taking place.
7124     * You can freely retry the payment in full (though you probably want to do so over different
7125     * paths than the ones selected).
7126     */
7127    LDKPaymentSendFailure_AllFailedRetrySafe,
7128    /**
7129     * Some paths which were attempted failed to send, though possibly not all. At least some
7130     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7131     * in over-/re-payment.
7132     *
7133     * The results here are ordered the same as the paths in the route object which was passed to
7134     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7135     * retried (though there is currently no API with which to do so).
7136     *
7137     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7138     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7139     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7140     * with the latest update_id.
7141     */
7142    LDKPaymentSendFailure_PartialFailure,
7143    /**
7144     * Must be last for serialization purposes
7145     */
7146    LDKPaymentSendFailure_Sentinel,
7147 } LDKPaymentSendFailure_Tag;
7148
7149 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7150    LDKPaymentSendFailure_Tag tag;
7151    union {
7152       struct {
7153          struct LDKAPIError parameter_error;
7154       };
7155       struct {
7156          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7157       };
7158       struct {
7159          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7160       };
7161       struct {
7162          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
7163       };
7164    };
7165 } LDKPaymentSendFailure;
7166
7167 /**
7168  * The contents of CResult_NonePaymentSendFailureZ
7169  */
7170 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7171    /**
7172     * Note that this value is always NULL, as there are no contents in the OK variant
7173     */
7174    void *result;
7175    /**
7176     * A pointer to the contents in the error state.
7177     * Reading from this pointer when `result_ok` is set is undefined.
7178     */
7179    struct LDKPaymentSendFailure *err;
7180 } LDKCResult_NonePaymentSendFailureZPtr;
7181
7182 /**
7183  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7184  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7185  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7186  */
7187 typedef struct LDKCResult_NonePaymentSendFailureZ {
7188    /**
7189     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7190     * `err` or `result` depending on the state of `result_ok`.
7191     */
7192    union LDKCResult_NonePaymentSendFailureZPtr contents;
7193    /**
7194     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7195     */
7196    bool result_ok;
7197 } LDKCResult_NonePaymentSendFailureZ;
7198
7199 /**
7200  * A tuple of 2 elements. See the individual fields for the types contained.
7201  */
7202 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7203    /**
7204     * The element at position 0
7205     */
7206    struct LDKThirtyTwoBytes a;
7207    /**
7208     * The element at position 1
7209     */
7210    struct LDKThirtyTwoBytes b;
7211 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7212
7213 /**
7214  * The contents of CResult_PaymentSecretAPIErrorZ
7215  */
7216 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7217    /**
7218     * A pointer to the contents in the success state.
7219     * Reading from this pointer when `result_ok` is not set is undefined.
7220     */
7221    struct LDKThirtyTwoBytes *result;
7222    /**
7223     * A pointer to the contents in the error state.
7224     * Reading from this pointer when `result_ok` is set is undefined.
7225     */
7226    struct LDKAPIError *err;
7227 } LDKCResult_PaymentSecretAPIErrorZPtr;
7228
7229 /**
7230  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7231  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7233  */
7234 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7235    /**
7236     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7237     * `err` or `result` depending on the state of `result_ok`.
7238     */
7239    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7240    /**
7241     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7242     */
7243    bool result_ok;
7244 } LDKCResult_PaymentSecretAPIErrorZ;
7245
7246 /**
7247  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7248  * This corresponds to std::vector in C++
7249  */
7250 typedef struct LDKCVec_ChannelMonitorZ {
7251    /**
7252     * The elements in the array.
7253     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7254     */
7255    struct LDKChannelMonitor *data;
7256    /**
7257     * The number of elements pointed to by `data`.
7258     */
7259    uintptr_t datalen;
7260 } LDKCVec_ChannelMonitorZ;
7261
7262 /**
7263  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7264  * blocks are connected and disconnected.
7265  *
7266  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7267  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7268  * channel state changes and HTLCs are resolved. See method documentation for specific
7269  * requirements.
7270  *
7271  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7272  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7273  * without taking any further action such as persisting the current state.
7274  *
7275  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7276  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7277  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7278  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7279  * multiple instances.
7280  *
7281  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7282  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7283  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
7284  */
7285 typedef struct LDKWatch {
7286    /**
7287     * An opaque pointer which is passed to your function implementations as an argument.
7288     * This has no meaning in the LDK, and can be NULL or any other value.
7289     */
7290    void *this_arg;
7291    /**
7292     * Watches a channel identified by `funding_txo` using `monitor`.
7293     *
7294     * Implementations are responsible for watching the chain for the funding transaction along
7295     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7296     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7297     *
7298     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7299     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7300     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7301     */
7302    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7303    /**
7304     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7305     *
7306     * Implementations must call [`update_monitor`] with the given update. See
7307     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7308     *
7309     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7310     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
7311     */
7312    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7313    /**
7314     * Returns any monitor events since the last call. Subsequent calls must only return new
7315     * events.
7316     */
7317    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
7318    /**
7319     * Frees any resources associated with this object given its this_arg pointer.
7320     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7321     */
7322    void (*free)(void *this_arg);
7323 } LDKWatch;
7324
7325 /**
7326  * An interface to send a transaction to the Bitcoin network.
7327  */
7328 typedef struct LDKBroadcasterInterface {
7329    /**
7330     * An opaque pointer which is passed to your function implementations as an argument.
7331     * This has no meaning in the LDK, and can be NULL or any other value.
7332     */
7333    void *this_arg;
7334    /**
7335     * Sends a transaction out to (hopefully) be mined.
7336     */
7337    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7338    /**
7339     * Frees any resources associated with this object given its this_arg pointer.
7340     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7341     */
7342    void (*free)(void *this_arg);
7343 } LDKBroadcasterInterface;
7344
7345 /**
7346  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7347  * own the memory pointed to by data.
7348  */
7349 typedef struct LDKu8slice {
7350    /**
7351     * A pointer to the byte buffer
7352     */
7353    const uint8_t *data;
7354    /**
7355     * The number of bytes pointed to by `data`.
7356     */
7357    uintptr_t datalen;
7358 } LDKu8slice;
7359
7360 /**
7361  * A trait to describe an object which can get user secrets and key material.
7362  */
7363 typedef struct LDKKeysInterface {
7364    /**
7365     * An opaque pointer which is passed to your function implementations as an argument.
7366     * This has no meaning in the LDK, and can be NULL or any other value.
7367     */
7368    void *this_arg;
7369    /**
7370     * Get node secret key (aka node_id or network_key).
7371     *
7372     * This method must return the same value each time it is called.
7373     */
7374    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
7375    /**
7376     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7377     *
7378     * This method should return a different value each time it is called, to avoid linking
7379     * on-chain funds across channels as controlled to the same user.
7380     */
7381    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7382    /**
7383     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
7384     * a channel.
7385     *
7386     * This method should return a different value each time it is called, to avoid linking
7387     * on-chain funds across channels as controlled to the same user.
7388     */
7389    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
7390    /**
7391     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7392     * restarted with some stale data!
7393     *
7394     * This method must return a different value each time it is called.
7395     */
7396    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7397    /**
7398     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7399     * onion packets and for temporary channel IDs. There is no requirement that these be
7400     * persisted anywhere, though they must be unique across restarts.
7401     *
7402     * This method must return a different value each time it is called.
7403     */
7404    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7405    /**
7406     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7407     * This is only called during deserialization of other objects which contain
7408     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7409     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7410     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7411     * you've read all of the provided bytes to ensure no corruption occurred.
7412     */
7413    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7414    /**
7415     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
7416     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
7417     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7418     * blindly signing the hash.
7419     */
7420    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
7421    /**
7422     * Frees any resources associated with this object given its this_arg pointer.
7423     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7424     */
7425    void (*free)(void *this_arg);
7426 } LDKKeysInterface;
7427
7428 /**
7429  * A trait which should be implemented to provide feerate information on a number of time
7430  * horizons.
7431  *
7432  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7433  * called from inside the library in response to chain events, P2P events, or timer events).
7434  */
7435 typedef struct LDKFeeEstimator {
7436    /**
7437     * An opaque pointer which is passed to your function implementations as an argument.
7438     * This has no meaning in the LDK, and can be NULL or any other value.
7439     */
7440    void *this_arg;
7441    /**
7442     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7443     *
7444     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
7445     * don't put us below 1 satoshi-per-byte).
7446     *
7447     * This translates to:
7448     *  * satoshis-per-byte * 250
7449     *  * ceil(satoshis-per-kbyte / 4)
7450     */
7451    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7452    /**
7453     * Frees any resources associated with this object given its this_arg pointer.
7454     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7455     */
7456    void (*free)(void *this_arg);
7457 } LDKFeeEstimator;
7458
7459 /**
7460  * A trait encapsulating the operations required of a logger
7461  */
7462 typedef struct LDKLogger {
7463    /**
7464     * An opaque pointer which is passed to your function implementations as an argument.
7465     * This has no meaning in the LDK, and can be NULL or any other value.
7466     */
7467    void *this_arg;
7468    /**
7469     * Logs the `Record`
7470     */
7471    void (*log)(const void *this_arg, const char *record);
7472    /**
7473     * Frees any resources associated with this object given its this_arg pointer.
7474     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7475     */
7476    void (*free)(void *this_arg);
7477 } LDKLogger;
7478
7479
7480
7481 /**
7482  * Manager which keeps track of a number of channels and sends messages to the appropriate
7483  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7484  *
7485  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7486  * to individual Channels.
7487  *
7488  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7489  * all peers during write/read (though does not modify this instance, only the instance being
7490  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7491  * called funding_transaction_generated for outbound channels).
7492  *
7493  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7494  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7495  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7496  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7497  * the serialization process). If the deserialized version is out-of-date compared to the
7498  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7499  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7500  *
7501  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7502  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7503  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7504  * block_connected() to step towards your best block) upon deserialization before using the
7505  * object!
7506  *
7507  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7508  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7509  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7510  * offline for a full minute. In order to track this, you must call
7511  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7512  *
7513  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7514  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7515  * essentially you should default to using a SimpleRefChannelManager, and use a
7516  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7517  * you're using lightning-net-tokio.
7518  */
7519 typedef struct MUST_USE_STRUCT LDKChannelManager {
7520    /**
7521     * A pointer to the opaque Rust object.
7522     * Nearly everywhere, inner must be non-null, however in places where
7523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7524     */
7525    LDKnativeChannelManager *inner;
7526    /**
7527     * Indicates that this is the only struct which contains the same pointer.
7528     * Rust functions which take ownership of an object provided via an argument require
7529     * this to be true and invalidate the object pointed to by inner.
7530     */
7531    bool is_owned;
7532 } LDKChannelManager;
7533
7534 /**
7535  * A tuple of 2 elements. See the individual fields for the types contained.
7536  */
7537 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7538    /**
7539     * The element at position 0
7540     */
7541    struct LDKThirtyTwoBytes a;
7542    /**
7543     * The element at position 1
7544     */
7545    struct LDKChannelManager b;
7546 } LDKC2Tuple_BlockHashChannelManagerZ;
7547
7548 /**
7549  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7550  */
7551 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7552    /**
7553     * A pointer to the contents in the success state.
7554     * Reading from this pointer when `result_ok` is not set is undefined.
7555     */
7556    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7557    /**
7558     * A pointer to the contents in the error state.
7559     * Reading from this pointer when `result_ok` is set is undefined.
7560     */
7561    struct LDKDecodeError *err;
7562 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7563
7564 /**
7565  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7566  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7567  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7568  */
7569 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7570    /**
7571     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7572     * `err` or `result` depending on the state of `result_ok`.
7573     */
7574    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7575    /**
7576     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7577     */
7578    bool result_ok;
7579 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7580
7581 /**
7582  * A trait indicating an object may generate message send events
7583  */
7584 typedef struct LDKMessageSendEventsProvider {
7585    /**
7586     * An opaque pointer which is passed to your function implementations as an argument.
7587     * This has no meaning in the LDK, and can be NULL or any other value.
7588     */
7589    void *this_arg;
7590    /**
7591     * Gets the list of pending events which were generated by previous actions, clearing the list
7592     * in the process.
7593     */
7594    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7595    /**
7596     * Frees any resources associated with this object given its this_arg pointer.
7597     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7598     */
7599    void (*free)(void *this_arg);
7600 } LDKMessageSendEventsProvider;
7601
7602 /**
7603  * A trait indicating an object may generate events
7604  */
7605 typedef struct LDKEventsProvider {
7606    /**
7607     * An opaque pointer which is passed to your function implementations as an argument.
7608     * This has no meaning in the LDK, and can be NULL or any other value.
7609     */
7610    void *this_arg;
7611    /**
7612     * Gets the list of pending events which were generated by previous actions, clearing the list
7613     * in the process.
7614     */
7615    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
7616    /**
7617     * Frees any resources associated with this object given its this_arg pointer.
7618     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7619     */
7620    void (*free)(void *this_arg);
7621 } LDKEventsProvider;
7622
7623
7624
7625 /**
7626  * Configuration we set when applicable.
7627  *
7628  * Default::default() provides sane defaults.
7629  */
7630 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7631    /**
7632     * A pointer to the opaque Rust object.
7633     * Nearly everywhere, inner must be non-null, however in places where
7634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7635     */
7636    LDKnativeChannelHandshakeConfig *inner;
7637    /**
7638     * Indicates that this is the only struct which contains the same pointer.
7639     * Rust functions which take ownership of an object provided via an argument require
7640     * this to be true and invalidate the object pointed to by inner.
7641     */
7642    bool is_owned;
7643 } LDKChannelHandshakeConfig;
7644
7645
7646
7647 /**
7648  * Optional channel limits which are applied during channel creation.
7649  *
7650  * These limits are only applied to our counterparty's limits, not our own.
7651  *
7652  * Use 0/<type>::max_value() as appropriate to skip checking.
7653  *
7654  * Provides sane defaults for most configurations.
7655  *
7656  * Most additional limits are disabled except those with which specify a default in individual
7657  * field documentation. Note that this may result in barely-usable channels, but since they
7658  * are applied mostly only to incoming channels that's not much of a problem.
7659  */
7660 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7661    /**
7662     * A pointer to the opaque Rust object.
7663     * Nearly everywhere, inner must be non-null, however in places where
7664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7665     */
7666    LDKnativeChannelHandshakeLimits *inner;
7667    /**
7668     * Indicates that this is the only struct which contains the same pointer.
7669     * Rust functions which take ownership of an object provided via an argument require
7670     * this to be true and invalidate the object pointed to by inner.
7671     */
7672    bool is_owned;
7673 } LDKChannelHandshakeLimits;
7674
7675
7676
7677 /**
7678  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7679  *
7680  * Default::default() provides sane defaults for most configurations
7681  * (but currently with 0 relay fees!)
7682  */
7683 typedef struct MUST_USE_STRUCT LDKUserConfig {
7684    /**
7685     * A pointer to the opaque Rust object.
7686     * Nearly everywhere, inner must be non-null, however in places where
7687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7688     */
7689    LDKnativeUserConfig *inner;
7690    /**
7691     * Indicates that this is the only struct which contains the same pointer.
7692     * Rust functions which take ownership of an object provided via an argument require
7693     * this to be true and invalidate the object pointed to by inner.
7694     */
7695    bool is_owned;
7696 } LDKUserConfig;
7697
7698 /**
7699  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7700  * UTXOs.
7701  */
7702 typedef struct LDKAccess {
7703    /**
7704     * An opaque pointer which is passed to your function implementations as an argument.
7705     * This has no meaning in the LDK, and can be NULL or any other value.
7706     */
7707    void *this_arg;
7708    /**
7709     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7710     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7711     * is unknown.
7712     *
7713     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7714     */
7715    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7716    /**
7717     * Frees any resources associated with this object given its this_arg pointer.
7718     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7719     */
7720    void (*free)(void *this_arg);
7721 } LDKAccess;
7722
7723 /**
7724  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7725  * chain.
7726  *
7727  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7728  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7729  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7730  * when needed.
7731  */
7732 typedef struct LDKListen {
7733    /**
7734     * An opaque pointer which is passed to your function implementations as an argument.
7735     * This has no meaning in the LDK, and can be NULL or any other value.
7736     */
7737    void *this_arg;
7738    /**
7739     * Notifies the listener that a block was added at the given height.
7740     */
7741    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7742    /**
7743     * Notifies the listener that a block was removed at the given height.
7744     */
7745    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7746    /**
7747     * Frees any resources associated with this object given its this_arg pointer.
7748     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7749     */
7750    void (*free)(void *this_arg);
7751 } LDKListen;
7752
7753 /**
7754  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7755  * unconfirmed during a chain reorganization.
7756  *
7757  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7758  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7759  * related to registered transactions and outputs. Upon notification, it would pass along the
7760  * matching transactions using this interface.
7761  *
7762  * # Use
7763  *
7764  * The intended use is as follows:
7765  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7766  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7767  *   that has been reorganized out of the chain.
7768  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7769  *
7770  * # Order
7771  *
7772  * Clients must call these methods in chain order. Specifically:
7773  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7774  *   block.
7775  * - Dependent transactions within the same block must be given in topological order, possibly in
7776  *   separate calls.
7777  * - Unconfirmed transactions must be given after the original confirmations and before any
7778  *   reconfirmation.
7779  *
7780  * See individual method documentation for further details.
7781  *
7782  * [`transactions_confirmed`]: Self::transactions_confirmed
7783  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7784  * [`best_block_updated`]: Self::best_block_updated
7785  * [`get_relevant_txids`]: Self::get_relevant_txids
7786  */
7787 typedef struct LDKConfirm {
7788    /**
7789     * An opaque pointer which is passed to your function implementations as an argument.
7790     * This has no meaning in the LDK, and can be NULL or any other value.
7791     */
7792    void *this_arg;
7793    /**
7794     * Processes transactions confirmed in a block with a given header and height.
7795     *
7796     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7797     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7798     * appearing in the same block do not need to be included in the same call; instead, multiple
7799     * calls with additional transactions may be made so long as they are made in [chain order].
7800     *
7801     * May be called before or after [`best_block_updated`] for the corresponding block. However,
7802     * in the event of a chain reorganization, it must not be called with a `header` that is no
7803     * longer in the chain as of the last call to [`best_block_updated`].
7804     *
7805     * [chain order]: Confirm#Order
7806     * [`best_block_updated`]: Self::best_block_updated
7807     */
7808    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7809    /**
7810     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
7811     *
7812     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
7813     * reorganized out of the best chain. Once called, the given transaction should not be returned
7814     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
7815     *
7816     * [`get_relevant_txids`]: Self::get_relevant_txids
7817     * [`transactions_confirmed`]: Self::transactions_confirmed
7818     */
7819    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
7820    /**
7821     * Processes an update to the best header connected at the given height.
7822     *
7823     * Should be called when a new header is available but may be skipped for intermediary blocks
7824     * if they become available at the same time.
7825     */
7826    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7827    /**
7828     * Returns transactions that should be monitored for reorganization out of the chain.
7829     *
7830     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
7831     * confirmations to be safe from a chain reorganization. Should not include any transactions
7832     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
7833     *
7834     * May be called to determine the subset of transactions that must still be monitored for
7835     * reorganization. Will be idempotent between calls but may change as a result of calls to the
7836     * other interface methods. Thus, this is useful to determine which transactions may need to be
7837     * given to [`transaction_unconfirmed`].
7838     *
7839     * [`transactions_confirmed`]: Self::transactions_confirmed
7840     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7841     */
7842    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
7843    /**
7844     * Frees any resources associated with this object given its this_arg pointer.
7845     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7846     */
7847    void (*free)(void *this_arg);
7848 } LDKConfirm;
7849
7850
7851
7852 /**
7853  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
7854  *
7855  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
7856  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
7857  * the return value of [`Filter::register_output`].
7858  *
7859  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
7860  * may have been spent there. See [`Filter::register_output`] for details.
7861  *
7862  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
7863  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
7864  */
7865 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
7866    /**
7867     * A pointer to the opaque Rust object.
7868     * Nearly everywhere, inner must be non-null, however in places where
7869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7870     */
7871    LDKnativeWatchedOutput *inner;
7872    /**
7873     * Indicates that this is the only struct which contains the same pointer.
7874     * Rust functions which take ownership of an object provided via an argument require
7875     * this to be true and invalidate the object pointed to by inner.
7876     */
7877    bool is_owned;
7878 } LDKWatchedOutput;
7879
7880 /**
7881  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
7882  * channels.
7883  *
7884  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
7885  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
7886  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
7887  * receiving full blocks from a chain source, any further filtering is unnecessary.
7888  *
7889  * After an output has been registered, subsequent block retrievals from the chain source must not
7890  * exclude any transactions matching the new criteria nor any in-block descendants of such
7891  * transactions.
7892  *
7893  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
7894  * should not block on I/O. Implementations should instead queue the newly monitored data to be
7895  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
7896  * invocation that has called the `Filter` must return [`TemporaryFailure`].
7897  *
7898  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
7899  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
7900  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
7901  */
7902 typedef struct LDKFilter {
7903    /**
7904     * An opaque pointer which is passed to your function implementations as an argument.
7905     * This has no meaning in the LDK, and can be NULL or any other value.
7906     */
7907    void *this_arg;
7908    /**
7909     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
7910     * a spending condition.
7911     */
7912    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
7913    /**
7914     * Registers interest in spends of a transaction output.
7915     *
7916     * Optionally, when `output.block_hash` is set, should return any transaction spending the
7917     * output that is found in the corresponding block along with its index.
7918     *
7919     * This return value is useful for Electrum clients in order to supply in-block descendant
7920     * transactions which otherwise were not included. This is not necessary for other clients if
7921     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
7922     * full block).
7923     */
7924    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
7925    /**
7926     * Frees any resources associated with this object given its this_arg pointer.
7927     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7928     */
7929    void (*free)(void *this_arg);
7930 } LDKFilter;
7931
7932 /**
7933  * `Persist` defines behavior for persisting channel monitors: this could mean
7934  * writing once to disk, and/or uploading to one or more backup services.
7935  *
7936  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
7937  * to disk/backups. And, on every update, you **must** persist either the
7938  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
7939  * of situations such as revoking a transaction, then crashing before this
7940  * revocation can be persisted, then unintentionally broadcasting a revoked
7941  * transaction and losing money. This is a risk because previous channel states
7942  * are toxic, so it's important that whatever channel state is persisted is
7943  * kept up-to-date.
7944  */
7945 typedef struct LDKPersist {
7946    /**
7947     * An opaque pointer which is passed to your function implementations as an argument.
7948     * This has no meaning in the LDK, and can be NULL or any other value.
7949     */
7950    void *this_arg;
7951    /**
7952     * Persist a new channel's data. The data can be stored any way you want, but
7953     * the identifier provided by Rust-Lightning is the channel's outpoint (and
7954     * it is up to you to maintain a correct mapping between the outpoint and the
7955     * stored channel data). Note that you **must** persist every new monitor to
7956     * disk. See the `Persist` trait documentation for more details.
7957     *
7958     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7959     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7960     */
7961    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
7962    /**
7963     * Update one channel's data. The provided `ChannelMonitor` has already
7964     * applied the given update.
7965     *
7966     * Note that on every update, you **must** persist either the
7967     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
7968     * the `Persist` trait documentation for more details.
7969     *
7970     * If an implementer chooses to persist the updates only, they need to make
7971     * sure that all the updates are applied to the `ChannelMonitors` *before*
7972     * the set of channel monitors is given to the `ChannelManager`
7973     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
7974     * applying a monitor update to a monitor. If full `ChannelMonitors` are
7975     * persisted, then there is no need to persist individual updates.
7976     *
7977     * Note that there could be a performance tradeoff between persisting complete
7978     * channel monitors on every update vs. persisting only updates and applying
7979     * them in batches. The size of each monitor grows `O(number of state updates)`
7980     * whereas updates are small and `O(1)`.
7981     *
7982     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7983     * [`ChannelMonitorUpdate::write`] for writing out an update, and
7984     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7985     */
7986    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
7987    /**
7988     * Frees any resources associated with this object given its this_arg pointer.
7989     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7990     */
7991    void (*free)(void *this_arg);
7992 } LDKPersist;
7993
7994
7995
7996 /**
7997  * An implementation of [`chain::Watch`] for monitoring channels.
7998  *
7999  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8000  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8001  * or used independently to monitor channels remotely. See the [module-level documentation] for
8002  * details.
8003  *
8004  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8005  * [module-level documentation]: crate::chain::chainmonitor
8006  */
8007 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8008    /**
8009     * A pointer to the opaque Rust object.
8010     * Nearly everywhere, inner must be non-null, however in places where
8011     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8012     */
8013    LDKnativeChainMonitor *inner;
8014    /**
8015     * Indicates that this is the only struct which contains the same pointer.
8016     * Rust functions which take ownership of an object provided via an argument require
8017     * this to be true and invalidate the object pointed to by inner.
8018     */
8019    bool is_owned;
8020 } LDKChainMonitor;
8021
8022
8023
8024 /**
8025  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8026  * and derives keys from that.
8027  *
8028  * Your node_id is seed/0'
8029  * ChannelMonitor closes may use seed/1'
8030  * Cooperative closes may use seed/2'
8031  * The two close keys may be needed to claim on-chain funds!
8032  */
8033 typedef struct MUST_USE_STRUCT LDKKeysManager {
8034    /**
8035     * A pointer to the opaque Rust object.
8036     * Nearly everywhere, inner must be non-null, however in places where
8037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8038     */
8039    LDKnativeKeysManager *inner;
8040    /**
8041     * Indicates that this is the only struct which contains the same pointer.
8042     * Rust functions which take ownership of an object provided via an argument require
8043     * this to be true and invalidate the object pointed to by inner.
8044     */
8045    bool is_owned;
8046 } LDKKeysManager;
8047
8048
8049
8050 /**
8051  * Chain-related parameters used to construct a new `ChannelManager`.
8052  *
8053  * Typically, the block-specific parameters are derived from the best block hash for the network,
8054  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8055  * are not needed when deserializing a previously constructed `ChannelManager`.
8056  */
8057 typedef struct MUST_USE_STRUCT LDKChainParameters {
8058    /**
8059     * A pointer to the opaque Rust object.
8060     * Nearly everywhere, inner must be non-null, however in places where
8061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8062     */
8063    LDKnativeChainParameters *inner;
8064    /**
8065     * Indicates that this is the only struct which contains the same pointer.
8066     * Rust functions which take ownership of an object provided via an argument require
8067     * this to be true and invalidate the object pointed to by inner.
8068     */
8069    bool is_owned;
8070 } LDKChainParameters;
8071
8072
8073
8074 /**
8075  * The best known block as identified by its hash and height.
8076  */
8077 typedef struct MUST_USE_STRUCT LDKBestBlock {
8078    /**
8079     * A pointer to the opaque Rust object.
8080     * Nearly everywhere, inner must be non-null, however in places where
8081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8082     */
8083    LDKnativeBestBlock *inner;
8084    /**
8085     * Indicates that this is the only struct which contains the same pointer.
8086     * Rust functions which take ownership of an object provided via an argument require
8087     * this to be true and invalidate the object pointed to by inner.
8088     */
8089    bool is_owned;
8090 } LDKBestBlock;
8091
8092 /**
8093  * A 3-byte byte array.
8094  */
8095 typedef struct LDKThreeBytes {
8096    /**
8097     * The three bytes
8098     */
8099    uint8_t data[3];
8100 } LDKThreeBytes;
8101
8102 /**
8103  * A trait to describe an object which can receive channel messages.
8104  *
8105  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8106  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8107  */
8108 typedef struct LDKChannelMessageHandler {
8109    /**
8110     * An opaque pointer which is passed to your function implementations as an argument.
8111     * This has no meaning in the LDK, and can be NULL or any other value.
8112     */
8113    void *this_arg;
8114    /**
8115     * Handle an incoming open_channel message from the given peer.
8116     */
8117    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8118    /**
8119     * Handle an incoming accept_channel message from the given peer.
8120     */
8121    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8122    /**
8123     * Handle an incoming funding_created message from the given peer.
8124     */
8125    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8126    /**
8127     * Handle an incoming funding_signed message from the given peer.
8128     */
8129    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8130    /**
8131     * Handle an incoming funding_locked message from the given peer.
8132     */
8133    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8134    /**
8135     * Handle an incoming shutdown message from the given peer.
8136     */
8137    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
8138    /**
8139     * Handle an incoming closing_signed message from the given peer.
8140     */
8141    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8142    /**
8143     * Handle an incoming update_add_htlc message from the given peer.
8144     */
8145    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8146    /**
8147     * Handle an incoming update_fulfill_htlc message from the given peer.
8148     */
8149    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8150    /**
8151     * Handle an incoming update_fail_htlc message from the given peer.
8152     */
8153    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8154    /**
8155     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8156     */
8157    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8158    /**
8159     * Handle an incoming commitment_signed message from the given peer.
8160     */
8161    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8162    /**
8163     * Handle an incoming revoke_and_ack message from the given peer.
8164     */
8165    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8166    /**
8167     * Handle an incoming update_fee message from the given peer.
8168     */
8169    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8170    /**
8171     * Handle an incoming announcement_signatures message from the given peer.
8172     */
8173    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8174    /**
8175     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8176     * is believed to be possible in the future (eg they're sending us messages we don't
8177     * understand or indicate they require unknown feature bits), no_connection_possible is set
8178     * and any outstanding channels should be failed.
8179     */
8180    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8181    /**
8182     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8183     */
8184    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8185    /**
8186     * Handle an incoming channel_reestablish message from the given peer.
8187     */
8188    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8189    /**
8190     * Handle an incoming channel update from the given peer.
8191     */
8192    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8193    /**
8194     * Handle an incoming error message from the given peer.
8195     */
8196    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8197    /**
8198     * Implementation of MessageSendEventsProvider for this object.
8199     */
8200    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8201    /**
8202     * Frees any resources associated with this object given its this_arg pointer.
8203     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8204     */
8205    void (*free)(void *this_arg);
8206 } LDKChannelMessageHandler;
8207
8208
8209
8210 /**
8211  * Arguments for the creation of a ChannelManager that are not deserialized.
8212  *
8213  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8214  * is:
8215  * 1) Deserialize all stored ChannelMonitors.
8216  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8217  *    <(BlockHash, ChannelManager)>::read(reader, args)
8218  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8219  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8220  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8221  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8222  *    ChannelMonitor::get_funding_txo().
8223  * 4) Reconnect blocks on your ChannelMonitors.
8224  * 5) Disconnect/connect blocks on the ChannelManager.
8225  * 6) Move the ChannelMonitors into your local chain::Watch.
8226  *
8227  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8228  * call any other methods on the newly-deserialized ChannelManager.
8229  *
8230  * Note that because some channels may be closed during deserialization, it is critical that you
8231  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8232  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8233  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8234  * not force-close the same channels but consider them live), you may end up revoking a state for
8235  * which you've already broadcasted the transaction.
8236  */
8237 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8238    /**
8239     * A pointer to the opaque Rust object.
8240     * Nearly everywhere, inner must be non-null, however in places where
8241     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8242     */
8243    LDKnativeChannelManagerReadArgs *inner;
8244    /**
8245     * Indicates that this is the only struct which contains the same pointer.
8246     * Rust functions which take ownership of an object provided via an argument require
8247     * this to be true and invalidate the object pointed to by inner.
8248     */
8249    bool is_owned;
8250 } LDKChannelManagerReadArgs;
8251
8252
8253
8254 /**
8255  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8256  * This is used to convince the recipient that the channel is at a certain commitment
8257  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8258  * and even later commitments may have been revoked.
8259  */
8260 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8261    /**
8262     * A pointer to the opaque Rust object.
8263     * Nearly everywhere, inner must be non-null, however in places where
8264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8265     */
8266    LDKnativeDataLossProtect *inner;
8267    /**
8268     * Indicates that this is the only struct which contains the same pointer.
8269     * Rust functions which take ownership of an object provided via an argument require
8270     * this to be true and invalidate the object pointed to by inner.
8271     */
8272    bool is_owned;
8273 } LDKDataLossProtect;
8274
8275 /**
8276  * A trait to describe an object which can receive routing messages.
8277  *
8278  * # Implementor DoS Warnings
8279  *
8280  * For `gossip_queries` messages there are potential DoS vectors when handling
8281  * inbound queries. Implementors using an on-disk network graph should be aware of
8282  * repeated disk I/O for queries accessing different parts of the network graph.
8283  */
8284 typedef struct LDKRoutingMessageHandler {
8285    /**
8286     * An opaque pointer which is passed to your function implementations as an argument.
8287     * This has no meaning in the LDK, and can be NULL or any other value.
8288     */
8289    void *this_arg;
8290    /**
8291     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8292     * false or returning an Err otherwise.
8293     */
8294    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8295    /**
8296     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8297     * or returning an Err otherwise.
8298     */
8299    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8300    /**
8301     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8302     * false or returning an Err otherwise.
8303     */
8304    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8305    /**
8306     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8307     */
8308    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8309    /**
8310     * Gets a subset of the channel announcements and updates required to dump our routing table
8311     * to a remote node, starting at the short_channel_id indicated by starting_point and
8312     * including the batch_amount entries immediately higher in numerical value than starting_point.
8313     */
8314    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8315    /**
8316     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8317     * starting at the node *after* the provided publickey and including batch_amount entries
8318     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8319     * If None is provided for starting_point, we start at the first node.
8320     */
8321    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8322    /**
8323     * Called when a connection is established with a peer. This can be used to
8324     * perform routing table synchronization using a strategy defined by the
8325     * implementor.
8326     */
8327    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8328    /**
8329     * Handles the reply of a query we initiated to learn about channels
8330     * for a given range of blocks. We can expect to receive one or more
8331     * replies to a single query.
8332     */
8333    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8334    /**
8335     * Handles the reply of a query we initiated asking for routing gossip
8336     * messages for a list of channels. We should receive this message when
8337     * a node has completed its best effort to send us the pertaining routing
8338     * gossip messages.
8339     */
8340    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8341    /**
8342     * Handles when a peer asks us to send a list of short_channel_ids
8343     * for the requested range of blocks.
8344     */
8345    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8346    /**
8347     * Handles when a peer asks us to send routing gossip messages for a
8348     * list of short_channel_ids.
8349     */
8350    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8351    /**
8352     * Implementation of MessageSendEventsProvider for this object.
8353     */
8354    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8355    /**
8356     * Frees any resources associated with this object given its this_arg pointer.
8357     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8358     */
8359    void (*free)(void *this_arg);
8360 } LDKRoutingMessageHandler;
8361
8362
8363
8364 /**
8365  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8366  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8367  */
8368 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8369    /**
8370     * A pointer to the opaque Rust object.
8371     * Nearly everywhere, inner must be non-null, however in places where
8372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8373     */
8374    LDKnativeIgnoringMessageHandler *inner;
8375    /**
8376     * Indicates that this is the only struct which contains the same pointer.
8377     * Rust functions which take ownership of an object provided via an argument require
8378     * this to be true and invalidate the object pointed to by inner.
8379     */
8380    bool is_owned;
8381 } LDKIgnoringMessageHandler;
8382
8383
8384
8385 /**
8386  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8387  * You can provide one of these as the route_handler in a MessageHandler.
8388  */
8389 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8390    /**
8391     * A pointer to the opaque Rust object.
8392     * Nearly everywhere, inner must be non-null, however in places where
8393     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8394     */
8395    LDKnativeErroringMessageHandler *inner;
8396    /**
8397     * Indicates that this is the only struct which contains the same pointer.
8398     * Rust functions which take ownership of an object provided via an argument require
8399     * this to be true and invalidate the object pointed to by inner.
8400     */
8401    bool is_owned;
8402 } LDKErroringMessageHandler;
8403
8404
8405
8406 /**
8407  * Provides references to trait impls which handle different types of messages.
8408  */
8409 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8410    /**
8411     * A pointer to the opaque Rust object.
8412     * Nearly everywhere, inner must be non-null, however in places where
8413     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8414     */
8415    LDKnativeMessageHandler *inner;
8416    /**
8417     * Indicates that this is the only struct which contains the same pointer.
8418     * Rust functions which take ownership of an object provided via an argument require
8419     * this to be true and invalidate the object pointed to by inner.
8420     */
8421    bool is_owned;
8422 } LDKMessageHandler;
8423
8424 /**
8425  * Provides an object which can be used to send data to and which uniquely identifies a connection
8426  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8427  * implement Hash to meet the PeerManager API.
8428  *
8429  * For efficiency, Clone should be relatively cheap for this type.
8430  *
8431  * You probably want to just extend an int and put a file descriptor in a struct and implement
8432  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8433  * be careful to ensure you don't have races whereby you might register a new connection with an
8434  * fd which is the same as a previous one which has yet to be removed via
8435  * PeerManager::socket_disconnected().
8436  */
8437 typedef struct LDKSocketDescriptor {
8438    /**
8439     * An opaque pointer which is passed to your function implementations as an argument.
8440     * This has no meaning in the LDK, and can be NULL or any other value.
8441     */
8442    void *this_arg;
8443    /**
8444     * Attempts to send some data from the given slice to the peer.
8445     *
8446     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8447     * Note that in the disconnected case, socket_disconnected must still fire and further write
8448     * attempts may occur until that time.
8449     *
8450     * If the returned size is smaller than data.len(), a write_available event must
8451     * trigger the next time more data can be written. Additionally, until the a send_data event
8452     * completes fully, no further read_events should trigger on the same peer!
8453     *
8454     * If a read_event on this descriptor had previously returned true (indicating that read
8455     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8456     * indicating that read events on this descriptor should resume. A resume_read of false does
8457     * *not* imply that further read events should be paused.
8458     */
8459    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8460    /**
8461     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8462     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8463     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8464     * though races may occur whereby disconnect_socket is called after a call to
8465     * socket_disconnected but prior to socket_disconnected returning.
8466     */
8467    void (*disconnect_socket)(void *this_arg);
8468    /**
8469     * Checks if two objects are equal given this object's this_arg pointer and another object.
8470     */
8471    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8472    /**
8473     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8474     * This is used, for example, for inclusion of this object in a hash map.
8475     */
8476    uint64_t (*hash)(const void *this_arg);
8477    /**
8478     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8479     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8480     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8481     */
8482    void *(*clone)(const void *this_arg);
8483    /**
8484     * Frees any resources associated with this object given its this_arg pointer.
8485     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8486     */
8487    void (*free)(void *this_arg);
8488 } LDKSocketDescriptor;
8489
8490
8491
8492 /**
8493  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8494  * events into messages which it passes on to its MessageHandlers.
8495  *
8496  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8497  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8498  * essentially you should default to using a SimpleRefPeerManager, and use a
8499  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8500  * you're using lightning-net-tokio.
8501  */
8502 typedef struct MUST_USE_STRUCT LDKPeerManager {
8503    /**
8504     * A pointer to the opaque Rust object.
8505     * Nearly everywhere, inner must be non-null, however in places where
8506     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8507     */
8508    LDKnativePeerManager *inner;
8509    /**
8510     * Indicates that this is the only struct which contains the same pointer.
8511     * Rust functions which take ownership of an object provided via an argument require
8512     * this to be true and invalidate the object pointed to by inner.
8513     */
8514    bool is_owned;
8515 } LDKPeerManager;
8516
8517
8518
8519 /**
8520  * Static channel fields used to build transactions given per-commitment fields, organized by
8521  * broadcaster/countersignatory.
8522  *
8523  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8524  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8525  */
8526 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8527    /**
8528     * A pointer to the opaque Rust object.
8529     * Nearly everywhere, inner must be non-null, however in places where
8530     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8531     */
8532    LDKnativeDirectedChannelTransactionParameters *inner;
8533    /**
8534     * Indicates that this is the only struct which contains the same pointer.
8535     * Rust functions which take ownership of an object provided via an argument require
8536     * this to be true and invalidate the object pointed to by inner.
8537     */
8538    bool is_owned;
8539 } LDKDirectedChannelTransactionParameters;
8540
8541
8542
8543 /**
8544  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8545  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8546  * the C bindings, as it can be done directly in Rust code.
8547  */
8548 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8549    /**
8550     * A pointer to the opaque Rust object.
8551     * Nearly everywhere, inner must be non-null, however in places where
8552     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8553     */
8554    LDKnativeLockedNetworkGraph *inner;
8555    /**
8556     * Indicates that this is the only struct which contains the same pointer.
8557     * Rust functions which take ownership of an object provided via an argument require
8558     * this to be true and invalidate the object pointed to by inner.
8559     */
8560    bool is_owned;
8561 } LDKLockedNetworkGraph;
8562
8563
8564
8565 /**
8566  * Receives and validates network updates from peers,
8567  * stores authentic and relevant data as a network graph.
8568  * This network graph is then used for routing payments.
8569  * Provides interface to help with initial routing sync by
8570  * serving historical announcements.
8571  */
8572 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8573    /**
8574     * A pointer to the opaque Rust object.
8575     * Nearly everywhere, inner must be non-null, however in places where
8576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8577     */
8578    LDKnativeNetGraphMsgHandler *inner;
8579    /**
8580     * Indicates that this is the only struct which contains the same pointer.
8581     * Rust functions which take ownership of an object provided via an argument require
8582     * this to be true and invalidate the object pointed to by inner.
8583     */
8584    bool is_owned;
8585 } LDKNetGraphMsgHandler;
8586
8587
8588
8589 /**
8590  * FilesystemPersister persists channel data on disk, where each channel's
8591  * data is stored in a file named after its funding outpoint.
8592  *
8593  * Warning: this module does the best it can with calls to persist data, but it
8594  * can only guarantee that the data is passed to the drive. It is up to the
8595  * drive manufacturers to do the actual persistence properly, which they often
8596  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8597  * user to validate their entire storage stack, to ensure the writes are
8598  * persistent.
8599  * Corollary: especially when dealing with larger amounts of money, it is best
8600  * practice to have multiple channel data backups and not rely only on one
8601  * FilesystemPersister.
8602  */
8603 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8604    /**
8605     * A pointer to the opaque Rust object.
8606     * Nearly everywhere, inner must be non-null, however in places where
8607     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8608     */
8609    LDKnativeFilesystemPersister *inner;
8610    /**
8611     * Indicates that this is the only struct which contains the same pointer.
8612     * Rust functions which take ownership of an object provided via an argument require
8613     * this to be true and invalidate the object pointed to by inner.
8614     */
8615    bool is_owned;
8616 } LDKFilesystemPersister;
8617
8618
8619
8620 /**
8621  * Data of the `RawInvoice` that is encoded in the data part
8622  */
8623 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8624    /**
8625     * A pointer to the opaque Rust object.
8626     * Nearly everywhere, inner must be non-null, however in places where
8627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8628     */
8629    LDKnativeRawDataPart *inner;
8630    /**
8631     * Indicates that this is the only struct which contains the same pointer.
8632     * Rust functions which take ownership of an object provided via an argument require
8633     * this to be true and invalidate the object pointed to by inner.
8634     */
8635    bool is_owned;
8636 } LDKRawDataPart;
8637
8638
8639
8640 /**
8641  * SHA-256 hash
8642  */
8643 typedef struct MUST_USE_STRUCT LDKSha256 {
8644    /**
8645     * A pointer to the opaque Rust object.
8646     * Nearly everywhere, inner must be non-null, however in places where
8647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8648     */
8649    LDKnativeSha256 *inner;
8650    /**
8651     * Indicates that this is the only struct which contains the same pointer.
8652     * Rust functions which take ownership of an object provided via an argument require
8653     * this to be true and invalidate the object pointed to by inner.
8654     */
8655    bool is_owned;
8656 } LDKSha256;
8657
8658
8659
8660 /**
8661  * `min_final_cltv_expiry` to use for the last HTLC in the route
8662  */
8663 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8664    /**
8665     * A pointer to the opaque Rust object.
8666     * Nearly everywhere, inner must be non-null, however in places where
8667     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8668     */
8669    LDKnativeMinFinalCltvExpiry *inner;
8670    /**
8671     * Indicates that this is the only struct which contains the same pointer.
8672     * Rust functions which take ownership of an object provided via an argument require
8673     * this to be true and invalidate the object pointed to by inner.
8674     */
8675    bool is_owned;
8676 } LDKMinFinalCltvExpiry;
8677
8678 /**
8679  * Integer in the range `0..32`
8680  */
8681 typedef struct LDKu5 {
8682    uint8_t _0;
8683 } LDKu5;
8684
8685 /**
8686  * A 20-byte byte array.
8687  */
8688 typedef struct LDKTwentyBytes {
8689    /**
8690     * The twenty bytes
8691     */
8692    uint8_t data[20];
8693 } LDKTwentyBytes;
8694
8695 /**
8696  * Fallback address in case no LN payment is possible
8697  */
8698 typedef enum LDKFallback_Tag {
8699    LDKFallback_SegWitProgram,
8700    LDKFallback_PubKeyHash,
8701    LDKFallback_ScriptHash,
8702    /**
8703     * Must be last for serialization purposes
8704     */
8705    LDKFallback_Sentinel,
8706 } LDKFallback_Tag;
8707
8708 typedef struct LDKFallback_LDKSegWitProgram_Body {
8709    struct LDKu5 version;
8710    struct LDKCVec_u8Z program;
8711 } LDKFallback_LDKSegWitProgram_Body;
8712
8713 typedef struct MUST_USE_STRUCT LDKFallback {
8714    LDKFallback_Tag tag;
8715    union {
8716       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8717       struct {
8718          struct LDKTwentyBytes pub_key_hash;
8719       };
8720       struct {
8721          struct LDKTwentyBytes script_hash;
8722       };
8723    };
8724 } LDKFallback;
8725
8726 extern const uintptr_t MAX_BUF_SIZE;
8727
8728 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8729
8730 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8731
8732 extern const uint16_t BREAKDOWN_TIMEOUT;
8733
8734 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8735
8736 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8737
8738 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8739
8740 extern const uint8_t TAG_PAYMENT_HASH;
8741
8742 extern const uint8_t TAG_DESCRIPTION;
8743
8744 extern const uint8_t TAG_PAYEE_PUB_KEY;
8745
8746 extern const uint8_t TAG_DESCRIPTION_HASH;
8747
8748 extern const uint8_t TAG_EXPIRY_TIME;
8749
8750 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
8751
8752 extern const uint8_t TAG_FALLBACK;
8753
8754 extern const uint8_t TAG_ROUTE;
8755
8756 extern const uint8_t TAG_PAYMENT_SECRET;
8757
8758 extern const uint8_t TAG_FEATURES;
8759
8760 struct LDKStr _ldk_get_compiled_version(void);
8761
8762 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
8763
8764 /**
8765  * Frees the data buffer, if data_is_owned is set and datalen > 0.
8766  */
8767 void Transaction_free(struct LDKTransaction _res);
8768
8769 /**
8770  * Frees the data pointed to by script_pubkey.
8771  */
8772 void TxOut_free(struct LDKTxOut _res);
8773
8774 /**
8775  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
8776  */
8777 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
8778
8779 /**
8780  * Frees the data buffer, if chars_is_owned is set and len > 0.
8781  */
8782 void Str_free(struct LDKStr _res);
8783
8784 /**
8785  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
8786  */
8787 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
8788
8789 /**
8790  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
8791  */
8792 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
8793
8794 /**
8795  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
8796  */
8797 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
8798
8799 /**
8800  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
8801  * but with all dynamically-allocated buffers duplicated in new buffers.
8802  */
8803 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
8804
8805 /**
8806  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
8807  */
8808 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
8809
8810 /**
8811  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
8812  */
8813 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
8814
8815 /**
8816  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
8817  */
8818 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
8819
8820 /**
8821  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
8822  * but with all dynamically-allocated buffers duplicated in new buffers.
8823  */
8824 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
8825
8826 /**
8827  * Creates a new CResult_SecretKeyErrorZ in the success state.
8828  */
8829 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
8830
8831 /**
8832  * Creates a new CResult_SecretKeyErrorZ in the error state.
8833  */
8834 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
8835
8836 /**
8837  * Frees any resources used by the CResult_SecretKeyErrorZ.
8838  */
8839 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
8840
8841 /**
8842  * Creates a new CResult_PublicKeyErrorZ in the success state.
8843  */
8844 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
8845
8846 /**
8847  * Creates a new CResult_PublicKeyErrorZ in the error state.
8848  */
8849 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
8850
8851 /**
8852  * Frees any resources used by the CResult_PublicKeyErrorZ.
8853  */
8854 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
8855
8856 /**
8857  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
8858  */
8859 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
8860
8861 /**
8862  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
8863  */
8864 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
8865
8866 /**
8867  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
8868  */
8869 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
8870
8871 /**
8872  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
8873  * but with all dynamically-allocated buffers duplicated in new buffers.
8874  */
8875 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
8876
8877 /**
8878  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
8879  */
8880 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
8881
8882 /**
8883  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
8884  */
8885 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
8886
8887 /**
8888  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
8889  */
8890 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
8891
8892 /**
8893  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
8894  * but with all dynamically-allocated buffers duplicated in new buffers.
8895  */
8896 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
8897
8898 /**
8899  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
8900  */
8901 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
8902
8903 /**
8904  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
8905  */
8906 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
8907
8908 /**
8909  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
8910  */
8911 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
8912
8913 /**
8914  * Constructs a new COption_u32Z containing a u32
8915  */
8916 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
8917
8918 /**
8919  * Constructs a new COption_u32Z containing nothing
8920  */
8921 struct LDKCOption_u32Z COption_u32Z_none(void);
8922
8923 /**
8924  * Frees any resources associated with the u32, if we are in the Some state
8925  */
8926 void COption_u32Z_free(struct LDKCOption_u32Z _res);
8927
8928 /**
8929  * Creates a new COption_u32Z which has the same data as `orig`
8930  * but with all dynamically-allocated buffers duplicated in new buffers.
8931  */
8932 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
8933
8934 /**
8935  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
8936  */
8937 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
8938
8939 /**
8940  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
8941  */
8942 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
8943
8944 /**
8945  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
8946  */
8947 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
8948
8949 /**
8950  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
8951  * but with all dynamically-allocated buffers duplicated in new buffers.
8952  */
8953 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
8954
8955 /**
8956  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
8957  */
8958 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
8959
8960 /**
8961  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
8962  */
8963 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8964
8965 /**
8966  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
8967  */
8968 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
8969
8970 /**
8971  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8972  * but with all dynamically-allocated buffers duplicated in new buffers.
8973  */
8974 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8975
8976 /**
8977  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
8978  */
8979 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
8980
8981 /**
8982  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
8983  */
8984 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
8985
8986 /**
8987  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
8988  */
8989 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
8990
8991 /**
8992  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
8993  * but with all dynamically-allocated buffers duplicated in new buffers.
8994  */
8995 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
8996
8997 /**
8998  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8999  */
9000 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9001
9002 /**
9003  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9004  */
9005 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9006
9007 /**
9008  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9009  */
9010 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9011
9012 /**
9013  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9014  */
9015 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9016
9017 /**
9018  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9019  * but with all dynamically-allocated buffers duplicated in new buffers.
9020  */
9021 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9022
9023 /**
9024  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9025  */
9026 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9027
9028 /**
9029  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9030  */
9031 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9032
9033 /**
9034  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9035  */
9036 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9037
9038 /**
9039  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9040  * but with all dynamically-allocated buffers duplicated in new buffers.
9041  */
9042 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9043
9044 /**
9045  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9046  */
9047 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9048
9049 /**
9050  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9051  */
9052 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9053
9054 /**
9055  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9056  */
9057 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9058
9059 /**
9060  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9061  * but with all dynamically-allocated buffers duplicated in new buffers.
9062  */
9063 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9064
9065 /**
9066  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9067  */
9068 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9069
9070 /**
9071  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9072  */
9073 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9074
9075 /**
9076  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9077  */
9078 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9079
9080 /**
9081  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9082  */
9083 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9084
9085 /**
9086  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9087  */
9088 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9089
9090 /**
9091  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9092  */
9093 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9094
9095 /**
9096  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9097  * but with all dynamically-allocated buffers duplicated in new buffers.
9098  */
9099 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9100
9101 /**
9102  * Creates a new CResult_SiPrefixNoneZ in the success state.
9103  */
9104 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
9105
9106 /**
9107  * Creates a new CResult_SiPrefixNoneZ in the error state.
9108  */
9109 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
9110
9111 /**
9112  * Frees any resources used by the CResult_SiPrefixNoneZ.
9113  */
9114 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
9115
9116 /**
9117  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
9118  * but with all dynamically-allocated buffers duplicated in new buffers.
9119  */
9120 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
9121
9122 /**
9123  * Creates a new CResult_InvoiceNoneZ in the success state.
9124  */
9125 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
9126
9127 /**
9128  * Creates a new CResult_InvoiceNoneZ in the error state.
9129  */
9130 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
9131
9132 /**
9133  * Frees any resources used by the CResult_InvoiceNoneZ.
9134  */
9135 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
9136
9137 /**
9138  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
9139  * but with all dynamically-allocated buffers duplicated in new buffers.
9140  */
9141 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
9142
9143 /**
9144  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
9145  */
9146 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
9147
9148 /**
9149  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
9150  */
9151 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
9152
9153 /**
9154  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
9155  */
9156 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
9157
9158 /**
9159  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
9160  * but with all dynamically-allocated buffers duplicated in new buffers.
9161  */
9162 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
9163
9164 /**
9165  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9166  */
9167 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9168
9169 /**
9170  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9171  */
9172 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
9173
9174 /**
9175  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9176  */
9177 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
9178
9179 /**
9180  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
9181  */
9182 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
9183
9184 /**
9185  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
9186  */
9187 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
9188
9189 /**
9190  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
9191  */
9192 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
9193
9194 /**
9195  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9196  */
9197 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9198
9199 /**
9200  * Constructs a new COption_u64Z containing a u64
9201  */
9202 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9203
9204 /**
9205  * Constructs a new COption_u64Z containing nothing
9206  */
9207 struct LDKCOption_u64Z COption_u64Z_none(void);
9208
9209 /**
9210  * Frees any resources associated with the u64, if we are in the Some state
9211  */
9212 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9213
9214 /**
9215  * Creates a new COption_u64Z which has the same data as `orig`
9216  * but with all dynamically-allocated buffers duplicated in new buffers.
9217  */
9218 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9219
9220 /**
9221  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9222  */
9223 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
9224
9225 /**
9226  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9227  */
9228 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
9229
9230 /**
9231  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9232  */
9233 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
9234
9235 /**
9236  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9237  * but with all dynamically-allocated buffers duplicated in new buffers.
9238  */
9239 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
9240
9241 /**
9242  * Creates a new CResult_NoneSemanticErrorZ in the success state.
9243  */
9244 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
9245
9246 /**
9247  * Creates a new CResult_NoneSemanticErrorZ in the error state.
9248  */
9249 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
9250
9251 /**
9252  * Frees any resources used by the CResult_NoneSemanticErrorZ.
9253  */
9254 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
9255
9256 /**
9257  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
9258  * but with all dynamically-allocated buffers duplicated in new buffers.
9259  */
9260 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
9261
9262 /**
9263  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
9264  */
9265 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
9266
9267 /**
9268  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
9269  */
9270 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
9271
9272 /**
9273  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
9274  */
9275 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
9276
9277 /**
9278  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
9279  * but with all dynamically-allocated buffers duplicated in new buffers.
9280  */
9281 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
9282
9283 /**
9284  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
9285  */
9286 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
9287
9288 /**
9289  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
9290  */
9291 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
9292
9293 /**
9294  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
9295  */
9296 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
9297
9298 /**
9299  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9300  * but with all dynamically-allocated buffers duplicated in new buffers.
9301  */
9302 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
9303
9304 /**
9305  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
9306  */
9307 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
9308
9309 /**
9310  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
9311  */
9312 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
9313
9314 /**
9315  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
9316  */
9317 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
9318
9319 /**
9320  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
9321  * but with all dynamically-allocated buffers duplicated in new buffers.
9322  */
9323 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
9324
9325 /**
9326  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9327  */
9328 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9329
9330 /**
9331  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
9332  */
9333 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
9334
9335 /**
9336  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
9337  */
9338 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
9339
9340 /**
9341  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
9342  */
9343 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
9344
9345 /**
9346  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
9347  * but with all dynamically-allocated buffers duplicated in new buffers.
9348  */
9349 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
9350
9351 /**
9352  * Creates a new CResult_StringErrorZ in the success state.
9353  */
9354 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
9355
9356 /**
9357  * Creates a new CResult_StringErrorZ in the error state.
9358  */
9359 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
9360
9361 /**
9362  * Frees any resources used by the CResult_StringErrorZ.
9363  */
9364 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
9365
9366 /**
9367  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9368  */
9369 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
9370
9371 /**
9372  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9373  */
9374 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9375
9376 /**
9377  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9378  */
9379 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
9380
9381 /**
9382  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9383  * but with all dynamically-allocated buffers duplicated in new buffers.
9384  */
9385 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
9386
9387 /**
9388  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9389  */
9390 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
9391
9392 /**
9393  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9394  */
9395 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9396
9397 /**
9398  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9399  */
9400 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
9401
9402 /**
9403  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9404  * but with all dynamically-allocated buffers duplicated in new buffers.
9405  */
9406 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
9407
9408 /**
9409  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
9410  */
9411 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
9412
9413 /**
9414  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
9415  */
9416 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
9417
9418 /**
9419  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
9420  */
9421 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
9422
9423 /**
9424  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
9425  * but with all dynamically-allocated buffers duplicated in new buffers.
9426  */
9427 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
9428
9429 /**
9430  * Creates a new tuple which has the same data as `orig`
9431  * but with all dynamically-allocated buffers duplicated in new buffers.
9432  */
9433 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
9434
9435 /**
9436  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9437  */
9438 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
9439
9440 /**
9441  * Frees any resources used by the C2Tuple_OutPointScriptZ.
9442  */
9443 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
9444
9445 /**
9446  * Creates a new tuple which has the same data as `orig`
9447  * but with all dynamically-allocated buffers duplicated in new buffers.
9448  */
9449 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
9450
9451 /**
9452  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
9453  */
9454 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
9455
9456 /**
9457  * Frees any resources used by the C2Tuple_u32ScriptZ.
9458  */
9459 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
9460
9461 /**
9462  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9463  */
9464 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
9465
9466 /**
9467  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9468  */
9469 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
9470
9471 /**
9472  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9473  */
9474 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
9475
9476 /**
9477  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9478  */
9479 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
9480
9481 /**
9482  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9483  */
9484 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9485
9486 /**
9487  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9488  */
9489 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
9490
9491 /**
9492  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9493  */
9494 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
9495
9496 /**
9497  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9498  */
9499 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9500
9501 /**
9502  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9503  */
9504 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9505
9506 /**
9507  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9508  */
9509 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9510
9511 /**
9512  * Creates a new tuple which has the same data as `orig`
9513  * but with all dynamically-allocated buffers duplicated in new buffers.
9514  */
9515 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
9516
9517 /**
9518  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
9519  */
9520 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
9521
9522 /**
9523  * Frees any resources used by the C2Tuple_u32TxOutZ.
9524  */
9525 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
9526
9527 /**
9528  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9529  */
9530 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
9531
9532 /**
9533  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9534  */
9535 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
9536
9537 /**
9538  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9539  */
9540 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
9541
9542 /**
9543  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9544  */
9545 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
9546
9547 /**
9548  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9549  */
9550 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9551
9552 /**
9553  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9554  */
9555 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9556
9557 /**
9558  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9559  */
9560 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9561
9562 /**
9563  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9564  */
9565 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9566
9567 /**
9568  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9569  * but with all dynamically-allocated buffers duplicated in new buffers.
9570  */
9571 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9572
9573 /**
9574  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9575  */
9576 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9577
9578 /**
9579  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9580  */
9581 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9582
9583 /**
9584  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9585  */
9586 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
9587
9588 /**
9589  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9590  */
9591 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
9592
9593 /**
9594  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9595  */
9596 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
9597
9598 /**
9599  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9600  */
9601 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9602
9603 /**
9604  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9605  */
9606 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9607
9608 /**
9609  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9610  */
9611 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9612
9613 /**
9614  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9615  */
9616 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9617
9618 /**
9619  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9620  */
9621 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9622
9623 /**
9624  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9625  * but with all dynamically-allocated buffers duplicated in new buffers.
9626  */
9627 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9628
9629 /**
9630  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9631  */
9632 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9633
9634 /**
9635  * Creates a new CResult_RouteLightningErrorZ in the success state.
9636  */
9637 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9638
9639 /**
9640  * Creates a new CResult_RouteLightningErrorZ in the error state.
9641  */
9642 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9643
9644 /**
9645  * Frees any resources used by the CResult_RouteLightningErrorZ.
9646  */
9647 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9648
9649 /**
9650  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9651  * but with all dynamically-allocated buffers duplicated in new buffers.
9652  */
9653 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9654
9655 /**
9656  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9657  */
9658 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9659
9660 /**
9661  * Creates a new CResult_boolLightningErrorZ in the success state.
9662  */
9663 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
9664
9665 /**
9666  * Creates a new CResult_boolLightningErrorZ in the error state.
9667  */
9668 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
9669
9670 /**
9671  * Frees any resources used by the CResult_boolLightningErrorZ.
9672  */
9673 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
9674
9675 /**
9676  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9677  * but with all dynamically-allocated buffers duplicated in new buffers.
9678  */
9679 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
9680
9681 /**
9682  * Creates a new tuple which has the same data as `orig`
9683  * but with all dynamically-allocated buffers duplicated in new buffers.
9684  */
9685 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
9686
9687 /**
9688  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9689  */
9690 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
9691
9692 /**
9693  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9694  */
9695 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
9696
9697 /**
9698  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9699  */
9700 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
9701
9702 /**
9703  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9704  */
9705 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
9706
9707 /**
9708  * Creates a new CResult_NoneLightningErrorZ in the success state.
9709  */
9710 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
9711
9712 /**
9713  * Creates a new CResult_NoneLightningErrorZ in the error state.
9714  */
9715 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
9716
9717 /**
9718  * Frees any resources used by the CResult_NoneLightningErrorZ.
9719  */
9720 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
9721
9722 /**
9723  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9724  * but with all dynamically-allocated buffers duplicated in new buffers.
9725  */
9726 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
9727
9728 /**
9729  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9730  */
9731 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
9732
9733 /**
9734  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9735  */
9736 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
9737
9738 /**
9739  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9740  */
9741 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9742
9743 /**
9744  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9745  */
9746 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
9747
9748 /**
9749  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9750  * but with all dynamically-allocated buffers duplicated in new buffers.
9751  */
9752 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
9753
9754 /**
9755  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
9756  */
9757 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
9758
9759 /**
9760  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
9761  */
9762 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
9763
9764 /**
9765  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
9766  */
9767 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
9768
9769 /**
9770  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9771  * but with all dynamically-allocated buffers duplicated in new buffers.
9772  */
9773 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
9774
9775 /**
9776  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
9777  */
9778 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
9779
9780 /**
9781  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
9782  */
9783 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
9784
9785 /**
9786  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
9787  */
9788 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
9789
9790 /**
9791  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9792  * but with all dynamically-allocated buffers duplicated in new buffers.
9793  */
9794 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
9795
9796 /**
9797  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9798  */
9799 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9800
9801 /**
9802  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9803  */
9804 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9805
9806 /**
9807  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9808  */
9809 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9810
9811 /**
9812  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9813  * but with all dynamically-allocated buffers duplicated in new buffers.
9814  */
9815 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9816
9817 /**
9818  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9819  */
9820 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9821
9822 /**
9823  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9824  */
9825 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9826
9827 /**
9828  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9829  */
9830 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9831
9832 /**
9833  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9834  */
9835 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9836
9837 /**
9838  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9839  */
9840 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
9841
9842 /**
9843  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9844  */
9845 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9846
9847 /**
9848  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9849  */
9850 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
9851
9852 /**
9853  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9854  * but with all dynamically-allocated buffers duplicated in new buffers.
9855  */
9856 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9857
9858 /**
9859  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9860  */
9861 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
9862
9863 /**
9864  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9865  */
9866 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
9867
9868 /**
9869  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9870  */
9871 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
9872
9873 /**
9874  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9875  * but with all dynamically-allocated buffers duplicated in new buffers.
9876  */
9877 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
9878
9879 /**
9880  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9881  */
9882 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
9883
9884 /**
9885  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9886  */
9887 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
9888
9889 /**
9890  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9891  */
9892 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
9893
9894 /**
9895  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9896  * but with all dynamically-allocated buffers duplicated in new buffers.
9897  */
9898 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
9899
9900 /**
9901  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9902  */
9903 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9904
9905 /**
9906  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9907  */
9908 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
9909
9910 /**
9911  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9912  */
9913 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
9914
9915 /**
9916  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
9917  */
9918 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
9919
9920 /**
9921  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9922  * but with all dynamically-allocated buffers duplicated in new buffers.
9923  */
9924 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
9925
9926 /**
9927  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9928  */
9929 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
9930
9931 /**
9932  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9933  */
9934 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
9935
9936 /**
9937  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9938  */
9939 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
9940
9941 /**
9942  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9943  */
9944 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
9945
9946 /**
9947  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9948  * but with all dynamically-allocated buffers duplicated in new buffers.
9949  */
9950 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
9951
9952 /**
9953  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9954  */
9955 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
9956
9957 /**
9958  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9959  */
9960 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
9961
9962 /**
9963  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9964  */
9965 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
9966
9967 /**
9968  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9969  * but with all dynamically-allocated buffers duplicated in new buffers.
9970  */
9971 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
9972
9973 /**
9974  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9975  */
9976 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9977
9978 /**
9979  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9980  */
9981 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9982
9983 /**
9984  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9985  */
9986 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9987
9988 /**
9989  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9990  */
9991 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9992
9993 /**
9994  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9995  */
9996 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9997
9998 /**
9999  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
10000  */
10001 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
10002
10003 /**
10004  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10005  */
10006 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10007
10008 /**
10009  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10010  */
10011 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10012
10013 /**
10014  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10015  */
10016 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10017
10018 /**
10019  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10020  */
10021 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10022
10023 /**
10024  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10025  */
10026 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10027
10028 /**
10029  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10030  */
10031 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10032
10033 /**
10034  * Creates a new CResult_NetAddressu8Z in the success state.
10035  */
10036 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10037
10038 /**
10039  * Creates a new CResult_NetAddressu8Z in the error state.
10040  */
10041 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10042
10043 /**
10044  * Frees any resources used by the CResult_NetAddressu8Z.
10045  */
10046 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10047
10048 /**
10049  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10050  * but with all dynamically-allocated buffers duplicated in new buffers.
10051  */
10052 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10053
10054 /**
10055  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10056  */
10057 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10058
10059 /**
10060  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10061  */
10062 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10063
10064 /**
10065  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10066  */
10067 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10068
10069 /**
10070  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10071  * but with all dynamically-allocated buffers duplicated in new buffers.
10072  */
10073 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10074
10075 /**
10076  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10077  */
10078 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10079
10080 /**
10081  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10082  */
10083 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10084
10085 /**
10086  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10087  */
10088 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10089
10090 /**
10091  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10092  */
10093 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10094
10095 /**
10096  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10097  */
10098 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10099
10100 /**
10101  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10102  */
10103 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10104
10105 /**
10106  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10107  */
10108 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10109
10110 /**
10111  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10112  * but with all dynamically-allocated buffers duplicated in new buffers.
10113  */
10114 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10115
10116 /**
10117  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10118  */
10119 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10120
10121 /**
10122  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10123  */
10124 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10125
10126 /**
10127  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10128  */
10129 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10130
10131 /**
10132  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10133  * but with all dynamically-allocated buffers duplicated in new buffers.
10134  */
10135 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10136
10137 /**
10138  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10139  */
10140 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10141
10142 /**
10143  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10144  */
10145 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10146
10147 /**
10148  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10149  */
10150 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10151
10152 /**
10153  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10154  * but with all dynamically-allocated buffers duplicated in new buffers.
10155  */
10156 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10157
10158 /**
10159  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10160  */
10161 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10162
10163 /**
10164  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10165  */
10166 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10167
10168 /**
10169  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10170  */
10171 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10172
10173 /**
10174  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10175  * but with all dynamically-allocated buffers duplicated in new buffers.
10176  */
10177 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10178
10179 /**
10180  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10181  */
10182 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10183
10184 /**
10185  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10186  */
10187 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10188
10189 /**
10190  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10191  */
10192 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10193
10194 /**
10195  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10196  * but with all dynamically-allocated buffers duplicated in new buffers.
10197  */
10198 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10199
10200 /**
10201  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10202  */
10203 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10204
10205 /**
10206  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10207  */
10208 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10209
10210 /**
10211  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10212  */
10213 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10214
10215 /**
10216  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10217  * but with all dynamically-allocated buffers duplicated in new buffers.
10218  */
10219 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10220
10221 /**
10222  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10223  */
10224 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10225
10226 /**
10227  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10228  */
10229 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10230
10231 /**
10232  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10233  */
10234 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10235
10236 /**
10237  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10238  * but with all dynamically-allocated buffers duplicated in new buffers.
10239  */
10240 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10241
10242 /**
10243  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10244  */
10245 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10246
10247 /**
10248  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10249  */
10250 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10251
10252 /**
10253  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10254  */
10255 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
10256
10257 /**
10258  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10259  * but with all dynamically-allocated buffers duplicated in new buffers.
10260  */
10261 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
10262
10263 /**
10264  * Creates a new CResult_InitDecodeErrorZ in the success state.
10265  */
10266 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
10267
10268 /**
10269  * Creates a new CResult_InitDecodeErrorZ in the error state.
10270  */
10271 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
10272
10273 /**
10274  * Frees any resources used by the CResult_InitDecodeErrorZ.
10275  */
10276 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
10277
10278 /**
10279  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10280  * but with all dynamically-allocated buffers duplicated in new buffers.
10281  */
10282 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
10283
10284 /**
10285  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10286  */
10287 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
10288
10289 /**
10290  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10291  */
10292 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
10293
10294 /**
10295  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10296  */
10297 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
10298
10299 /**
10300  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10301  * but with all dynamically-allocated buffers duplicated in new buffers.
10302  */
10303 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
10304
10305 /**
10306  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10307  */
10308 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
10309
10310 /**
10311  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10312  */
10313 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
10314
10315 /**
10316  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10317  */
10318 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
10319
10320 /**
10321  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10322  * but with all dynamically-allocated buffers duplicated in new buffers.
10323  */
10324 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
10325
10326 /**
10327  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10328  */
10329 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
10330
10331 /**
10332  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10333  */
10334 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
10335
10336 /**
10337  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10338  */
10339 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
10340
10341 /**
10342  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10343  * but with all dynamically-allocated buffers duplicated in new buffers.
10344  */
10345 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
10346
10347 /**
10348  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10349  */
10350 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
10351
10352 /**
10353  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10354  */
10355 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10356
10357 /**
10358  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10359  */
10360 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
10361
10362 /**
10363  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10364  * but with all dynamically-allocated buffers duplicated in new buffers.
10365  */
10366 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
10367
10368 /**
10369  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10370  */
10371 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
10372
10373 /**
10374  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10375  */
10376 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10377
10378 /**
10379  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10380  */
10381 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
10382
10383 /**
10384  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10385  * but with all dynamically-allocated buffers duplicated in new buffers.
10386  */
10387 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
10388
10389 /**
10390  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10391  */
10392 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
10393
10394 /**
10395  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10396  */
10397 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
10398
10399 /**
10400  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10401  */
10402 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
10403
10404 /**
10405  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10406  * but with all dynamically-allocated buffers duplicated in new buffers.
10407  */
10408 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
10409
10410 /**
10411  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10412  */
10413 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
10414
10415 /**
10416  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10417  */
10418 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10419
10420 /**
10421  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10422  */
10423 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
10424
10425 /**
10426  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10427  * but with all dynamically-allocated buffers duplicated in new buffers.
10428  */
10429 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
10430
10431 /**
10432  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10433  */
10434 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
10435
10436 /**
10437  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10438  */
10439 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
10440
10441 /**
10442  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10443  */
10444 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
10445
10446 /**
10447  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10448  * but with all dynamically-allocated buffers duplicated in new buffers.
10449  */
10450 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
10451
10452 /**
10453  * Creates a new CResult_PingDecodeErrorZ in the success state.
10454  */
10455 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
10456
10457 /**
10458  * Creates a new CResult_PingDecodeErrorZ in the error state.
10459  */
10460 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
10461
10462 /**
10463  * Frees any resources used by the CResult_PingDecodeErrorZ.
10464  */
10465 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
10466
10467 /**
10468  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10469  * but with all dynamically-allocated buffers duplicated in new buffers.
10470  */
10471 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
10472
10473 /**
10474  * Creates a new CResult_PongDecodeErrorZ in the success state.
10475  */
10476 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
10477
10478 /**
10479  * Creates a new CResult_PongDecodeErrorZ in the error state.
10480  */
10481 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
10482
10483 /**
10484  * Frees any resources used by the CResult_PongDecodeErrorZ.
10485  */
10486 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
10487
10488 /**
10489  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10490  * but with all dynamically-allocated buffers duplicated in new buffers.
10491  */
10492 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
10493
10494 /**
10495  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10496  */
10497 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
10498
10499 /**
10500  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10501  */
10502 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10503
10504 /**
10505  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10506  */
10507 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
10508
10509 /**
10510  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10511  * but with all dynamically-allocated buffers duplicated in new buffers.
10512  */
10513 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10514
10515 /**
10516  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10517  */
10518 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
10519
10520 /**
10521  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10522  */
10523 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10524
10525 /**
10526  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10527  */
10528 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
10529
10530 /**
10531  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10532  * but with all dynamically-allocated buffers duplicated in new buffers.
10533  */
10534 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10535
10536 /**
10537  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10538  */
10539 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
10540
10541 /**
10542  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10543  */
10544 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10545
10546 /**
10547  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10548  */
10549 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
10550
10551 /**
10552  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10553  * but with all dynamically-allocated buffers duplicated in new buffers.
10554  */
10555 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10556
10557 /**
10558  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10559  */
10560 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
10561
10562 /**
10563  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10564  */
10565 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10566
10567 /**
10568  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10569  */
10570 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
10571
10572 /**
10573  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10574  * but with all dynamically-allocated buffers duplicated in new buffers.
10575  */
10576 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
10577
10578 /**
10579  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10580  */
10581 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
10582
10583 /**
10584  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10585  */
10586 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
10587
10588 /**
10589  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10590  */
10591 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
10592
10593 /**
10594  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10595  * but with all dynamically-allocated buffers duplicated in new buffers.
10596  */
10597 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
10598
10599 /**
10600  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10601  */
10602 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
10603
10604 /**
10605  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10606  */
10607 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10608
10609 /**
10610  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10611  */
10612 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
10613
10614 /**
10615  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10616  * but with all dynamically-allocated buffers duplicated in new buffers.
10617  */
10618 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10619
10620 /**
10621  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10622  */
10623 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
10624
10625 /**
10626  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10627  */
10628 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
10629
10630 /**
10631  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10632  */
10633 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
10634
10635 /**
10636  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10637  * but with all dynamically-allocated buffers duplicated in new buffers.
10638  */
10639 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
10640
10641 /**
10642  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10643  */
10644 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
10645
10646 /**
10647  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10648  */
10649 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
10650
10651 /**
10652  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10653  */
10654 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
10655
10656 /**
10657  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10658  * but with all dynamically-allocated buffers duplicated in new buffers.
10659  */
10660 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
10661
10662 /**
10663  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10664  */
10665 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
10666
10667 /**
10668  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10669  */
10670 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
10671
10672 /**
10673  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10674  */
10675 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
10676
10677 /**
10678  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10679  * but with all dynamically-allocated buffers duplicated in new buffers.
10680  */
10681 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
10682
10683 /**
10684  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10685  */
10686 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
10687
10688 /**
10689  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10690  */
10691 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10692
10693 /**
10694  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10695  */
10696 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
10697
10698 /**
10699  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10700  * but with all dynamically-allocated buffers duplicated in new buffers.
10701  */
10702 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10703
10704 /**
10705  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10706  */
10707 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
10708
10709 /**
10710  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10711  */
10712 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
10713
10714 /**
10715  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10716  */
10717 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
10718
10719 /**
10720  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10721  * but with all dynamically-allocated buffers duplicated in new buffers.
10722  */
10723 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
10724
10725 /**
10726  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10727  */
10728 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
10729
10730 /**
10731  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10732  */
10733 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
10734
10735 /**
10736  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10737  */
10738 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
10739
10740 /**
10741  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10742  * but with all dynamically-allocated buffers duplicated in new buffers.
10743  */
10744 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
10745
10746 /**
10747  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10748  */
10749 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
10750
10751 /**
10752  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10753  */
10754 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
10755
10756 /**
10757  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
10758  */
10759 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
10760
10761 /**
10762  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
10763  * but with all dynamically-allocated buffers duplicated in new buffers.
10764  */
10765 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
10766
10767 /**
10768  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10769  */
10770 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10771
10772 /**
10773  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10774  */
10775 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10776
10777 /**
10778  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10779  */
10780 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10781
10782 /**
10783  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10784  * but with all dynamically-allocated buffers duplicated in new buffers.
10785  */
10786 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10787
10788 /**
10789  * Creates a new tuple which has the same data as `orig`
10790  * but with all dynamically-allocated buffers duplicated in new buffers.
10791  */
10792 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10793
10794 /**
10795  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10796  */
10797 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10798
10799 /**
10800  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10801  */
10802 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10803
10804 /**
10805  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10806  */
10807 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10808
10809 /**
10810  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10811  */
10812 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10813
10814 /**
10815  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10816  */
10817 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10818
10819 /**
10820  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10821  * but with all dynamically-allocated buffers duplicated in new buffers.
10822  */
10823 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10824
10825 /**
10826  * Creates a new CResult_SignatureNoneZ in the success state.
10827  */
10828 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10829
10830 /**
10831  * Creates a new CResult_SignatureNoneZ in the error state.
10832  */
10833 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10834
10835 /**
10836  * Frees any resources used by the CResult_SignatureNoneZ.
10837  */
10838 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10839
10840 /**
10841  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10842  * but with all dynamically-allocated buffers duplicated in new buffers.
10843  */
10844 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10845
10846 /**
10847  * Creates a new CResult_SignDecodeErrorZ in the success state.
10848  */
10849 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10850
10851 /**
10852  * Creates a new CResult_SignDecodeErrorZ in the error state.
10853  */
10854 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10855
10856 /**
10857  * Frees any resources used by the CResult_SignDecodeErrorZ.
10858  */
10859 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10860
10861 /**
10862  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10863  * but with all dynamically-allocated buffers duplicated in new buffers.
10864  */
10865 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10866
10867 /**
10868  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
10869  */
10870 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
10871
10872 /**
10873  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
10874  */
10875 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
10876
10877 /**
10878  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
10879  */
10880 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
10881
10882 /**
10883  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
10884  * but with all dynamically-allocated buffers duplicated in new buffers.
10885  */
10886 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
10887
10888 /**
10889  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10890  */
10891 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
10892
10893 /**
10894  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
10895  */
10896 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
10897
10898 /**
10899  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
10900  */
10901 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
10902
10903 /**
10904  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
10905  */
10906 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
10907
10908 /**
10909  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
10910  * but with all dynamically-allocated buffers duplicated in new buffers.
10911  */
10912 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
10913
10914 /**
10915  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
10916  */
10917 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
10918
10919 /**
10920  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10921  */
10922 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10923
10924 /**
10925  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10926  */
10927 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10928
10929 /**
10930  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10931  * but with all dynamically-allocated buffers duplicated in new buffers.
10932  */
10933 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10934
10935 /**
10936  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10937  */
10938 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10939
10940 /**
10941  * Creates a new CResult_TransactionNoneZ in the success state.
10942  */
10943 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10944
10945 /**
10946  * Creates a new CResult_TransactionNoneZ in the error state.
10947  */
10948 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10949
10950 /**
10951  * Frees any resources used by the CResult_TransactionNoneZ.
10952  */
10953 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10954
10955 /**
10956  * Creates a new CResult_NoneErrorZ in the success state.
10957  */
10958 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
10959
10960 /**
10961  * Creates a new CResult_NoneErrorZ in the error state.
10962  */
10963 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
10964
10965 /**
10966  * Frees any resources used by the CResult_NoneErrorZ.
10967  */
10968 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
10969
10970 /**
10971  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10972  */
10973 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
10974
10975 /**
10976  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10977  */
10978 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
10979
10980 /**
10981  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10982  */
10983 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
10984
10985 /**
10986  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10987  */
10988 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
10989
10990 /**
10991  * Creates a new CResult_NoneAPIErrorZ in the success state.
10992  */
10993 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
10994
10995 /**
10996  * Creates a new CResult_NoneAPIErrorZ in the error state.
10997  */
10998 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
10999
11000 /**
11001  * Frees any resources used by the CResult_NoneAPIErrorZ.
11002  */
11003 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
11004
11005 /**
11006  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
11007  * but with all dynamically-allocated buffers duplicated in new buffers.
11008  */
11009 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
11010
11011 /**
11012  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11013  */
11014 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
11015
11016 /**
11017  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11018  */
11019 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
11020
11021 /**
11022  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
11023  */
11024 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
11025
11026 /**
11027  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
11028  */
11029 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
11030
11031 /**
11032  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
11033  */
11034 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
11035
11036 /**
11037  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
11038  * but with all dynamically-allocated buffers duplicated in new buffers.
11039  */
11040 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
11041
11042 /**
11043  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
11044  */
11045 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
11046
11047 /**
11048  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
11049  */
11050 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
11051
11052 /**
11053  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
11054  */
11055 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
11056
11057 /**
11058  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
11059  */
11060 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
11061
11062 /**
11063  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
11064  */
11065 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
11066
11067 /**
11068  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11069  */
11070 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
11071
11072 /**
11073  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
11074  */
11075 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
11076
11077 /**
11078  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
11079  */
11080 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
11081
11082 /**
11083  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
11084  */
11085 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
11086
11087 /**
11088  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
11089  */
11090 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
11091
11092 /**
11093  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
11094  */
11095 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
11096
11097 /**
11098  * Frees any resources used by the Event
11099  */
11100 void Event_free(struct LDKEvent this_ptr);
11101
11102 /**
11103  * Creates a copy of the Event
11104  */
11105 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11106
11107 /**
11108  * Serialize the Event object into a byte array which can be read by Event_read
11109  */
11110 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11111
11112 /**
11113  * Frees any resources used by the MessageSendEvent
11114  */
11115 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11116
11117 /**
11118  * Creates a copy of the MessageSendEvent
11119  */
11120 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11121
11122 /**
11123  * Calls the free function if one is set
11124  */
11125 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11126
11127 /**
11128  * Calls the free function if one is set
11129  */
11130 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11131
11132 /**
11133  * Frees any resources used by the APIError
11134  */
11135 void APIError_free(struct LDKAPIError this_ptr);
11136
11137 /**
11138  * Creates a copy of the APIError
11139  */
11140 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11141
11142 /**
11143  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11144  * 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.
11145  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11146  */
11147 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11148
11149 /**
11150  * Recovers the PublicKey of the signer of the message given the message and the signature.
11151  */
11152 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11153
11154 /**
11155  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11156  * and the PublicKey.
11157  */
11158 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11159
11160 /**
11161  * Creates a copy of the Level
11162  */
11163 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11164
11165 /**
11166  * Returns the most verbose logging level.
11167  */
11168 MUST_USE_RES enum LDKLevel Level_max(void);
11169
11170 /**
11171  * Calls the free function if one is set
11172  */
11173 void Logger_free(struct LDKLogger this_ptr);
11174
11175 /**
11176  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11177  */
11178 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11179
11180 /**
11181  * Confirmations we will wait for before considering the channel locked in.
11182  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11183  * equivalent limit applied to outbound channels).
11184  *
11185  * Default value: 6.
11186  */
11187 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11188
11189 /**
11190  * Confirmations we will wait for before considering the channel locked in.
11191  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11192  * equivalent limit applied to outbound channels).
11193  *
11194  * Default value: 6.
11195  */
11196 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11197
11198 /**
11199  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11200  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11201  * transaction).
11202  *
11203  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11204  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11205  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11206  * possibly with time in between to RBF the spending transaction).
11207  *
11208  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11209  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11210  * our channel.
11211  *
11212  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11213  * can tweak config to ask for more security, not less.
11214  */
11215 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11216
11217 /**
11218  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11219  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11220  * transaction).
11221  *
11222  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11223  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11224  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11225  * possibly with time in between to RBF the spending transaction).
11226  *
11227  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11228  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11229  * our channel.
11230  *
11231  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11232  * can tweak config to ask for more security, not less.
11233  */
11234 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11235
11236 /**
11237  * Set to the smallest value HTLC we will accept to process.
11238  *
11239  * This value is sent to our counterparty on channel-open and we close the channel any time
11240  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11241  *
11242  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11243  * by the protocol.
11244  */
11245 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11246
11247 /**
11248  * Set to the smallest value HTLC we will accept to process.
11249  *
11250  * This value is sent to our counterparty on channel-open and we close the channel any time
11251  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11252  *
11253  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11254  * by the protocol.
11255  */
11256 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11257
11258 /**
11259  * Constructs a new ChannelHandshakeConfig given each field
11260  */
11261 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);
11262
11263 /**
11264  * Creates a copy of the ChannelHandshakeConfig
11265  */
11266 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11267
11268 /**
11269  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11270  */
11271 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11272
11273 /**
11274  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11275  */
11276 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11277
11278 /**
11279  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11280  * only applies to inbound channels.
11281  *
11282  * Default value: 0.
11283  */
11284 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11285
11286 /**
11287  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11288  * only applies to inbound channels.
11289  *
11290  * Default value: 0.
11291  */
11292 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11293
11294 /**
11295  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11296  * you to limit the maximum minimum-size they can require.
11297  *
11298  * Default value: u64::max_value.
11299  */
11300 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11301
11302 /**
11303  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11304  * you to limit the maximum minimum-size they can require.
11305  *
11306  * Default value: u64::max_value.
11307  */
11308 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11309
11310 /**
11311  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11312  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11313  *
11314  * Default value: 0.
11315  */
11316 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11317
11318 /**
11319  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11320  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11321  *
11322  * Default value: 0.
11323  */
11324 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11325
11326 /**
11327  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11328  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11329  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11330  *
11331  * Default value: u64::max_value.
11332  */
11333 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11334
11335 /**
11336  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11337  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11338  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11339  *
11340  * Default value: u64::max_value.
11341  */
11342 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11343
11344 /**
11345  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11346  * time. This allows you to set a minimum such value.
11347  *
11348  * Default value: 0.
11349  */
11350 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11351
11352 /**
11353  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11354  * time. This allows you to set a minimum such value.
11355  *
11356  * Default value: 0.
11357  */
11358 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11359
11360 /**
11361  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11362  * required to always be higher than this value so this only applies to HTLC outputs (and
11363  * potentially to-self outputs before any payments have been made).
11364  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11365  * This setting allows you to set a minimum dust limit for their commitment transactions,
11366  * reflecting the reality that tiny outputs are not considered standard transactions and will
11367  * not propagate through the Bitcoin network.
11368  *
11369  * Default value: 546, the current dust limit on the Bitcoin network.
11370  */
11371 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11372
11373 /**
11374  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
11375  * required to always be higher than this value so this only applies to HTLC outputs (and
11376  * potentially to-self outputs before any payments have been made).
11377  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11378  * This setting allows you to set a minimum dust limit for their commitment transactions,
11379  * reflecting the reality that tiny outputs are not considered standard transactions and will
11380  * not propagate through the Bitcoin network.
11381  *
11382  * Default value: 546, the current dust limit on the Bitcoin network.
11383  */
11384 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11385
11386 /**
11387  * Maximum allowed threshold above which outputs will not be generated in their commitment
11388  * transactions.
11389  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11390  *
11391  * Default value: u64::max_value.
11392  */
11393 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11394
11395 /**
11396  * Maximum allowed threshold above which outputs will not be generated in their commitment
11397  * transactions.
11398  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
11399  *
11400  * Default value: u64::max_value.
11401  */
11402 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11403
11404 /**
11405  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11406  * certain number of blocks, specified by the node which is not the funder (as the funder can
11407  * assume they aren't going to double-spend themselves).
11408  * This config allows you to set a limit on the maximum amount of time to wait.
11409  *
11410  * Default value: 144, or roughly one day and only applies to outbound channels.
11411  */
11412 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11413
11414 /**
11415  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11416  * certain number of blocks, specified by the node which is not the funder (as the funder can
11417  * assume they aren't going to double-spend themselves).
11418  * This config allows you to set a limit on the maximum amount of time to wait.
11419  *
11420  * Default value: 144, or roughly one day and only applies to outbound channels.
11421  */
11422 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11423
11424 /**
11425  * Set to force the incoming channel to match our announced channel preference in
11426  * ChannelConfig.
11427  *
11428  * Default value: true, to make the default that no announced channels are possible (which is
11429  * appropriate for any nodes which are not online very reliably).
11430  */
11431 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11432
11433 /**
11434  * Set to force the incoming channel to match our announced channel preference in
11435  * ChannelConfig.
11436  *
11437  * Default value: true, to make the default that no announced channels are possible (which is
11438  * appropriate for any nodes which are not online very reliably).
11439  */
11440 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11441
11442 /**
11443  * Set to the amount of time we're willing to wait to claim money back to us.
11444  *
11445  * Not checking this value would be a security issue, as our peer would be able to set it to
11446  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11447  *
11448  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11449  * reduce the loss of having useless locked funds (if your peer accepts)
11450  */
11451 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11452
11453 /**
11454  * Set to the amount of time we're willing to wait to claim money back to us.
11455  *
11456  * Not checking this value would be a security issue, as our peer would be able to set it to
11457  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11458  *
11459  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11460  * reduce the loss of having useless locked funds (if your peer accepts)
11461  */
11462 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11463
11464 /**
11465  * Constructs a new ChannelHandshakeLimits given each field
11466  */
11467 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);
11468
11469 /**
11470  * Creates a copy of the ChannelHandshakeLimits
11471  */
11472 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11473
11474 /**
11475  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11476  */
11477 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11478
11479 /**
11480  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11481  */
11482 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11483
11484 /**
11485  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11486  * This may be allowed to change at runtime in a later update, however doing so must result in
11487  * update messages sent to notify all nodes of our updated relay fee.
11488  *
11489  * Default value: 0.
11490  */
11491 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11492
11493 /**
11494  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11495  * This may be allowed to change at runtime in a later update, however doing so must result in
11496  * update messages sent to notify all nodes of our updated relay fee.
11497  *
11498  * Default value: 0.
11499  */
11500 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11501
11502 /**
11503  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11504  * the channel this config applies to.
11505  *
11506  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11507  * HTLC balance when a channel appears on-chain whereas
11508  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11509  * (non-HTLC-encumbered) balance.
11510  *
11511  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11512  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11513  * commitment transaction at least once per this many blocks (minus some margin to allow us
11514  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11515  * the spending transaction).
11516  *
11517  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11518  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11519  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11520  *
11521  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11522  */
11523 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11524
11525 /**
11526  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11527  * the channel this config applies to.
11528  *
11529  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11530  * HTLC balance when a channel appears on-chain whereas
11531  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11532  * (non-HTLC-encumbered) balance.
11533  *
11534  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11535  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11536  * commitment transaction at least once per this many blocks (minus some margin to allow us
11537  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11538  * the spending transaction).
11539  *
11540  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11541  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11542  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11543  *
11544  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11545  */
11546 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11547
11548 /**
11549  * Set to announce the channel publicly and notify all nodes that they can route via this
11550  * channel.
11551  *
11552  * This should only be set to true for nodes which expect to be online reliably.
11553  *
11554  * As the node which funds a channel picks this value this will only apply for new outbound
11555  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11556  *
11557  * This cannot be changed after the initial channel handshake.
11558  *
11559  * Default value: false.
11560  */
11561 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11562
11563 /**
11564  * Set to announce the channel publicly and notify all nodes that they can route via this
11565  * channel.
11566  *
11567  * This should only be set to true for nodes which expect to be online reliably.
11568  *
11569  * As the node which funds a channel picks this value this will only apply for new outbound
11570  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11571  *
11572  * This cannot be changed after the initial channel handshake.
11573  *
11574  * Default value: false.
11575  */
11576 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11577
11578 /**
11579  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11580  * supports it, they will then enforce the mutual-close output to us matches what we provided
11581  * at intialization, preventing us from closing to an alternate pubkey.
11582  *
11583  * This is set to true by default to provide a slight increase in security, though ultimately
11584  * any attacker who is able to take control of a channel can just as easily send the funds via
11585  * lightning payments, so we never require that our counterparties support this option.
11586  *
11587  * This cannot be changed after a channel has been initialized.
11588  *
11589  * Default value: true.
11590  */
11591 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11592
11593 /**
11594  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11595  * supports it, they will then enforce the mutual-close output to us matches what we provided
11596  * at intialization, preventing us from closing to an alternate pubkey.
11597  *
11598  * This is set to true by default to provide a slight increase in security, though ultimately
11599  * any attacker who is able to take control of a channel can just as easily send the funds via
11600  * lightning payments, so we never require that our counterparties support this option.
11601  *
11602  * This cannot be changed after a channel has been initialized.
11603  *
11604  * Default value: true.
11605  */
11606 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11607
11608 /**
11609  * Constructs a new ChannelConfig given each field
11610  */
11611 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);
11612
11613 /**
11614  * Creates a copy of the ChannelConfig
11615  */
11616 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
11617
11618 /**
11619  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
11620  */
11621 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
11622
11623 /**
11624  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
11625  */
11626 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
11627
11628 /**
11629  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
11630  */
11631 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
11632
11633 /**
11634  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
11635  */
11636 void UserConfig_free(struct LDKUserConfig this_obj);
11637
11638 /**
11639  * Channel config that we propose to our counterparty.
11640  */
11641 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11642
11643 /**
11644  * Channel config that we propose to our counterparty.
11645  */
11646 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
11647
11648 /**
11649  * Limits applied to our counterparty's proposed channel config settings.
11650  */
11651 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11652
11653 /**
11654  * Limits applied to our counterparty's proposed channel config settings.
11655  */
11656 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
11657
11658 /**
11659  * Channel config which affects behavior during channel lifetime.
11660  */
11661 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
11662
11663 /**
11664  * Channel config which affects behavior during channel lifetime.
11665  */
11666 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
11667
11668 /**
11669  * Constructs a new UserConfig given each field
11670  */
11671 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);
11672
11673 /**
11674  * Creates a copy of the UserConfig
11675  */
11676 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
11677
11678 /**
11679  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
11680  */
11681 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
11682
11683 /**
11684  * Creates a copy of the AccessError
11685  */
11686 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
11687
11688 /**
11689  * Calls the free function if one is set
11690  */
11691 void Access_free(struct LDKAccess this_ptr);
11692
11693 /**
11694  * Calls the free function if one is set
11695  */
11696 void Listen_free(struct LDKListen this_ptr);
11697
11698 /**
11699  * Calls the free function if one is set
11700  */
11701 void Confirm_free(struct LDKConfirm this_ptr);
11702
11703 /**
11704  * Calls the free function if one is set
11705  */
11706 void Watch_free(struct LDKWatch this_ptr);
11707
11708 /**
11709  * Calls the free function if one is set
11710  */
11711 void Filter_free(struct LDKFilter this_ptr);
11712
11713 /**
11714  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
11715  */
11716 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
11717
11718 /**
11719  * First block where the transaction output may have been spent.
11720  */
11721 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11722
11723 /**
11724  * First block where the transaction output may have been spent.
11725  */
11726 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11727
11728 /**
11729  * Outpoint identifying the transaction output.
11730  */
11731 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11732
11733 /**
11734  * Outpoint identifying the transaction output.
11735  */
11736 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
11737
11738 /**
11739  * Spending condition of the transaction output.
11740  */
11741 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
11742
11743 /**
11744  * Spending condition of the transaction output.
11745  */
11746 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11747
11748 /**
11749  * Constructs a new WatchedOutput given each field
11750  */
11751 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
11752
11753 /**
11754  * Calls the free function if one is set
11755  */
11756 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
11757
11758 /**
11759  * Creates a copy of the ConfirmationTarget
11760  */
11761 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
11762
11763 /**
11764  * Calls the free function if one is set
11765  */
11766 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
11767
11768 /**
11769  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
11770  */
11771 void ChainMonitor_free(struct LDKChainMonitor this_obj);
11772
11773 /**
11774  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
11775  *
11776  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
11777  * will call back to it indicating transactions and outputs of interest. This allows clients to
11778  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
11779  * always need to fetch full blocks absent another means for determining which blocks contain
11780  * transactions relevant to the watched channels.
11781  */
11782 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
11783
11784 /**
11785  * Constructs a new Listen which calls the relevant methods on this_arg.
11786  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11787  */
11788 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11789
11790 /**
11791  * Constructs a new Confirm which calls the relevant methods on this_arg.
11792  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
11793  */
11794 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11795
11796 /**
11797  * Constructs a new Watch which calls the relevant methods on this_arg.
11798  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
11799  */
11800 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11801
11802 /**
11803  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11804  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11805  */
11806 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
11807
11808 /**
11809  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
11810  */
11811 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
11812
11813 /**
11814  * The sequence number of this update. Updates *must* be replayed in-order according to this
11815  * sequence number (and updates may panic if they are not). The update_id values are strictly
11816  * increasing and increase by one for each new update, with one exception specified below.
11817  *
11818  * This sequence number is also used to track up to which points updates which returned
11819  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11820  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11821  *
11822  * The only instance where update_id values are not strictly increasing is the case where we
11823  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11824  * its docs for more details.
11825  */
11826 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
11827
11828 /**
11829  * The sequence number of this update. Updates *must* be replayed in-order according to this
11830  * sequence number (and updates may panic if they are not). The update_id values are strictly
11831  * increasing and increase by one for each new update, with one exception specified below.
11832  *
11833  * This sequence number is also used to track up to which points updates which returned
11834  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
11835  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
11836  *
11837  * The only instance where update_id values are not strictly increasing is the case where we
11838  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
11839  * its docs for more details.
11840  */
11841 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
11842
11843 /**
11844  * Creates a copy of the ChannelMonitorUpdate
11845  */
11846 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
11847
11848 /**
11849  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
11850  */
11851 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
11852
11853 /**
11854  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
11855  */
11856 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
11857
11858 /**
11859  * Creates a copy of the ChannelMonitorUpdateErr
11860  */
11861 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
11862
11863 /**
11864  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
11865  */
11866 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
11867
11868 /**
11869  * Creates a copy of the MonitorUpdateError
11870  */
11871 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
11872
11873 /**
11874  * Frees any resources used by the MonitorEvent
11875  */
11876 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
11877
11878 /**
11879  * Creates a copy of the MonitorEvent
11880  */
11881 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
11882
11883 /**
11884  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
11885  */
11886 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
11887
11888 /**
11889  * Creates a copy of the HTLCUpdate
11890  */
11891 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
11892
11893 /**
11894  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
11895  */
11896 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
11897
11898 /**
11899  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
11900  */
11901 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
11902
11903 /**
11904  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
11905  */
11906 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
11907
11908 /**
11909  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
11910  */
11911 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
11912
11913 /**
11914  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
11915  * itself.
11916  *
11917  * panics if the given update is not the next update by update_id.
11918  */
11919 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);
11920
11921 /**
11922  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
11923  * ChannelMonitor.
11924  */
11925 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11926
11927 /**
11928  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
11929  */
11930 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11931
11932 /**
11933  * Gets a list of txids, with their output scripts (in the order they appear in the
11934  * transaction), which we must learn about spends of via block_connected().
11935  */
11936 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11937
11938 /**
11939  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
11940  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
11941  * have been registered.
11942  */
11943 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
11944
11945 /**
11946  * Get the list of HTLCs who's status has been updated on chain. This should be called by
11947  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
11948  */
11949 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11950
11951 /**
11952  * Gets the list of pending events which were generated by previous actions, clearing the list
11953  * in the process.
11954  *
11955  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
11956  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
11957  * no internal locking in ChannelMonitors.
11958  */
11959 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
11960
11961 /**
11962  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
11963  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
11964  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
11965  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
11966  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
11967  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
11968  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
11969  * out-of-band the other node operator to coordinate with him if option is available to you.
11970  * In any-case, choice is up to the user.
11971  */
11972 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);
11973
11974 /**
11975  * Processes transactions in a newly connected block, which may result in any of the following:
11976  * - update the monitor's state against resolved HTLCs
11977  * - punish the counterparty in the case of seeing a revoked commitment transaction
11978  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
11979  * - detect settled outputs for later spending
11980  * - schedule and bump any in-flight claims
11981  *
11982  * Returns any new outputs to watch from `txdata`; after called, these are also included in
11983  * [`get_outputs_to_watch`].
11984  *
11985  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
11986  */
11987 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);
11988
11989 /**
11990  * Determines if the disconnected block contained any transactions of interest and updates
11991  * appropriately.
11992  */
11993 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);
11994
11995 /**
11996  * Processes transactions confirmed in a block with the given header and height, returning new
11997  * outputs to watch. See [`block_connected`] for details.
11998  *
11999  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12000  * blocks. See [`chain::Confirm`] for calling expectations.
12001  *
12002  * [`block_connected`]: Self::block_connected
12003  */
12004 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);
12005
12006 /**
12007  * Processes a transaction that was reorganized out of the chain.
12008  *
12009  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12010  * than blocks. See [`chain::Confirm`] for calling expectations.
12011  *
12012  * [`block_disconnected`]: Self::block_disconnected
12013  */
12014 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);
12015
12016 /**
12017  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12018  * [`block_connected`] for details.
12019  *
12020  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12021  * blocks. See [`chain::Confirm`] for calling expectations.
12022  *
12023  * [`block_connected`]: Self::block_connected
12024  */
12025 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);
12026
12027 /**
12028  * Returns the set of txids that should be monitored for re-organization out of the chain.
12029  */
12030 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12031
12032 /**
12033  * Calls the free function if one is set
12034  */
12035 void Persist_free(struct LDKPersist this_ptr);
12036
12037 /**
12038  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12039  */
12040 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12041
12042 /**
12043  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12044  */
12045 void OutPoint_free(struct LDKOutPoint this_obj);
12046
12047 /**
12048  * The referenced transaction's txid.
12049  */
12050 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12051
12052 /**
12053  * The referenced transaction's txid.
12054  */
12055 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12056
12057 /**
12058  * The index of the referenced output in its transaction's vout.
12059  */
12060 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12061
12062 /**
12063  * The index of the referenced output in its transaction's vout.
12064  */
12065 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12066
12067 /**
12068  * Constructs a new OutPoint given each field
12069  */
12070 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12071
12072 /**
12073  * Creates a copy of the OutPoint
12074  */
12075 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12076
12077 /**
12078  * Convert an `OutPoint` to a lightning channel id.
12079  */
12080 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12081
12082 /**
12083  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12084  */
12085 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12086
12087 /**
12088  * Read a OutPoint from a byte array, created by OutPoint_write
12089  */
12090 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12091
12092 /**
12093  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12094  */
12095 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12096
12097 /**
12098  * The outpoint which is spendable
12099  */
12100 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12101
12102 /**
12103  * The outpoint which is spendable
12104  */
12105 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12106
12107 /**
12108  * Per commitment point to derive delayed_payment_key by key holder
12109  */
12110 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12111
12112 /**
12113  * Per commitment point to derive delayed_payment_key by key holder
12114  */
12115 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12116
12117 /**
12118  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12119  * the witness_script.
12120  */
12121 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12122
12123 /**
12124  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12125  * the witness_script.
12126  */
12127 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12128
12129 /**
12130  * The output which is referenced by the given outpoint
12131  */
12132 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12133
12134 /**
12135  * The revocation point specific to the commitment transaction which was broadcast. Used to
12136  * derive the witnessScript for this output.
12137  */
12138 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12139
12140 /**
12141  * The revocation point specific to the commitment transaction which was broadcast. Used to
12142  * derive the witnessScript for this output.
12143  */
12144 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12145
12146 /**
12147  * Arbitrary identification information returned by a call to
12148  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12149  * the channel to spend the output.
12150  */
12151 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12152
12153 /**
12154  * Arbitrary identification information returned by a call to
12155  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12156  * the channel to spend the output.
12157  */
12158 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12159
12160 /**
12161  * The value of the channel which this output originated from, possibly indirectly.
12162  */
12163 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12164
12165 /**
12166  * The value of the channel which this output originated from, possibly indirectly.
12167  */
12168 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12169
12170 /**
12171  * Constructs a new DelayedPaymentOutputDescriptor given each field
12172  */
12173 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);
12174
12175 /**
12176  * Creates a copy of the DelayedPaymentOutputDescriptor
12177  */
12178 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12179
12180 /**
12181  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12182  */
12183 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12184
12185 /**
12186  * The outpoint which is spendable
12187  */
12188 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12189
12190 /**
12191  * The outpoint which is spendable
12192  */
12193 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12194
12195 /**
12196  * The output which is referenced by the given outpoint
12197  */
12198 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12199
12200 /**
12201  * Arbitrary identification information returned by a call to
12202  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12203  * the channel to spend the output.
12204  */
12205 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12206
12207 /**
12208  * Arbitrary identification information returned by a call to
12209  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12210  * the channel to spend the output.
12211  */
12212 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12213
12214 /**
12215  * The value of the channel which this transactions spends.
12216  */
12217 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12218
12219 /**
12220  * The value of the channel which this transactions spends.
12221  */
12222 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12223
12224 /**
12225  * Constructs a new StaticPaymentOutputDescriptor given each field
12226  */
12227 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);
12228
12229 /**
12230  * Creates a copy of the StaticPaymentOutputDescriptor
12231  */
12232 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12233
12234 /**
12235  * Frees any resources used by the SpendableOutputDescriptor
12236  */
12237 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12238
12239 /**
12240  * Creates a copy of the SpendableOutputDescriptor
12241  */
12242 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12243
12244 /**
12245  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12246  */
12247 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12248
12249 /**
12250  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12251  */
12252 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12253
12254 /**
12255  * Calls the free function if one is set
12256  */
12257 void BaseSign_free(struct LDKBaseSign this_ptr);
12258
12259 /**
12260  * Creates a copy of a Sign
12261  */
12262 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12263
12264 /**
12265  * Calls the free function if one is set
12266  */
12267 void Sign_free(struct LDKSign this_ptr);
12268
12269 /**
12270  * Calls the free function if one is set
12271  */
12272 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12273
12274 /**
12275  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12276  */
12277 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12278
12279 /**
12280  * Private key of anchor tx
12281  */
12282 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12283
12284 /**
12285  * Private key of anchor tx
12286  */
12287 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12288
12289 /**
12290  * Holder secret key for blinded revocation pubkey
12291  */
12292 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12293
12294 /**
12295  * Holder secret key for blinded revocation pubkey
12296  */
12297 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12298
12299 /**
12300  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12301  */
12302 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12303
12304 /**
12305  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12306  */
12307 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12308
12309 /**
12310  * Holder secret key used in HTLC tx
12311  */
12312 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12313
12314 /**
12315  * Holder secret key used in HTLC tx
12316  */
12317 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12318
12319 /**
12320  * Holder htlc secret key used in commitment tx htlc outputs
12321  */
12322 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12323
12324 /**
12325  * Holder htlc secret key used in commitment tx htlc outputs
12326  */
12327 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12328
12329 /**
12330  * Commitment seed
12331  */
12332 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12333
12334 /**
12335  * Commitment seed
12336  */
12337 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12338
12339 /**
12340  * Creates a copy of the InMemorySigner
12341  */
12342 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12343
12344 /**
12345  * Create a new InMemorySigner
12346  */
12347 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);
12348
12349 /**
12350  * Counterparty pubkeys.
12351  * Will panic if ready_channel wasn't called.
12352  */
12353 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12354
12355 /**
12356  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12357  * transactions, ie the amount of time that we have to wait to recover our funds if we
12358  * broadcast a transaction.
12359  * Will panic if ready_channel wasn't called.
12360  */
12361 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12362
12363 /**
12364  * The contest_delay value specified by us and applied on transactions broadcastable
12365  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12366  * if they broadcast a transaction.
12367  * Will panic if ready_channel wasn't called.
12368  */
12369 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12370
12371 /**
12372  * Whether the holder is the initiator
12373  * Will panic if ready_channel wasn't called.
12374  */
12375 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12376
12377 /**
12378  * Funding outpoint
12379  * Will panic if ready_channel wasn't called.
12380  */
12381 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12382
12383 /**
12384  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12385  * building transactions.
12386  *
12387  * Will panic if ready_channel wasn't called.
12388  */
12389 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12390
12391 /**
12392  * Sign the single input of spend_tx at index `input_idx` which spends the output
12393  * described by descriptor, returning the witness stack for the input.
12394  *
12395  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12396  * or is not spending the outpoint described by `descriptor.outpoint`.
12397  */
12398 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);
12399
12400 /**
12401  * Sign the single input of spend_tx at index `input_idx` which spends the output
12402  * described by descriptor, returning the witness stack for the input.
12403  *
12404  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12405  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12406  * sequence set to `descriptor.to_self_delay`.
12407  */
12408 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);
12409
12410 /**
12411  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12412  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12413  */
12414 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12415
12416 /**
12417  * Constructs a new Sign which calls the relevant methods on this_arg.
12418  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12419  */
12420 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12421
12422 /**
12423  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12424  */
12425 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12426
12427 /**
12428  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12429  */
12430 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12431
12432 /**
12433  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12434  */
12435 void KeysManager_free(struct LDKKeysManager this_obj);
12436
12437 /**
12438  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12439  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12440  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12441  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12442  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12443  * simply use the current time (with very high precision).
12444  *
12445  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12446  * obviously, starting_time should be unique every time you reload the library - it is only
12447  * used to generate new ephemeral key data (which will be stored by the individual channel if
12448  * necessary).
12449  *
12450  * Note that the seed is required to recover certain on-chain funds independent of
12451  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12452  * channel, and some on-chain during-closing funds.
12453  *
12454  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12455  * versions. Once the library is more fully supported, the docs will be updated to include a
12456  * detailed description of the guarantee.
12457  */
12458 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12459
12460 /**
12461  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12462  *
12463  * Key derivation parameters are accessible through a per-channel secrets
12464  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12465  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12466  */
12467 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]);
12468
12469 /**
12470  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12471  * output to the given change destination (if sufficient change value remains). The
12472  * transaction will have a feerate, at least, of the given value.
12473  *
12474  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12475  * if a descriptor was duplicated.
12476  *
12477  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12478  *
12479  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12480  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12481  */
12482 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);
12483
12484 /**
12485  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12486  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12487  */
12488 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12489
12490 /**
12491  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12492  */
12493 void ChannelManager_free(struct LDKChannelManager this_obj);
12494
12495 /**
12496  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12497  */
12498 void ChainParameters_free(struct LDKChainParameters this_obj);
12499
12500 /**
12501  * The network for determining the `chain_hash` in Lightning messages.
12502  */
12503 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12504
12505 /**
12506  * The network for determining the `chain_hash` in Lightning messages.
12507  */
12508 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12509
12510 /**
12511  * The hash and height of the latest block successfully connected.
12512  *
12513  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12514  */
12515 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12516
12517 /**
12518  * The hash and height of the latest block successfully connected.
12519  *
12520  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12521  */
12522 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12523
12524 /**
12525  * Constructs a new ChainParameters given each field
12526  */
12527 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12528
12529 /**
12530  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12531  */
12532 void BestBlock_free(struct LDKBestBlock this_obj);
12533
12534 /**
12535  * Creates a copy of the BestBlock
12536  */
12537 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12538
12539 /**
12540  * Returns the best block from the genesis of the given network.
12541  */
12542 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12543
12544 /**
12545  * Returns the best block as identified by the given block hash and height.
12546  */
12547 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12548
12549 /**
12550  * Returns the best block hash.
12551  */
12552 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12553
12554 /**
12555  * Returns the best block height.
12556  */
12557 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12558
12559 /**
12560  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12561  */
12562 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12563
12564 /**
12565  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12566  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12567  * Note that this means this value is *not* persistent - it can change once during the
12568  * lifetime of the channel.
12569  */
12570 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12571
12572 /**
12573  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12574  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12575  * Note that this means this value is *not* persistent - it can change once during the
12576  * lifetime of the channel.
12577  */
12578 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12579
12580 /**
12581  * The position of the funding transaction in the chain. None if the funding transaction has
12582  * not yet been confirmed and the channel fully opened.
12583  */
12584 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12585
12586 /**
12587  * The position of the funding transaction in the chain. None if the funding transaction has
12588  * not yet been confirmed and the channel fully opened.
12589  */
12590 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
12591
12592 /**
12593  * The node_id of our counterparty
12594  */
12595 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12596
12597 /**
12598  * The node_id of our counterparty
12599  */
12600 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12601
12602 /**
12603  * The Features the channel counterparty provided upon last connection.
12604  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12605  * many routing-relevant features are present in the init context.
12606  */
12607 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12608
12609 /**
12610  * The Features the channel counterparty provided upon last connection.
12611  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
12612  * many routing-relevant features are present in the init context.
12613  */
12614 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
12615
12616 /**
12617  * The value, in satoshis, of this channel as appears in the funding output
12618  */
12619 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12620
12621 /**
12622  * The value, in satoshis, of this channel as appears in the funding output
12623  */
12624 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12625
12626 /**
12627  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12628  */
12629 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12630
12631 /**
12632  * The user_id passed in to create_channel, or 0 if the channel was inbound.
12633  */
12634 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12635
12636 /**
12637  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12638  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12639  * available for inclusion in new outbound HTLCs). This further does not include any pending
12640  * outgoing HTLCs which are awaiting some other resolution to be sent.
12641  */
12642 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12643
12644 /**
12645  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
12646  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12647  * available for inclusion in new outbound HTLCs). This further does not include any pending
12648  * outgoing HTLCs which are awaiting some other resolution to be sent.
12649  */
12650 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12651
12652 /**
12653  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12654  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12655  * available for inclusion in new inbound HTLCs).
12656  * Note that there are some corner cases not fully handled here, so the actual available
12657  * inbound capacity may be slightly higher than this.
12658  */
12659 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12660
12661 /**
12662  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
12663  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
12664  * available for inclusion in new inbound HTLCs).
12665  * Note that there are some corner cases not fully handled here, so the actual available
12666  * inbound capacity may be slightly higher than this.
12667  */
12668 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
12669
12670 /**
12671  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12672  * the peer is connected, and (c) no monitor update failure is pending resolution.
12673  */
12674 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
12675
12676 /**
12677  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
12678  * the peer is connected, and (c) no monitor update failure is pending resolution.
12679  */
12680 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
12681
12682 /**
12683  * Creates a copy of the ChannelDetails
12684  */
12685 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
12686
12687 /**
12688  * Frees any resources used by the PaymentSendFailure
12689  */
12690 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
12691
12692 /**
12693  * Creates a copy of the PaymentSendFailure
12694  */
12695 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
12696
12697 /**
12698  * Constructs a new ChannelManager to hold several channels and route between them.
12699  *
12700  * This is the main \"logic hub\" for all channel-related actions, and implements
12701  * ChannelMessageHandler.
12702  *
12703  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
12704  *
12705  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
12706  *
12707  * Users need to notify the new ChannelManager when a new block is connected or
12708  * disconnected using its `block_connected` and `block_disconnected` methods, starting
12709  * from after `params.latest_hash`.
12710  */
12711 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);
12712
12713 /**
12714  * Gets the current configuration applied to all new channels,  as
12715  */
12716 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
12717
12718 /**
12719  * Creates a new outbound channel to the given remote node and with the given value.
12720  *
12721  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
12722  * tracking of which events correspond with which create_channel call. Note that the
12723  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
12724  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
12725  * otherwise ignored.
12726  *
12727  * If successful, will generate a SendOpenChannel message event, so you should probably poll
12728  * PeerManager::process_events afterwards.
12729  *
12730  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
12731  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
12732  */
12733 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);
12734
12735 /**
12736  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
12737  * more information.
12738  */
12739 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12740
12741 /**
12742  * Gets the list of usable channels, in random order. Useful as an argument to
12743  * get_route to ensure non-announced channels are used.
12744  *
12745  * These are guaranteed to have their is_live value set to true, see the documentation for
12746  * ChannelDetails::is_live for more info on exactly what the criteria are.
12747  */
12748 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12749
12750 /**
12751  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
12752  * will be accepted on the given channel, and after additional timeout/the closing of all
12753  * pending HTLCs, the channel will be closed on chain.
12754  *
12755  * May generate a SendShutdown message event on success, which should be relayed.
12756  */
12757 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12758
12759 /**
12760  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
12761  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
12762  */
12763 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
12764
12765 /**
12766  * Force close all channels, immediately broadcasting the latest local commitment transaction
12767  * for each to the chain and rejecting new HTLCs on each.
12768  */
12769 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
12770
12771 /**
12772  * Sends a payment along a given route.
12773  *
12774  * Value parameters are provided via the last hop in route, see documentation for RouteHop
12775  * fields for more info.
12776  *
12777  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
12778  * payment), we don't do anything to stop you! We always try to ensure that if the provided
12779  * next hop knows the preimage to payment_hash they can claim an additional amount as
12780  * specified in the last hop in the route! Thus, you should probably do your own
12781  * payment_preimage tracking (which you should already be doing as they represent \"proof of
12782  * payment\") and prevent double-sends yourself.
12783  *
12784  * May generate SendHTLCs message(s) event on success, which should be relayed.
12785  *
12786  * Each path may have a different return value, and PaymentSendValue may return a Vec with
12787  * each entry matching the corresponding-index entry in the route paths, see
12788  * PaymentSendFailure for more info.
12789  *
12790  * In general, a path may raise:
12791  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
12792  *    node public key) is specified.
12793  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
12794  *    (including due to previous monitor update failure or new permanent monitor update
12795  *    failure).
12796  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
12797  *    relevant updates.
12798  *
12799  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
12800  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
12801  * different route unless you intend to pay twice!
12802  *
12803  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
12804  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
12805  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
12806  * must not contain multiple paths as multi-path payments require a recipient-provided
12807  * payment_secret.
12808  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
12809  * bit set (either as required or as available). If multiple paths are present in the Route,
12810  * we assume the invoice had the basic_mpp feature set.
12811  */
12812 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);
12813
12814 /**
12815  * Call this upon creation of a funding transaction for the given channel.
12816  *
12817  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
12818  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
12819  *
12820  * Panics if a funding transaction has already been provided for this channel.
12821  *
12822  * May panic if the output found in the funding transaction is duplicative with some other
12823  * channel (note that this should be trivially prevented by using unique funding transaction
12824  * keys per-channel).
12825  *
12826  * Do NOT broadcast the funding transaction yourself. When we have safely received our
12827  * counterparty's signature the funding transaction will automatically be broadcast via the
12828  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
12829  *
12830  * Note that this includes RBF or similar transaction replacement strategies - lightning does
12831  * not currently support replacing a funding transaction on an existing channel. Instead,
12832  * create a new channel with a conflicting funding transaction.
12833  */
12834 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);
12835
12836 /**
12837  * Generates a signed node_announcement from the given arguments and creates a
12838  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
12839  * seen a channel_announcement from us (ie unless we have public channels open).
12840  *
12841  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
12842  * to humans. They carry no in-protocol meaning.
12843  *
12844  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
12845  * incoming connections. These will be broadcast to the network, publicly tying these
12846  * addresses together. If you wish to preserve user privacy, addresses should likely contain
12847  * only Tor Onion addresses.
12848  *
12849  * Panics if addresses is absurdly large (more than 500).
12850  */
12851 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
12852
12853 /**
12854  * Processes HTLCs which are pending waiting on random forward delay.
12855  *
12856  * Should only really ever be called in response to a PendingHTLCsForwardable event.
12857  * Will likely generate further events.
12858  */
12859 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
12860
12861 /**
12862  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
12863  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
12864  * to inform the network about the uselessness of these channels.
12865  *
12866  * This method handles all the details, and must be called roughly once per minute.
12867  *
12868  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
12869  */
12870 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
12871
12872 /**
12873  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
12874  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
12875  * along the path (including in our own channel on which we received it).
12876  * Returns false if no payment was found to fail backwards, true if the process of failing the
12877  * HTLC backwards has been started.
12878  */
12879 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
12880
12881 /**
12882  * Provides a payment preimage in response to a PaymentReceived event, returning true and
12883  * generating message events for the net layer to claim the payment, if possible. Thus, you
12884  * should probably kick the net layer to go send messages if this returns true!
12885  *
12886  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
12887  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
12888  * event matches your expectation. If you fail to do so and call this method, you may provide
12889  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
12890  *
12891  * May panic if called except in response to a PaymentReceived event.
12892  *
12893  * [`create_inbound_payment`]: Self::create_inbound_payment
12894  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12895  */
12896 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
12897
12898 /**
12899  * Gets the node_id held by this ChannelManager
12900  */
12901 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
12902
12903 /**
12904  * Restores a single, given channel to normal operation after a
12905  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
12906  * operation.
12907  *
12908  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
12909  * fully committed in every copy of the given channels' ChannelMonitors.
12910  *
12911  * Note that there is no effect to calling with a highest_applied_update_id other than the
12912  * current latest ChannelMonitorUpdate and one call to this function after multiple
12913  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
12914  * exists largely only to prevent races between this and concurrent update_monitor calls.
12915  *
12916  * Thus, the anticipated use is, at a high level:
12917  *  1) You register a chain::Watch with this ChannelManager,
12918  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
12919  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
12920  *     any time it cannot do so instantly,
12921  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
12922  *  4) once all remote copies are updated, you call this function with the update_id that
12923  *     completed, and once it is the latest the Channel will be re-enabled.
12924  */
12925 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);
12926
12927 /**
12928  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
12929  * to pay us.
12930  *
12931  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
12932  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
12933  *
12934  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
12935  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
12936  * passed directly to [`claim_funds`].
12937  *
12938  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
12939  *
12940  * [`claim_funds`]: Self::claim_funds
12941  * [`PaymentReceived`]: events::Event::PaymentReceived
12942  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
12943  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12944  */
12945 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);
12946
12947 /**
12948  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
12949  * stored external to LDK.
12950  *
12951  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
12952  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
12953  * the `min_value_msat` provided here, if one is provided.
12954  *
12955  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
12956  * method may return an Err if another payment with the same payment_hash is still pending.
12957  *
12958  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
12959  * allow tracking of which events correspond with which calls to this and
12960  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
12961  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
12962  * with invoice metadata stored elsewhere.
12963  *
12964  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
12965  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
12966  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
12967  * sender \"proof-of-payment\" unless they have paid the required amount.
12968  *
12969  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
12970  * in excess of the current time. This should roughly match the expiry time set in the invoice.
12971  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
12972  * pay the invoice failing. The BOLT spec suggests 7,200 secs as a default validity time for
12973  * invoices when no timeout is set.
12974  *
12975  * Note that we use block header time to time-out pending inbound payments (with some margin
12976  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
12977  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
12978  * If you need exact expiry semantics, you should enforce them upon receipt of
12979  * [`PaymentReceived`].
12980  *
12981  * Pending inbound payments are stored in memory and in serialized versions of this
12982  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
12983  * space is limited, you may wish to rate-limit inbound payment creation.
12984  *
12985  * May panic if `invoice_expiry_delta_secs` is greater than one year.
12986  *
12987  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
12988  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
12989  *
12990  * [`create_inbound_payment`]: Self::create_inbound_payment
12991  * [`PaymentReceived`]: events::Event::PaymentReceived
12992  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
12993  */
12994 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);
12995
12996 /**
12997  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
12998  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
12999  */
13000 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13001
13002 /**
13003  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13004  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13005  */
13006 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13007
13008 /**
13009  * Constructs a new Listen which calls the relevant methods on this_arg.
13010  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13011  */
13012 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13013
13014 /**
13015  * Constructs a new Confirm which calls the relevant methods on this_arg.
13016  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13017  */
13018 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13019
13020 /**
13021  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13022  * indicating whether persistence is necessary. Only one listener on
13023  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13024  * up.
13025  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13026  */
13027 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13028
13029 /**
13030  * Blocks until ChannelManager needs to be persisted. Only one listener on
13031  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13032  * up.
13033  */
13034 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13035
13036 /**
13037  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13038  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13039  */
13040 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13041
13042 /**
13043  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13044  */
13045 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13046
13047 /**
13048  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13049  */
13050 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13051
13052 /**
13053  * The keys provider which will give us relevant keys. Some keys will be loaded during
13054  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13055  * signing data.
13056  */
13057 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13058
13059 /**
13060  * The keys provider which will give us relevant keys. Some keys will be loaded during
13061  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13062  * signing data.
13063  */
13064 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13065
13066 /**
13067  * The fee_estimator for use in the ChannelManager in the future.
13068  *
13069  * No calls to the FeeEstimator will be made during deserialization.
13070  */
13071 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13072
13073 /**
13074  * The fee_estimator for use in the ChannelManager in the future.
13075  *
13076  * No calls to the FeeEstimator will be made during deserialization.
13077  */
13078 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13079
13080 /**
13081  * The chain::Watch for use in the ChannelManager in the future.
13082  *
13083  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13084  * you have deserialized ChannelMonitors separately and will add them to your
13085  * chain::Watch after deserializing this ChannelManager.
13086  */
13087 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13088
13089 /**
13090  * The chain::Watch for use in the ChannelManager in the future.
13091  *
13092  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13093  * you have deserialized ChannelMonitors separately and will add them to your
13094  * chain::Watch after deserializing this ChannelManager.
13095  */
13096 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13097
13098 /**
13099  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13100  * used to broadcast the latest local commitment transactions of channels which must be
13101  * force-closed during deserialization.
13102  */
13103 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13104
13105 /**
13106  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13107  * used to broadcast the latest local commitment transactions of channels which must be
13108  * force-closed during deserialization.
13109  */
13110 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13111
13112 /**
13113  * The Logger for use in the ChannelManager and which may be used to log information during
13114  * deserialization.
13115  */
13116 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13117
13118 /**
13119  * The Logger for use in the ChannelManager and which may be used to log information during
13120  * deserialization.
13121  */
13122 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13123
13124 /**
13125  * Default settings used for new channels. Any existing channels will continue to use the
13126  * runtime settings which were stored when the ChannelManager was serialized.
13127  */
13128 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13129
13130 /**
13131  * Default settings used for new channels. Any existing channels will continue to use the
13132  * runtime settings which were stored when the ChannelManager was serialized.
13133  */
13134 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13135
13136 /**
13137  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13138  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13139  * populate a HashMap directly from C.
13140  */
13141 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);
13142
13143 /**
13144  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13145  */
13146 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13147
13148 /**
13149  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13150  */
13151 void DecodeError_free(struct LDKDecodeError this_obj);
13152
13153 /**
13154  * Creates a copy of the DecodeError
13155  */
13156 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13157
13158 /**
13159  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13160  */
13161 void Init_free(struct LDKInit this_obj);
13162
13163 /**
13164  * The relevant features which the sender supports
13165  */
13166 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13167
13168 /**
13169  * The relevant features which the sender supports
13170  */
13171 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13172
13173 /**
13174  * Constructs a new Init given each field
13175  */
13176 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13177
13178 /**
13179  * Creates a copy of the Init
13180  */
13181 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13182
13183 /**
13184  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13185  */
13186 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13187
13188 /**
13189  * The channel ID involved in the error
13190  */
13191 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13192
13193 /**
13194  * The channel ID involved in the error
13195  */
13196 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13197
13198 /**
13199  * A possibly human-readable error description.
13200  * The string should be sanitized before it is used (e.g. emitted to logs
13201  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13202  * vulnerability in the terminal emulator or the logging subsystem.
13203  */
13204 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13205
13206 /**
13207  * A possibly human-readable error description.
13208  * The string should be sanitized before it is used (e.g. emitted to logs
13209  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13210  * vulnerability in the terminal emulator or the logging subsystem.
13211  */
13212 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13213
13214 /**
13215  * Constructs a new ErrorMessage given each field
13216  */
13217 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13218
13219 /**
13220  * Creates a copy of the ErrorMessage
13221  */
13222 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13223
13224 /**
13225  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13226  */
13227 void Ping_free(struct LDKPing this_obj);
13228
13229 /**
13230  * The desired response length
13231  */
13232 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13233
13234 /**
13235  * The desired response length
13236  */
13237 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13238
13239 /**
13240  * The ping packet size.
13241  * This field is not sent on the wire. byteslen zeros are sent.
13242  */
13243 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13244
13245 /**
13246  * The ping packet size.
13247  * This field is not sent on the wire. byteslen zeros are sent.
13248  */
13249 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13250
13251 /**
13252  * Constructs a new Ping given each field
13253  */
13254 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13255
13256 /**
13257  * Creates a copy of the Ping
13258  */
13259 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13260
13261 /**
13262  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13263  */
13264 void Pong_free(struct LDKPong this_obj);
13265
13266 /**
13267  * The pong packet size.
13268  * This field is not sent on the wire. byteslen zeros are sent.
13269  */
13270 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13271
13272 /**
13273  * The pong packet size.
13274  * This field is not sent on the wire. byteslen zeros are sent.
13275  */
13276 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13277
13278 /**
13279  * Constructs a new Pong given each field
13280  */
13281 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13282
13283 /**
13284  * Creates a copy of the Pong
13285  */
13286 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13287
13288 /**
13289  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13290  */
13291 void OpenChannel_free(struct LDKOpenChannel this_obj);
13292
13293 /**
13294  * The genesis hash of the blockchain where the channel is to be opened
13295  */
13296 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13297
13298 /**
13299  * The genesis hash of the blockchain where the channel is to be opened
13300  */
13301 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13302
13303 /**
13304  * A temporary channel ID, until the funding outpoint is announced
13305  */
13306 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13307
13308 /**
13309  * A temporary channel ID, until the funding outpoint is announced
13310  */
13311 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13312
13313 /**
13314  * The channel value
13315  */
13316 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13317
13318 /**
13319  * The channel value
13320  */
13321 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13322
13323 /**
13324  * The amount to push to the counterparty as part of the open, in milli-satoshi
13325  */
13326 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13327
13328 /**
13329  * The amount to push to the counterparty as part of the open, in milli-satoshi
13330  */
13331 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13332
13333 /**
13334  * The threshold below which outputs on transactions broadcast by sender will be omitted
13335  */
13336 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13337
13338 /**
13339  * The threshold below which outputs on transactions broadcast by sender will be omitted
13340  */
13341 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13342
13343 /**
13344  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13345  */
13346 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13347
13348 /**
13349  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13350  */
13351 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13352
13353 /**
13354  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13355  */
13356 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13357
13358 /**
13359  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13360  */
13361 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13362
13363 /**
13364  * The minimum HTLC size incoming to sender, in milli-satoshi
13365  */
13366 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13367
13368 /**
13369  * The minimum HTLC size incoming to sender, in milli-satoshi
13370  */
13371 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13372
13373 /**
13374  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13375  */
13376 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13377
13378 /**
13379  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13380  */
13381 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13382
13383 /**
13384  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13385  */
13386 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13387
13388 /**
13389  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13390  */
13391 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13392
13393 /**
13394  * The maximum number of inbound HTLCs towards sender
13395  */
13396 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13397
13398 /**
13399  * The maximum number of inbound HTLCs towards sender
13400  */
13401 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13402
13403 /**
13404  * The sender's key controlling the funding transaction
13405  */
13406 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13407
13408 /**
13409  * The sender's key controlling the funding transaction
13410  */
13411 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13412
13413 /**
13414  * Used to derive a revocation key for transactions broadcast by counterparty
13415  */
13416 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13417
13418 /**
13419  * Used to derive a revocation key for transactions broadcast by counterparty
13420  */
13421 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13422
13423 /**
13424  * A payment key to sender for transactions broadcast by counterparty
13425  */
13426 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13427
13428 /**
13429  * A payment key to sender for transactions broadcast by counterparty
13430  */
13431 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13432
13433 /**
13434  * Used to derive a payment key to sender for transactions broadcast by sender
13435  */
13436 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13437
13438 /**
13439  * Used to derive a payment key to sender for transactions broadcast by sender
13440  */
13441 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13442
13443 /**
13444  * Used to derive an HTLC payment key to sender
13445  */
13446 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13447
13448 /**
13449  * Used to derive an HTLC payment key to sender
13450  */
13451 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13452
13453 /**
13454  * The first to-be-broadcast-by-sender transaction's per commitment point
13455  */
13456 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13457
13458 /**
13459  * The first to-be-broadcast-by-sender transaction's per commitment point
13460  */
13461 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13462
13463 /**
13464  * Channel flags
13465  */
13466 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13467
13468 /**
13469  * Channel flags
13470  */
13471 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13472
13473 /**
13474  * Creates a copy of the OpenChannel
13475  */
13476 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13477
13478 /**
13479  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13480  */
13481 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13482
13483 /**
13484  * A temporary channel ID, until the funding outpoint is announced
13485  */
13486 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13487
13488 /**
13489  * A temporary channel ID, until the funding outpoint is announced
13490  */
13491 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13492
13493 /**
13494  * The threshold below which outputs on transactions broadcast by sender will be omitted
13495  */
13496 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13497
13498 /**
13499  * The threshold below which outputs on transactions broadcast by sender will be omitted
13500  */
13501 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13502
13503 /**
13504  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13505  */
13506 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13507
13508 /**
13509  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13510  */
13511 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13512
13513 /**
13514  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13515  */
13516 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13517
13518 /**
13519  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13520  */
13521 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13522
13523 /**
13524  * The minimum HTLC size incoming to sender, in milli-satoshi
13525  */
13526 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13527
13528 /**
13529  * The minimum HTLC size incoming to sender, in milli-satoshi
13530  */
13531 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13532
13533 /**
13534  * Minimum depth of the funding transaction before the channel is considered open
13535  */
13536 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13537
13538 /**
13539  * Minimum depth of the funding transaction before the channel is considered open
13540  */
13541 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
13542
13543 /**
13544  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13545  */
13546 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13547
13548 /**
13549  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13550  */
13551 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13552
13553 /**
13554  * The maximum number of inbound HTLCs towards sender
13555  */
13556 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13557
13558 /**
13559  * The maximum number of inbound HTLCs towards sender
13560  */
13561 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
13562
13563 /**
13564  * The sender's key controlling the funding transaction
13565  */
13566 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13567
13568 /**
13569  * The sender's key controlling the funding transaction
13570  */
13571 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13572
13573 /**
13574  * Used to derive a revocation key for transactions broadcast by counterparty
13575  */
13576 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13577
13578 /**
13579  * Used to derive a revocation key for transactions broadcast by counterparty
13580  */
13581 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13582
13583 /**
13584  * A payment key to sender for transactions broadcast by counterparty
13585  */
13586 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13587
13588 /**
13589  * A payment key to sender for transactions broadcast by counterparty
13590  */
13591 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13592
13593 /**
13594  * Used to derive a payment key to sender for transactions broadcast by sender
13595  */
13596 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13597
13598 /**
13599  * Used to derive a payment key to sender for transactions broadcast by sender
13600  */
13601 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13602
13603 /**
13604  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13605  */
13606 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13607
13608 /**
13609  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
13610  */
13611 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13612
13613 /**
13614  * The first to-be-broadcast-by-sender transaction's per commitment point
13615  */
13616 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13617
13618 /**
13619  * The first to-be-broadcast-by-sender transaction's per commitment point
13620  */
13621 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13622
13623 /**
13624  * Creates a copy of the AcceptChannel
13625  */
13626 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
13627
13628 /**
13629  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
13630  */
13631 void FundingCreated_free(struct LDKFundingCreated this_obj);
13632
13633 /**
13634  * A temporary channel ID, until the funding is established
13635  */
13636 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13637
13638 /**
13639  * A temporary channel ID, until the funding is established
13640  */
13641 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13642
13643 /**
13644  * The funding transaction ID
13645  */
13646 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
13647
13648 /**
13649  * The funding transaction ID
13650  */
13651 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13652
13653 /**
13654  * The specific output index funding this channel
13655  */
13656 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13657
13658 /**
13659  * The specific output index funding this channel
13660  */
13661 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
13662
13663 /**
13664  * The signature of the channel initiator (funder) on the funding transaction
13665  */
13666 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
13667
13668 /**
13669  * The signature of the channel initiator (funder) on the funding transaction
13670  */
13671 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
13672
13673 /**
13674  * Constructs a new FundingCreated given each field
13675  */
13676 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);
13677
13678 /**
13679  * Creates a copy of the FundingCreated
13680  */
13681 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
13682
13683 /**
13684  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
13685  */
13686 void FundingSigned_free(struct LDKFundingSigned this_obj);
13687
13688 /**
13689  * The channel ID
13690  */
13691 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
13692
13693 /**
13694  * The channel ID
13695  */
13696 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13697
13698 /**
13699  * The signature of the channel acceptor (fundee) on the funding transaction
13700  */
13701 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
13702
13703 /**
13704  * The signature of the channel acceptor (fundee) on the funding transaction
13705  */
13706 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13707
13708 /**
13709  * Constructs a new FundingSigned given each field
13710  */
13711 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
13712
13713 /**
13714  * Creates a copy of the FundingSigned
13715  */
13716 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
13717
13718 /**
13719  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
13720  */
13721 void FundingLocked_free(struct LDKFundingLocked this_obj);
13722
13723 /**
13724  * The channel ID
13725  */
13726 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
13727
13728 /**
13729  * The channel ID
13730  */
13731 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13732
13733 /**
13734  * The per-commitment point of the second commitment transaction
13735  */
13736 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
13737
13738 /**
13739  * The per-commitment point of the second commitment transaction
13740  */
13741 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13742
13743 /**
13744  * Constructs a new FundingLocked given each field
13745  */
13746 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
13747
13748 /**
13749  * Creates a copy of the FundingLocked
13750  */
13751 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
13752
13753 /**
13754  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
13755  */
13756 void Shutdown_free(struct LDKShutdown this_obj);
13757
13758 /**
13759  * The channel ID
13760  */
13761 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
13762
13763 /**
13764  * The channel ID
13765  */
13766 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13767
13768 /**
13769  * The destination of this peer's funds on closing.
13770  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13771  */
13772 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
13773
13774 /**
13775  * The destination of this peer's funds on closing.
13776  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
13777  */
13778 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13779
13780 /**
13781  * Constructs a new Shutdown given each field
13782  */
13783 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
13784
13785 /**
13786  * Creates a copy of the Shutdown
13787  */
13788 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
13789
13790 /**
13791  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
13792  */
13793 void ClosingSigned_free(struct LDKClosingSigned this_obj);
13794
13795 /**
13796  * The channel ID
13797  */
13798 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
13799
13800 /**
13801  * The channel ID
13802  */
13803 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13804
13805 /**
13806  * The proposed total fee for the closing transaction
13807  */
13808 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13809
13810 /**
13811  * The proposed total fee for the closing transaction
13812  */
13813 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
13814
13815 /**
13816  * A signature on the closing transaction
13817  */
13818 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
13819
13820 /**
13821  * A signature on the closing transaction
13822  */
13823 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
13824
13825 /**
13826  * Constructs a new ClosingSigned given each field
13827  */
13828 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
13829
13830 /**
13831  * Creates a copy of the ClosingSigned
13832  */
13833 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
13834
13835 /**
13836  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
13837  */
13838 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
13839
13840 /**
13841  * The channel ID
13842  */
13843 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13844
13845 /**
13846  * The channel ID
13847  */
13848 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13849
13850 /**
13851  * The HTLC ID
13852  */
13853 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13854
13855 /**
13856  * The HTLC ID
13857  */
13858 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13859
13860 /**
13861  * The HTLC value in milli-satoshi
13862  */
13863 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13864
13865 /**
13866  * The HTLC value in milli-satoshi
13867  */
13868 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
13869
13870 /**
13871  * The payment hash, the pre-image of which controls HTLC redemption
13872  */
13873 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
13874
13875 /**
13876  * The payment hash, the pre-image of which controls HTLC redemption
13877  */
13878 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13879
13880 /**
13881  * The expiry height of the HTLC
13882  */
13883 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
13884
13885 /**
13886  * The expiry height of the HTLC
13887  */
13888 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
13889
13890 /**
13891  * Creates a copy of the UpdateAddHTLC
13892  */
13893 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
13894
13895 /**
13896  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
13897  */
13898 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
13899
13900 /**
13901  * The channel ID
13902  */
13903 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13904
13905 /**
13906  * The channel ID
13907  */
13908 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13909
13910 /**
13911  * The HTLC ID
13912  */
13913 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
13914
13915 /**
13916  * The HTLC ID
13917  */
13918 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
13919
13920 /**
13921  * The pre-image of the payment hash, allowing HTLC redemption
13922  */
13923 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
13924
13925 /**
13926  * The pre-image of the payment hash, allowing HTLC redemption
13927  */
13928 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13929
13930 /**
13931  * Constructs a new UpdateFulfillHTLC given each field
13932  */
13933 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
13934
13935 /**
13936  * Creates a copy of the UpdateFulfillHTLC
13937  */
13938 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
13939
13940 /**
13941  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
13942  */
13943 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
13944
13945 /**
13946  * The channel ID
13947  */
13948 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
13949
13950 /**
13951  * The channel ID
13952  */
13953 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13954
13955 /**
13956  * The HTLC ID
13957  */
13958 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
13959
13960 /**
13961  * The HTLC ID
13962  */
13963 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
13964
13965 /**
13966  * Creates a copy of the UpdateFailHTLC
13967  */
13968 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
13969
13970 /**
13971  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
13972  */
13973 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
13974
13975 /**
13976  * The channel ID
13977  */
13978 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
13979
13980 /**
13981  * The channel ID
13982  */
13983 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13984
13985 /**
13986  * The HTLC ID
13987  */
13988 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13989
13990 /**
13991  * The HTLC ID
13992  */
13993 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
13994
13995 /**
13996  * The failure code
13997  */
13998 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
13999
14000 /**
14001  * The failure code
14002  */
14003 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14004
14005 /**
14006  * Creates a copy of the UpdateFailMalformedHTLC
14007  */
14008 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14009
14010 /**
14011  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14012  */
14013 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14014
14015 /**
14016  * The channel ID
14017  */
14018 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14019
14020 /**
14021  * The channel ID
14022  */
14023 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14024
14025 /**
14026  * A signature on the commitment transaction
14027  */
14028 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14029
14030 /**
14031  * A signature on the commitment transaction
14032  */
14033 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14034
14035 /**
14036  * Signatures on the HTLC transactions
14037  */
14038 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14039
14040 /**
14041  * Constructs a new CommitmentSigned given each field
14042  */
14043 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14044
14045 /**
14046  * Creates a copy of the CommitmentSigned
14047  */
14048 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14049
14050 /**
14051  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14052  */
14053 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14054
14055 /**
14056  * The channel ID
14057  */
14058 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14059
14060 /**
14061  * The channel ID
14062  */
14063 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14064
14065 /**
14066  * The secret corresponding to the per-commitment point
14067  */
14068 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14069
14070 /**
14071  * The secret corresponding to the per-commitment point
14072  */
14073 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14074
14075 /**
14076  * The next sender-broadcast commitment transaction's per-commitment point
14077  */
14078 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14079
14080 /**
14081  * The next sender-broadcast commitment transaction's per-commitment point
14082  */
14083 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14084
14085 /**
14086  * Constructs a new RevokeAndACK given each field
14087  */
14088 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);
14089
14090 /**
14091  * Creates a copy of the RevokeAndACK
14092  */
14093 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14094
14095 /**
14096  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14097  */
14098 void UpdateFee_free(struct LDKUpdateFee this_obj);
14099
14100 /**
14101  * The channel ID
14102  */
14103 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14104
14105 /**
14106  * The channel ID
14107  */
14108 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14109
14110 /**
14111  * Fee rate per 1000-weight of the transaction
14112  */
14113 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14114
14115 /**
14116  * Fee rate per 1000-weight of the transaction
14117  */
14118 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14119
14120 /**
14121  * Constructs a new UpdateFee given each field
14122  */
14123 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14124
14125 /**
14126  * Creates a copy of the UpdateFee
14127  */
14128 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14129
14130 /**
14131  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14132  */
14133 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14134
14135 /**
14136  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14137  * belonging to the recipient
14138  */
14139 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14140
14141 /**
14142  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14143  * belonging to the recipient
14144  */
14145 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14146
14147 /**
14148  * The sender's per-commitment point for their current commitment transaction
14149  */
14150 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14151
14152 /**
14153  * The sender's per-commitment point for their current commitment transaction
14154  */
14155 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14156
14157 /**
14158  * Constructs a new DataLossProtect given each field
14159  */
14160 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14161
14162 /**
14163  * Creates a copy of the DataLossProtect
14164  */
14165 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14166
14167 /**
14168  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14169  */
14170 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14171
14172 /**
14173  * The channel ID
14174  */
14175 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14176
14177 /**
14178  * The channel ID
14179  */
14180 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14181
14182 /**
14183  * The next commitment number for the sender
14184  */
14185 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14186
14187 /**
14188  * The next commitment number for the sender
14189  */
14190 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14191
14192 /**
14193  * The next commitment number for the recipient
14194  */
14195 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14196
14197 /**
14198  * The next commitment number for the recipient
14199  */
14200 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14201
14202 /**
14203  * Creates a copy of the ChannelReestablish
14204  */
14205 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14206
14207 /**
14208  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14209  */
14210 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14211
14212 /**
14213  * The channel ID
14214  */
14215 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14216
14217 /**
14218  * The channel ID
14219  */
14220 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14221
14222 /**
14223  * The short channel ID
14224  */
14225 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14226
14227 /**
14228  * The short channel ID
14229  */
14230 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14231
14232 /**
14233  * A signature by the node key
14234  */
14235 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14236
14237 /**
14238  * A signature by the node key
14239  */
14240 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14241
14242 /**
14243  * A signature by the funding key
14244  */
14245 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14246
14247 /**
14248  * A signature by the funding key
14249  */
14250 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14251
14252 /**
14253  * Constructs a new AnnouncementSignatures given each field
14254  */
14255 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);
14256
14257 /**
14258  * Creates a copy of the AnnouncementSignatures
14259  */
14260 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14261
14262 /**
14263  * Frees any resources used by the NetAddress
14264  */
14265 void NetAddress_free(struct LDKNetAddress this_ptr);
14266
14267 /**
14268  * Creates a copy of the NetAddress
14269  */
14270 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14271
14272 /**
14273  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14274  */
14275 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14276
14277 /**
14278  * Read a Result from a byte array, created by Result_write
14279  */
14280 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14281
14282 /**
14283  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14284  */
14285 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14286
14287 /**
14288  * The advertised features
14289  */
14290 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14291
14292 /**
14293  * The advertised features
14294  */
14295 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14296
14297 /**
14298  * A strictly monotonic announcement counter, with gaps allowed
14299  */
14300 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14301
14302 /**
14303  * A strictly monotonic announcement counter, with gaps allowed
14304  */
14305 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14306
14307 /**
14308  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14309  * to this node).
14310  */
14311 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14312
14313 /**
14314  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14315  * to this node).
14316  */
14317 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14318
14319 /**
14320  * An RGB color for UI purposes
14321  */
14322 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14323
14324 /**
14325  * An RGB color for UI purposes
14326  */
14327 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14328
14329 /**
14330  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14331  * of uniqueness.
14332  */
14333 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14334
14335 /**
14336  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14337  * of uniqueness.
14338  */
14339 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14340
14341 /**
14342  * List of addresses on which this node is reachable
14343  */
14344 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14345
14346 /**
14347  * Creates a copy of the UnsignedNodeAnnouncement
14348  */
14349 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14350
14351 /**
14352  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14353  */
14354 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14355
14356 /**
14357  * The signature by the node key
14358  */
14359 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14360
14361 /**
14362  * The signature by the node key
14363  */
14364 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14365
14366 /**
14367  * The actual content of the announcement
14368  */
14369 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14370
14371 /**
14372  * The actual content of the announcement
14373  */
14374 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14375
14376 /**
14377  * Constructs a new NodeAnnouncement given each field
14378  */
14379 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14380
14381 /**
14382  * Creates a copy of the NodeAnnouncement
14383  */
14384 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14385
14386 /**
14387  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14388  */
14389 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14390
14391 /**
14392  * The advertised channel features
14393  */
14394 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14395
14396 /**
14397  * The advertised channel features
14398  */
14399 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14400
14401 /**
14402  * The genesis hash of the blockchain where the channel is to be opened
14403  */
14404 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14405
14406 /**
14407  * The genesis hash of the blockchain where the channel is to be opened
14408  */
14409 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14410
14411 /**
14412  * The short channel ID
14413  */
14414 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14415
14416 /**
14417  * The short channel ID
14418  */
14419 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14420
14421 /**
14422  * One of the two node_ids which are endpoints of this channel
14423  */
14424 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14425
14426 /**
14427  * One of the two node_ids which are endpoints of this channel
14428  */
14429 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14430
14431 /**
14432  * The other of the two node_ids which are endpoints of this channel
14433  */
14434 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14435
14436 /**
14437  * The other of the two node_ids which are endpoints of this channel
14438  */
14439 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14440
14441 /**
14442  * The funding key for the first node
14443  */
14444 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14445
14446 /**
14447  * The funding key for the first node
14448  */
14449 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14450
14451 /**
14452  * The funding key for the second node
14453  */
14454 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14455
14456 /**
14457  * The funding key for the second node
14458  */
14459 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14460
14461 /**
14462  * Creates a copy of the UnsignedChannelAnnouncement
14463  */
14464 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14465
14466 /**
14467  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14468  */
14469 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14470
14471 /**
14472  * Authentication of the announcement by the first public node
14473  */
14474 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14475
14476 /**
14477  * Authentication of the announcement by the first public node
14478  */
14479 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14480
14481 /**
14482  * Authentication of the announcement by the second public node
14483  */
14484 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14485
14486 /**
14487  * Authentication of the announcement by the second public node
14488  */
14489 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14490
14491 /**
14492  * Proof of funding UTXO ownership by the first public node
14493  */
14494 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14495
14496 /**
14497  * Proof of funding UTXO ownership by the first public node
14498  */
14499 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14500
14501 /**
14502  * Proof of funding UTXO ownership by the second public node
14503  */
14504 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14505
14506 /**
14507  * Proof of funding UTXO ownership by the second public node
14508  */
14509 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14510
14511 /**
14512  * The actual announcement
14513  */
14514 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14515
14516 /**
14517  * The actual announcement
14518  */
14519 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
14520
14521 /**
14522  * Constructs a new ChannelAnnouncement given each field
14523  */
14524 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);
14525
14526 /**
14527  * Creates a copy of the ChannelAnnouncement
14528  */
14529 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
14530
14531 /**
14532  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
14533  */
14534 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
14535
14536 /**
14537  * The genesis hash of the blockchain where the channel is to be opened
14538  */
14539 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
14540
14541 /**
14542  * The genesis hash of the blockchain where the channel is to be opened
14543  */
14544 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14545
14546 /**
14547  * The short channel ID
14548  */
14549 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14550
14551 /**
14552  * The short channel ID
14553  */
14554 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14555
14556 /**
14557  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14558  */
14559 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14560
14561 /**
14562  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
14563  */
14564 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14565
14566 /**
14567  * Channel flags
14568  */
14569 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14570
14571 /**
14572  * Channel flags
14573  */
14574 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
14575
14576 /**
14577  * The number of blocks such that if:
14578  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14579  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14580  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14581  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14582  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14583  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14584  * constructing the route.
14585  */
14586 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14587
14588 /**
14589  * The number of blocks such that if:
14590  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
14591  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
14592  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
14593  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
14594  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
14595  * forwarding. Note that the HTLC sender is the one who originally sets this value when
14596  * constructing the route.
14597  */
14598 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
14599
14600 /**
14601  * The minimum HTLC size incoming to sender, in milli-satoshi
14602  */
14603 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14604
14605 /**
14606  * The minimum HTLC size incoming to sender, in milli-satoshi
14607  */
14608 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
14609
14610 /**
14611  * The base HTLC fee charged by sender, in milli-satoshi
14612  */
14613 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14614
14615 /**
14616  * The base HTLC fee charged by sender, in milli-satoshi
14617  */
14618 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14619
14620 /**
14621  * The amount to fee multiplier, in micro-satoshi
14622  */
14623 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
14624
14625 /**
14626  * The amount to fee multiplier, in micro-satoshi
14627  */
14628 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
14629
14630 /**
14631  * Creates a copy of the UnsignedChannelUpdate
14632  */
14633 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
14634
14635 /**
14636  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
14637  */
14638 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
14639
14640 /**
14641  * A signature of the channel update
14642  */
14643 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14644
14645 /**
14646  * A signature of the channel update
14647  */
14648 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
14649
14650 /**
14651  * The actual channel update
14652  */
14653 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
14654
14655 /**
14656  * The actual channel update
14657  */
14658 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
14659
14660 /**
14661  * Constructs a new ChannelUpdate given each field
14662  */
14663 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
14664
14665 /**
14666  * Creates a copy of the ChannelUpdate
14667  */
14668 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
14669
14670 /**
14671  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
14672  */
14673 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
14674
14675 /**
14676  * The genesis hash of the blockchain being queried
14677  */
14678 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
14679
14680 /**
14681  * The genesis hash of the blockchain being queried
14682  */
14683 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14684
14685 /**
14686  * The height of the first block for the channel UTXOs being queried
14687  */
14688 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14689
14690 /**
14691  * The height of the first block for the channel UTXOs being queried
14692  */
14693 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14694
14695 /**
14696  * The number of blocks to include in the query results
14697  */
14698 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
14699
14700 /**
14701  * The number of blocks to include in the query results
14702  */
14703 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14704
14705 /**
14706  * Constructs a new QueryChannelRange given each field
14707  */
14708 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
14709
14710 /**
14711  * Creates a copy of the QueryChannelRange
14712  */
14713 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
14714
14715 /**
14716  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
14717  */
14718 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
14719
14720 /**
14721  * The genesis hash of the blockchain being queried
14722  */
14723 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
14724
14725 /**
14726  * The genesis hash of the blockchain being queried
14727  */
14728 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14729
14730 /**
14731  * The height of the first block in the range of the reply
14732  */
14733 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14734
14735 /**
14736  * The height of the first block in the range of the reply
14737  */
14738 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14739
14740 /**
14741  * The number of blocks included in the range of the reply
14742  */
14743 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14744
14745 /**
14746  * The number of blocks included in the range of the reply
14747  */
14748 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
14749
14750 /**
14751  * True when this is the final reply for a query
14752  */
14753 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
14754
14755 /**
14756  * True when this is the final reply for a query
14757  */
14758 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
14759
14760 /**
14761  * The short_channel_ids in the channel range
14762  */
14763 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14764
14765 /**
14766  * Constructs a new ReplyChannelRange given each field
14767  */
14768 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);
14769
14770 /**
14771  * Creates a copy of the ReplyChannelRange
14772  */
14773 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
14774
14775 /**
14776  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
14777  */
14778 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
14779
14780 /**
14781  * The genesis hash of the blockchain being queried
14782  */
14783 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
14784
14785 /**
14786  * The genesis hash of the blockchain being queried
14787  */
14788 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14789
14790 /**
14791  * The short_channel_ids that are being queried
14792  */
14793 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
14794
14795 /**
14796  * Constructs a new QueryShortChannelIds given each field
14797  */
14798 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
14799
14800 /**
14801  * Creates a copy of the QueryShortChannelIds
14802  */
14803 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
14804
14805 /**
14806  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
14807  */
14808 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
14809
14810 /**
14811  * The genesis hash of the blockchain that was queried
14812  */
14813 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
14814
14815 /**
14816  * The genesis hash of the blockchain that was queried
14817  */
14818 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14819
14820 /**
14821  * Indicates if the query recipient maintains up-to-date channel
14822  * information for the chain_hash
14823  */
14824 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
14825
14826 /**
14827  * Indicates if the query recipient maintains up-to-date channel
14828  * information for the chain_hash
14829  */
14830 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
14831
14832 /**
14833  * Constructs a new ReplyShortChannelIdsEnd given each field
14834  */
14835 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
14836
14837 /**
14838  * Creates a copy of the ReplyShortChannelIdsEnd
14839  */
14840 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
14841
14842 /**
14843  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
14844  */
14845 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
14846
14847 /**
14848  * The genesis hash of the blockchain for channel and node information
14849  */
14850 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
14851
14852 /**
14853  * The genesis hash of the blockchain for channel and node information
14854  */
14855 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14856
14857 /**
14858  * The starting unix timestamp
14859  */
14860 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14861
14862 /**
14863  * The starting unix timestamp
14864  */
14865 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14866
14867 /**
14868  * The range of information in seconds
14869  */
14870 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
14871
14872 /**
14873  * The range of information in seconds
14874  */
14875 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
14876
14877 /**
14878  * Constructs a new GossipTimestampFilter given each field
14879  */
14880 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
14881
14882 /**
14883  * Creates a copy of the GossipTimestampFilter
14884  */
14885 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
14886
14887 /**
14888  * Frees any resources used by the ErrorAction
14889  */
14890 void ErrorAction_free(struct LDKErrorAction this_ptr);
14891
14892 /**
14893  * Creates a copy of the ErrorAction
14894  */
14895 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
14896
14897 /**
14898  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
14899  */
14900 void LightningError_free(struct LDKLightningError this_obj);
14901
14902 /**
14903  * A human-readable message describing the error
14904  */
14905 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
14906
14907 /**
14908  * A human-readable message describing the error
14909  */
14910 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
14911
14912 /**
14913  * The action which should be taken against the offending peer.
14914  */
14915 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
14916
14917 /**
14918  * The action which should be taken against the offending peer.
14919  */
14920 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
14921
14922 /**
14923  * Constructs a new LightningError given each field
14924  */
14925 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
14926
14927 /**
14928  * Creates a copy of the LightningError
14929  */
14930 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
14931
14932 /**
14933  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
14934  */
14935 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
14936
14937 /**
14938  * update_add_htlc messages which should be sent
14939  */
14940 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
14941
14942 /**
14943  * update_fulfill_htlc messages which should be sent
14944  */
14945 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
14946
14947 /**
14948  * update_fail_htlc messages which should be sent
14949  */
14950 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
14951
14952 /**
14953  * update_fail_malformed_htlc messages which should be sent
14954  */
14955 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
14956
14957 /**
14958  * An update_fee message which should be sent
14959  */
14960 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14961
14962 /**
14963  * An update_fee message which should be sent
14964  */
14965 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
14966
14967 /**
14968  * Finally, the commitment_signed message which should be sent
14969  */
14970 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
14971
14972 /**
14973  * Finally, the commitment_signed message which should be sent
14974  */
14975 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
14976
14977 /**
14978  * Constructs a new CommitmentUpdate given each field
14979  */
14980 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);
14981
14982 /**
14983  * Creates a copy of the CommitmentUpdate
14984  */
14985 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
14986
14987 /**
14988  * Frees any resources used by the HTLCFailChannelUpdate
14989  */
14990 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
14991
14992 /**
14993  * Creates a copy of the HTLCFailChannelUpdate
14994  */
14995 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
14996
14997 /**
14998  * Calls the free function if one is set
14999  */
15000 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15001
15002 /**
15003  * Calls the free function if one is set
15004  */
15005 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15006
15007 /**
15008  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15009  */
15010 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15011
15012 /**
15013  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15014  */
15015 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15016
15017 /**
15018  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15019  */
15020 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15021
15022 /**
15023  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15024  */
15025 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15026
15027 /**
15028  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15029  */
15030 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15031
15032 /**
15033  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15034  */
15035 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15036
15037 /**
15038  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15039  */
15040 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15041
15042 /**
15043  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15044  */
15045 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15046
15047 /**
15048  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15049  */
15050 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15051
15052 /**
15053  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15054  */
15055 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15056
15057 /**
15058  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15059  */
15060 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15061
15062 /**
15063  * Read a FundingCreated from a byte array, created by FundingCreated_write
15064  */
15065 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15066
15067 /**
15068  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15069  */
15070 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15071
15072 /**
15073  * Read a FundingSigned from a byte array, created by FundingSigned_write
15074  */
15075 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15076
15077 /**
15078  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15079  */
15080 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15081
15082 /**
15083  * Read a FundingLocked from a byte array, created by FundingLocked_write
15084  */
15085 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15086
15087 /**
15088  * Serialize the Init object into a byte array which can be read by Init_read
15089  */
15090 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15091
15092 /**
15093  * Read a Init from a byte array, created by Init_write
15094  */
15095 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15096
15097 /**
15098  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15099  */
15100 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15101
15102 /**
15103  * Read a OpenChannel from a byte array, created by OpenChannel_write
15104  */
15105 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15106
15107 /**
15108  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15109  */
15110 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15111
15112 /**
15113  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15114  */
15115 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15116
15117 /**
15118  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15119  */
15120 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15121
15122 /**
15123  * Read a Shutdown from a byte array, created by Shutdown_write
15124  */
15125 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15126
15127 /**
15128  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15129  */
15130 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15131
15132 /**
15133  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15134  */
15135 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15136
15137 /**
15138  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15139  */
15140 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15141
15142 /**
15143  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15144  */
15145 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15146
15147 /**
15148  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15149  */
15150 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15151
15152 /**
15153  * Read a UpdateFee from a byte array, created by UpdateFee_write
15154  */
15155 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15156
15157 /**
15158  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15159  */
15160 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15161
15162 /**
15163  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15164  */
15165 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15166
15167 /**
15168  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15169  */
15170 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15171
15172 /**
15173  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15174  */
15175 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15176
15177 /**
15178  * Serialize the Ping object into a byte array which can be read by Ping_read
15179  */
15180 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15181
15182 /**
15183  * Read a Ping from a byte array, created by Ping_write
15184  */
15185 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15186
15187 /**
15188  * Serialize the Pong object into a byte array which can be read by Pong_read
15189  */
15190 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15191
15192 /**
15193  * Read a Pong from a byte array, created by Pong_write
15194  */
15195 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15196
15197 /**
15198  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15199  */
15200 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15201
15202 /**
15203  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15204  */
15205 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15206
15207 /**
15208  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15209  */
15210 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15211
15212 /**
15213  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15214  */
15215 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15216
15217 /**
15218  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15219  */
15220 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15221
15222 /**
15223  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15224  */
15225 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15226
15227 /**
15228  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15229  */
15230 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15231
15232 /**
15233  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15234  */
15235 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15236
15237 /**
15238  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15239  */
15240 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15241
15242 /**
15243  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15244  */
15245 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15246
15247 /**
15248  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15249  */
15250 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15251
15252 /**
15253  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15254  */
15255 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15256
15257 /**
15258  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15259  */
15260 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15261
15262 /**
15263  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15264  */
15265 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15266
15267 /**
15268  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15269  */
15270 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15271
15272 /**
15273  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15274  */
15275 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15276
15277 /**
15278  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15279  */
15280 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15281
15282 /**
15283  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15284  */
15285 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15286
15287 /**
15288  *\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
15289  */
15290 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15291
15292 /**
15293  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15294  */
15295 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15296
15297 /**
15298  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15299  */
15300 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15301
15302 /**
15303  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15304  */
15305 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15306
15307 /**
15308  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15309  */
15310 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15311
15312 /**
15313  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15314  */
15315 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15316
15317 /**
15318  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15319  */
15320 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15321
15322 /**
15323  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15324  */
15325 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15326
15327 /**
15328  * Constructs a new IgnoringMessageHandler given each field
15329  */
15330 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15331
15332 /**
15333  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15334  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15335  */
15336 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15337
15338 /**
15339  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15340  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15341  */
15342 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15343
15344 /**
15345  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15346  */
15347 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15348
15349 /**
15350  * Constructs a new ErroringMessageHandler
15351  */
15352 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15353
15354 /**
15355  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15356  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15357  */
15358 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15359
15360 /**
15361  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15362  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15363  */
15364 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15365
15366 /**
15367  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15368  */
15369 void MessageHandler_free(struct LDKMessageHandler this_obj);
15370
15371 /**
15372  * A message handler which handles messages specific to channels. Usually this is just a
15373  * ChannelManager object or a ErroringMessageHandler.
15374  */
15375 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15376
15377 /**
15378  * A message handler which handles messages specific to channels. Usually this is just a
15379  * ChannelManager object or a ErroringMessageHandler.
15380  */
15381 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15382
15383 /**
15384  * A message handler which handles messages updating our knowledge of the network channel
15385  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15386  */
15387 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15388
15389 /**
15390  * A message handler which handles messages updating our knowledge of the network channel
15391  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15392  */
15393 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15394
15395 /**
15396  * Constructs a new MessageHandler given each field
15397  */
15398 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15399
15400 /**
15401  * Creates a copy of a SocketDescriptor
15402  */
15403 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15404
15405 /**
15406  * Calls the free function if one is set
15407  */
15408 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15409
15410 /**
15411  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15412  */
15413 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15414
15415 /**
15416  * Used to indicate that we probably can't make any future connections to this peer, implying
15417  * we should go ahead and force-close any channels we have with it.
15418  */
15419 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15420
15421 /**
15422  * Used to indicate that we probably can't make any future connections to this peer, implying
15423  * we should go ahead and force-close any channels we have with it.
15424  */
15425 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15426
15427 /**
15428  * Constructs a new PeerHandleError given each field
15429  */
15430 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15431
15432 /**
15433  * Creates a copy of the PeerHandleError
15434  */
15435 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15436
15437 /**
15438  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15439  */
15440 void PeerManager_free(struct LDKPeerManager this_obj);
15441
15442 /**
15443  * Constructs a new PeerManager with the given message handlers and node_id secret key
15444  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15445  * cryptographically secure random bytes.
15446  */
15447 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);
15448
15449 /**
15450  * Get the list of node ids for peers which have completed the initial handshake.
15451  *
15452  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15453  * new_outbound_connection, however entries will only appear once the initial handshake has
15454  * completed and we are sure the remote peer has the private key for the given node_id.
15455  */
15456 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15457
15458 /**
15459  * Indicates a new outbound connection has been established to a node with the given node_id.
15460  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15461  * descriptor but must disconnect the connection immediately.
15462  *
15463  * Returns a small number of bytes to send to the remote node (currently always 50).
15464  *
15465  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15466  * socket_disconnected().
15467  */
15468 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);
15469
15470 /**
15471  * Indicates a new inbound connection has been established.
15472  *
15473  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15474  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15475  * call socket_disconnected for the new descriptor but must disconnect the connection
15476  * immediately.
15477  *
15478  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15479  * socket_disconnected called.
15480  */
15481 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15482
15483 /**
15484  * Indicates that there is room to write data to the given socket descriptor.
15485  *
15486  * May return an Err to indicate that the connection should be closed.
15487  *
15488  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15489  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15490  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15491  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15492  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15493  * new_\\*_connection event.
15494  */
15495 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15496
15497 /**
15498  * Indicates that data was read from the given socket descriptor.
15499  *
15500  * May return an Err to indicate that the connection should be closed.
15501  *
15502  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15503  * Thus, however, you almost certainly want to call process_events() after any read_event to
15504  * generate send_data calls to handle responses.
15505  *
15506  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
15507  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
15508  *
15509  * Panics if the descriptor was not previously registered in a new_*_connection event.
15510  */
15511 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);
15512
15513 /**
15514  * Checks for any events generated by our handlers and processes them. Includes sending most
15515  * response messages as well as messages generated by calls to handler functions directly (eg
15516  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
15517  */
15518 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
15519
15520 /**
15521  * Indicates that the given socket descriptor's connection is now closed.
15522  *
15523  * This must only be called if the socket has been disconnected by the peer or your own
15524  * decision to disconnect it and must NOT be called in any case where other parts of this
15525  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
15526  * the peer.
15527  *
15528  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
15529  */
15530 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15531
15532 /**
15533  * Disconnect a peer given its node id.
15534  *
15535  * Set no_connection_possible to true to prevent any further connection with this peer,
15536  * force-closing any channels we have with it.
15537  *
15538  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
15539  * so be careful about reentrancy issues.
15540  */
15541 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
15542
15543 /**
15544  * This function should be called roughly once every 30 seconds.
15545  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
15546  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
15547  */
15548 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
15549
15550 /**
15551  * Build the commitment secret from the seed and the commitment number
15552  */
15553 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
15554
15555 /**
15556  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
15557  * from the base secret and the per_commitment_point.
15558  *
15559  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15560  * generated (ie our own).
15561  */
15562 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
15563
15564 /**
15565  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
15566  * from the base point and the per_commitment_key. This is the public equivalent of
15567  * derive_private_key - using only public keys to derive a public key instead of private keys.
15568  *
15569  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15570  * generated (ie our own).
15571  */
15572 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
15573
15574 /**
15575  * Derives a per-commitment-transaction revocation key from its constituent parts.
15576  *
15577  * Only the cheating participant owns a valid witness to propagate a revoked
15578  * commitment transaction, thus per_commitment_secret always come from cheater
15579  * and revocation_base_secret always come from punisher, which is the broadcaster
15580  * of the transaction spending with this key knowledge.
15581  *
15582  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15583  * generated (ie our own).
15584  */
15585 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
15586
15587 /**
15588  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
15589  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
15590  * public key instead of private keys.
15591  *
15592  * Only the cheating participant owns a valid witness to propagate a revoked
15593  * commitment transaction, thus per_commitment_point always come from cheater
15594  * and revocation_base_point always come from punisher, which is the broadcaster
15595  * of the transaction spending with this key knowledge.
15596  *
15597  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
15598  * generated (ie our own).
15599  */
15600 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
15601
15602 /**
15603  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
15604  */
15605 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
15606
15607 /**
15608  * The broadcaster's per-commitment public key which was used to derive the other keys.
15609  */
15610 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15611
15612 /**
15613  * The broadcaster's per-commitment public key which was used to derive the other keys.
15614  */
15615 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15616
15617 /**
15618  * The revocation key which is used to allow the broadcaster of the commitment
15619  * transaction to provide their counterparty the ability to punish them if they broadcast
15620  * an old state.
15621  */
15622 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15623
15624 /**
15625  * The revocation key which is used to allow the broadcaster of the commitment
15626  * transaction to provide their counterparty the ability to punish them if they broadcast
15627  * an old state.
15628  */
15629 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15630
15631 /**
15632  * Broadcaster's HTLC Key
15633  */
15634 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15635
15636 /**
15637  * Broadcaster's HTLC Key
15638  */
15639 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15640
15641 /**
15642  * Countersignatory's HTLC Key
15643  */
15644 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15645
15646 /**
15647  * Countersignatory's HTLC Key
15648  */
15649 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15650
15651 /**
15652  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15653  */
15654 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
15655
15656 /**
15657  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
15658  */
15659 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15660
15661 /**
15662  * Constructs a new TxCreationKeys given each field
15663  */
15664 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);
15665
15666 /**
15667  * Creates a copy of the TxCreationKeys
15668  */
15669 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
15670
15671 /**
15672  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
15673  */
15674 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
15675
15676 /**
15677  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
15678  */
15679 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
15680
15681 /**
15682  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
15683  */
15684 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
15685
15686 /**
15687  * The public key which is used to sign all commitment transactions, as it appears in the
15688  * on-chain channel lock-in 2-of-2 multisig output.
15689  */
15690 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15691
15692 /**
15693  * The public key which is used to sign all commitment transactions, as it appears in the
15694  * on-chain channel lock-in 2-of-2 multisig output.
15695  */
15696 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15697
15698 /**
15699  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15700  * revocation keys. This is combined with the per-commitment-secret generated by the
15701  * counterparty to create a secret which the counterparty can reveal to revoke previous
15702  * states.
15703  */
15704 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15705
15706 /**
15707  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
15708  * revocation keys. This is combined with the per-commitment-secret generated by the
15709  * counterparty to create a secret which the counterparty can reveal to revoke previous
15710  * states.
15711  */
15712 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15713
15714 /**
15715  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15716  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15717  * static across every commitment transaction.
15718  */
15719 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15720
15721 /**
15722  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
15723  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
15724  * static across every commitment transaction.
15725  */
15726 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15727
15728 /**
15729  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15730  * public key which receives non-HTLC-encumbered funds which are only available for spending
15731  * after some delay (or can be claimed via the revocation path).
15732  */
15733 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15734
15735 /**
15736  * The base point which is used (with derive_public_key) to derive a per-commitment payment
15737  * public key which receives non-HTLC-encumbered funds which are only available for spending
15738  * after some delay (or can be claimed via the revocation path).
15739  */
15740 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15741
15742 /**
15743  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15744  * which is used to encumber HTLC-in-flight outputs.
15745  */
15746 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
15747
15748 /**
15749  * The base point which is used (with derive_public_key) to derive a per-commitment public key
15750  * which is used to encumber HTLC-in-flight outputs.
15751  */
15752 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15753
15754 /**
15755  * Constructs a new ChannelPublicKeys given each field
15756  */
15757 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);
15758
15759 /**
15760  * Creates a copy of the ChannelPublicKeys
15761  */
15762 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
15763
15764 /**
15765  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
15766  */
15767 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
15768
15769 /**
15770  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
15771  */
15772 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
15773
15774 /**
15775  * Create per-state keys from channel base points and the per-commitment point.
15776  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15777  */
15778 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);
15779
15780 /**
15781  * Generate per-state keys from channel static keys.
15782  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
15783  */
15784 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);
15785
15786 /**
15787  * A script either spendable by the revocation
15788  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
15789  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
15790  */
15791 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
15792
15793 /**
15794  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
15795  */
15796 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
15797
15798 /**
15799  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15800  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15801  * need to compare this value to whether the commitment transaction in question is that of
15802  * the counterparty or our own.
15803  */
15804 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15805
15806 /**
15807  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
15808  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
15809  * need to compare this value to whether the commitment transaction in question is that of
15810  * the counterparty or our own.
15811  */
15812 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
15813
15814 /**
15815  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15816  * this divided by 1000.
15817  */
15818 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15819
15820 /**
15821  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
15822  * this divided by 1000.
15823  */
15824 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
15825
15826 /**
15827  * The CLTV lock-time at which this HTLC expires.
15828  */
15829 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15830
15831 /**
15832  * The CLTV lock-time at which this HTLC expires.
15833  */
15834 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
15835
15836 /**
15837  * The hash of the preimage which unlocks this HTLC.
15838  */
15839 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
15840
15841 /**
15842  * The hash of the preimage which unlocks this HTLC.
15843  */
15844 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15845
15846 /**
15847  * The position within the commitment transactions' outputs. This may be None if the value is
15848  * below the dust limit (in which case no output appears in the commitment transaction and the
15849  * value is spent to additional transaction fees).
15850  */
15851 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
15852
15853 /**
15854  * The position within the commitment transactions' outputs. This may be None if the value is
15855  * below the dust limit (in which case no output appears in the commitment transaction and the
15856  * value is spent to additional transaction fees).
15857  */
15858 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
15859
15860 /**
15861  * Constructs a new HTLCOutputInCommitment given each field
15862  */
15863 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);
15864
15865 /**
15866  * Creates a copy of the HTLCOutputInCommitment
15867  */
15868 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
15869
15870 /**
15871  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
15872  */
15873 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
15874
15875 /**
15876  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
15877  */
15878 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
15879
15880 /**
15881  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
15882  * does not need to have its previous_output_index filled.
15883  */
15884 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
15885
15886 /**
15887  * Gets the redeemscript for a funding output from the two funding public keys.
15888  * Note that the order of funding public keys does not matter.
15889  */
15890 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
15891
15892 /**
15893  * panics if htlc.transaction_output_index.is_none()!
15894  */
15895 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);
15896
15897 /**
15898  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15899  */
15900 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
15901
15902 /**
15903  * Holder public keys
15904  */
15905 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15906
15907 /**
15908  * Holder public keys
15909  */
15910 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15911
15912 /**
15913  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15914  */
15915 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15916
15917 /**
15918  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
15919  */
15920 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15921
15922 /**
15923  * Whether the holder is the initiator of this channel.
15924  * This is an input to the commitment number obscure factor computation.
15925  */
15926 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15927
15928 /**
15929  * Whether the holder is the initiator of this channel.
15930  * This is an input to the commitment number obscure factor computation.
15931  */
15932 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
15933
15934 /**
15935  * The late-bound counterparty channel transaction parameters.
15936  * These parameters are populated at the point in the protocol where the counterparty provides them.
15937  */
15938 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15939
15940 /**
15941  * The late-bound counterparty channel transaction parameters.
15942  * These parameters are populated at the point in the protocol where the counterparty provides them.
15943  */
15944 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
15945
15946 /**
15947  * The late-bound funding outpoint
15948  */
15949 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
15950
15951 /**
15952  * The late-bound funding outpoint
15953  */
15954 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15955
15956 /**
15957  * Constructs a new ChannelTransactionParameters given each field
15958  */
15959 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);
15960
15961 /**
15962  * Creates a copy of the ChannelTransactionParameters
15963  */
15964 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
15965
15966 /**
15967  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
15968  */
15969 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
15970
15971 /**
15972  * Counter-party public keys
15973  */
15974 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15975
15976 /**
15977  * Counter-party public keys
15978  */
15979 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
15980
15981 /**
15982  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15983  */
15984 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
15985
15986 /**
15987  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
15988  */
15989 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
15990
15991 /**
15992  * Constructs a new CounterpartyChannelTransactionParameters given each field
15993  */
15994 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
15995
15996 /**
15997  * Creates a copy of the CounterpartyChannelTransactionParameters
15998  */
15999 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16000
16001 /**
16002  * Whether the late bound parameters are populated.
16003  */
16004 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16005
16006 /**
16007  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16008  * given that the holder is the broadcaster.
16009  *
16010  * self.is_populated() must be true before calling this function.
16011  */
16012 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16013
16014 /**
16015  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16016  * given that the counterparty is the broadcaster.
16017  *
16018  * self.is_populated() must be true before calling this function.
16019  */
16020 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16021
16022 /**
16023  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16024  */
16025 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16026
16027 /**
16028  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16029  */
16030 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16031
16032 /**
16033  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16034  */
16035 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16036
16037 /**
16038  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16039  */
16040 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16041
16042 /**
16043  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16044  */
16045 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16046
16047 /**
16048  * Get the channel pubkeys for the broadcaster
16049  */
16050 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16051
16052 /**
16053  * Get the channel pubkeys for the countersignatory
16054  */
16055 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16056
16057 /**
16058  * Get the contest delay applicable to the transactions.
16059  * Note that the contest delay was selected by the countersignatory.
16060  */
16061 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16062
16063 /**
16064  * Whether the channel is outbound from the broadcaster.
16065  *
16066  * The boolean representing the side that initiated the channel is
16067  * an input to the commitment number obscure factor computation.
16068  */
16069 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16070
16071 /**
16072  * The funding outpoint
16073  */
16074 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16075
16076 /**
16077  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16078  */
16079 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16080
16081 /**
16082  * Our counterparty's signature for the transaction
16083  */
16084 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16085
16086 /**
16087  * Our counterparty's signature for the transaction
16088  */
16089 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16090
16091 /**
16092  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16093  */
16094 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16095
16096 /**
16097  * Creates a copy of the HolderCommitmentTransaction
16098  */
16099 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16100
16101 /**
16102  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16103  */
16104 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16105
16106 /**
16107  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16108  */
16109 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16110
16111 /**
16112  * Create a new holder transaction with the given counterparty signatures.
16113  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16114  */
16115 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);
16116
16117 /**
16118  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16119  */
16120 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16121
16122 /**
16123  * The commitment transaction
16124  */
16125 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16126
16127 /**
16128  * The commitment transaction
16129  */
16130 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16131
16132 /**
16133  * The txid for the commitment transaction.
16134  *
16135  * This is provided as a performance optimization, instead of calling transaction.txid()
16136  * multiple times.
16137  */
16138 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16139
16140 /**
16141  * The txid for the commitment transaction.
16142  *
16143  * This is provided as a performance optimization, instead of calling transaction.txid()
16144  * multiple times.
16145  */
16146 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16147
16148 /**
16149  * Constructs a new BuiltCommitmentTransaction given each field
16150  */
16151 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16152
16153 /**
16154  * Creates a copy of the BuiltCommitmentTransaction
16155  */
16156 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16157
16158 /**
16159  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16160  */
16161 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16162
16163 /**
16164  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16165  */
16166 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16167
16168 /**
16169  * Get the SIGHASH_ALL sighash value of the transaction.
16170  *
16171  * This can be used to verify a signature.
16172  */
16173 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);
16174
16175 /**
16176  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16177  * because we are about to broadcast a holder transaction.
16178  */
16179 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);
16180
16181 /**
16182  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16183  */
16184 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16185
16186 /**
16187  * Creates a copy of the CommitmentTransaction
16188  */
16189 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16190
16191 /**
16192  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16193  */
16194 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16195
16196 /**
16197  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16198  */
16199 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16200
16201 /**
16202  * The backwards-counting commitment number
16203  */
16204 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16205
16206 /**
16207  * The value to be sent to the broadcaster
16208  */
16209 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16210
16211 /**
16212  * The value to be sent to the counterparty
16213  */
16214 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16215
16216 /**
16217  * The feerate paid per 1000-weight-unit in this commitment transaction.
16218  */
16219 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16220
16221 /**
16222  * Trust our pre-built transaction and derived transaction creation public keys.
16223  *
16224  * Applies a wrapper which allows access to these fields.
16225  *
16226  * This should only be used if you fully trust the builder of this object.  It should not
16227  *\tbe used by an external signer - instead use the verify function.
16228  */
16229 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16230
16231 /**
16232  * Verify our pre-built transaction and derived transaction creation public keys.
16233  *
16234  * Applies a wrapper which allows access to these fields.
16235  *
16236  * An external validating signer must call this method before signing
16237  * or using the built transaction.
16238  */
16239 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);
16240
16241 /**
16242  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16243  */
16244 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16245
16246 /**
16247  * The transaction ID of the built Bitcoin transaction
16248  */
16249 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16250
16251 /**
16252  * The pre-built Bitcoin commitment transaction
16253  */
16254 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16255
16256 /**
16257  * The pre-calculated transaction creation public keys.
16258  */
16259 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16260
16261 /**
16262  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16263  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16264  *
16265  * The returned Vec has one entry for each HTLC, and in the same order.
16266  */
16267 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);
16268
16269 /**
16270  * Get the transaction number obscure factor
16271  */
16272 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16273
16274 /**
16275  * Creates a copy of the InitFeatures
16276  */
16277 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16278
16279 /**
16280  * Creates a copy of the NodeFeatures
16281  */
16282 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16283
16284 /**
16285  * Creates a copy of the ChannelFeatures
16286  */
16287 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16288
16289 /**
16290  * Creates a copy of the InvoiceFeatures
16291  */
16292 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16293
16294 /**
16295  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16296  */
16297 void InitFeatures_free(struct LDKInitFeatures this_obj);
16298
16299 /**
16300  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16301  */
16302 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16303
16304 /**
16305  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16306  */
16307 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16308
16309 /**
16310  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16311  */
16312 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16313
16314 /**
16315  * Create a blank Features with no features set
16316  */
16317 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16318
16319 /**
16320  * Creates a Features with the bits set which are known by the implementation
16321  */
16322 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16323
16324 /**
16325  * Create a blank Features with no features set
16326  */
16327 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16328
16329 /**
16330  * Creates a Features with the bits set which are known by the implementation
16331  */
16332 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16333
16334 /**
16335  * Create a blank Features with no features set
16336  */
16337 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16338
16339 /**
16340  * Creates a Features with the bits set which are known by the implementation
16341  */
16342 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16343
16344 /**
16345  * Create a blank Features with no features set
16346  */
16347 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16348
16349 /**
16350  * Creates a Features with the bits set which are known by the implementation
16351  */
16352 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16353
16354 /**
16355  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16356  */
16357 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16358
16359 /**
16360  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16361  */
16362 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16363
16364 /**
16365  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16366  */
16367 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16368
16369 /**
16370  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16371  */
16372 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16373
16374 /**
16375  * Read a InitFeatures from a byte array, created by InitFeatures_write
16376  */
16377 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16378
16379 /**
16380  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16381  */
16382 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16383
16384 /**
16385  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16386  */
16387 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16388
16389 /**
16390  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16391  */
16392 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16393
16394 /**
16395  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16396  */
16397 void RouteHop_free(struct LDKRouteHop this_obj);
16398
16399 /**
16400  * The node_id of the node at this hop.
16401  */
16402 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16403
16404 /**
16405  * The node_id of the node at this hop.
16406  */
16407 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16408
16409 /**
16410  * The node_announcement features of the node at this hop. For the last hop, these may be
16411  * amended to match the features present in the invoice this node generated.
16412  */
16413 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16414
16415 /**
16416  * The node_announcement features of the node at this hop. For the last hop, these may be
16417  * amended to match the features present in the invoice this node generated.
16418  */
16419 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16420
16421 /**
16422  * The channel that should be used from the previous hop to reach this node.
16423  */
16424 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16425
16426 /**
16427  * The channel that should be used from the previous hop to reach this node.
16428  */
16429 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16430
16431 /**
16432  * The channel_announcement features of the channel that should be used from the previous hop
16433  * to reach this node.
16434  */
16435 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16436
16437 /**
16438  * The channel_announcement features of the channel that should be used from the previous hop
16439  * to reach this node.
16440  */
16441 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16442
16443 /**
16444  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16445  * For the last hop, this should be the full value of the payment (might be more than
16446  * requested if we had to match htlc_minimum_msat).
16447  */
16448 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16449
16450 /**
16451  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16452  * For the last hop, this should be the full value of the payment (might be more than
16453  * requested if we had to match htlc_minimum_msat).
16454  */
16455 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16456
16457 /**
16458  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16459  * expected at the destination, in excess of the current block height.
16460  */
16461 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16462
16463 /**
16464  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16465  * expected at the destination, in excess of the current block height.
16466  */
16467 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
16468
16469 /**
16470  * Constructs a new RouteHop given each field
16471  */
16472 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);
16473
16474 /**
16475  * Creates a copy of the RouteHop
16476  */
16477 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
16478
16479 /**
16480  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
16481  */
16482 void Route_free(struct LDKRoute this_obj);
16483
16484 /**
16485  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
16486  * last RouteHop in each path must be the same.
16487  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
16488  * destination. Thus, this must always be at least length one. While the maximum length of any
16489  * given path is variable, keeping the length of any path to less than 20 should currently
16490  * ensure it is viable.
16491  */
16492 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
16493
16494 /**
16495  * Constructs a new Route given each field
16496  */
16497 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
16498
16499 /**
16500  * Creates a copy of the Route
16501  */
16502 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
16503
16504 /**
16505  * Serialize the Route object into a byte array which can be read by Route_read
16506  */
16507 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
16508
16509 /**
16510  * Read a Route from a byte array, created by Route_write
16511  */
16512 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
16513
16514 /**
16515  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
16516  */
16517 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
16518
16519 /**
16520  * The node_id of the non-target end of the route
16521  */
16522 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16523
16524 /**
16525  * The node_id of the non-target end of the route
16526  */
16527 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16528
16529 /**
16530  * The short_channel_id of this channel
16531  */
16532 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16533
16534 /**
16535  * The short_channel_id of this channel
16536  */
16537 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
16538
16539 /**
16540  * The fees which must be paid to use this channel
16541  */
16542 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16543
16544 /**
16545  * The fees which must be paid to use this channel
16546  */
16547 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16548
16549 /**
16550  * The difference in CLTV values between this node and the next node.
16551  */
16552 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16553
16554 /**
16555  * The difference in CLTV values between this node and the next node.
16556  */
16557 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
16558
16559 /**
16560  * The minimum value, in msat, which must be relayed to the next hop.
16561  */
16562 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16563
16564 /**
16565  * The minimum value, in msat, which must be relayed to the next hop.
16566  */
16567 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16568
16569 /**
16570  * The maximum value in msat available for routing with a single HTLC.
16571  */
16572 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
16573
16574 /**
16575  * The maximum value in msat available for routing with a single HTLC.
16576  */
16577 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16578
16579 /**
16580  * Constructs a new RouteHintHop given each field
16581  */
16582 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);
16583
16584 /**
16585  * Creates a copy of the RouteHintHop
16586  */
16587 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
16588
16589 /**
16590  * Gets a route from us (payer) to the given target node (payee).
16591  *
16592  * If the payee provided features in their invoice, they should be provided via payee_features.
16593  * Without this, MPP will only be used if the payee's features are available in the network graph.
16594  *
16595  * Extra routing hops between known nodes and the target will be used if they are included in
16596  * last_hops.
16597  *
16598  * If some channels aren't announced, it may be useful to fill in a first_hops with the
16599  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
16600  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
16601  * in first_hops will be used.
16602  *
16603  * Panics if first_hops contains channels without short_channel_ids
16604  * (ChannelManager::list_usable_channels will never include such channels).
16605  *
16606  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
16607  * equal), however the enabled/disabled bit on such channels as well as the
16608  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
16609  */
16610 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);
16611
16612 /**
16613  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
16614  */
16615 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
16616
16617 /**
16618  * Creates a copy of the NetworkGraph
16619  */
16620 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
16621
16622 /**
16623  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
16624  */
16625 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
16626
16627 /**
16628  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
16629  */
16630 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
16631
16632 /**
16633  * Creates a new tracker of the actual state of the network of channels and nodes,
16634  * assuming a fresh network graph.
16635  * Chain monitor is used to make sure announced channels exist on-chain,
16636  * channel data is correct, and that the announcement is signed with
16637  * channel owners' keys.
16638  */
16639 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
16640
16641 /**
16642  * Creates a new tracker of the actual state of the network of channels and nodes,
16643  * assuming an existing Network Graph.
16644  */
16645 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
16646
16647 /**
16648  * Adds a provider used to check new announcements. Does not affect
16649  * existing announcements unless they are updated.
16650  * Add, update or remove the provider would replace the current one.
16651  */
16652 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
16653
16654 /**
16655  * Take a read lock on the network_graph and return it in the C-bindings
16656  * newtype helper. This is likely only useful when called via the C
16657  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
16658  * yourself.
16659  */
16660 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16661
16662 /**
16663  * Get a reference to the NetworkGraph which this read-lock contains.
16664  */
16665 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
16666
16667 /**
16668  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
16669  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
16670  */
16671 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16672
16673 /**
16674  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16675  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16676  */
16677 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
16678
16679 /**
16680  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
16681  */
16682 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
16683
16684 /**
16685  * When the last update to the channel direction was issued.
16686  * Value is opaque, as set in the announcement.
16687  */
16688 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16689
16690 /**
16691  * When the last update to the channel direction was issued.
16692  * Value is opaque, as set in the announcement.
16693  */
16694 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
16695
16696 /**
16697  * Whether the channel can be currently used for payments (in this one direction).
16698  */
16699 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16700
16701 /**
16702  * Whether the channel can be currently used for payments (in this one direction).
16703  */
16704 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
16705
16706 /**
16707  * The difference in CLTV values that you must have when routing through this channel.
16708  */
16709 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16710
16711 /**
16712  * The difference in CLTV values that you must have when routing through this channel.
16713  */
16714 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
16715
16716 /**
16717  * The minimum value, which must be relayed to the next hop via the channel
16718  */
16719 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16720
16721 /**
16722  * The minimum value, which must be relayed to the next hop via the channel
16723  */
16724 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
16725
16726 /**
16727  * The maximum value which may be relayed to the next hop via the channel.
16728  */
16729 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16730
16731 /**
16732  * The maximum value which may be relayed to the next hop via the channel.
16733  */
16734 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16735
16736 /**
16737  * Fees charged when the channel is used for routing
16738  */
16739 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16740
16741 /**
16742  * Fees charged when the channel is used for routing
16743  */
16744 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
16745
16746 /**
16747  * Most recent update for the channel received from the network
16748  * Mostly redundant with the data we store in fields explicitly.
16749  * Everything else is useful only for sending out for initial routing sync.
16750  * Not stored if contains excess data to prevent DoS.
16751  */
16752 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
16753
16754 /**
16755  * Most recent update for the channel received from the network
16756  * Mostly redundant with the data we store in fields explicitly.
16757  * Everything else is useful only for sending out for initial routing sync.
16758  * Not stored if contains excess data to prevent DoS.
16759  */
16760 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
16761
16762 /**
16763  * Constructs a new DirectionalChannelInfo given each field
16764  */
16765 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);
16766
16767 /**
16768  * Creates a copy of the DirectionalChannelInfo
16769  */
16770 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
16771
16772 /**
16773  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
16774  */
16775 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
16776
16777 /**
16778  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
16779  */
16780 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
16781
16782 /**
16783  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
16784  */
16785 void ChannelInfo_free(struct LDKChannelInfo this_obj);
16786
16787 /**
16788  * Protocol features of a channel communicated during its announcement
16789  */
16790 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16791
16792 /**
16793  * Protocol features of a channel communicated during its announcement
16794  */
16795 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16796
16797 /**
16798  * Source node of the first direction of a channel
16799  */
16800 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16801
16802 /**
16803  * Source node of the first direction of a channel
16804  */
16805 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16806
16807 /**
16808  * Details about the first direction of a channel
16809  */
16810 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16811
16812 /**
16813  * Details about the first direction of a channel
16814  */
16815 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16816
16817 /**
16818  * Source node of the second direction of a channel
16819  */
16820 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16821
16822 /**
16823  * Source node of the second direction of a channel
16824  */
16825 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16826
16827 /**
16828  * Details about the second direction of a channel
16829  */
16830 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16831
16832 /**
16833  * Details about the second direction of a channel
16834  */
16835 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
16836
16837 /**
16838  * The channel capacity as seen on-chain, if chain lookup is available.
16839  */
16840 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16841
16842 /**
16843  * The channel capacity as seen on-chain, if chain lookup is available.
16844  */
16845 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16846
16847 /**
16848  * An initial announcement of the channel
16849  * Mostly redundant with the data we store in fields explicitly.
16850  * Everything else is useful only for sending out for initial routing sync.
16851  * Not stored if contains excess data to prevent DoS.
16852  */
16853 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
16854
16855 /**
16856  * An initial announcement of the channel
16857  * Mostly redundant with the data we store in fields explicitly.
16858  * Everything else is useful only for sending out for initial routing sync.
16859  * Not stored if contains excess data to prevent DoS.
16860  */
16861 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
16862
16863 /**
16864  * Constructs a new ChannelInfo given each field
16865  */
16866 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);
16867
16868 /**
16869  * Creates a copy of the ChannelInfo
16870  */
16871 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
16872
16873 /**
16874  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
16875  */
16876 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
16877
16878 /**
16879  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
16880  */
16881 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
16882
16883 /**
16884  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
16885  */
16886 void RoutingFees_free(struct LDKRoutingFees this_obj);
16887
16888 /**
16889  * Flat routing fee in satoshis
16890  */
16891 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16892
16893 /**
16894  * Flat routing fee in satoshis
16895  */
16896 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16897
16898 /**
16899  * Liquidity-based routing fee in millionths of a routed amount.
16900  * In other words, 10000 is 1%.
16901  */
16902 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
16903
16904 /**
16905  * Liquidity-based routing fee in millionths of a routed amount.
16906  * In other words, 10000 is 1%.
16907  */
16908 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
16909
16910 /**
16911  * Constructs a new RoutingFees given each field
16912  */
16913 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
16914
16915 /**
16916  * Creates a copy of the RoutingFees
16917  */
16918 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
16919
16920 /**
16921  * Read a RoutingFees from a byte array, created by RoutingFees_write
16922  */
16923 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
16924
16925 /**
16926  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
16927  */
16928 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
16929
16930 /**
16931  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
16932  */
16933 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
16934
16935 /**
16936  * Protocol features the node announced support for
16937  */
16938 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16939
16940 /**
16941  * Protocol features the node announced support for
16942  */
16943 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16944
16945 /**
16946  * When the last known update to the node state was issued.
16947  * Value is opaque, as set in the announcement.
16948  */
16949 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16950
16951 /**
16952  * When the last known update to the node state was issued.
16953  * Value is opaque, as set in the announcement.
16954  */
16955 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
16956
16957 /**
16958  * Color assigned to the node
16959  */
16960 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
16961
16962 /**
16963  * Color assigned to the node
16964  */
16965 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
16966
16967 /**
16968  * Moniker assigned to the node.
16969  * May be invalid or malicious (eg control chars),
16970  * should not be exposed to the user.
16971  */
16972 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
16973
16974 /**
16975  * Moniker assigned to the node.
16976  * May be invalid or malicious (eg control chars),
16977  * should not be exposed to the user.
16978  */
16979 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16980
16981 /**
16982  * Internet-level addresses via which one can connect to the node
16983  */
16984 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
16985
16986 /**
16987  * An initial announcement of the node
16988  * Mostly redundant with the data we store in fields explicitly.
16989  * Everything else is useful only for sending out for initial routing sync.
16990  * Not stored if contains excess data to prevent DoS.
16991  */
16992 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
16993
16994 /**
16995  * An initial announcement of the node
16996  * Mostly redundant with the data we store in fields explicitly.
16997  * Everything else is useful only for sending out for initial routing sync.
16998  * Not stored if contains excess data to prevent DoS.
16999  */
17000 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17001
17002 /**
17003  * Constructs a new NodeAnnouncementInfo given each field
17004  */
17005 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);
17006
17007 /**
17008  * Creates a copy of the NodeAnnouncementInfo
17009  */
17010 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17011
17012 /**
17013  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17014  */
17015 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17016
17017 /**
17018  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17019  */
17020 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17021
17022 /**
17023  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17024  */
17025 void NodeInfo_free(struct LDKNodeInfo this_obj);
17026
17027 /**
17028  * All valid channels a node has announced
17029  */
17030 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17031
17032 /**
17033  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17034  * The two fields (flat and proportional fee) are independent,
17035  * meaning they don't have to refer to the same channel.
17036  */
17037 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17038
17039 /**
17040  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17041  * The two fields (flat and proportional fee) are independent,
17042  * meaning they don't have to refer to the same channel.
17043  */
17044 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17045
17046 /**
17047  * More information about a node from node_announcement.
17048  * Optional because we store a Node entry after learning about it from
17049  * a channel announcement, but before receiving a node announcement.
17050  */
17051 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17052
17053 /**
17054  * More information about a node from node_announcement.
17055  * Optional because we store a Node entry after learning about it from
17056  * a channel announcement, but before receiving a node announcement.
17057  */
17058 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17059
17060 /**
17061  * Constructs a new NodeInfo given each field
17062  */
17063 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17064
17065 /**
17066  * Creates a copy of the NodeInfo
17067  */
17068 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17069
17070 /**
17071  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17072  */
17073 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17074
17075 /**
17076  * Read a NodeInfo from a byte array, created by NodeInfo_write
17077  */
17078 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17079
17080 /**
17081  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17082  */
17083 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17084
17085 /**
17086  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17087  */
17088 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17089
17090 /**
17091  * Creates a new, empty, network graph.
17092  */
17093 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17094
17095 /**
17096  * For an already known node (from channel announcements), update its stored properties from a
17097  * given node announcement.
17098  *
17099  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17100  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17101  * routing messages from a source using a protocol other than the lightning P2P protocol.
17102  */
17103 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17104
17105 /**
17106  * For an already known node (from channel announcements), update its stored properties from a
17107  * given node announcement without verifying the associated signatures. Because we aren't
17108  * given the associated signatures here we cannot relay the node announcement to any of our
17109  * peers.
17110  */
17111 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17112
17113 /**
17114  * Store or update channel info from a channel announcement.
17115  *
17116  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17117  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17118  * routing messages from a source using a protocol other than the lightning P2P protocol.
17119  *
17120  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17121  * the corresponding UTXO exists on chain and is correctly-formatted.
17122  */
17123 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);
17124
17125 /**
17126  * Store or update channel info from a channel announcement without verifying the associated
17127  * signatures. Because we aren't given the associated signatures here we cannot relay the
17128  * channel announcement to any of our peers.
17129  *
17130  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17131  * the corresponding UTXO exists on chain and is correctly-formatted.
17132  */
17133 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);
17134
17135 /**
17136  * Close a channel if a corresponding HTLC fail was sent.
17137  * If permanent, removes a channel from the local storage.
17138  * May cause the removal of nodes too, if this was their last channel.
17139  * If not permanent, makes channels unavailable for routing.
17140  */
17141 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17142
17143 /**
17144  * For an already known (from announcement) channel, update info about one of the directions
17145  * of the channel.
17146  *
17147  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17148  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17149  * routing messages from a source using a protocol other than the lightning P2P protocol.
17150  */
17151 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17152
17153 /**
17154  * For an already known (from announcement) channel, update info about one of the directions
17155  * of the channel without verifying the associated signatures. Because we aren't given the
17156  * associated signatures here we cannot relay the channel update to any of our peers.
17157  */
17158 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17159
17160 /**
17161  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17162  */
17163 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17164
17165 /**
17166  * Initialize a new FilesystemPersister and set the path to the individual channels'
17167  * files.
17168  */
17169 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17170
17171 /**
17172  * Get the directory which was provided when this persister was initialized.
17173  */
17174 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17175
17176 /**
17177  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17178  * initialization, within a file called \"manager\".
17179  */
17180 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17181
17182 /**
17183  * Read `ChannelMonitor`s from disk.
17184  */
17185 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17186
17187 /**
17188  * Constructs a new Persist which calls the relevant methods on this_arg.
17189  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17190  */
17191 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17192
17193 /**
17194  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17195  *
17196  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17197  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17198  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17199  * since this check is fast we recommend to do it anyway.
17200  *
17201  * If this function fails this is considered a bug. Please open an issue describing your
17202  * platform and stating your current system time.
17203  *
17204  * # Panics
17205  * If the check fails this function panics. By calling this function on startup you ensure that
17206  * this wont happen at an arbitrary later point in time.
17207  */
17208 void check_platform(void);
17209
17210 /**
17211  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17212  */
17213 void Invoice_free(struct LDKInvoice this_obj);
17214
17215 /**
17216  * Creates a copy of the Invoice
17217  */
17218 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17219
17220 /**
17221  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17222  */
17223 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17224
17225 /**
17226  * Creates a copy of the SignedRawInvoice
17227  */
17228 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17229
17230 /**
17231  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17232  */
17233 void RawInvoice_free(struct LDKRawInvoice this_obj);
17234
17235 /**
17236  * data part
17237  */
17238 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17239
17240 /**
17241  * data part
17242  */
17243 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17244
17245 /**
17246  * Creates a copy of the RawInvoice
17247  */
17248 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17249
17250 /**
17251  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17252  */
17253 void RawDataPart_free(struct LDKRawDataPart this_obj);
17254
17255 /**
17256  * generation time of the invoice
17257  */
17258 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17259
17260 /**
17261  * generation time of the invoice
17262  */
17263 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17264
17265 /**
17266  * Creates a copy of the RawDataPart
17267  */
17268 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17269
17270 /**
17271  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17272  */
17273 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17274
17275 /**
17276  * Creates a copy of the PositiveTimestamp
17277  */
17278 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17279
17280 /**
17281  * Creates a copy of the SiPrefix
17282  */
17283 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17284
17285 /**
17286  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17287  * This is effectively 10^12 * the prefix multiplier
17288  */
17289 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17290
17291 /**
17292  * Creates a copy of the Currency
17293  */
17294 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17295
17296 /**
17297  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17298  */
17299 void Sha256_free(struct LDKSha256 this_obj);
17300
17301 /**
17302  * Creates a copy of the Sha256
17303  */
17304 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17305
17306 /**
17307  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17308  */
17309 void Description_free(struct LDKDescription this_obj);
17310
17311 /**
17312  * Creates a copy of the Description
17313  */
17314 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17315
17316 /**
17317  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17318  */
17319 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17320
17321 /**
17322  * Creates a copy of the PayeePubKey
17323  */
17324 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17325
17326 /**
17327  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17328  */
17329 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17330
17331 /**
17332  * Creates a copy of the ExpiryTime
17333  */
17334 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
17335
17336 /**
17337  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
17338  */
17339 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
17340
17341 /**
17342  * Creates a copy of the MinFinalCltvExpiry
17343  */
17344 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
17345
17346 /**
17347  * Frees any resources used by the Fallback
17348  */
17349 void Fallback_free(struct LDKFallback this_ptr);
17350
17351 /**
17352  * Creates a copy of the Fallback
17353  */
17354 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
17355
17356 /**
17357  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
17358  */
17359 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
17360
17361 /**
17362  * Creates a copy of the InvoiceSignature
17363  */
17364 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
17365
17366 /**
17367  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17368  */
17369 void RouteHint_free(struct LDKRouteHint this_obj);
17370
17371 /**
17372  * Creates a copy of the RouteHint
17373  */
17374 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17375
17376 /**
17377  * Disassembles the `SignedRawInvoice` into its three parts:
17378  *  1. raw invoice
17379  *  2. hash of the raw invoice
17380  *  3. signature
17381  */
17382 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
17383
17384 /**
17385  * The `RawInvoice` which was signed.
17386  */
17387 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17388
17389 /**
17390  * The hash of the `RawInvoice` that was signed.
17391  */
17392 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
17393
17394 /**
17395  * InvoiceSignature for the invoice.
17396  */
17397 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17398
17399 /**
17400  * Recovers the public key used for signing the invoice from the recoverable signature.
17401  */
17402 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17403
17404 /**
17405  * Checks if the signature is valid for the included payee public key or if none exists if it's
17406  * valid for the recovered signature (which should always be true?).
17407  */
17408 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
17409
17410 /**
17411  * Calculate the hash of the encoded `RawInvoice`
17412  */
17413 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17414
17415 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17416
17417 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17418
17419 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17420
17421 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17422
17423 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17424
17425 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17426
17427 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17428
17429 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17430
17431 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17432
17433 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17434
17435 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
17436
17437 /**
17438  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
17439  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17440  * `CreationError::TimestampOutOfBounds`.
17441  */
17442 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
17443
17444 /**
17445  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
17446  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
17447  * `CreationError::TimestampOutOfBounds`.
17448  */
17449 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
17450
17451 /**
17452  * Returns the UNIX timestamp representing the stored time
17453  */
17454 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17455
17456 /**
17457  * Returns a reference to the internal `SystemTime` time representation
17458  */
17459 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
17460
17461 /**
17462  * Transform the `Invoice` into it's unchecked version
17463  */
17464 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
17465
17466 /**
17467  * Check that the invoice is signed correctly and that key recovery works
17468  */
17469 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
17470
17471 /**
17472  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
17473  * ```
17474  * use lightning_invoice::*;
17475  *
17476  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
17477  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
17478  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
17479  * \tky03ylcqca784w\";
17480  *
17481  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
17482  *
17483  * assert!(Invoice::from_signed(signed).is_ok());
17484  * ```
17485  */
17486 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
17487
17488 /**
17489  * Returns the `Invoice`'s timestamp (should equal it's creation time)
17490  */
17491 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
17492
17493 /**
17494  * Returns the hash to which we will receive the preimage on completion of the payment
17495  */
17496 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
17497
17498 /**
17499  * Get the payee's public key if one was included in the invoice
17500  */
17501 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17502
17503 /**
17504  * Get the payment secret if one was included in the invoice
17505  */
17506 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
17507
17508 /**
17509  * Get the invoice features if they were included in the invoice
17510  */
17511 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
17512
17513 /**
17514  * Recover the payee's public key (only to be used if none was included in the invoice)
17515  */
17516 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
17517
17518 /**
17519  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
17520  */
17521 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
17522
17523 /**
17524  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
17525  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
17526  */
17527 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
17528
17529 /**
17530  * Returns a list of all routes included in the invoice
17531  */
17532 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
17533
17534 /**
17535  * Returns the currency for which the invoice was issued
17536  */
17537 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
17538
17539 /**
17540  * Returns the amount if specified in the invoice as pico <currency>.
17541  */
17542 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
17543
17544 /**
17545  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
17546  * returns `CreationError::DescriptionTooLong` otherwise
17547  *
17548  * Please note that single characters may use more than one byte due to UTF8 encoding.
17549  */
17550 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
17551
17552 /**
17553  * Returns the underlying description `String`
17554  */
17555 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
17556
17557 /**
17558  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
17559  * overflow on adding the `EpiryTime` to it then this function will return a
17560  * `CreationError::ExpiryTimeOutOfBounds`.
17561  */
17562 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
17563
17564 /**
17565  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
17566  * would overflow on adding the `EpiryTime` to it then this function will return a
17567  * `CreationError::ExpiryTimeOutOfBounds`.
17568  */
17569 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
17570
17571 /**
17572  * Returns the expiry time in seconds
17573  */
17574 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17575
17576 /**
17577  * Returns a reference to the underlying `Duration` (=expiry time)
17578  */
17579 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
17580
17581 /**
17582  * Create a new (partial) route from a list of hops
17583  */
17584 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
17585
17586 /**
17587  * Returrn the underlying vector of hops
17588  */
17589 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
17590
17591 /**
17592  * Creates a copy of the CreationError
17593  */
17594 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
17595
17596 /**
17597  * Get the string representation of a CreationError object
17598  */
17599 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
17600
17601 /**
17602  * Creates a copy of the SemanticError
17603  */
17604 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
17605
17606 /**
17607  * Get the string representation of a SemanticError object
17608  */
17609 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
17610
17611 /**
17612  * Frees any resources used by the SignOrCreationError
17613  */
17614 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
17615
17616 /**
17617  * Creates a copy of the SignOrCreationError
17618  */
17619 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
17620
17621 /**
17622  * Get the string representation of a SignOrCreationError object
17623  */
17624 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
17625
17626 /**
17627  * Utility to construct an invoice. Generally, unless you want to do something like a custom
17628  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
17629  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
17630  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
17631  * that the payment secret is valid when the invoice is paid.
17632  */
17633 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
17634
17635 /**
17636  * Read a SiPrefix object from a string
17637  */
17638 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
17639
17640 /**
17641  * Read a Invoice object from a string
17642  */
17643 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
17644
17645 /**
17646  * Read a SignedRawInvoice object from a string
17647  */
17648 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
17649
17650 /**
17651  * Get the string representation of a Invoice object
17652  */
17653 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
17654
17655 /**
17656  * Get the string representation of a SignedRawInvoice object
17657  */
17658 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
17659
17660 /**
17661  * Get the string representation of a Currency object
17662  */
17663 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
17664
17665 /**
17666  * Get the string representation of a SiPrefix object
17667  */
17668 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
17669
17670 #endif /* LDK_C_BINDINGS_H */
17671
17672 #include <ldk_ver.h>