Update auto-generated bindings
[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) that failed
41     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
42     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
43     * operational state.
44     *
45     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
46     * you return a TemporaryFailure you must ensure that it is written to disk safely before
47     * writing out the latest ChannelManager state.
48     *
49     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
50     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
51     * to claim it on this channel) and those updates must be applied wherever they can be. At
52     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
53     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
54     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
55     * been \"frozen\".
56     *
57     * Note that even if updates made after TemporaryFailure succeed you must still provide a
58     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
59     * normal channel operation. Note that this is normally generated through a call to
60     * [`ChainMonitor::channel_monitor_updated`].
61     *
62     * Note that the update being processed here will not be replayed for you when you return a
63     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
64     * you must store the update itself on your own local disk prior to returning a
65     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
66     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
67     * reload-time.
68     *
69     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
70     * remote location (with local copies persisted immediately), it is anticipated that all
71     * updates will return TemporaryFailure until the remote copies could be updated.
72     *
73     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
74     */
75    LDKChannelMonitorUpdateErr_TemporaryFailure,
76    /**
77     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
78     * different watchtower and cannot update with all watchtowers that were previously informed
79     * of this channel).
80     *
81     * At reception of this error, ChannelManager will force-close the channel and return at
82     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
83     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
84     * update must be rejected.
85     *
86     * This failure may also signal a failure to update the local persisted copy of one of
87     * the channel monitor instance.
88     *
89     * Note that even when you fail a holder commitment transaction update, you must store the
90     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
91     * broadcasts it (e.g distributed channel-monitor deployment)
92     *
93     * In case of distributed watchtowers deployment, the new version must be written to disk, as
94     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
95     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
96     * lagging behind on block processing.
97     */
98    LDKChannelMonitorUpdateErr_PermanentFailure,
99    /**
100     * Must be last for serialization purposes
101     */
102    LDKChannelMonitorUpdateErr_Sentinel,
103 } LDKChannelMonitorUpdateErr;
104
105 /**
106  * An enum that represents the speed at which we want a transaction to confirm used for feerate
107  * estimation.
108  */
109 typedef enum LDKConfirmationTarget {
110    /**
111     * We are happy with this transaction confirming slowly when feerate drops some.
112     */
113    LDKConfirmationTarget_Background,
114    /**
115     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
116     */
117    LDKConfirmationTarget_Normal,
118    /**
119     * We'd like this transaction to confirm in the next few blocks.
120     */
121    LDKConfirmationTarget_HighPriority,
122    /**
123     * Must be last for serialization purposes
124     */
125    LDKConfirmationTarget_Sentinel,
126 } LDKConfirmationTarget;
127
128 /**
129  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
130  */
131 typedef enum LDKCreationError {
132    /**
133     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
134     */
135    LDKCreationError_DescriptionTooLong,
136    /**
137     * The specified route has too many hops and can't be encoded
138     */
139    LDKCreationError_RouteTooLong,
140    /**
141     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
142     */
143    LDKCreationError_TimestampOutOfBounds,
144    /**
145     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
146     */
147    LDKCreationError_ExpiryTimeOutOfBounds,
148    /**
149     * Must be last for serialization purposes
150     */
151    LDKCreationError_Sentinel,
152 } LDKCreationError;
153
154 /**
155  * Enum representing the crypto currencies (or networks) supported by this library
156  */
157 typedef enum LDKCurrency {
158    /**
159     * Bitcoin mainnet
160     */
161    LDKCurrency_Bitcoin,
162    /**
163     * Bitcoin testnet
164     */
165    LDKCurrency_BitcoinTestnet,
166    /**
167     * Bitcoin regtest
168     */
169    LDKCurrency_Regtest,
170    /**
171     * Bitcoin simnet
172     */
173    LDKCurrency_Simnet,
174    /**
175     * Bitcoin signet
176     */
177    LDKCurrency_Signet,
178    /**
179     * Must be last for serialization purposes
180     */
181    LDKCurrency_Sentinel,
182 } LDKCurrency;
183
184 /**
185  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
186  */
187 typedef enum LDKIOError {
188    LDKIOError_NotFound,
189    LDKIOError_PermissionDenied,
190    LDKIOError_ConnectionRefused,
191    LDKIOError_ConnectionReset,
192    LDKIOError_ConnectionAborted,
193    LDKIOError_NotConnected,
194    LDKIOError_AddrInUse,
195    LDKIOError_AddrNotAvailable,
196    LDKIOError_BrokenPipe,
197    LDKIOError_AlreadyExists,
198    LDKIOError_WouldBlock,
199    LDKIOError_InvalidInput,
200    LDKIOError_InvalidData,
201    LDKIOError_TimedOut,
202    LDKIOError_WriteZero,
203    LDKIOError_Interrupted,
204    LDKIOError_Other,
205    LDKIOError_UnexpectedEof,
206    /**
207     * Must be last for serialization purposes
208     */
209    LDKIOError_Sentinel,
210 } LDKIOError;
211
212 /**
213  * An enum representing the available verbosity levels of the logger.
214  */
215 typedef enum LDKLevel {
216    /**
217     * Designates very low priority, often extremely verbose, information
218     */
219    LDKLevel_Trace,
220    /**
221     * Designates lower priority information
222     */
223    LDKLevel_Debug,
224    /**
225     * Designates useful information
226     */
227    LDKLevel_Info,
228    /**
229     * Designates hazardous situations
230     */
231    LDKLevel_Warn,
232    /**
233     * Designates very serious errors
234     */
235    LDKLevel_Error,
236    /**
237     * Must be last for serialization purposes
238     */
239    LDKLevel_Sentinel,
240 } LDKLevel;
241
242 /**
243  * An enum representing the possible Bitcoin or test networks which we can run on
244  */
245 typedef enum LDKNetwork {
246    /**
247     * The main Bitcoin blockchain.
248     */
249    LDKNetwork_Bitcoin,
250    /**
251     * The testnet3 blockchain.
252     */
253    LDKNetwork_Testnet,
254    /**
255     * A local test blockchain.
256     */
257    LDKNetwork_Regtest,
258    /**
259     * A blockchain on which blocks are signed instead of mined.
260     */
261    LDKNetwork_Signet,
262    /**
263     * Must be last for serialization purposes
264     */
265    LDKNetwork_Sentinel,
266 } LDKNetwork;
267
268 /**
269  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
270  */
271 typedef enum LDKSecp256k1Error {
272    /**
273     * Signature failed verification
274     */
275    LDKSecp256k1Error_IncorrectSignature,
276    /**
277     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
278     */
279    LDKSecp256k1Error_InvalidMessage,
280    /**
281     * Bad public key
282     */
283    LDKSecp256k1Error_InvalidPublicKey,
284    /**
285     * Bad signature
286     */
287    LDKSecp256k1Error_InvalidSignature,
288    /**
289     * Bad secret key
290     */
291    LDKSecp256k1Error_InvalidSecretKey,
292    /**
293     * Bad recovery id
294     */
295    LDKSecp256k1Error_InvalidRecoveryId,
296    /**
297     * Invalid tweak for add_assign or mul_assign
298     */
299    LDKSecp256k1Error_InvalidTweak,
300    /**
301     * tweak_add_check failed on an xonly public key
302     */
303    LDKSecp256k1Error_TweakCheckFailed,
304    /**
305     * Didn't pass enough memory to context creation with preallocated memory
306     */
307    LDKSecp256k1Error_NotEnoughMemory,
308    /**
309     * Must be last for serialization purposes
310     */
311    LDKSecp256k1Error_Sentinel,
312 } LDKSecp256k1Error;
313
314 /**
315  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
316  * requirements sections in BOLT #11
317  */
318 typedef enum LDKSemanticError {
319    /**
320     * The invoice is missing the mandatory payment hash
321     */
322    LDKSemanticError_NoPaymentHash,
323    /**
324     * The invoice has multiple payment hashes which isn't allowed
325     */
326    LDKSemanticError_MultiplePaymentHashes,
327    /**
328     * No description or description hash are part of the invoice
329     */
330    LDKSemanticError_NoDescription,
331    /**
332     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
333     */
334    LDKSemanticError_MultipleDescriptions,
335    /**
336     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
337     * should provide.
338     */
339    LDKSemanticError_NoPaymentSecret,
340    /**
341     * The invoice contains multiple payment secrets
342     */
343    LDKSemanticError_MultiplePaymentSecrets,
344    /**
345     * The invoice's features are invalid
346     */
347    LDKSemanticError_InvalidFeatures,
348    /**
349     * The recovery id doesn't fit the signature/pub key
350     */
351    LDKSemanticError_InvalidRecoveryId,
352    /**
353     * The invoice's signature is invalid
354     */
355    LDKSemanticError_InvalidSignature,
356    /**
357     * The invoice's amount was not a whole number of millisatoshis
358     */
359    LDKSemanticError_ImpreciseAmount,
360    /**
361     * Must be last for serialization purposes
362     */
363    LDKSemanticError_Sentinel,
364 } LDKSemanticError;
365
366 /**
367  * SI prefixes for the human readable part
368  */
369 typedef enum LDKSiPrefix {
370    /**
371     * 10^-3
372     */
373    LDKSiPrefix_Milli,
374    /**
375     * 10^-6
376     */
377    LDKSiPrefix_Micro,
378    /**
379     * 10^-9
380     */
381    LDKSiPrefix_Nano,
382    /**
383     * 10^-12
384     */
385    LDKSiPrefix_Pico,
386    /**
387     * Must be last for serialization purposes
388     */
389    LDKSiPrefix_Sentinel,
390 } LDKSiPrefix;
391
392 /**
393  * A Rust str object, ie a reference to a UTF8-valid string.
394  * This is *not* null-terminated so cannot be used directly as a C string!
395  */
396 typedef struct LDKStr {
397    /**
398     * A pointer to the string's bytes, in UTF8 encoding
399     */
400    const uint8_t *chars;
401    /**
402     * The number of bytes (not characters!) pointed to by `chars`
403     */
404    uintptr_t len;
405    /**
406     * Whether the data pointed to by `chars` should be freed or not.
407     */
408    bool chars_is_owned;
409 } LDKStr;
410
411 /**
412  * A serialized transaction, in (pointer, length) form.
413  *
414  * This type optionally owns its own memory, and thus the semantics around access change based on
415  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
416  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
417  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
418  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
419  * you would be invalid.
420  *
421  * Note that, while it may change in the future, because transactions on the Rust side are stored
422  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
423  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
424  * `data_is_owned` either set or unset at your discretion.
425  */
426 typedef struct LDKTransaction {
427    /**
428     * The serialized transaction data.
429     *
430     * This is non-const for your convenience, an object passed to Rust is never written to.
431     */
432    uint8_t *data;
433    /**
434     * The length of the serialized transaction
435     */
436    uintptr_t datalen;
437    /**
438     * Whether the data pointed to by `data` should be freed or not.
439     */
440    bool data_is_owned;
441 } LDKTransaction;
442
443 /**
444  * A dynamically-allocated array of u8s of arbitrary size.
445  * This corresponds to std::vector in C++
446  */
447 typedef struct LDKCVec_u8Z {
448    /**
449     * The elements in the array.
450     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
451     */
452    uint8_t *data;
453    /**
454     * The number of elements pointed to by `data`.
455     */
456    uintptr_t datalen;
457 } LDKCVec_u8Z;
458
459 /**
460  * A transaction output including a scriptPubKey and value.
461  * This type *does* own its own memory, so must be free'd appropriately.
462  */
463 typedef struct LDKTxOut {
464    /**
465     * The script_pubkey in this output
466     */
467    struct LDKCVec_u8Z script_pubkey;
468    /**
469     * The value, in satoshis, of this output
470     */
471    uint64_t value;
472 } LDKTxOut;
473
474 /**
475  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
476  */
477 typedef struct LDKSecretKey {
478    /**
479     * The bytes of the secret key
480     */
481    uint8_t bytes[32];
482 } LDKSecretKey;
483
484 /**
485  * The contents of CResult_SecretKeyErrorZ
486  */
487 typedef union LDKCResult_SecretKeyErrorZPtr {
488    /**
489     * A pointer to the contents in the success state.
490     * Reading from this pointer when `result_ok` is not set is undefined.
491     */
492    struct LDKSecretKey *result;
493    /**
494     * A pointer to the contents in the error state.
495     * Reading from this pointer when `result_ok` is set is undefined.
496     */
497    enum LDKSecp256k1Error *err;
498 } LDKCResult_SecretKeyErrorZPtr;
499
500 /**
501  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
502  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
503  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
504  */
505 typedef struct LDKCResult_SecretKeyErrorZ {
506    /**
507     * The contents of this CResult_SecretKeyErrorZ, accessible via either
508     * `err` or `result` depending on the state of `result_ok`.
509     */
510    union LDKCResult_SecretKeyErrorZPtr contents;
511    /**
512     * Whether this CResult_SecretKeyErrorZ represents a success state.
513     */
514    bool result_ok;
515 } LDKCResult_SecretKeyErrorZ;
516
517 /**
518  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
519  */
520 typedef struct LDKPublicKey {
521    /**
522     * The bytes of the public key
523     */
524    uint8_t compressed_form[33];
525 } LDKPublicKey;
526
527 /**
528  * The contents of CResult_PublicKeyErrorZ
529  */
530 typedef union LDKCResult_PublicKeyErrorZPtr {
531    /**
532     * A pointer to the contents in the success state.
533     * Reading from this pointer when `result_ok` is not set is undefined.
534     */
535    struct LDKPublicKey *result;
536    /**
537     * A pointer to the contents in the error state.
538     * Reading from this pointer when `result_ok` is set is undefined.
539     */
540    enum LDKSecp256k1Error *err;
541 } LDKCResult_PublicKeyErrorZPtr;
542
543 /**
544  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
545  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
547  */
548 typedef struct LDKCResult_PublicKeyErrorZ {
549    /**
550     * The contents of this CResult_PublicKeyErrorZ, accessible via either
551     * `err` or `result` depending on the state of `result_ok`.
552     */
553    union LDKCResult_PublicKeyErrorZPtr contents;
554    /**
555     * Whether this CResult_PublicKeyErrorZ represents a success state.
556     */
557    bool result_ok;
558 } LDKCResult_PublicKeyErrorZ;
559
560
561
562 /**
563  * The set of public keys which are used in the creation of one commitment transaction.
564  * These are derived from the channel base keys and per-commitment data.
565  *
566  * A broadcaster key is provided from potential broadcaster of the computed transaction.
567  * A countersignatory key is coming from a protocol participant unable to broadcast the
568  * transaction.
569  *
570  * These keys are assumed to be good, either because the code derived them from
571  * channel basepoints via the new function, or they were obtained via
572  * CommitmentTransaction.trust().keys() because we trusted the source of the
573  * pre-calculated keys.
574  */
575 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
576    /**
577     * A pointer to the opaque Rust object.
578     * Nearly everywhere, inner must be non-null, however in places where
579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
580     */
581    LDKnativeTxCreationKeys *inner;
582    /**
583     * Indicates that this is the only struct which contains the same pointer.
584     * Rust functions which take ownership of an object provided via an argument require
585     * this to be true and invalidate the object pointed to by inner.
586     */
587    bool is_owned;
588 } LDKTxCreationKeys;
589
590
591
592 /**
593  * An error in decoding a message or struct.
594  */
595 typedef struct MUST_USE_STRUCT LDKDecodeError {
596    /**
597     * A pointer to the opaque Rust object.
598     * Nearly everywhere, inner must be non-null, however in places where
599     * the Rust equivalent takes an Option, it may be set to null to indicate None.
600     */
601    LDKnativeDecodeError *inner;
602    /**
603     * Indicates that this is the only struct which contains the same pointer.
604     * Rust functions which take ownership of an object provided via an argument require
605     * this to be true and invalidate the object pointed to by inner.
606     */
607    bool is_owned;
608 } LDKDecodeError;
609
610 /**
611  * The contents of CResult_TxCreationKeysDecodeErrorZ
612  */
613 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
614    /**
615     * A pointer to the contents in the success state.
616     * Reading from this pointer when `result_ok` is not set is undefined.
617     */
618    struct LDKTxCreationKeys *result;
619    /**
620     * A pointer to the contents in the error state.
621     * Reading from this pointer when `result_ok` is set is undefined.
622     */
623    struct LDKDecodeError *err;
624 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
625
626 /**
627  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
628  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
629  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
630  */
631 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
632    /**
633     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
634     * `err` or `result` depending on the state of `result_ok`.
635     */
636    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
637    /**
638     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
639     */
640    bool result_ok;
641 } LDKCResult_TxCreationKeysDecodeErrorZ;
642
643
644
645 /**
646  * One counterparty's public keys which do not change over the life of a channel.
647  */
648 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
649    /**
650     * A pointer to the opaque Rust object.
651     * Nearly everywhere, inner must be non-null, however in places where
652     * the Rust equivalent takes an Option, it may be set to null to indicate None.
653     */
654    LDKnativeChannelPublicKeys *inner;
655    /**
656     * Indicates that this is the only struct which contains the same pointer.
657     * Rust functions which take ownership of an object provided via an argument require
658     * this to be true and invalidate the object pointed to by inner.
659     */
660    bool is_owned;
661 } LDKChannelPublicKeys;
662
663 /**
664  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
665  */
666 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
667    /**
668     * A pointer to the contents in the success state.
669     * Reading from this pointer when `result_ok` is not set is undefined.
670     */
671    struct LDKChannelPublicKeys *result;
672    /**
673     * A pointer to the contents in the error state.
674     * Reading from this pointer when `result_ok` is set is undefined.
675     */
676    struct LDKDecodeError *err;
677 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
678
679 /**
680  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
681  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
682  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
683  */
684 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
685    /**
686     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
687     * `err` or `result` depending on the state of `result_ok`.
688     */
689    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
690    /**
691     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
692     */
693    bool result_ok;
694 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
695
696 /**
697  * The contents of CResult_TxCreationKeysErrorZ
698  */
699 typedef union LDKCResult_TxCreationKeysErrorZPtr {
700    /**
701     * A pointer to the contents in the success state.
702     * Reading from this pointer when `result_ok` is not set is undefined.
703     */
704    struct LDKTxCreationKeys *result;
705    /**
706     * A pointer to the contents in the error state.
707     * Reading from this pointer when `result_ok` is set is undefined.
708     */
709    enum LDKSecp256k1Error *err;
710 } LDKCResult_TxCreationKeysErrorZPtr;
711
712 /**
713  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
714  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
715  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
716  */
717 typedef struct LDKCResult_TxCreationKeysErrorZ {
718    /**
719     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
720     * `err` or `result` depending on the state of `result_ok`.
721     */
722    union LDKCResult_TxCreationKeysErrorZPtr contents;
723    /**
724     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
725     */
726    bool result_ok;
727 } LDKCResult_TxCreationKeysErrorZ;
728
729 /**
730  * An enum which can either contain a u32 or not
731  */
732 typedef enum LDKCOption_u32Z_Tag {
733    /**
734     * When we're in this state, this COption_u32Z contains a u32
735     */
736    LDKCOption_u32Z_Some,
737    /**
738     * When we're in this state, this COption_u32Z contains nothing
739     */
740    LDKCOption_u32Z_None,
741    /**
742     * Must be last for serialization purposes
743     */
744    LDKCOption_u32Z_Sentinel,
745 } LDKCOption_u32Z_Tag;
746
747 typedef struct LDKCOption_u32Z {
748    LDKCOption_u32Z_Tag tag;
749    union {
750       struct {
751          uint32_t some;
752       };
753    };
754 } LDKCOption_u32Z;
755
756
757
758 /**
759  * Information about an HTLC as it appears in a commitment transaction
760  */
761 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
762    /**
763     * A pointer to the opaque Rust object.
764     * Nearly everywhere, inner must be non-null, however in places where
765     * the Rust equivalent takes an Option, it may be set to null to indicate None.
766     */
767    LDKnativeHTLCOutputInCommitment *inner;
768    /**
769     * Indicates that this is the only struct which contains the same pointer.
770     * Rust functions which take ownership of an object provided via an argument require
771     * this to be true and invalidate the object pointed to by inner.
772     */
773    bool is_owned;
774 } LDKHTLCOutputInCommitment;
775
776 /**
777  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
778  */
779 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
780    /**
781     * A pointer to the contents in the success state.
782     * Reading from this pointer when `result_ok` is not set is undefined.
783     */
784    struct LDKHTLCOutputInCommitment *result;
785    /**
786     * A pointer to the contents in the error state.
787     * Reading from this pointer when `result_ok` is set is undefined.
788     */
789    struct LDKDecodeError *err;
790 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
791
792 /**
793  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
794  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
795  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
796  */
797 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
798    /**
799     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
800     * `err` or `result` depending on the state of `result_ok`.
801     */
802    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
803    /**
804     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
805     */
806    bool result_ok;
807 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
808
809
810
811 /**
812  * Late-bound per-channel counterparty data used to build transactions.
813  */
814 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
815    /**
816     * A pointer to the opaque Rust object.
817     * Nearly everywhere, inner must be non-null, however in places where
818     * the Rust equivalent takes an Option, it may be set to null to indicate None.
819     */
820    LDKnativeCounterpartyChannelTransactionParameters *inner;
821    /**
822     * Indicates that this is the only struct which contains the same pointer.
823     * Rust functions which take ownership of an object provided via an argument require
824     * this to be true and invalidate the object pointed to by inner.
825     */
826    bool is_owned;
827 } LDKCounterpartyChannelTransactionParameters;
828
829 /**
830  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
831  */
832 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
833    /**
834     * A pointer to the contents in the success state.
835     * Reading from this pointer when `result_ok` is not set is undefined.
836     */
837    struct LDKCounterpartyChannelTransactionParameters *result;
838    /**
839     * A pointer to the contents in the error state.
840     * Reading from this pointer when `result_ok` is set is undefined.
841     */
842    struct LDKDecodeError *err;
843 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
844
845 /**
846  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
847  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
848  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
849  */
850 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851    /**
852     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
853     * `err` or `result` depending on the state of `result_ok`.
854     */
855    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
856    /**
857     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858     */
859    bool result_ok;
860 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
861
862
863
864 /**
865  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
866  * The fields are organized by holder/counterparty.
867  *
868  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
869  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
870  */
871 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
872    /**
873     * A pointer to the opaque Rust object.
874     * Nearly everywhere, inner must be non-null, however in places where
875     * the Rust equivalent takes an Option, it may be set to null to indicate None.
876     */
877    LDKnativeChannelTransactionParameters *inner;
878    /**
879     * Indicates that this is the only struct which contains the same pointer.
880     * Rust functions which take ownership of an object provided via an argument require
881     * this to be true and invalidate the object pointed to by inner.
882     */
883    bool is_owned;
884 } LDKChannelTransactionParameters;
885
886 /**
887  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
888  */
889 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
890    /**
891     * A pointer to the contents in the success state.
892     * Reading from this pointer when `result_ok` is not set is undefined.
893     */
894    struct LDKChannelTransactionParameters *result;
895    /**
896     * A pointer to the contents in the error state.
897     * Reading from this pointer when `result_ok` is set is undefined.
898     */
899    struct LDKDecodeError *err;
900 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
901
902 /**
903  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
904  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
906  */
907 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
908    /**
909     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
910     * `err` or `result` depending on the state of `result_ok`.
911     */
912    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
913    /**
914     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
915     */
916    bool result_ok;
917 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
918
919 /**
920  * Represents a secp256k1 signature serialized as two 32-byte numbers
921  */
922 typedef struct LDKSignature {
923    /**
924     * The bytes of the signature in "compact" form
925     */
926    uint8_t compact_form[64];
927 } LDKSignature;
928
929 /**
930  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
931  * This corresponds to std::vector in C++
932  */
933 typedef struct LDKCVec_SignatureZ {
934    /**
935     * The elements in the array.
936     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
937     */
938    struct LDKSignature *data;
939    /**
940     * The number of elements pointed to by `data`.
941     */
942    uintptr_t datalen;
943 } LDKCVec_SignatureZ;
944
945
946
947 /**
948  * Information needed to build and sign a holder's commitment transaction.
949  *
950  * The transaction is only signed once we are ready to broadcast.
951  */
952 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
953    /**
954     * A pointer to the opaque Rust object.
955     * Nearly everywhere, inner must be non-null, however in places where
956     * the Rust equivalent takes an Option, it may be set to null to indicate None.
957     */
958    LDKnativeHolderCommitmentTransaction *inner;
959    /**
960     * Indicates that this is the only struct which contains the same pointer.
961     * Rust functions which take ownership of an object provided via an argument require
962     * this to be true and invalidate the object pointed to by inner.
963     */
964    bool is_owned;
965 } LDKHolderCommitmentTransaction;
966
967 /**
968  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
969  */
970 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
971    /**
972     * A pointer to the contents in the success state.
973     * Reading from this pointer when `result_ok` is not set is undefined.
974     */
975    struct LDKHolderCommitmentTransaction *result;
976    /**
977     * A pointer to the contents in the error state.
978     * Reading from this pointer when `result_ok` is set is undefined.
979     */
980    struct LDKDecodeError *err;
981 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
982
983 /**
984  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
985  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
986  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
987  */
988 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
989    /**
990     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
991     * `err` or `result` depending on the state of `result_ok`.
992     */
993    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
994    /**
995     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
996     */
997    bool result_ok;
998 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
999
1000
1001
1002 /**
1003  * A pre-built Bitcoin commitment transaction and its txid.
1004  */
1005 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1006    /**
1007     * A pointer to the opaque Rust object.
1008     * Nearly everywhere, inner must be non-null, however in places where
1009     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1010     */
1011    LDKnativeBuiltCommitmentTransaction *inner;
1012    /**
1013     * Indicates that this is the only struct which contains the same pointer.
1014     * Rust functions which take ownership of an object provided via an argument require
1015     * this to be true and invalidate the object pointed to by inner.
1016     */
1017    bool is_owned;
1018 } LDKBuiltCommitmentTransaction;
1019
1020 /**
1021  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1022  */
1023 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1024    /**
1025     * A pointer to the contents in the success state.
1026     * Reading from this pointer when `result_ok` is not set is undefined.
1027     */
1028    struct LDKBuiltCommitmentTransaction *result;
1029    /**
1030     * A pointer to the contents in the error state.
1031     * Reading from this pointer when `result_ok` is set is undefined.
1032     */
1033    struct LDKDecodeError *err;
1034 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1035
1036 /**
1037  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1038  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1040  */
1041 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1042    /**
1043     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1044     * `err` or `result` depending on the state of `result_ok`.
1045     */
1046    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1047    /**
1048     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1049     */
1050    bool result_ok;
1051 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1052
1053
1054
1055 /**
1056  * A wrapper on ClosingTransaction indicating that the built bitcoin
1057  * transaction is trusted.
1058  *
1059  * See trust() and verify() functions on CommitmentTransaction.
1060  *
1061  * This structure implements Deref.
1062  */
1063 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1064    /**
1065     * A pointer to the opaque Rust object.
1066     * Nearly everywhere, inner must be non-null, however in places where
1067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1068     */
1069    LDKnativeTrustedClosingTransaction *inner;
1070    /**
1071     * Indicates that this is the only struct which contains the same pointer.
1072     * Rust functions which take ownership of an object provided via an argument require
1073     * this to be true and invalidate the object pointed to by inner.
1074     */
1075    bool is_owned;
1076 } LDKTrustedClosingTransaction;
1077
1078 /**
1079  * The contents of CResult_TrustedClosingTransactionNoneZ
1080  */
1081 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1082    /**
1083     * A pointer to the contents in the success state.
1084     * Reading from this pointer when `result_ok` is not set is undefined.
1085     */
1086    struct LDKTrustedClosingTransaction *result;
1087    /**
1088     * Note that this value is always NULL, as there are no contents in the Err variant
1089     */
1090    void *err;
1091 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1092
1093 /**
1094  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1095  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1096  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1097  */
1098 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1099    /**
1100     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1101     * `err` or `result` depending on the state of `result_ok`.
1102     */
1103    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1104    /**
1105     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1106     */
1107    bool result_ok;
1108 } LDKCResult_TrustedClosingTransactionNoneZ;
1109
1110
1111
1112 /**
1113  * This class tracks the per-transaction information needed to build a commitment transaction and will
1114  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1115  * and for transactions we sign for the counterparty.
1116  *
1117  * This class can be used inside a signer implementation to generate a signature given the relevant
1118  * secret key.
1119  */
1120 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1121    /**
1122     * A pointer to the opaque Rust object.
1123     * Nearly everywhere, inner must be non-null, however in places where
1124     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1125     */
1126    LDKnativeCommitmentTransaction *inner;
1127    /**
1128     * Indicates that this is the only struct which contains the same pointer.
1129     * Rust functions which take ownership of an object provided via an argument require
1130     * this to be true and invalidate the object pointed to by inner.
1131     */
1132    bool is_owned;
1133 } LDKCommitmentTransaction;
1134
1135 /**
1136  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1137  */
1138 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1139    /**
1140     * A pointer to the contents in the success state.
1141     * Reading from this pointer when `result_ok` is not set is undefined.
1142     */
1143    struct LDKCommitmentTransaction *result;
1144    /**
1145     * A pointer to the contents in the error state.
1146     * Reading from this pointer when `result_ok` is set is undefined.
1147     */
1148    struct LDKDecodeError *err;
1149 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1150
1151 /**
1152  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1153  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1155  */
1156 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1157    /**
1158     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1159     * `err` or `result` depending on the state of `result_ok`.
1160     */
1161    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1162    /**
1163     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1164     */
1165    bool result_ok;
1166 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1167
1168
1169
1170 /**
1171  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1172  * transaction and the transaction creation keys) are trusted.
1173  *
1174  * See trust() and verify() functions on CommitmentTransaction.
1175  *
1176  * This structure implements Deref.
1177  */
1178 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1179    /**
1180     * A pointer to the opaque Rust object.
1181     * Nearly everywhere, inner must be non-null, however in places where
1182     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1183     */
1184    LDKnativeTrustedCommitmentTransaction *inner;
1185    /**
1186     * Indicates that this is the only struct which contains the same pointer.
1187     * Rust functions which take ownership of an object provided via an argument require
1188     * this to be true and invalidate the object pointed to by inner.
1189     */
1190    bool is_owned;
1191 } LDKTrustedCommitmentTransaction;
1192
1193 /**
1194  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1195  */
1196 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1197    /**
1198     * A pointer to the contents in the success state.
1199     * Reading from this pointer when `result_ok` is not set is undefined.
1200     */
1201    struct LDKTrustedCommitmentTransaction *result;
1202    /**
1203     * Note that this value is always NULL, as there are no contents in the Err variant
1204     */
1205    void *err;
1206 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1207
1208 /**
1209  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1210  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1212  */
1213 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1214    /**
1215     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1216     * `err` or `result` depending on the state of `result_ok`.
1217     */
1218    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1219    /**
1220     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1221     */
1222    bool result_ok;
1223 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1224
1225 /**
1226  * The contents of CResult_CVec_SignatureZNoneZ
1227  */
1228 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
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 LDKCVec_SignatureZ *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_CVec_SignatureZNoneZPtr;
1239
1240 /**
1241  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1242  * containing a crate::c_types::derived::CVec_SignatureZ 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_CVec_SignatureZNoneZ {
1246    /**
1247     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1248     * `err` or `result` depending on the state of `result_ok`.
1249     */
1250    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1251    /**
1252     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1253     */
1254    bool result_ok;
1255 } LDKCResult_CVec_SignatureZNoneZ;
1256
1257
1258
1259 /**
1260  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1261  *
1262  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1263  */
1264 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1265    /**
1266     * A pointer to the opaque Rust object.
1267     * Nearly everywhere, inner must be non-null, however in places where
1268     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1269     */
1270    LDKnativeShutdownScript *inner;
1271    /**
1272     * Indicates that this is the only struct which contains the same pointer.
1273     * Rust functions which take ownership of an object provided via an argument require
1274     * this to be true and invalidate the object pointed to by inner.
1275     */
1276    bool is_owned;
1277 } LDKShutdownScript;
1278
1279 /**
1280  * The contents of CResult_ShutdownScriptDecodeErrorZ
1281  */
1282 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1283    /**
1284     * A pointer to the contents in the success state.
1285     * Reading from this pointer when `result_ok` is not set is undefined.
1286     */
1287    struct LDKShutdownScript *result;
1288    /**
1289     * A pointer to the contents in the error state.
1290     * Reading from this pointer when `result_ok` is set is undefined.
1291     */
1292    struct LDKDecodeError *err;
1293 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1294
1295 /**
1296  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1297  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1298  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1299  */
1300 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1301    /**
1302     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1303     * `err` or `result` depending on the state of `result_ok`.
1304     */
1305    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1306    /**
1307     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1308     */
1309    bool result_ok;
1310 } LDKCResult_ShutdownScriptDecodeErrorZ;
1311
1312
1313
1314 /**
1315  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1316  */
1317 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeInvalidShutdownScript *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKInvalidShutdownScript;
1331
1332 /**
1333  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1334  */
1335 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1336    /**
1337     * A pointer to the contents in the success state.
1338     * Reading from this pointer when `result_ok` is not set is undefined.
1339     */
1340    struct LDKShutdownScript *result;
1341    /**
1342     * A pointer to the contents in the error state.
1343     * Reading from this pointer when `result_ok` is set is undefined.
1344     */
1345    struct LDKInvalidShutdownScript *err;
1346 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1347
1348 /**
1349  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1350  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1351  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1352  */
1353 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1354    /**
1355     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1356     * `err` or `result` depending on the state of `result_ok`.
1357     */
1358    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1359    /**
1360     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1361     */
1362    bool result_ok;
1363 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1364
1365 /**
1366  * The contents of CResult_NoneErrorZ
1367  */
1368 typedef union LDKCResult_NoneErrorZPtr {
1369    /**
1370     * Note that this value is always NULL, as there are no contents in the OK variant
1371     */
1372    void *result;
1373    /**
1374     * A pointer to the contents in the error state.
1375     * Reading from this pointer when `result_ok` is set is undefined.
1376     */
1377    enum LDKIOError *err;
1378 } LDKCResult_NoneErrorZPtr;
1379
1380 /**
1381  * A CResult_NoneErrorZ represents the result of a fallible operation,
1382  * containing a () on success and a crate::c_types::IOError on failure.
1383  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1384  */
1385 typedef struct LDKCResult_NoneErrorZ {
1386    /**
1387     * The contents of this CResult_NoneErrorZ, accessible via either
1388     * `err` or `result` depending on the state of `result_ok`.
1389     */
1390    union LDKCResult_NoneErrorZPtr contents;
1391    /**
1392     * Whether this CResult_NoneErrorZ represents a success state.
1393     */
1394    bool result_ok;
1395 } LDKCResult_NoneErrorZ;
1396
1397
1398
1399 /**
1400  * A hop in a route
1401  */
1402 typedef struct MUST_USE_STRUCT LDKRouteHop {
1403    /**
1404     * A pointer to the opaque Rust object.
1405     * Nearly everywhere, inner must be non-null, however in places where
1406     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1407     */
1408    LDKnativeRouteHop *inner;
1409    /**
1410     * Indicates that this is the only struct which contains the same pointer.
1411     * Rust functions which take ownership of an object provided via an argument require
1412     * this to be true and invalidate the object pointed to by inner.
1413     */
1414    bool is_owned;
1415 } LDKRouteHop;
1416
1417 /**
1418  * The contents of CResult_RouteHopDecodeErrorZ
1419  */
1420 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1421    /**
1422     * A pointer to the contents in the success state.
1423     * Reading from this pointer when `result_ok` is not set is undefined.
1424     */
1425    struct LDKRouteHop *result;
1426    /**
1427     * A pointer to the contents in the error state.
1428     * Reading from this pointer when `result_ok` is set is undefined.
1429     */
1430    struct LDKDecodeError *err;
1431 } LDKCResult_RouteHopDecodeErrorZPtr;
1432
1433 /**
1434  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1435  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1437  */
1438 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1439    /**
1440     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1441     * `err` or `result` depending on the state of `result_ok`.
1442     */
1443    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1444    /**
1445     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1446     */
1447    bool result_ok;
1448 } LDKCResult_RouteHopDecodeErrorZ;
1449
1450 /**
1451  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1452  * This corresponds to std::vector in C++
1453  */
1454 typedef struct LDKCVec_RouteHopZ {
1455    /**
1456     * The elements in the array.
1457     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1458     */
1459    struct LDKRouteHop *data;
1460    /**
1461     * The number of elements pointed to by `data`.
1462     */
1463    uintptr_t datalen;
1464 } LDKCVec_RouteHopZ;
1465
1466 /**
1467  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1468  * This corresponds to std::vector in C++
1469  */
1470 typedef struct LDKCVec_CVec_RouteHopZZ {
1471    /**
1472     * The elements in the array.
1473     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1474     */
1475    struct LDKCVec_RouteHopZ *data;
1476    /**
1477     * The number of elements pointed to by `data`.
1478     */
1479    uintptr_t datalen;
1480 } LDKCVec_CVec_RouteHopZZ;
1481
1482
1483
1484 /**
1485  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1486  * it can take multiple paths. Each path is composed of one or more hops through the network.
1487  */
1488 typedef struct MUST_USE_STRUCT LDKRoute {
1489    /**
1490     * A pointer to the opaque Rust object.
1491     * Nearly everywhere, inner must be non-null, however in places where
1492     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1493     */
1494    LDKnativeRoute *inner;
1495    /**
1496     * Indicates that this is the only struct which contains the same pointer.
1497     * Rust functions which take ownership of an object provided via an argument require
1498     * this to be true and invalidate the object pointed to by inner.
1499     */
1500    bool is_owned;
1501 } LDKRoute;
1502
1503 /**
1504  * The contents of CResult_RouteDecodeErrorZ
1505  */
1506 typedef union LDKCResult_RouteDecodeErrorZPtr {
1507    /**
1508     * A pointer to the contents in the success state.
1509     * Reading from this pointer when `result_ok` is not set is undefined.
1510     */
1511    struct LDKRoute *result;
1512    /**
1513     * A pointer to the contents in the error state.
1514     * Reading from this pointer when `result_ok` is set is undefined.
1515     */
1516    struct LDKDecodeError *err;
1517 } LDKCResult_RouteDecodeErrorZPtr;
1518
1519 /**
1520  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1521  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1523  */
1524 typedef struct LDKCResult_RouteDecodeErrorZ {
1525    /**
1526     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1527     * `err` or `result` depending on the state of `result_ok`.
1528     */
1529    union LDKCResult_RouteDecodeErrorZPtr contents;
1530    /**
1531     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1532     */
1533    bool result_ok;
1534 } LDKCResult_RouteDecodeErrorZ;
1535
1536
1537
1538 /**
1539  * Parameters needed to find a [`Route`] for paying a [`Payee`].
1540  *
1541  * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
1542  * payment path.
1543  *
1544  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1545  */
1546 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1547    /**
1548     * A pointer to the opaque Rust object.
1549     * Nearly everywhere, inner must be non-null, however in places where
1550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1551     */
1552    LDKnativeRouteParameters *inner;
1553    /**
1554     * Indicates that this is the only struct which contains the same pointer.
1555     * Rust functions which take ownership of an object provided via an argument require
1556     * this to be true and invalidate the object pointed to by inner.
1557     */
1558    bool is_owned;
1559 } LDKRouteParameters;
1560
1561 /**
1562  * The contents of CResult_RouteParametersDecodeErrorZ
1563  */
1564 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1565    /**
1566     * A pointer to the contents in the success state.
1567     * Reading from this pointer when `result_ok` is not set is undefined.
1568     */
1569    struct LDKRouteParameters *result;
1570    /**
1571     * A pointer to the contents in the error state.
1572     * Reading from this pointer when `result_ok` is set is undefined.
1573     */
1574    struct LDKDecodeError *err;
1575 } LDKCResult_RouteParametersDecodeErrorZPtr;
1576
1577 /**
1578  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1579  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1581  */
1582 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1583    /**
1584     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1585     * `err` or `result` depending on the state of `result_ok`.
1586     */
1587    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1588    /**
1589     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1590     */
1591    bool result_ok;
1592 } LDKCResult_RouteParametersDecodeErrorZ;
1593
1594
1595
1596 /**
1597  * A list of hops along a payment path terminating with a channel to the recipient.
1598  */
1599 typedef struct MUST_USE_STRUCT LDKRouteHint {
1600    /**
1601     * A pointer to the opaque Rust object.
1602     * Nearly everywhere, inner must be non-null, however in places where
1603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1604     */
1605    LDKnativeRouteHint *inner;
1606    /**
1607     * Indicates that this is the only struct which contains the same pointer.
1608     * Rust functions which take ownership of an object provided via an argument require
1609     * this to be true and invalidate the object pointed to by inner.
1610     */
1611    bool is_owned;
1612 } LDKRouteHint;
1613
1614 /**
1615  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1616  * This corresponds to std::vector in C++
1617  */
1618 typedef struct LDKCVec_RouteHintZ {
1619    /**
1620     * The elements in the array.
1621     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1622     */
1623    struct LDKRouteHint *data;
1624    /**
1625     * The number of elements pointed to by `data`.
1626     */
1627    uintptr_t datalen;
1628 } LDKCVec_RouteHintZ;
1629
1630 /**
1631  * An enum which can either contain a u64 or not
1632  */
1633 typedef enum LDKCOption_u64Z_Tag {
1634    /**
1635     * When we're in this state, this COption_u64Z contains a u64
1636     */
1637    LDKCOption_u64Z_Some,
1638    /**
1639     * When we're in this state, this COption_u64Z contains nothing
1640     */
1641    LDKCOption_u64Z_None,
1642    /**
1643     * Must be last for serialization purposes
1644     */
1645    LDKCOption_u64Z_Sentinel,
1646 } LDKCOption_u64Z_Tag;
1647
1648 typedef struct LDKCOption_u64Z {
1649    LDKCOption_u64Z_Tag tag;
1650    union {
1651       struct {
1652          uint64_t some;
1653       };
1654    };
1655 } LDKCOption_u64Z;
1656
1657
1658
1659 /**
1660  * The recipient of a payment.
1661  */
1662 typedef struct MUST_USE_STRUCT LDKPayee {
1663    /**
1664     * A pointer to the opaque Rust object.
1665     * Nearly everywhere, inner must be non-null, however in places where
1666     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1667     */
1668    LDKnativePayee *inner;
1669    /**
1670     * Indicates that this is the only struct which contains the same pointer.
1671     * Rust functions which take ownership of an object provided via an argument require
1672     * this to be true and invalidate the object pointed to by inner.
1673     */
1674    bool is_owned;
1675 } LDKPayee;
1676
1677 /**
1678  * The contents of CResult_PayeeDecodeErrorZ
1679  */
1680 typedef union LDKCResult_PayeeDecodeErrorZPtr {
1681    /**
1682     * A pointer to the contents in the success state.
1683     * Reading from this pointer when `result_ok` is not set is undefined.
1684     */
1685    struct LDKPayee *result;
1686    /**
1687     * A pointer to the contents in the error state.
1688     * Reading from this pointer when `result_ok` is set is undefined.
1689     */
1690    struct LDKDecodeError *err;
1691 } LDKCResult_PayeeDecodeErrorZPtr;
1692
1693 /**
1694  * A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
1695  * containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
1696  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1697  */
1698 typedef struct LDKCResult_PayeeDecodeErrorZ {
1699    /**
1700     * The contents of this CResult_PayeeDecodeErrorZ, accessible via either
1701     * `err` or `result` depending on the state of `result_ok`.
1702     */
1703    union LDKCResult_PayeeDecodeErrorZPtr contents;
1704    /**
1705     * Whether this CResult_PayeeDecodeErrorZ represents a success state.
1706     */
1707    bool result_ok;
1708 } LDKCResult_PayeeDecodeErrorZ;
1709
1710
1711
1712 /**
1713  * A channel descriptor for a hop along a payment path.
1714  */
1715 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1716    /**
1717     * A pointer to the opaque Rust object.
1718     * Nearly everywhere, inner must be non-null, however in places where
1719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1720     */
1721    LDKnativeRouteHintHop *inner;
1722    /**
1723     * Indicates that this is the only struct which contains the same pointer.
1724     * Rust functions which take ownership of an object provided via an argument require
1725     * this to be true and invalidate the object pointed to by inner.
1726     */
1727    bool is_owned;
1728 } LDKRouteHintHop;
1729
1730 /**
1731  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1732  * This corresponds to std::vector in C++
1733  */
1734 typedef struct LDKCVec_RouteHintHopZ {
1735    /**
1736     * The elements in the array.
1737     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1738     */
1739    struct LDKRouteHintHop *data;
1740    /**
1741     * The number of elements pointed to by `data`.
1742     */
1743    uintptr_t datalen;
1744 } LDKCVec_RouteHintHopZ;
1745
1746 /**
1747  * The contents of CResult_RouteHintDecodeErrorZ
1748  */
1749 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1750    /**
1751     * A pointer to the contents in the success state.
1752     * Reading from this pointer when `result_ok` is not set is undefined.
1753     */
1754    struct LDKRouteHint *result;
1755    /**
1756     * A pointer to the contents in the error state.
1757     * Reading from this pointer when `result_ok` is set is undefined.
1758     */
1759    struct LDKDecodeError *err;
1760 } LDKCResult_RouteHintDecodeErrorZPtr;
1761
1762 /**
1763  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1764  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1765  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1766  */
1767 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1768    /**
1769     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1770     * `err` or `result` depending on the state of `result_ok`.
1771     */
1772    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1773    /**
1774     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1775     */
1776    bool result_ok;
1777 } LDKCResult_RouteHintDecodeErrorZ;
1778
1779 /**
1780  * The contents of CResult_RouteHintHopDecodeErrorZ
1781  */
1782 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1783    /**
1784     * A pointer to the contents in the success state.
1785     * Reading from this pointer when `result_ok` is not set is undefined.
1786     */
1787    struct LDKRouteHintHop *result;
1788    /**
1789     * A pointer to the contents in the error state.
1790     * Reading from this pointer when `result_ok` is set is undefined.
1791     */
1792    struct LDKDecodeError *err;
1793 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1794
1795 /**
1796  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1797  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1798  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1799  */
1800 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1801    /**
1802     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
1803     * `err` or `result` depending on the state of `result_ok`.
1804     */
1805    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
1806    /**
1807     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
1808     */
1809    bool result_ok;
1810 } LDKCResult_RouteHintHopDecodeErrorZ;
1811
1812
1813
1814 /**
1815  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1816  */
1817 typedef struct MUST_USE_STRUCT LDKChannelDetails {
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    LDKnativeChannelDetails *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 } LDKChannelDetails;
1831
1832 /**
1833  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1834  * This corresponds to std::vector in C++
1835  */
1836 typedef struct LDKCVec_ChannelDetailsZ {
1837    /**
1838     * The elements in the array.
1839     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1840     */
1841    struct LDKChannelDetails *data;
1842    /**
1843     * The number of elements pointed to by `data`.
1844     */
1845    uintptr_t datalen;
1846 } LDKCVec_ChannelDetailsZ;
1847
1848
1849
1850 /**
1851  * An Err type for failure to process messages.
1852  */
1853 typedef struct MUST_USE_STRUCT LDKLightningError {
1854    /**
1855     * A pointer to the opaque Rust object.
1856     * Nearly everywhere, inner must be non-null, however in places where
1857     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1858     */
1859    LDKnativeLightningError *inner;
1860    /**
1861     * Indicates that this is the only struct which contains the same pointer.
1862     * Rust functions which take ownership of an object provided via an argument require
1863     * this to be true and invalidate the object pointed to by inner.
1864     */
1865    bool is_owned;
1866 } LDKLightningError;
1867
1868 /**
1869  * The contents of CResult_RouteLightningErrorZ
1870  */
1871 typedef union LDKCResult_RouteLightningErrorZPtr {
1872    /**
1873     * A pointer to the contents in the success state.
1874     * Reading from this pointer when `result_ok` is not set is undefined.
1875     */
1876    struct LDKRoute *result;
1877    /**
1878     * A pointer to the contents in the error state.
1879     * Reading from this pointer when `result_ok` is set is undefined.
1880     */
1881    struct LDKLightningError *err;
1882 } LDKCResult_RouteLightningErrorZPtr;
1883
1884 /**
1885  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1886  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1888  */
1889 typedef struct LDKCResult_RouteLightningErrorZ {
1890    /**
1891     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1892     * `err` or `result` depending on the state of `result_ok`.
1893     */
1894    union LDKCResult_RouteLightningErrorZPtr contents;
1895    /**
1896     * Whether this CResult_RouteLightningErrorZ represents a success state.
1897     */
1898    bool result_ok;
1899 } LDKCResult_RouteLightningErrorZ;
1900
1901 /**
1902  * The contents of CResult_TxOutAccessErrorZ
1903  */
1904 typedef union LDKCResult_TxOutAccessErrorZPtr {
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 LDKTxOut *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 LDKAccessError *err;
1915 } LDKCResult_TxOutAccessErrorZPtr;
1916
1917 /**
1918  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1919  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1920  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1921  */
1922 typedef struct LDKCResult_TxOutAccessErrorZ {
1923    /**
1924     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1925     * `err` or `result` depending on the state of `result_ok`.
1926     */
1927    union LDKCResult_TxOutAccessErrorZPtr contents;
1928    /**
1929     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1930     */
1931    bool result_ok;
1932 } LDKCResult_TxOutAccessErrorZ;
1933
1934 /**
1935  * A tuple of 2 elements. See the individual fields for the types contained.
1936  */
1937 typedef struct LDKC2Tuple_usizeTransactionZ {
1938    /**
1939     * The element at position 0
1940     */
1941    uintptr_t a;
1942    /**
1943     * The element at position 1
1944     */
1945    struct LDKTransaction b;
1946 } LDKC2Tuple_usizeTransactionZ;
1947
1948 /**
1949  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1950  * This corresponds to std::vector in C++
1951  */
1952 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1953    /**
1954     * The elements in the array.
1955     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1956     */
1957    struct LDKC2Tuple_usizeTransactionZ *data;
1958    /**
1959     * The number of elements pointed to by `data`.
1960     */
1961    uintptr_t datalen;
1962 } LDKCVec_C2Tuple_usizeTransactionZZ;
1963
1964 /**
1965  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1966  * look up the corresponding function in rust-lightning's docs.
1967  */
1968 typedef struct LDKThirtyTwoBytes {
1969    /**
1970     * The thirty-two bytes
1971     */
1972    uint8_t data[32];
1973 } LDKThirtyTwoBytes;
1974
1975 /**
1976  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1977  * This corresponds to std::vector in C++
1978  */
1979 typedef struct LDKCVec_TxidZ {
1980    /**
1981     * The elements in the array.
1982     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1983     */
1984    struct LDKThirtyTwoBytes *data;
1985    /**
1986     * The number of elements pointed to by `data`.
1987     */
1988    uintptr_t datalen;
1989 } LDKCVec_TxidZ;
1990
1991 /**
1992  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1993  */
1994 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1995    /**
1996     * Note that this value is always NULL, as there are no contents in the OK variant
1997     */
1998    void *result;
1999    /**
2000     * A pointer to the contents in the error state.
2001     * Reading from this pointer when `result_ok` is set is undefined.
2002     */
2003    enum LDKChannelMonitorUpdateErr *err;
2004 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2005
2006 /**
2007  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2008  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2010  */
2011 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2012    /**
2013     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2014     * `err` or `result` depending on the state of `result_ok`.
2015     */
2016    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2017    /**
2018     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2019     */
2020    bool result_ok;
2021 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2022
2023
2024
2025 /**
2026  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2027  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2028  * preimage claim backward will lead to loss of funds.
2029  */
2030 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2031    /**
2032     * A pointer to the opaque Rust object.
2033     * Nearly everywhere, inner must be non-null, however in places where
2034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2035     */
2036    LDKnativeHTLCUpdate *inner;
2037    /**
2038     * Indicates that this is the only struct which contains the same pointer.
2039     * Rust functions which take ownership of an object provided via an argument require
2040     * this to be true and invalidate the object pointed to by inner.
2041     */
2042    bool is_owned;
2043 } LDKHTLCUpdate;
2044
2045
2046
2047 /**
2048  * A reference to a transaction output.
2049  *
2050  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2051  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2052  */
2053 typedef struct MUST_USE_STRUCT LDKOutPoint {
2054    /**
2055     * A pointer to the opaque Rust object.
2056     * Nearly everywhere, inner must be non-null, however in places where
2057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2058     */
2059    LDKnativeOutPoint *inner;
2060    /**
2061     * Indicates that this is the only struct which contains the same pointer.
2062     * Rust functions which take ownership of an object provided via an argument require
2063     * this to be true and invalidate the object pointed to by inner.
2064     */
2065    bool is_owned;
2066 } LDKOutPoint;
2067
2068 /**
2069  * An event to be processed by the ChannelManager.
2070  */
2071 typedef enum LDKMonitorEvent_Tag {
2072    /**
2073     * A monitor event containing an HTLCUpdate.
2074     */
2075    LDKMonitorEvent_HTLCEvent,
2076    /**
2077     * A monitor event that the Channel's commitment transaction was confirmed.
2078     */
2079    LDKMonitorEvent_CommitmentTxConfirmed,
2080    /**
2081     * Indicates a [`ChannelMonitor`] update has completed. See
2082     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
2083     *
2084     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
2085     */
2086    LDKMonitorEvent_UpdateCompleted,
2087    /**
2088     * Indicates a [`ChannelMonitor`] update has failed. See
2089     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
2090     *
2091     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
2092     */
2093    LDKMonitorEvent_UpdateFailed,
2094    /**
2095     * Must be last for serialization purposes
2096     */
2097    LDKMonitorEvent_Sentinel,
2098 } LDKMonitorEvent_Tag;
2099
2100 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
2101    /**
2102     * The funding outpoint of the [`ChannelMonitor`] that was updated
2103     */
2104    struct LDKOutPoint funding_txo;
2105    /**
2106     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
2107     * [`ChannelMonitor::get_latest_update_id`].
2108     *
2109     * Note that this should only be set to a given update's ID if all previous updates for the
2110     * same [`ChannelMonitor`] have been applied and persisted.
2111     */
2112    uint64_t monitor_update_id;
2113 } LDKMonitorEvent_LDKUpdateCompleted_Body;
2114
2115 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2116    LDKMonitorEvent_Tag tag;
2117    union {
2118       struct {
2119          struct LDKHTLCUpdate htlc_event;
2120       };
2121       struct {
2122          struct LDKOutPoint commitment_tx_confirmed;
2123       };
2124       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
2125       struct {
2126          struct LDKOutPoint update_failed;
2127       };
2128    };
2129 } LDKMonitorEvent;
2130
2131 /**
2132  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2133  * This corresponds to std::vector in C++
2134  */
2135 typedef struct LDKCVec_MonitorEventZ {
2136    /**
2137     * The elements in the array.
2138     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2139     */
2140    struct LDKMonitorEvent *data;
2141    /**
2142     * The number of elements pointed to by `data`.
2143     */
2144    uintptr_t datalen;
2145 } LDKCVec_MonitorEventZ;
2146
2147 /**
2148  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2149  */
2150 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2151    /**
2152     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2153     */
2154    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2155    /**
2156     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2157     */
2158    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2159    /**
2160     * Must be last for serialization purposes
2161     */
2162    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2163 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2164
2165 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2166    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2167    union {
2168       struct {
2169          struct LDKC2Tuple_usizeTransactionZ some;
2170       };
2171    };
2172 } LDKCOption_C2Tuple_usizeTransactionZZ;
2173
2174
2175
2176 /**
2177  * A channel_update message to be sent or received from a peer
2178  */
2179 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2180    /**
2181     * A pointer to the opaque Rust object.
2182     * Nearly everywhere, inner must be non-null, however in places where
2183     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2184     */
2185    LDKnativeChannelUpdate *inner;
2186    /**
2187     * Indicates that this is the only struct which contains the same pointer.
2188     * Rust functions which take ownership of an object provided via an argument require
2189     * this to be true and invalidate the object pointed to by inner.
2190     */
2191    bool is_owned;
2192 } LDKChannelUpdate;
2193
2194 /**
2195  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2196  * return packet by a node along the route. See [BOLT #4] for details.
2197  *
2198  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2199  */
2200 typedef enum LDKNetworkUpdate_Tag {
2201    /**
2202     * An error indicating a `channel_update` messages should be applied via
2203     * [`NetworkGraph::update_channel`].
2204     */
2205    LDKNetworkUpdate_ChannelUpdateMessage,
2206    /**
2207     * An error indicating only that a channel has been closed, which should be applied via
2208     * [`NetworkGraph::close_channel_from_update`].
2209     */
2210    LDKNetworkUpdate_ChannelClosed,
2211    /**
2212     * An error indicating only that a node has failed, which should be applied via
2213     * [`NetworkGraph::fail_node`].
2214     */
2215    LDKNetworkUpdate_NodeFailure,
2216    /**
2217     * Must be last for serialization purposes
2218     */
2219    LDKNetworkUpdate_Sentinel,
2220 } LDKNetworkUpdate_Tag;
2221
2222 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2223    /**
2224     * The update to apply via [`NetworkGraph::update_channel`].
2225     */
2226    struct LDKChannelUpdate msg;
2227 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2228
2229 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2230    /**
2231     * The short channel id of the closed channel.
2232     */
2233    uint64_t short_channel_id;
2234    /**
2235     * Whether the channel should be permanently removed or temporarily disabled until a new
2236     * `channel_update` message is received.
2237     */
2238    bool is_permanent;
2239 } LDKNetworkUpdate_LDKChannelClosed_Body;
2240
2241 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2242    /**
2243     * The node id of the failed node.
2244     */
2245    struct LDKPublicKey node_id;
2246    /**
2247     * Whether the node should be permanently removed from consideration or can be restored
2248     * when a new `channel_update` message is received.
2249     */
2250    bool is_permanent;
2251 } LDKNetworkUpdate_LDKNodeFailure_Body;
2252
2253 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2254    LDKNetworkUpdate_Tag tag;
2255    union {
2256       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2257       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2258       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2259    };
2260 } LDKNetworkUpdate;
2261
2262 /**
2263  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2264  */
2265 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2266    /**
2267     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2268     */
2269    LDKCOption_NetworkUpdateZ_Some,
2270    /**
2271     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2272     */
2273    LDKCOption_NetworkUpdateZ_None,
2274    /**
2275     * Must be last for serialization purposes
2276     */
2277    LDKCOption_NetworkUpdateZ_Sentinel,
2278 } LDKCOption_NetworkUpdateZ_Tag;
2279
2280 typedef struct LDKCOption_NetworkUpdateZ {
2281    LDKCOption_NetworkUpdateZ_Tag tag;
2282    union {
2283       struct {
2284          struct LDKNetworkUpdate some;
2285       };
2286    };
2287 } LDKCOption_NetworkUpdateZ;
2288
2289
2290
2291 /**
2292  * Information about a spendable output to a P2WSH script. See
2293  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2294  */
2295 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2296    /**
2297     * A pointer to the opaque Rust object.
2298     * Nearly everywhere, inner must be non-null, however in places where
2299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2300     */
2301    LDKnativeDelayedPaymentOutputDescriptor *inner;
2302    /**
2303     * Indicates that this is the only struct which contains the same pointer.
2304     * Rust functions which take ownership of an object provided via an argument require
2305     * this to be true and invalidate the object pointed to by inner.
2306     */
2307    bool is_owned;
2308 } LDKDelayedPaymentOutputDescriptor;
2309
2310
2311
2312 /**
2313  * Information about a spendable output to our \"payment key\". See
2314  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2315  */
2316 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2317    /**
2318     * A pointer to the opaque Rust object.
2319     * Nearly everywhere, inner must be non-null, however in places where
2320     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2321     */
2322    LDKnativeStaticPaymentOutputDescriptor *inner;
2323    /**
2324     * Indicates that this is the only struct which contains the same pointer.
2325     * Rust functions which take ownership of an object provided via an argument require
2326     * this to be true and invalidate the object pointed to by inner.
2327     */
2328    bool is_owned;
2329 } LDKStaticPaymentOutputDescriptor;
2330
2331 /**
2332  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2333  * claim at any point in the future) an event is generated which you must track and be able to
2334  * spend on-chain. The information needed to do this is provided in this enum, including the
2335  * outpoint describing which txid and output index is available, the full output which exists at
2336  * that txid/index, and any keys or other information required to sign.
2337  */
2338 typedef enum LDKSpendableOutputDescriptor_Tag {
2339    /**
2340     * An output to a script which was provided via KeysInterface directly, either from
2341     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2342     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2343     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2344     * on-chain using the payment preimage or after it has timed out.
2345     */
2346    LDKSpendableOutputDescriptor_StaticOutput,
2347    /**
2348     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2349     *
2350     * The witness in the spending input should be:
2351     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2352     *
2353     * Note that the nSequence field in the spending input must be set to to_self_delay
2354     * (which means the transaction is not broadcastable until at least to_self_delay
2355     * blocks after the outpoint confirms).
2356     *
2357     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2358     * it is an output from an old state which we broadcast (which should never happen).
2359     *
2360     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2361     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2362     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2363     * chan_utils::derive_private_key. The public key can be generated without the secret key
2364     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2365     * Sign::pubkeys().
2366     *
2367     * To derive the revocation_pubkey provided here (which is used in the witness
2368     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2369     * call to Sign::ready_channel) and the provided per_commitment point
2370     * to chan_utils::derive_public_revocation_key.
2371     *
2372     * The witness script which is hashed and included in the output script_pubkey may be
2373     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2374     * (derived as above), and the to_self_delay contained here to
2375     * chan_utils::get_revokeable_redeemscript.
2376     */
2377    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2378    /**
2379     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2380     * corresponds to the public key in Sign::pubkeys().payment_point).
2381     * The witness in the spending input, is, thus, simply:
2382     * <BIP 143 signature> <payment key>
2383     *
2384     * These are generally the result of our counterparty having broadcast the current state,
2385     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2386     */
2387    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2388    /**
2389     * Must be last for serialization purposes
2390     */
2391    LDKSpendableOutputDescriptor_Sentinel,
2392 } LDKSpendableOutputDescriptor_Tag;
2393
2394 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2395    /**
2396     * The outpoint which is spendable
2397     */
2398    struct LDKOutPoint outpoint;
2399    /**
2400     * The output which is referenced by the given outpoint.
2401     */
2402    struct LDKTxOut output;
2403 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2404
2405 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2406    LDKSpendableOutputDescriptor_Tag tag;
2407    union {
2408       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2409       struct {
2410          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2411       };
2412       struct {
2413          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2414       };
2415    };
2416 } LDKSpendableOutputDescriptor;
2417
2418 /**
2419  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2420  * This corresponds to std::vector in C++
2421  */
2422 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2423    /**
2424     * The elements in the array.
2425     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2426     */
2427    struct LDKSpendableOutputDescriptor *data;
2428    /**
2429     * The number of elements pointed to by `data`.
2430     */
2431    uintptr_t datalen;
2432 } LDKCVec_SpendableOutputDescriptorZ;
2433
2434
2435
2436 /**
2437  * An accept_channel message to be sent or received from a peer
2438  */
2439 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2440    /**
2441     * A pointer to the opaque Rust object.
2442     * Nearly everywhere, inner must be non-null, however in places where
2443     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2444     */
2445    LDKnativeAcceptChannel *inner;
2446    /**
2447     * Indicates that this is the only struct which contains the same pointer.
2448     * Rust functions which take ownership of an object provided via an argument require
2449     * this to be true and invalidate the object pointed to by inner.
2450     */
2451    bool is_owned;
2452 } LDKAcceptChannel;
2453
2454
2455
2456 /**
2457  * An open_channel message to be sent or received from a peer
2458  */
2459 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2460    /**
2461     * A pointer to the opaque Rust object.
2462     * Nearly everywhere, inner must be non-null, however in places where
2463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2464     */
2465    LDKnativeOpenChannel *inner;
2466    /**
2467     * Indicates that this is the only struct which contains the same pointer.
2468     * Rust functions which take ownership of an object provided via an argument require
2469     * this to be true and invalidate the object pointed to by inner.
2470     */
2471    bool is_owned;
2472 } LDKOpenChannel;
2473
2474
2475
2476 /**
2477  * A funding_created message to be sent or received from a peer
2478  */
2479 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2480    /**
2481     * A pointer to the opaque Rust object.
2482     * Nearly everywhere, inner must be non-null, however in places where
2483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2484     */
2485    LDKnativeFundingCreated *inner;
2486    /**
2487     * Indicates that this is the only struct which contains the same pointer.
2488     * Rust functions which take ownership of an object provided via an argument require
2489     * this to be true and invalidate the object pointed to by inner.
2490     */
2491    bool is_owned;
2492 } LDKFundingCreated;
2493
2494
2495
2496 /**
2497  * A funding_signed message to be sent or received from a peer
2498  */
2499 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2500    /**
2501     * A pointer to the opaque Rust object.
2502     * Nearly everywhere, inner must be non-null, however in places where
2503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2504     */
2505    LDKnativeFundingSigned *inner;
2506    /**
2507     * Indicates that this is the only struct which contains the same pointer.
2508     * Rust functions which take ownership of an object provided via an argument require
2509     * this to be true and invalidate the object pointed to by inner.
2510     */
2511    bool is_owned;
2512 } LDKFundingSigned;
2513
2514
2515
2516 /**
2517  * A funding_locked message to be sent or received from a peer
2518  */
2519 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2520    /**
2521     * A pointer to the opaque Rust object.
2522     * Nearly everywhere, inner must be non-null, however in places where
2523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2524     */
2525    LDKnativeFundingLocked *inner;
2526    /**
2527     * Indicates that this is the only struct which contains the same pointer.
2528     * Rust functions which take ownership of an object provided via an argument require
2529     * this to be true and invalidate the object pointed to by inner.
2530     */
2531    bool is_owned;
2532 } LDKFundingLocked;
2533
2534
2535
2536 /**
2537  * An announcement_signatures message to be sent or received from a peer
2538  */
2539 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2540    /**
2541     * A pointer to the opaque Rust object.
2542     * Nearly everywhere, inner must be non-null, however in places where
2543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2544     */
2545    LDKnativeAnnouncementSignatures *inner;
2546    /**
2547     * Indicates that this is the only struct which contains the same pointer.
2548     * Rust functions which take ownership of an object provided via an argument require
2549     * this to be true and invalidate the object pointed to by inner.
2550     */
2551    bool is_owned;
2552 } LDKAnnouncementSignatures;
2553
2554
2555
2556 /**
2557  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2558  * transaction updates if they were pending.
2559  */
2560 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2561    /**
2562     * A pointer to the opaque Rust object.
2563     * Nearly everywhere, inner must be non-null, however in places where
2564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2565     */
2566    LDKnativeCommitmentUpdate *inner;
2567    /**
2568     * Indicates that this is the only struct which contains the same pointer.
2569     * Rust functions which take ownership of an object provided via an argument require
2570     * this to be true and invalidate the object pointed to by inner.
2571     */
2572    bool is_owned;
2573 } LDKCommitmentUpdate;
2574
2575
2576
2577 /**
2578  * A revoke_and_ack message to be sent or received from a peer
2579  */
2580 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2581    /**
2582     * A pointer to the opaque Rust object.
2583     * Nearly everywhere, inner must be non-null, however in places where
2584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2585     */
2586    LDKnativeRevokeAndACK *inner;
2587    /**
2588     * Indicates that this is the only struct which contains the same pointer.
2589     * Rust functions which take ownership of an object provided via an argument require
2590     * this to be true and invalidate the object pointed to by inner.
2591     */
2592    bool is_owned;
2593 } LDKRevokeAndACK;
2594
2595
2596
2597 /**
2598  * A closing_signed message to be sent or received from a peer
2599  */
2600 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2601    /**
2602     * A pointer to the opaque Rust object.
2603     * Nearly everywhere, inner must be non-null, however in places where
2604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2605     */
2606    LDKnativeClosingSigned *inner;
2607    /**
2608     * Indicates that this is the only struct which contains the same pointer.
2609     * Rust functions which take ownership of an object provided via an argument require
2610     * this to be true and invalidate the object pointed to by inner.
2611     */
2612    bool is_owned;
2613 } LDKClosingSigned;
2614
2615
2616
2617 /**
2618  * A shutdown message to be sent or received from a peer
2619  */
2620 typedef struct MUST_USE_STRUCT LDKShutdown {
2621    /**
2622     * A pointer to the opaque Rust object.
2623     * Nearly everywhere, inner must be non-null, however in places where
2624     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2625     */
2626    LDKnativeShutdown *inner;
2627    /**
2628     * Indicates that this is the only struct which contains the same pointer.
2629     * Rust functions which take ownership of an object provided via an argument require
2630     * this to be true and invalidate the object pointed to by inner.
2631     */
2632    bool is_owned;
2633 } LDKShutdown;
2634
2635
2636
2637 /**
2638  * A channel_reestablish message to be sent or received from a peer
2639  */
2640 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2641    /**
2642     * A pointer to the opaque Rust object.
2643     * Nearly everywhere, inner must be non-null, however in places where
2644     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2645     */
2646    LDKnativeChannelReestablish *inner;
2647    /**
2648     * Indicates that this is the only struct which contains the same pointer.
2649     * Rust functions which take ownership of an object provided via an argument require
2650     * this to be true and invalidate the object pointed to by inner.
2651     */
2652    bool is_owned;
2653 } LDKChannelReestablish;
2654
2655
2656
2657 /**
2658  * A channel_announcement message to be sent or received from a peer
2659  */
2660 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2661    /**
2662     * A pointer to the opaque Rust object.
2663     * Nearly everywhere, inner must be non-null, however in places where
2664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2665     */
2666    LDKnativeChannelAnnouncement *inner;
2667    /**
2668     * Indicates that this is the only struct which contains the same pointer.
2669     * Rust functions which take ownership of an object provided via an argument require
2670     * this to be true and invalidate the object pointed to by inner.
2671     */
2672    bool is_owned;
2673 } LDKChannelAnnouncement;
2674
2675
2676
2677 /**
2678  * A node_announcement message to be sent or received from a peer
2679  */
2680 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2681    /**
2682     * A pointer to the opaque Rust object.
2683     * Nearly everywhere, inner must be non-null, however in places where
2684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2685     */
2686    LDKnativeNodeAnnouncement *inner;
2687    /**
2688     * Indicates that this is the only struct which contains the same pointer.
2689     * Rust functions which take ownership of an object provided via an argument require
2690     * this to be true and invalidate the object pointed to by inner.
2691     */
2692    bool is_owned;
2693 } LDKNodeAnnouncement;
2694
2695
2696
2697 /**
2698  * An error message to be sent or received from a peer
2699  */
2700 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2701    /**
2702     * A pointer to the opaque Rust object.
2703     * Nearly everywhere, inner must be non-null, however in places where
2704     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2705     */
2706    LDKnativeErrorMessage *inner;
2707    /**
2708     * Indicates that this is the only struct which contains the same pointer.
2709     * Rust functions which take ownership of an object provided via an argument require
2710     * this to be true and invalidate the object pointed to by inner.
2711     */
2712    bool is_owned;
2713 } LDKErrorMessage;
2714
2715 /**
2716  * Used to put an error message in a LightningError
2717  */
2718 typedef enum LDKErrorAction_Tag {
2719    /**
2720     * The peer took some action which made us think they were useless. Disconnect them.
2721     */
2722    LDKErrorAction_DisconnectPeer,
2723    /**
2724     * The peer did something harmless that we weren't able to process, just log and ignore
2725     */
2726    LDKErrorAction_IgnoreError,
2727    /**
2728     * The peer did something harmless that we weren't able to meaningfully process.
2729     * If the error is logged, log it at the given level.
2730     */
2731    LDKErrorAction_IgnoreAndLog,
2732    /**
2733     * The peer did something incorrect. Tell them.
2734     */
2735    LDKErrorAction_SendErrorMessage,
2736    /**
2737     * Must be last for serialization purposes
2738     */
2739    LDKErrorAction_Sentinel,
2740 } LDKErrorAction_Tag;
2741
2742 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2743    /**
2744     * An error message which we should make an effort to send before we disconnect.
2745     *
2746     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2747     */
2748    struct LDKErrorMessage msg;
2749 } LDKErrorAction_LDKDisconnectPeer_Body;
2750
2751 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2752    /**
2753     * The message to send.
2754     */
2755    struct LDKErrorMessage msg;
2756 } LDKErrorAction_LDKSendErrorMessage_Body;
2757
2758 typedef struct MUST_USE_STRUCT LDKErrorAction {
2759    LDKErrorAction_Tag tag;
2760    union {
2761       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2762       struct {
2763          enum LDKLevel ignore_and_log;
2764       };
2765       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2766    };
2767 } LDKErrorAction;
2768
2769
2770
2771 /**
2772  * A query_channel_range message is used to query a peer for channel
2773  * UTXOs in a range of blocks. The recipient of a query makes a best
2774  * effort to reply to the query using one or more reply_channel_range
2775  * messages.
2776  */
2777 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2778    /**
2779     * A pointer to the opaque Rust object.
2780     * Nearly everywhere, inner must be non-null, however in places where
2781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2782     */
2783    LDKnativeQueryChannelRange *inner;
2784    /**
2785     * Indicates that this is the only struct which contains the same pointer.
2786     * Rust functions which take ownership of an object provided via an argument require
2787     * this to be true and invalidate the object pointed to by inner.
2788     */
2789    bool is_owned;
2790 } LDKQueryChannelRange;
2791
2792
2793
2794 /**
2795  * A query_short_channel_ids message is used to query a peer for
2796  * routing gossip messages related to one or more short_channel_ids.
2797  * The query recipient will reply with the latest, if available,
2798  * channel_announcement, channel_update and node_announcement messages
2799  * it maintains for the requested short_channel_ids followed by a
2800  * reply_short_channel_ids_end message. The short_channel_ids sent in
2801  * this query are encoded. We only support encoding_type=0 uncompressed
2802  * serialization and do not support encoding_type=1 zlib serialization.
2803  */
2804 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2805    /**
2806     * A pointer to the opaque Rust object.
2807     * Nearly everywhere, inner must be non-null, however in places where
2808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2809     */
2810    LDKnativeQueryShortChannelIds *inner;
2811    /**
2812     * Indicates that this is the only struct which contains the same pointer.
2813     * Rust functions which take ownership of an object provided via an argument require
2814     * this to be true and invalidate the object pointed to by inner.
2815     */
2816    bool is_owned;
2817 } LDKQueryShortChannelIds;
2818
2819
2820
2821 /**
2822  * A reply_channel_range message is a reply to a query_channel_range
2823  * message. Multiple reply_channel_range messages can be sent in reply
2824  * to a single query_channel_range message. The query recipient makes a
2825  * best effort to respond based on their local network view which may
2826  * not be a perfect view of the network. The short_channel_ids in the
2827  * reply are encoded. We only support encoding_type=0 uncompressed
2828  * serialization and do not support encoding_type=1 zlib serialization.
2829  */
2830 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2831    /**
2832     * A pointer to the opaque Rust object.
2833     * Nearly everywhere, inner must be non-null, however in places where
2834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2835     */
2836    LDKnativeReplyChannelRange *inner;
2837    /**
2838     * Indicates that this is the only struct which contains the same pointer.
2839     * Rust functions which take ownership of an object provided via an argument require
2840     * this to be true and invalidate the object pointed to by inner.
2841     */
2842    bool is_owned;
2843 } LDKReplyChannelRange;
2844
2845 /**
2846  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2847  * broadcast to most peers).
2848  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2849  */
2850 typedef enum LDKMessageSendEvent_Tag {
2851    /**
2852     * Used to indicate that we've accepted a channel open and should send the accept_channel
2853     * message provided to the given peer.
2854     */
2855    LDKMessageSendEvent_SendAcceptChannel,
2856    /**
2857     * Used to indicate that we've initiated a channel open and should send the open_channel
2858     * message provided to the given peer.
2859     */
2860    LDKMessageSendEvent_SendOpenChannel,
2861    /**
2862     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2863     */
2864    LDKMessageSendEvent_SendFundingCreated,
2865    /**
2866     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2867     */
2868    LDKMessageSendEvent_SendFundingSigned,
2869    /**
2870     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2871     */
2872    LDKMessageSendEvent_SendFundingLocked,
2873    /**
2874     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2875     */
2876    LDKMessageSendEvent_SendAnnouncementSignatures,
2877    /**
2878     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2879     * message should be sent to the peer with the given node_id.
2880     */
2881    LDKMessageSendEvent_UpdateHTLCs,
2882    /**
2883     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2884     */
2885    LDKMessageSendEvent_SendRevokeAndACK,
2886    /**
2887     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2888     */
2889    LDKMessageSendEvent_SendClosingSigned,
2890    /**
2891     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2892     */
2893    LDKMessageSendEvent_SendShutdown,
2894    /**
2895     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2896     */
2897    LDKMessageSendEvent_SendChannelReestablish,
2898    /**
2899     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2900     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2901     *
2902     * Note that after doing so, you very likely (unless you did so very recently) want to call
2903     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2904     * This ensures that any nodes which see our channel_announcement also have a relevant
2905     * node_announcement, including relevant feature flags which may be important for routing
2906     * through or to us.
2907     */
2908    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2909    /**
2910     * Used to indicate that a node_announcement should be broadcast to all peers.
2911     */
2912    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2913    /**
2914     * Used to indicate that a channel_update should be broadcast to all peers.
2915     */
2916    LDKMessageSendEvent_BroadcastChannelUpdate,
2917    /**
2918     * Used to indicate that a channel_update should be sent to a single peer.
2919     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
2920     * private channel and we shouldn't be informing all of our peers of channel parameters.
2921     */
2922    LDKMessageSendEvent_SendChannelUpdate,
2923    /**
2924     * Broadcast an error downstream to be handled
2925     */
2926    LDKMessageSendEvent_HandleError,
2927    /**
2928     * Query a peer for channels with funding transaction UTXOs in a block range.
2929     */
2930    LDKMessageSendEvent_SendChannelRangeQuery,
2931    /**
2932     * Request routing gossip messages from a peer for a list of channels identified by
2933     * their short_channel_ids.
2934     */
2935    LDKMessageSendEvent_SendShortIdsQuery,
2936    /**
2937     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2938     * emitted during processing of the query.
2939     */
2940    LDKMessageSendEvent_SendReplyChannelRange,
2941    /**
2942     * Must be last for serialization purposes
2943     */
2944    LDKMessageSendEvent_Sentinel,
2945 } LDKMessageSendEvent_Tag;
2946
2947 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2948    /**
2949     * The node_id of the node which should receive this message
2950     */
2951    struct LDKPublicKey node_id;
2952    /**
2953     * The message which should be sent.
2954     */
2955    struct LDKAcceptChannel msg;
2956 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2957
2958 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2959    /**
2960     * The node_id of the node which should receive this message
2961     */
2962    struct LDKPublicKey node_id;
2963    /**
2964     * The message which should be sent.
2965     */
2966    struct LDKOpenChannel msg;
2967 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2968
2969 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2970    /**
2971     * The node_id of the node which should receive this message
2972     */
2973    struct LDKPublicKey node_id;
2974    /**
2975     * The message which should be sent.
2976     */
2977    struct LDKFundingCreated msg;
2978 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2979
2980 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2981    /**
2982     * The node_id of the node which should receive this message
2983     */
2984    struct LDKPublicKey node_id;
2985    /**
2986     * The message which should be sent.
2987     */
2988    struct LDKFundingSigned msg;
2989 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2990
2991 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2992    /**
2993     * The node_id of the node which should receive these message(s)
2994     */
2995    struct LDKPublicKey node_id;
2996    /**
2997     * The funding_locked message which should be sent.
2998     */
2999    struct LDKFundingLocked msg;
3000 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3001
3002 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3003    /**
3004     * The node_id of the node which should receive these message(s)
3005     */
3006    struct LDKPublicKey node_id;
3007    /**
3008     * The announcement_signatures message which should be sent.
3009     */
3010    struct LDKAnnouncementSignatures msg;
3011 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3012
3013 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3014    /**
3015     * The node_id of the node which should receive these message(s)
3016     */
3017    struct LDKPublicKey node_id;
3018    /**
3019     * The update messages which should be sent. ALL messages in the struct should be sent!
3020     */
3021    struct LDKCommitmentUpdate updates;
3022 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3023
3024 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3025    /**
3026     * The node_id of the node which should receive this message
3027     */
3028    struct LDKPublicKey node_id;
3029    /**
3030     * The message which should be sent.
3031     */
3032    struct LDKRevokeAndACK msg;
3033 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3034
3035 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3036    /**
3037     * The node_id of the node which should receive this message
3038     */
3039    struct LDKPublicKey node_id;
3040    /**
3041     * The message which should be sent.
3042     */
3043    struct LDKClosingSigned msg;
3044 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3045
3046 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3047    /**
3048     * The node_id of the node which should receive this message
3049     */
3050    struct LDKPublicKey node_id;
3051    /**
3052     * The message which should be sent.
3053     */
3054    struct LDKShutdown msg;
3055 } LDKMessageSendEvent_LDKSendShutdown_Body;
3056
3057 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3058    /**
3059     * The node_id of the node which should receive this message
3060     */
3061    struct LDKPublicKey node_id;
3062    /**
3063     * The message which should be sent.
3064     */
3065    struct LDKChannelReestablish msg;
3066 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3067
3068 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3069    /**
3070     * The channel_announcement which should be sent.
3071     */
3072    struct LDKChannelAnnouncement msg;
3073    /**
3074     * The followup channel_update which should be sent.
3075     */
3076    struct LDKChannelUpdate update_msg;
3077 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3078
3079 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3080    /**
3081     * The node_announcement which should be sent.
3082     */
3083    struct LDKNodeAnnouncement msg;
3084 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3085
3086 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3087    /**
3088     * The channel_update which should be sent.
3089     */
3090    struct LDKChannelUpdate msg;
3091 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3092
3093 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3094    /**
3095     * The node_id of the node which should receive this message
3096     */
3097    struct LDKPublicKey node_id;
3098    /**
3099     * The channel_update which should be sent.
3100     */
3101    struct LDKChannelUpdate msg;
3102 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3103
3104 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3105    /**
3106     * The node_id of the node which should receive this message
3107     */
3108    struct LDKPublicKey node_id;
3109    /**
3110     * The action which should be taken.
3111     */
3112    struct LDKErrorAction action;
3113 } LDKMessageSendEvent_LDKHandleError_Body;
3114
3115 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3116    /**
3117     * The node_id of this message recipient
3118     */
3119    struct LDKPublicKey node_id;
3120    /**
3121     * The query_channel_range which should be sent.
3122     */
3123    struct LDKQueryChannelRange msg;
3124 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3125
3126 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3127    /**
3128     * The node_id of this message recipient
3129     */
3130    struct LDKPublicKey node_id;
3131    /**
3132     * The query_short_channel_ids which should be sent.
3133     */
3134    struct LDKQueryShortChannelIds msg;
3135 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3136
3137 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3138    /**
3139     * The node_id of this message recipient
3140     */
3141    struct LDKPublicKey node_id;
3142    /**
3143     * The reply_channel_range which should be sent.
3144     */
3145    struct LDKReplyChannelRange msg;
3146 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3147
3148 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3149    LDKMessageSendEvent_Tag tag;
3150    union {
3151       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3152       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3153       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3154       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3155       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3156       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3157       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3158       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3159       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3160       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3161       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3162       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3163       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3164       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3165       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
3166       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3167       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3168       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3169       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3170    };
3171 } LDKMessageSendEvent;
3172
3173 /**
3174  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3175  * This corresponds to std::vector in C++
3176  */
3177 typedef struct LDKCVec_MessageSendEventZ {
3178    /**
3179     * The elements in the array.
3180     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3181     */
3182    struct LDKMessageSendEvent *data;
3183    /**
3184     * The number of elements pointed to by `data`.
3185     */
3186    uintptr_t datalen;
3187 } LDKCVec_MessageSendEventZ;
3188
3189
3190
3191 /**
3192  * Features used within an `init` message.
3193  */
3194 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3195    /**
3196     * A pointer to the opaque Rust object.
3197     * Nearly everywhere, inner must be non-null, however in places where
3198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3199     */
3200    LDKnativeInitFeatures *inner;
3201    /**
3202     * Indicates that this is the only struct which contains the same pointer.
3203     * Rust functions which take ownership of an object provided via an argument require
3204     * this to be true and invalidate the object pointed to by inner.
3205     */
3206    bool is_owned;
3207 } LDKInitFeatures;
3208
3209 /**
3210  * The contents of CResult_InitFeaturesDecodeErrorZ
3211  */
3212 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
3213    /**
3214     * A pointer to the contents in the success state.
3215     * Reading from this pointer when `result_ok` is not set is undefined.
3216     */
3217    struct LDKInitFeatures *result;
3218    /**
3219     * A pointer to the contents in the error state.
3220     * Reading from this pointer when `result_ok` is set is undefined.
3221     */
3222    struct LDKDecodeError *err;
3223 } LDKCResult_InitFeaturesDecodeErrorZPtr;
3224
3225 /**
3226  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3227  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3229  */
3230 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
3231    /**
3232     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3233     * `err` or `result` depending on the state of `result_ok`.
3234     */
3235    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
3236    /**
3237     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3238     */
3239    bool result_ok;
3240 } LDKCResult_InitFeaturesDecodeErrorZ;
3241
3242
3243
3244 /**
3245  * Features used within a `node_announcement` message.
3246  */
3247 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3248    /**
3249     * A pointer to the opaque Rust object.
3250     * Nearly everywhere, inner must be non-null, however in places where
3251     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3252     */
3253    LDKnativeNodeFeatures *inner;
3254    /**
3255     * Indicates that this is the only struct which contains the same pointer.
3256     * Rust functions which take ownership of an object provided via an argument require
3257     * this to be true and invalidate the object pointed to by inner.
3258     */
3259    bool is_owned;
3260 } LDKNodeFeatures;
3261
3262 /**
3263  * The contents of CResult_NodeFeaturesDecodeErrorZ
3264  */
3265 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
3266    /**
3267     * A pointer to the contents in the success state.
3268     * Reading from this pointer when `result_ok` is not set is undefined.
3269     */
3270    struct LDKNodeFeatures *result;
3271    /**
3272     * A pointer to the contents in the error state.
3273     * Reading from this pointer when `result_ok` is set is undefined.
3274     */
3275    struct LDKDecodeError *err;
3276 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
3277
3278 /**
3279  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3280  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3281  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3282  */
3283 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
3284    /**
3285     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3286     * `err` or `result` depending on the state of `result_ok`.
3287     */
3288    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
3289    /**
3290     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3291     */
3292    bool result_ok;
3293 } LDKCResult_NodeFeaturesDecodeErrorZ;
3294
3295
3296
3297 /**
3298  * Features used within a `channel_announcement` message.
3299  */
3300 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3301    /**
3302     * A pointer to the opaque Rust object.
3303     * Nearly everywhere, inner must be non-null, however in places where
3304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3305     */
3306    LDKnativeChannelFeatures *inner;
3307    /**
3308     * Indicates that this is the only struct which contains the same pointer.
3309     * Rust functions which take ownership of an object provided via an argument require
3310     * this to be true and invalidate the object pointed to by inner.
3311     */
3312    bool is_owned;
3313 } LDKChannelFeatures;
3314
3315 /**
3316  * The contents of CResult_ChannelFeaturesDecodeErrorZ
3317  */
3318 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
3319    /**
3320     * A pointer to the contents in the success state.
3321     * Reading from this pointer when `result_ok` is not set is undefined.
3322     */
3323    struct LDKChannelFeatures *result;
3324    /**
3325     * A pointer to the contents in the error state.
3326     * Reading from this pointer when `result_ok` is set is undefined.
3327     */
3328    struct LDKDecodeError *err;
3329 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
3330
3331 /**
3332  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3333  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3334  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3335  */
3336 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
3337    /**
3338     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3339     * `err` or `result` depending on the state of `result_ok`.
3340     */
3341    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
3342    /**
3343     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3344     */
3345    bool result_ok;
3346 } LDKCResult_ChannelFeaturesDecodeErrorZ;
3347
3348
3349
3350 /**
3351  * Features used within an invoice.
3352  */
3353 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
3354    /**
3355     * A pointer to the opaque Rust object.
3356     * Nearly everywhere, inner must be non-null, however in places where
3357     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3358     */
3359    LDKnativeInvoiceFeatures *inner;
3360    /**
3361     * Indicates that this is the only struct which contains the same pointer.
3362     * Rust functions which take ownership of an object provided via an argument require
3363     * this to be true and invalidate the object pointed to by inner.
3364     */
3365    bool is_owned;
3366 } LDKInvoiceFeatures;
3367
3368 /**
3369  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
3370  */
3371 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
3372    /**
3373     * A pointer to the contents in the success state.
3374     * Reading from this pointer when `result_ok` is not set is undefined.
3375     */
3376    struct LDKInvoiceFeatures *result;
3377    /**
3378     * A pointer to the contents in the error state.
3379     * Reading from this pointer when `result_ok` is set is undefined.
3380     */
3381    struct LDKDecodeError *err;
3382 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
3383
3384 /**
3385  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3386  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3387  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3388  */
3389 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
3390    /**
3391     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3392     * `err` or `result` depending on the state of `result_ok`.
3393     */
3394    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
3395    /**
3396     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3397     */
3398    bool result_ok;
3399 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
3400
3401
3402
3403 /**
3404  * Parameters for configuring [`Scorer`].
3405  */
3406 typedef struct MUST_USE_STRUCT LDKScoringParameters {
3407    /**
3408     * A pointer to the opaque Rust object.
3409     * Nearly everywhere, inner must be non-null, however in places where
3410     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3411     */
3412    LDKnativeScoringParameters *inner;
3413    /**
3414     * Indicates that this is the only struct which contains the same pointer.
3415     * Rust functions which take ownership of an object provided via an argument require
3416     * this to be true and invalidate the object pointed to by inner.
3417     */
3418    bool is_owned;
3419 } LDKScoringParameters;
3420
3421 /**
3422  * The contents of CResult_ScoringParametersDecodeErrorZ
3423  */
3424 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
3425    /**
3426     * A pointer to the contents in the success state.
3427     * Reading from this pointer when `result_ok` is not set is undefined.
3428     */
3429    struct LDKScoringParameters *result;
3430    /**
3431     * A pointer to the contents in the error state.
3432     * Reading from this pointer when `result_ok` is set is undefined.
3433     */
3434    struct LDKDecodeError *err;
3435 } LDKCResult_ScoringParametersDecodeErrorZPtr;
3436
3437 /**
3438  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3439  * containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3441  */
3442 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
3443    /**
3444     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3445     * `err` or `result` depending on the state of `result_ok`.
3446     */
3447    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
3448    /**
3449     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3450     */
3451    bool result_ok;
3452 } LDKCResult_ScoringParametersDecodeErrorZ;
3453
3454
3455
3456 /**
3457  * [`routing::Score`] implementation that provides reasonable default behavior.
3458  *
3459  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
3460  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
3461  *
3462  * See [module-level documentation] for usage.
3463  *
3464  * [module-level documentation]: crate::routing::scorer
3465  */
3466 typedef struct MUST_USE_STRUCT LDKScorer {
3467    /**
3468     * A pointer to the opaque Rust object.
3469     * Nearly everywhere, inner must be non-null, however in places where
3470     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3471     */
3472    LDKnativeScorer *inner;
3473    /**
3474     * Indicates that this is the only struct which contains the same pointer.
3475     * Rust functions which take ownership of an object provided via an argument require
3476     * this to be true and invalidate the object pointed to by inner.
3477     */
3478    bool is_owned;
3479 } LDKScorer;
3480
3481 /**
3482  * The contents of CResult_ScorerDecodeErrorZ
3483  */
3484 typedef union LDKCResult_ScorerDecodeErrorZPtr {
3485    /**
3486     * A pointer to the contents in the success state.
3487     * Reading from this pointer when `result_ok` is not set is undefined.
3488     */
3489    struct LDKScorer *result;
3490    /**
3491     * A pointer to the contents in the error state.
3492     * Reading from this pointer when `result_ok` is set is undefined.
3493     */
3494    struct LDKDecodeError *err;
3495 } LDKCResult_ScorerDecodeErrorZPtr;
3496
3497 /**
3498  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3499  * containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3500  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3501  */
3502 typedef struct LDKCResult_ScorerDecodeErrorZ {
3503    /**
3504     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3505     * `err` or `result` depending on the state of `result_ok`.
3506     */
3507    union LDKCResult_ScorerDecodeErrorZPtr contents;
3508    /**
3509     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
3510     */
3511    bool result_ok;
3512 } LDKCResult_ScorerDecodeErrorZ;
3513
3514 /**
3515  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3516  */
3517 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3518    /**
3519     * A pointer to the contents in the success state.
3520     * Reading from this pointer when `result_ok` is not set is undefined.
3521     */
3522    struct LDKDelayedPaymentOutputDescriptor *result;
3523    /**
3524     * A pointer to the contents in the error state.
3525     * Reading from this pointer when `result_ok` is set is undefined.
3526     */
3527    struct LDKDecodeError *err;
3528 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
3529
3530 /**
3531  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3532  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3534  */
3535 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3536    /**
3537     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3538     * `err` or `result` depending on the state of `result_ok`.
3539     */
3540    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
3541    /**
3542     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3543     */
3544    bool result_ok;
3545 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
3546
3547 /**
3548  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3549  */
3550 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3551    /**
3552     * A pointer to the contents in the success state.
3553     * Reading from this pointer when `result_ok` is not set is undefined.
3554     */
3555    struct LDKStaticPaymentOutputDescriptor *result;
3556    /**
3557     * A pointer to the contents in the error state.
3558     * Reading from this pointer when `result_ok` is set is undefined.
3559     */
3560    struct LDKDecodeError *err;
3561 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
3562
3563 /**
3564  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3565  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3566  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3567  */
3568 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3569    /**
3570     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3571     * `err` or `result` depending on the state of `result_ok`.
3572     */
3573    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
3574    /**
3575     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3576     */
3577    bool result_ok;
3578 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3579
3580 /**
3581  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3582  */
3583 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3584    /**
3585     * A pointer to the contents in the success state.
3586     * Reading from this pointer when `result_ok` is not set is undefined.
3587     */
3588    struct LDKSpendableOutputDescriptor *result;
3589    /**
3590     * A pointer to the contents in the error state.
3591     * Reading from this pointer when `result_ok` is set is undefined.
3592     */
3593    struct LDKDecodeError *err;
3594 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3595
3596 /**
3597  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3598  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3599  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3600  */
3601 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3602    /**
3603     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3604     * `err` or `result` depending on the state of `result_ok`.
3605     */
3606    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3607    /**
3608     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3609     */
3610    bool result_ok;
3611 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3612
3613 /**
3614  * The contents of CResult_NoneNoneZ
3615  */
3616 typedef union LDKCResult_NoneNoneZPtr {
3617    /**
3618     * Note that this value is always NULL, as there are no contents in the OK variant
3619     */
3620    void *result;
3621    /**
3622     * Note that this value is always NULL, as there are no contents in the Err variant
3623     */
3624    void *err;
3625 } LDKCResult_NoneNoneZPtr;
3626
3627 /**
3628  * A CResult_NoneNoneZ represents the result of a fallible operation,
3629  * containing a () on success and a () on failure.
3630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3631  */
3632 typedef struct LDKCResult_NoneNoneZ {
3633    /**
3634     * The contents of this CResult_NoneNoneZ, accessible via either
3635     * `err` or `result` depending on the state of `result_ok`.
3636     */
3637    union LDKCResult_NoneNoneZPtr contents;
3638    /**
3639     * Whether this CResult_NoneNoneZ represents a success state.
3640     */
3641    bool result_ok;
3642 } LDKCResult_NoneNoneZ;
3643
3644 /**
3645  * A tuple of 2 elements. See the individual fields for the types contained.
3646  */
3647 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3648    /**
3649     * The element at position 0
3650     */
3651    struct LDKSignature a;
3652    /**
3653     * The element at position 1
3654     */
3655    struct LDKCVec_SignatureZ b;
3656 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3657
3658 /**
3659  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3660  */
3661 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3662    /**
3663     * A pointer to the contents in the success state.
3664     * Reading from this pointer when `result_ok` is not set is undefined.
3665     */
3666    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3667    /**
3668     * Note that this value is always NULL, as there are no contents in the Err variant
3669     */
3670    void *err;
3671 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3672
3673 /**
3674  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3675  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3676  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3677  */
3678 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3679    /**
3680     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3681     * `err` or `result` depending on the state of `result_ok`.
3682     */
3683    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3684    /**
3685     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3686     */
3687    bool result_ok;
3688 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3689
3690 /**
3691  * The contents of CResult_SignatureNoneZ
3692  */
3693 typedef union LDKCResult_SignatureNoneZPtr {
3694    /**
3695     * A pointer to the contents in the success state.
3696     * Reading from this pointer when `result_ok` is not set is undefined.
3697     */
3698    struct LDKSignature *result;
3699    /**
3700     * Note that this value is always NULL, as there are no contents in the Err variant
3701     */
3702    void *err;
3703 } LDKCResult_SignatureNoneZPtr;
3704
3705 /**
3706  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3707  * containing a crate::c_types::Signature on success and a () on failure.
3708  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3709  */
3710 typedef struct LDKCResult_SignatureNoneZ {
3711    /**
3712     * The contents of this CResult_SignatureNoneZ, accessible via either
3713     * `err` or `result` depending on the state of `result_ok`.
3714     */
3715    union LDKCResult_SignatureNoneZPtr contents;
3716    /**
3717     * Whether this CResult_SignatureNoneZ represents a success state.
3718     */
3719    bool result_ok;
3720 } LDKCResult_SignatureNoneZ;
3721
3722
3723
3724 /**
3725  * This class tracks the per-transaction information needed to build a closing transaction and will
3726  * actually build it and sign.
3727  *
3728  * This class can be used inside a signer implementation to generate a signature given the relevant
3729  * secret key.
3730  */
3731 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
3732    /**
3733     * A pointer to the opaque Rust object.
3734     * Nearly everywhere, inner must be non-null, however in places where
3735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3736     */
3737    LDKnativeClosingTransaction *inner;
3738    /**
3739     * Indicates that this is the only struct which contains the same pointer.
3740     * Rust functions which take ownership of an object provided via an argument require
3741     * this to be true and invalidate the object pointed to by inner.
3742     */
3743    bool is_owned;
3744 } LDKClosingTransaction;
3745
3746
3747
3748 /**
3749  * The unsigned part of a channel_announcement
3750  */
3751 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3752    /**
3753     * A pointer to the opaque Rust object.
3754     * Nearly everywhere, inner must be non-null, however in places where
3755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3756     */
3757    LDKnativeUnsignedChannelAnnouncement *inner;
3758    /**
3759     * Indicates that this is the only struct which contains the same pointer.
3760     * Rust functions which take ownership of an object provided via an argument require
3761     * this to be true and invalidate the object pointed to by inner.
3762     */
3763    bool is_owned;
3764 } LDKUnsignedChannelAnnouncement;
3765
3766 /**
3767  * A trait to sign lightning channel transactions as described in BOLT 3.
3768  *
3769  * Signing services could be implemented on a hardware wallet. In this case,
3770  * the current Sign would be a front-end on top of a communication
3771  * channel connected to your secure device and lightning key material wouldn't
3772  * reside on a hot server. Nevertheless, a this deployment would still need
3773  * to trust the ChannelManager to avoid loss of funds as this latest component
3774  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3775  *
3776  * A more secure iteration would be to use hashlock (or payment points) to pair
3777  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3778  * at the price of more state and computation on the hardware wallet side. In the future,
3779  * we are looking forward to design such interface.
3780  *
3781  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3782  * to act, as liveness and breach reply correctness are always going to be hard requirements
3783  * of LN security model, orthogonal of key management issues.
3784  */
3785 typedef struct LDKBaseSign {
3786    /**
3787     * An opaque pointer which is passed to your function implementations as an argument.
3788     * This has no meaning in the LDK, and can be NULL or any other value.
3789     */
3790    void *this_arg;
3791    /**
3792     * Gets the per-commitment point for a specific commitment number
3793     *
3794     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3795     */
3796    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3797    /**
3798     * Gets the commitment secret for a specific commitment number as part of the revocation process
3799     *
3800     * An external signer implementation should error here if the commitment was already signed
3801     * and should refuse to sign it in the future.
3802     *
3803     * May be called more than once for the same index.
3804     *
3805     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3806     */
3807    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3808    /**
3809     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
3810     *
3811     * This is required in order for the signer to make sure that releasing a commitment
3812     * secret won't leave us without a broadcastable holder transaction.
3813     * Policy checks should be implemented in this function, including checking the amount
3814     * sent to us and checking the HTLCs.
3815     */
3816    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
3817    /**
3818     * Gets the holder's channel public keys and basepoints
3819     */
3820    struct LDKChannelPublicKeys pubkeys;
3821    /**
3822     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3823     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3824     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3825     */
3826    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3827    /**
3828     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3829     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3830     * Sign object uniquely and lookup or re-derive its keys.
3831     */
3832    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3833    /**
3834     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3835     *
3836     * Note that if signing fails or is rejected, the channel will be force-closed.
3837     *
3838     * Policy checks should be implemented in this function, including checking the amount
3839     * sent to us and checking the HTLCs.
3840     */
3841    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3842    /**
3843     * Validate the counterparty's revocation.
3844     *
3845     * This is required in order for the signer to make sure that the state has moved
3846     * forward and it is safe to sign the next counterparty commitment.
3847     */
3848    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
3849    /**
3850     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3851     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3852     * latest commitment_tx when we initiate a force-close.
3853     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3854     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3855     * the latest.
3856     * This may be called multiple times for the same transaction.
3857     *
3858     * An external signer implementation should check that the commitment has not been revoked.
3859     *
3860     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3861     */
3862    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3863    /**
3864     * Create a signature for the given input in a transaction spending an HTLC transaction output
3865     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3866     *
3867     * A justice transaction may claim multiple outputs at the same time if timelocks are
3868     * similar, but only a signature for the input at index `input` should be signed for here.
3869     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3870     * to an upcoming timelock expiration.
3871     *
3872     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3873     *
3874     * per_commitment_key is revocation secret which was provided by our counterparty when they
3875     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3876     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3877     * so).
3878     */
3879    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
3880    /**
3881     * Create a signature for the given input in a transaction spending a commitment transaction
3882     * HTLC output when our counterparty broadcasts an old state.
3883     *
3884     * A justice transaction may claim multiple outputs at the same time if timelocks are
3885     * similar, but only a signature for the input at index `input` should be signed for here.
3886     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3887     * to an upcoming timelock expiration.
3888     *
3889     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3890     *
3891     * per_commitment_key is revocation secret which was provided by our counterparty when they
3892     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3893     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3894     * so).
3895     *
3896     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3897     * (which is committed to in the BIP 143 signatures).
3898     */
3899    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
3900    /**
3901     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3902     * transaction, either offered or received.
3903     *
3904     * Such a transaction may claim multiples offered outputs at same time if we know the
3905     * preimage for each when we create it, but only the input at index `input` should be
3906     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3907     * needed with regards to an upcoming timelock expiration.
3908     *
3909     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3910     * outputs.
3911     *
3912     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3913     *
3914     * Per_commitment_point is the dynamic point corresponding to the channel state
3915     * detected onchain. It has been generated by our counterparty and is used to derive
3916     * channel state keys, which are then included in the witness script and committed to in the
3917     * BIP 143 signature.
3918     */
3919    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);
3920    /**
3921     * Create a signature for a (proposed) closing transaction.
3922     *
3923     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3924     * chosen to forgo their output as dust.
3925     */
3926    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
3927    /**
3928     * Signs a channel announcement message with our funding key, proving it comes from one
3929     * of the channel participants.
3930     *
3931     * Note that if this fails or is rejected, the channel will not be publicly announced and
3932     * our counterparty may (though likely will not) close the channel on us for violating the
3933     * protocol.
3934     */
3935    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3936    /**
3937     * Set the counterparty static channel data, including basepoints,
3938     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3939     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3940     * they MUST NOT be allowed to change to different values once set.
3941     *
3942     * channel_parameters.is_populated() MUST be true.
3943     *
3944     * We bind holder_selected_contest_delay late here for API convenience.
3945     *
3946     * Will be called before any signatures are applied.
3947     */
3948    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3949    /**
3950     * Frees any resources associated with this object given its this_arg pointer.
3951     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3952     */
3953    void (*free)(void *this_arg);
3954 } LDKBaseSign;
3955
3956 /**
3957  * A cloneable signer.
3958  *
3959  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3960  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3961  * which implies Sized, into this derived trait.
3962  */
3963 typedef struct LDKSign {
3964    /**
3965     * An opaque pointer which is passed to your function implementations as an argument.
3966     * This has no meaning in the LDK, and can be NULL or any other value.
3967     */
3968    void *this_arg;
3969    /**
3970     * Implementation of BaseSign for this object.
3971     */
3972    struct LDKBaseSign BaseSign;
3973    /**
3974     * Serialize the object into a byte array
3975     */
3976    struct LDKCVec_u8Z (*write)(const void *this_arg);
3977    /**
3978     * Called, if set, after this Sign has been cloned into a duplicate object.
3979     * The new Sign is provided, and should be mutated as needed to perform a
3980     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3981     */
3982    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
3983    /**
3984     * Frees any resources associated with this object given its this_arg pointer.
3985     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3986     */
3987    void (*free)(void *this_arg);
3988 } LDKSign;
3989
3990 /**
3991  * The contents of CResult_SignDecodeErrorZ
3992  */
3993 typedef union LDKCResult_SignDecodeErrorZPtr {
3994    /**
3995     * A pointer to the contents in the success state.
3996     * Reading from this pointer when `result_ok` is not set is undefined.
3997     */
3998    struct LDKSign *result;
3999    /**
4000     * A pointer to the contents in the error state.
4001     * Reading from this pointer when `result_ok` is set is undefined.
4002     */
4003    struct LDKDecodeError *err;
4004 } LDKCResult_SignDecodeErrorZPtr;
4005
4006 /**
4007  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4008  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4010  */
4011 typedef struct LDKCResult_SignDecodeErrorZ {
4012    /**
4013     * The contents of this CResult_SignDecodeErrorZ, accessible via either
4014     * `err` or `result` depending on the state of `result_ok`.
4015     */
4016    union LDKCResult_SignDecodeErrorZPtr contents;
4017    /**
4018     * Whether this CResult_SignDecodeErrorZ represents a success state.
4019     */
4020    bool result_ok;
4021 } LDKCResult_SignDecodeErrorZ;
4022
4023 /**
4024  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
4025  * allows recovering the exact public key which created the signature given the message.
4026  */
4027 typedef struct LDKRecoverableSignature {
4028    /**
4029     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
4030     * recovery.
4031     */
4032    uint8_t serialized_form[68];
4033 } LDKRecoverableSignature;
4034
4035 /**
4036  * The contents of CResult_RecoverableSignatureNoneZ
4037  */
4038 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
4039    /**
4040     * A pointer to the contents in the success state.
4041     * Reading from this pointer when `result_ok` is not set is undefined.
4042     */
4043    struct LDKRecoverableSignature *result;
4044    /**
4045     * Note that this value is always NULL, as there are no contents in the Err variant
4046     */
4047    void *err;
4048 } LDKCResult_RecoverableSignatureNoneZPtr;
4049
4050 /**
4051  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4052  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
4053  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4054  */
4055 typedef struct LDKCResult_RecoverableSignatureNoneZ {
4056    /**
4057     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4058     * `err` or `result` depending on the state of `result_ok`.
4059     */
4060    union LDKCResult_RecoverableSignatureNoneZPtr contents;
4061    /**
4062     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4063     */
4064    bool result_ok;
4065 } LDKCResult_RecoverableSignatureNoneZ;
4066
4067 /**
4068  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4069  * This corresponds to std::vector in C++
4070  */
4071 typedef struct LDKCVec_CVec_u8ZZ {
4072    /**
4073     * The elements in the array.
4074     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4075     */
4076    struct LDKCVec_u8Z *data;
4077    /**
4078     * The number of elements pointed to by `data`.
4079     */
4080    uintptr_t datalen;
4081 } LDKCVec_CVec_u8ZZ;
4082
4083 /**
4084  * The contents of CResult_CVec_CVec_u8ZZNoneZ
4085  */
4086 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
4087    /**
4088     * A pointer to the contents in the success state.
4089     * Reading from this pointer when `result_ok` is not set is undefined.
4090     */
4091    struct LDKCVec_CVec_u8ZZ *result;
4092    /**
4093     * Note that this value is always NULL, as there are no contents in the Err variant
4094     */
4095    void *err;
4096 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
4097
4098 /**
4099  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4100  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4102  */
4103 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
4104    /**
4105     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4106     * `err` or `result` depending on the state of `result_ok`.
4107     */
4108    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
4109    /**
4110     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4111     */
4112    bool result_ok;
4113 } LDKCResult_CVec_CVec_u8ZZNoneZ;
4114
4115
4116
4117 /**
4118  * A simple implementation of Sign that just keeps the private keys in memory.
4119  *
4120  * This implementation performs no policy checks and is insufficient by itself as
4121  * a secure external signer.
4122  */
4123 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
4124    /**
4125     * A pointer to the opaque Rust object.
4126     * Nearly everywhere, inner must be non-null, however in places where
4127     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4128     */
4129    LDKnativeInMemorySigner *inner;
4130    /**
4131     * Indicates that this is the only struct which contains the same pointer.
4132     * Rust functions which take ownership of an object provided via an argument require
4133     * this to be true and invalidate the object pointed to by inner.
4134     */
4135    bool is_owned;
4136 } LDKInMemorySigner;
4137
4138 /**
4139  * The contents of CResult_InMemorySignerDecodeErrorZ
4140  */
4141 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
4142    /**
4143     * A pointer to the contents in the success state.
4144     * Reading from this pointer when `result_ok` is not set is undefined.
4145     */
4146    struct LDKInMemorySigner *result;
4147    /**
4148     * A pointer to the contents in the error state.
4149     * Reading from this pointer when `result_ok` is set is undefined.
4150     */
4151    struct LDKDecodeError *err;
4152 } LDKCResult_InMemorySignerDecodeErrorZPtr;
4153
4154 /**
4155  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4156  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4157  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4158  */
4159 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
4160    /**
4161     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4162     * `err` or `result` depending on the state of `result_ok`.
4163     */
4164    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
4165    /**
4166     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4167     */
4168    bool result_ok;
4169 } LDKCResult_InMemorySignerDecodeErrorZ;
4170
4171 /**
4172  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4173  * This corresponds to std::vector in C++
4174  */
4175 typedef struct LDKCVec_TxOutZ {
4176    /**
4177     * The elements in the array.
4178     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4179     */
4180    struct LDKTxOut *data;
4181    /**
4182     * The number of elements pointed to by `data`.
4183     */
4184    uintptr_t datalen;
4185 } LDKCVec_TxOutZ;
4186
4187 /**
4188  * The contents of CResult_TransactionNoneZ
4189  */
4190 typedef union LDKCResult_TransactionNoneZPtr {
4191    /**
4192     * A pointer to the contents in the success state.
4193     * Reading from this pointer when `result_ok` is not set is undefined.
4194     */
4195    struct LDKTransaction *result;
4196    /**
4197     * Note that this value is always NULL, as there are no contents in the Err variant
4198     */
4199    void *err;
4200 } LDKCResult_TransactionNoneZPtr;
4201
4202 /**
4203  * A CResult_TransactionNoneZ represents the result of a fallible operation,
4204  * containing a crate::c_types::Transaction on success and a () on failure.
4205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4206  */
4207 typedef struct LDKCResult_TransactionNoneZ {
4208    /**
4209     * The contents of this CResult_TransactionNoneZ, accessible via either
4210     * `err` or `result` depending on the state of `result_ok`.
4211     */
4212    union LDKCResult_TransactionNoneZPtr contents;
4213    /**
4214     * Whether this CResult_TransactionNoneZ represents a success state.
4215     */
4216    bool result_ok;
4217 } LDKCResult_TransactionNoneZ;
4218
4219
4220
4221 /**
4222  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
4223  * on-chain transactions to ensure no loss of funds occurs.
4224  *
4225  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
4226  * information and are actively monitoring the chain.
4227  *
4228  * Pending Events or updated HTLCs which have not yet been read out by
4229  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
4230  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
4231  * gotten are fully handled before re-serializing the new state.
4232  *
4233  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
4234  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4235  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
4236  * returned block hash and the the current chain and then reconnecting blocks to get to the
4237  * best chain) upon deserializing the object!
4238  */
4239 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
4240    /**
4241     * A pointer to the opaque Rust object.
4242     * Nearly everywhere, inner must be non-null, however in places where
4243     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4244     */
4245    LDKnativeChannelMonitor *inner;
4246    /**
4247     * Indicates that this is the only struct which contains the same pointer.
4248     * Rust functions which take ownership of an object provided via an argument require
4249     * this to be true and invalidate the object pointed to by inner.
4250     */
4251    bool is_owned;
4252 } LDKChannelMonitor;
4253
4254 /**
4255  * A tuple of 2 elements. See the individual fields for the types contained.
4256  */
4257 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
4258    /**
4259     * The element at position 0
4260     */
4261    struct LDKThirtyTwoBytes a;
4262    /**
4263     * The element at position 1
4264     */
4265    struct LDKChannelMonitor b;
4266 } LDKC2Tuple_BlockHashChannelMonitorZ;
4267
4268 /**
4269  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4270  * This corresponds to std::vector in C++
4271  */
4272 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
4273    /**
4274     * The elements in the array.
4275     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4276     */
4277    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
4278    /**
4279     * The number of elements pointed to by `data`.
4280     */
4281    uintptr_t datalen;
4282 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
4283
4284 /**
4285  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4286  */
4287 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4288    /**
4289     * A pointer to the contents in the success state.
4290     * Reading from this pointer when `result_ok` is not set is undefined.
4291     */
4292    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
4293    /**
4294     * A pointer to the contents in the error state.
4295     * Reading from this pointer when `result_ok` is set is undefined.
4296     */
4297    enum LDKIOError *err;
4298 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
4299
4300 /**
4301  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4302  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4303  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4304  */
4305 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4306    /**
4307     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4308     * `err` or `result` depending on the state of `result_ok`.
4309     */
4310    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
4311    /**
4312     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4313     */
4314    bool result_ok;
4315 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
4316
4317 /**
4318  * An enum which can either contain a u16 or not
4319  */
4320 typedef enum LDKCOption_u16Z_Tag {
4321    /**
4322     * When we're in this state, this COption_u16Z contains a u16
4323     */
4324    LDKCOption_u16Z_Some,
4325    /**
4326     * When we're in this state, this COption_u16Z contains nothing
4327     */
4328    LDKCOption_u16Z_None,
4329    /**
4330     * Must be last for serialization purposes
4331     */
4332    LDKCOption_u16Z_Sentinel,
4333 } LDKCOption_u16Z_Tag;
4334
4335 typedef struct LDKCOption_u16Z {
4336    LDKCOption_u16Z_Tag tag;
4337    union {
4338       struct {
4339          uint16_t some;
4340       };
4341    };
4342 } LDKCOption_u16Z;
4343
4344 /**
4345  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
4346  * too-high values)
4347  */
4348 typedef enum LDKAPIError_Tag {
4349    /**
4350     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
4351     * are documented, but generally indicates some precondition of a function was violated.
4352     */
4353    LDKAPIError_APIMisuseError,
4354    /**
4355     * Due to a high feerate, we were unable to complete the request.
4356     * For example, this may be returned if the feerate implies we cannot open a channel at the
4357     * requested value, but opening a larger channel would succeed.
4358     */
4359    LDKAPIError_FeeRateTooHigh,
4360    /**
4361     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
4362     * too-many-hops, etc).
4363     */
4364    LDKAPIError_RouteError,
4365    /**
4366     * We were unable to complete the request as the Channel required to do so is unable to
4367     * complete the request (or was not found). This can take many forms, including disconnected
4368     * peer, channel at capacity, channel shutting down, etc.
4369     */
4370    LDKAPIError_ChannelUnavailable,
4371    /**
4372     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4373     * attempted action to fail.
4374     */
4375    LDKAPIError_MonitorUpdateFailed,
4376    /**
4377     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
4378     * with the channel counterparty as negotiated in [`InitFeatures`].
4379     *
4380     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
4381     * a channel or cooperatively close one with this peer (and will have to force-close instead).
4382     *
4383     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
4384     * [`InitFeatures`]: crate::ln::features::InitFeatures
4385     */
4386    LDKAPIError_IncompatibleShutdownScript,
4387    /**
4388     * Must be last for serialization purposes
4389     */
4390    LDKAPIError_Sentinel,
4391 } LDKAPIError_Tag;
4392
4393 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4394    /**
4395     * A human-readable error message
4396     */
4397    struct LDKStr err;
4398 } LDKAPIError_LDKAPIMisuseError_Body;
4399
4400 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4401    /**
4402     * A human-readable error message
4403     */
4404    struct LDKStr err;
4405    /**
4406     * The feerate which was too high.
4407     */
4408    uint32_t feerate;
4409 } LDKAPIError_LDKFeeRateTooHigh_Body;
4410
4411 typedef struct LDKAPIError_LDKRouteError_Body {
4412    /**
4413     * A human-readable error message
4414     */
4415    struct LDKStr err;
4416 } LDKAPIError_LDKRouteError_Body;
4417
4418 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4419    /**
4420     * A human-readable error message
4421     */
4422    struct LDKStr err;
4423 } LDKAPIError_LDKChannelUnavailable_Body;
4424
4425 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
4426    /**
4427     * The incompatible shutdown script.
4428     */
4429    struct LDKShutdownScript script;
4430 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
4431
4432 typedef struct MUST_USE_STRUCT LDKAPIError {
4433    LDKAPIError_Tag tag;
4434    union {
4435       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
4436       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
4437       LDKAPIError_LDKRouteError_Body route_error;
4438       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
4439       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
4440    };
4441 } LDKAPIError;
4442
4443 /**
4444  * The contents of CResult_NoneAPIErrorZ
4445  */
4446 typedef union LDKCResult_NoneAPIErrorZPtr {
4447    /**
4448     * Note that this value is always NULL, as there are no contents in the OK variant
4449     */
4450    void *result;
4451    /**
4452     * A pointer to the contents in the error state.
4453     * Reading from this pointer when `result_ok` is set is undefined.
4454     */
4455    struct LDKAPIError *err;
4456 } LDKCResult_NoneAPIErrorZPtr;
4457
4458 /**
4459  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4460  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
4461  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4462  */
4463 typedef struct LDKCResult_NoneAPIErrorZ {
4464    /**
4465     * The contents of this CResult_NoneAPIErrorZ, accessible via either
4466     * `err` or `result` depending on the state of `result_ok`.
4467     */
4468    union LDKCResult_NoneAPIErrorZPtr contents;
4469    /**
4470     * Whether this CResult_NoneAPIErrorZ represents a success state.
4471     */
4472    bool result_ok;
4473 } LDKCResult_NoneAPIErrorZ;
4474
4475 /**
4476  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4477  * This corresponds to std::vector in C++
4478  */
4479 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
4480    /**
4481     * The elements in the array.
4482     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4483     */
4484    struct LDKCResult_NoneAPIErrorZ *data;
4485    /**
4486     * The number of elements pointed to by `data`.
4487     */
4488    uintptr_t datalen;
4489 } LDKCVec_CResult_NoneAPIErrorZZ;
4490
4491 /**
4492  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4493  * This corresponds to std::vector in C++
4494  */
4495 typedef struct LDKCVec_APIErrorZ {
4496    /**
4497     * The elements in the array.
4498     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4499     */
4500    struct LDKAPIError *data;
4501    /**
4502     * The number of elements pointed to by `data`.
4503     */
4504    uintptr_t datalen;
4505 } LDKCVec_APIErrorZ;
4506
4507 /**
4508  * The contents of CResult__u832APIErrorZ
4509  */
4510 typedef union LDKCResult__u832APIErrorZPtr {
4511    /**
4512     * A pointer to the contents in the success state.
4513     * Reading from this pointer when `result_ok` is not set is undefined.
4514     */
4515    struct LDKThirtyTwoBytes *result;
4516    /**
4517     * A pointer to the contents in the error state.
4518     * Reading from this pointer when `result_ok` is set is undefined.
4519     */
4520    struct LDKAPIError *err;
4521 } LDKCResult__u832APIErrorZPtr;
4522
4523 /**
4524  * A CResult__u832APIErrorZ represents the result of a fallible operation,
4525  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4526  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4527  */
4528 typedef struct LDKCResult__u832APIErrorZ {
4529    /**
4530     * The contents of this CResult__u832APIErrorZ, accessible via either
4531     * `err` or `result` depending on the state of `result_ok`.
4532     */
4533    union LDKCResult__u832APIErrorZPtr contents;
4534    /**
4535     * Whether this CResult__u832APIErrorZ represents a success state.
4536     */
4537    bool result_ok;
4538 } LDKCResult__u832APIErrorZ;
4539
4540 /**
4541  * If a payment fails to send, it can be in one of several states. This enum is returned as the
4542  * Err() type describing which state the payment is in, see the description of individual enum
4543  * states for more.
4544  */
4545 typedef enum LDKPaymentSendFailure_Tag {
4546    /**
4547     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
4548     * send the payment at all. No channel state has been changed or messages sent to peers, and
4549     * once you've changed the parameter at error, you can freely retry the payment in full.
4550     */
4551    LDKPaymentSendFailure_ParameterError,
4552    /**
4553     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4554     * from attempting to send the payment at all. No channel state has been changed or messages
4555     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4556     * payment in full.
4557     *
4558     * The results here are ordered the same as the paths in the route object which was passed to
4559     * send_payment.
4560     */
4561    LDKPaymentSendFailure_PathParameterError,
4562    /**
4563     * All paths which were attempted failed to send, with no channel state change taking place.
4564     * You can freely retry the payment in full (though you probably want to do so over different
4565     * paths than the ones selected).
4566     */
4567    LDKPaymentSendFailure_AllFailedRetrySafe,
4568    /**
4569     * Some paths which were attempted failed to send, though possibly not all. At least some
4570     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4571     * in over-/re-payment.
4572     *
4573     * The results here are ordered the same as the paths in the route object which was passed to
4574     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4575     * retried (though there is currently no API with which to do so).
4576     *
4577     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4578     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4579     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4580     * with the latest update_id.
4581     */
4582    LDKPaymentSendFailure_PartialFailure,
4583    /**
4584     * Must be last for serialization purposes
4585     */
4586    LDKPaymentSendFailure_Sentinel,
4587 } LDKPaymentSendFailure_Tag;
4588
4589 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
4590    /**
4591     * The errors themselves, in the same order as the route hops.
4592     */
4593    struct LDKCVec_CResult_NoneAPIErrorZZ results;
4594    /**
4595     * If some paths failed without irrevocably committing to the new HTLC(s), this will
4596     * contain a [`RouteParameters`] object which can be used to calculate a new route that
4597     * will pay all remaining unpaid balance.
4598     *
4599     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4600     */
4601    struct LDKRouteParameters failed_paths_retry;
4602    /**
4603     * The payment id for the payment, which is now at least partially pending.
4604     */
4605    struct LDKThirtyTwoBytes payment_id;
4606 } LDKPaymentSendFailure_LDKPartialFailure_Body;
4607
4608 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4609    LDKPaymentSendFailure_Tag tag;
4610    union {
4611       struct {
4612          struct LDKAPIError parameter_error;
4613       };
4614       struct {
4615          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4616       };
4617       struct {
4618          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4619       };
4620       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
4621    };
4622 } LDKPaymentSendFailure;
4623
4624 /**
4625  * The contents of CResult_PaymentIdPaymentSendFailureZ
4626  */
4627 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
4628    /**
4629     * A pointer to the contents in the success state.
4630     * Reading from this pointer when `result_ok` is not set is undefined.
4631     */
4632    struct LDKThirtyTwoBytes *result;
4633    /**
4634     * A pointer to the contents in the error state.
4635     * Reading from this pointer when `result_ok` is set is undefined.
4636     */
4637    struct LDKPaymentSendFailure *err;
4638 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
4639
4640 /**
4641  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4642  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4643  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4644  */
4645 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
4646    /**
4647     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4648     * `err` or `result` depending on the state of `result_ok`.
4649     */
4650    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
4651    /**
4652     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4653     */
4654    bool result_ok;
4655 } LDKCResult_PaymentIdPaymentSendFailureZ;
4656
4657 /**
4658  * The contents of CResult_NonePaymentSendFailureZ
4659  */
4660 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4661    /**
4662     * Note that this value is always NULL, as there are no contents in the OK variant
4663     */
4664    void *result;
4665    /**
4666     * A pointer to the contents in the error state.
4667     * Reading from this pointer when `result_ok` is set is undefined.
4668     */
4669    struct LDKPaymentSendFailure *err;
4670 } LDKCResult_NonePaymentSendFailureZPtr;
4671
4672 /**
4673  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4674  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4675  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4676  */
4677 typedef struct LDKCResult_NonePaymentSendFailureZ {
4678    /**
4679     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4680     * `err` or `result` depending on the state of `result_ok`.
4681     */
4682    union LDKCResult_NonePaymentSendFailureZPtr contents;
4683    /**
4684     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4685     */
4686    bool result_ok;
4687 } LDKCResult_NonePaymentSendFailureZ;
4688
4689 /**
4690  * A tuple of 2 elements. See the individual fields for the types contained.
4691  */
4692 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
4693    /**
4694     * The element at position 0
4695     */
4696    struct LDKThirtyTwoBytes a;
4697    /**
4698     * The element at position 1
4699     */
4700    struct LDKThirtyTwoBytes b;
4701 } LDKC2Tuple_PaymentHashPaymentIdZ;
4702
4703 /**
4704  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
4705  */
4706 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4707    /**
4708     * A pointer to the contents in the success state.
4709     * Reading from this pointer when `result_ok` is not set is undefined.
4710     */
4711    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
4712    /**
4713     * A pointer to the contents in the error state.
4714     * Reading from this pointer when `result_ok` is set is undefined.
4715     */
4716    struct LDKPaymentSendFailure *err;
4717 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
4718
4719 /**
4720  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
4721  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4723  */
4724 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4725    /**
4726     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
4727     * `err` or `result` depending on the state of `result_ok`.
4728     */
4729    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
4730    /**
4731     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
4732     */
4733    bool result_ok;
4734 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
4735
4736 /**
4737  * A 4-byte byte array.
4738  */
4739 typedef struct LDKFourBytes {
4740    /**
4741     * The four bytes
4742     */
4743    uint8_t data[4];
4744 } LDKFourBytes;
4745
4746 /**
4747  * A 16-byte byte array.
4748  */
4749 typedef struct LDKSixteenBytes {
4750    /**
4751     * The sixteen bytes
4752     */
4753    uint8_t data[16];
4754 } LDKSixteenBytes;
4755
4756 /**
4757  * A 10-byte byte array.
4758  */
4759 typedef struct LDKTenBytes {
4760    /**
4761     * The ten bytes
4762     */
4763    uint8_t data[10];
4764 } LDKTenBytes;
4765
4766 /**
4767  * An address which can be used to connect to a remote peer
4768  */
4769 typedef enum LDKNetAddress_Tag {
4770    /**
4771     * An IPv4 address/port on which the peer is listening.
4772     */
4773    LDKNetAddress_IPv4,
4774    /**
4775     * An IPv6 address/port on which the peer is listening.
4776     */
4777    LDKNetAddress_IPv6,
4778    /**
4779     * An old-style Tor onion address/port on which the peer is listening.
4780     */
4781    LDKNetAddress_OnionV2,
4782    /**
4783     * A new-style Tor onion address/port on which the peer is listening.
4784     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4785     * wrap as base32 and append \".onion\".
4786     */
4787    LDKNetAddress_OnionV3,
4788    /**
4789     * Must be last for serialization purposes
4790     */
4791    LDKNetAddress_Sentinel,
4792 } LDKNetAddress_Tag;
4793
4794 typedef struct LDKNetAddress_LDKIPv4_Body {
4795    /**
4796     * The 4-byte IPv4 address
4797     */
4798    struct LDKFourBytes addr;
4799    /**
4800     * The port on which the node is listening
4801     */
4802    uint16_t port;
4803 } LDKNetAddress_LDKIPv4_Body;
4804
4805 typedef struct LDKNetAddress_LDKIPv6_Body {
4806    /**
4807     * The 16-byte IPv6 address
4808     */
4809    struct LDKSixteenBytes addr;
4810    /**
4811     * The port on which the node is listening
4812     */
4813    uint16_t port;
4814 } LDKNetAddress_LDKIPv6_Body;
4815
4816 typedef struct LDKNetAddress_LDKOnionV2_Body {
4817    /**
4818     * The bytes (usually encoded in base32 with \".onion\" appended)
4819     */
4820    struct LDKTenBytes addr;
4821    /**
4822     * The port on which the node is listening
4823     */
4824    uint16_t port;
4825 } LDKNetAddress_LDKOnionV2_Body;
4826
4827 typedef struct LDKNetAddress_LDKOnionV3_Body {
4828    /**
4829     * The ed25519 long-term public key of the peer
4830     */
4831    struct LDKThirtyTwoBytes ed25519_pubkey;
4832    /**
4833     * The checksum of the pubkey and version, as included in the onion address
4834     */
4835    uint16_t checksum;
4836    /**
4837     * The version byte, as defined by the Tor Onion v3 spec.
4838     */
4839    uint8_t version;
4840    /**
4841     * The port on which the node is listening
4842     */
4843    uint16_t port;
4844 } LDKNetAddress_LDKOnionV3_Body;
4845
4846 typedef struct MUST_USE_STRUCT LDKNetAddress {
4847    LDKNetAddress_Tag tag;
4848    union {
4849       LDKNetAddress_LDKIPv4_Body i_pv4;
4850       LDKNetAddress_LDKIPv6_Body i_pv6;
4851       LDKNetAddress_LDKOnionV2_Body onion_v2;
4852       LDKNetAddress_LDKOnionV3_Body onion_v3;
4853    };
4854 } LDKNetAddress;
4855
4856 /**
4857  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4858  * This corresponds to std::vector in C++
4859  */
4860 typedef struct LDKCVec_NetAddressZ {
4861    /**
4862     * The elements in the array.
4863     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4864     */
4865    struct LDKNetAddress *data;
4866    /**
4867     * The number of elements pointed to by `data`.
4868     */
4869    uintptr_t datalen;
4870 } LDKCVec_NetAddressZ;
4871
4872 /**
4873  * A tuple of 2 elements. See the individual fields for the types contained.
4874  */
4875 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4876    /**
4877     * The element at position 0
4878     */
4879    struct LDKThirtyTwoBytes a;
4880    /**
4881     * The element at position 1
4882     */
4883    struct LDKThirtyTwoBytes b;
4884 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4885
4886 /**
4887  * The contents of CResult_PaymentSecretAPIErrorZ
4888  */
4889 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4890    /**
4891     * A pointer to the contents in the success state.
4892     * Reading from this pointer when `result_ok` is not set is undefined.
4893     */
4894    struct LDKThirtyTwoBytes *result;
4895    /**
4896     * A pointer to the contents in the error state.
4897     * Reading from this pointer when `result_ok` is set is undefined.
4898     */
4899    struct LDKAPIError *err;
4900 } LDKCResult_PaymentSecretAPIErrorZPtr;
4901
4902 /**
4903  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4904  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4906  */
4907 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4908    /**
4909     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4910     * `err` or `result` depending on the state of `result_ok`.
4911     */
4912    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4913    /**
4914     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4915     */
4916    bool result_ok;
4917 } LDKCResult_PaymentSecretAPIErrorZ;
4918
4919 /**
4920  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4921  * This corresponds to std::vector in C++
4922  */
4923 typedef struct LDKCVec_ChannelMonitorZ {
4924    /**
4925     * The elements in the array.
4926     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4927     */
4928    struct LDKChannelMonitor *data;
4929    /**
4930     * The number of elements pointed to by `data`.
4931     */
4932    uintptr_t datalen;
4933 } LDKCVec_ChannelMonitorZ;
4934
4935
4936
4937 /**
4938  * An update generated by the underlying Channel itself which contains some new information the
4939  * ChannelMonitor should be made aware of.
4940  */
4941 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4942    /**
4943     * A pointer to the opaque Rust object.
4944     * Nearly everywhere, inner must be non-null, however in places where
4945     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4946     */
4947    LDKnativeChannelMonitorUpdate *inner;
4948    /**
4949     * Indicates that this is the only struct which contains the same pointer.
4950     * Rust functions which take ownership of an object provided via an argument require
4951     * this to be true and invalidate the object pointed to by inner.
4952     */
4953    bool is_owned;
4954 } LDKChannelMonitorUpdate;
4955
4956 /**
4957  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4958  * blocks are connected and disconnected.
4959  *
4960  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4961  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4962  * channel state changes and HTLCs are resolved. See method documentation for specific
4963  * requirements.
4964  *
4965  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4966  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4967  * without taking any further action such as persisting the current state.
4968  *
4969  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4970  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4971  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4972  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4973  * multiple instances.
4974  *
4975  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
4976  */
4977 typedef struct LDKWatch {
4978    /**
4979     * An opaque pointer which is passed to your function implementations as an argument.
4980     * This has no meaning in the LDK, and can be NULL or any other value.
4981     */
4982    void *this_arg;
4983    /**
4984     * Watches a channel identified by `funding_txo` using `monitor`.
4985     *
4986     * Implementations are responsible for watching the chain for the funding transaction along
4987     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4988     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4989     *
4990     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
4991     * the given `funding_txo` has previously been registered via `watch_channel`.
4992     *
4993     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4994     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4995     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4996     */
4997    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4998    /**
4999     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
5000     *
5001     * Implementations must call [`update_monitor`] with the given update. See
5002     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
5003     *
5004     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
5005     */
5006    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
5007    /**
5008     * Returns any monitor events since the last call. Subsequent calls must only return new
5009     * events.
5010     *
5011     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
5012     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
5013     * to disk.
5014     *
5015     * For details on asynchronous [`ChannelMonitor`] updating and returning
5016     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
5017     */
5018    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
5019    /**
5020     * Frees any resources associated with this object given its this_arg pointer.
5021     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5022     */
5023    void (*free)(void *this_arg);
5024 } LDKWatch;
5025
5026 /**
5027  * An interface to send a transaction to the Bitcoin network.
5028  */
5029 typedef struct LDKBroadcasterInterface {
5030    /**
5031     * An opaque pointer which is passed to your function implementations as an argument.
5032     * This has no meaning in the LDK, and can be NULL or any other value.
5033     */
5034    void *this_arg;
5035    /**
5036     * Sends a transaction out to (hopefully) be mined.
5037     */
5038    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
5039    /**
5040     * Frees any resources associated with this object given its this_arg pointer.
5041     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5042     */
5043    void (*free)(void *this_arg);
5044 } LDKBroadcasterInterface;
5045
5046 /**
5047  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
5048  * own the memory pointed to by data.
5049  */
5050 typedef struct LDKu8slice {
5051    /**
5052     * A pointer to the byte buffer
5053     */
5054    const uint8_t *data;
5055    /**
5056     * The number of bytes pointed to by `data`.
5057     */
5058    uintptr_t datalen;
5059 } LDKu8slice;
5060
5061 /**
5062  * A trait to describe an object which can get user secrets and key material.
5063  */
5064 typedef struct LDKKeysInterface {
5065    /**
5066     * An opaque pointer which is passed to your function implementations as an argument.
5067     * This has no meaning in the LDK, and can be NULL or any other value.
5068     */
5069    void *this_arg;
5070    /**
5071     * Get node secret key (aka node_id or network_key).
5072     *
5073     * This method must return the same value each time it is called.
5074     */
5075    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
5076    /**
5077     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
5078     *
5079     * This method should return a different value each time it is called, to avoid linking
5080     * on-chain funds across channels as controlled to the same user.
5081     */
5082    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
5083    /**
5084     * Get a script pubkey which we will send funds to when closing a channel.
5085     *
5086     * This method should return a different value each time it is called, to avoid linking
5087     * on-chain funds across channels as controlled to the same user.
5088     */
5089    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
5090    /**
5091     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
5092     * restarted with some stale data!
5093     *
5094     * This method must return a different value each time it is called.
5095     */
5096    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
5097    /**
5098     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
5099     * onion packets and for temporary channel IDs. There is no requirement that these be
5100     * persisted anywhere, though they must be unique across restarts.
5101     *
5102     * This method must return a different value each time it is called.
5103     */
5104    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
5105    /**
5106     * Reads a `Signer` for this `KeysInterface` from the given input stream.
5107     * This is only called during deserialization of other objects which contain
5108     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
5109     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
5110     * contain no versioning scheme. You may wish to include your own version prefix and ensure
5111     * you've read all of the provided bytes to ensure no corruption occurred.
5112     */
5113    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
5114    /**
5115     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
5116     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
5117     * this trait to parse the invoice and make sure they're signing what they expect, rather than
5118     * blindly signing the hash.
5119     */
5120    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
5121    /**
5122     * Frees any resources associated with this object given its this_arg pointer.
5123     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5124     */
5125    void (*free)(void *this_arg);
5126 } LDKKeysInterface;
5127
5128 /**
5129  * A trait which should be implemented to provide feerate information on a number of time
5130  * horizons.
5131  *
5132  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
5133  * called from inside the library in response to chain events, P2P events, or timer events).
5134  */
5135 typedef struct LDKFeeEstimator {
5136    /**
5137     * An opaque pointer which is passed to your function implementations as an argument.
5138     * This has no meaning in the LDK, and can be NULL or any other value.
5139     */
5140    void *this_arg;
5141    /**
5142     * Gets estimated satoshis of fee required per 1000 Weight-Units.
5143     *
5144     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
5145     * don't put us below 1 satoshi-per-byte).
5146     *
5147     * This translates to:
5148     *  * satoshis-per-byte * 250
5149     *  * ceil(satoshis-per-kbyte / 4)
5150     */
5151    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
5152    /**
5153     * Frees any resources associated with this object given its this_arg pointer.
5154     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5155     */
5156    void (*free)(void *this_arg);
5157 } LDKFeeEstimator;
5158
5159 /**
5160  * A trait encapsulating the operations required of a logger
5161  */
5162 typedef struct LDKLogger {
5163    /**
5164     * An opaque pointer which is passed to your function implementations as an argument.
5165     * This has no meaning in the LDK, and can be NULL or any other value.
5166     */
5167    void *this_arg;
5168    /**
5169     * Logs the `Record`
5170     */
5171    void (*log)(const void *this_arg, const char *record);
5172    /**
5173     * Frees any resources associated with this object given its this_arg pointer.
5174     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5175     */
5176    void (*free)(void *this_arg);
5177 } LDKLogger;
5178
5179
5180
5181 /**
5182  * Manager which keeps track of a number of channels and sends messages to the appropriate
5183  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
5184  *
5185  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
5186  * to individual Channels.
5187  *
5188  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
5189  * all peers during write/read (though does not modify this instance, only the instance being
5190  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
5191  * called funding_transaction_generated for outbound channels).
5192  *
5193  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
5194  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
5195  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
5196  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
5197  * the serialization process). If the deserialized version is out-of-date compared to the
5198  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
5199  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
5200  *
5201  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
5202  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5203  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
5204  * block_connected() to step towards your best block) upon deserialization before using the
5205  * object!
5206  *
5207  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
5208  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
5209  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
5210  * offline for a full minute. In order to track this, you must call
5211  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
5212  *
5213  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
5214  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
5215  * essentially you should default to using a SimpleRefChannelManager, and use a
5216  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
5217  * you're using lightning-net-tokio.
5218  */
5219 typedef struct MUST_USE_STRUCT LDKChannelManager {
5220    /**
5221     * A pointer to the opaque Rust object.
5222     * Nearly everywhere, inner must be non-null, however in places where
5223     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5224     */
5225    LDKnativeChannelManager *inner;
5226    /**
5227     * Indicates that this is the only struct which contains the same pointer.
5228     * Rust functions which take ownership of an object provided via an argument require
5229     * this to be true and invalidate the object pointed to by inner.
5230     */
5231    bool is_owned;
5232 } LDKChannelManager;
5233
5234 /**
5235  * A tuple of 2 elements. See the individual fields for the types contained.
5236  */
5237 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
5238    /**
5239     * The element at position 0
5240     */
5241    struct LDKThirtyTwoBytes a;
5242    /**
5243     * The element at position 1
5244     */
5245    struct LDKChannelManager b;
5246 } LDKC2Tuple_BlockHashChannelManagerZ;
5247
5248 /**
5249  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5250  */
5251 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5252    /**
5253     * A pointer to the contents in the success state.
5254     * Reading from this pointer when `result_ok` is not set is undefined.
5255     */
5256    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
5257    /**
5258     * A pointer to the contents in the error state.
5259     * Reading from this pointer when `result_ok` is set is undefined.
5260     */
5261    struct LDKDecodeError *err;
5262 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
5263
5264 /**
5265  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5266  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5267  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5268  */
5269 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5270    /**
5271     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5272     * `err` or `result` depending on the state of `result_ok`.
5273     */
5274    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
5275    /**
5276     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5277     */
5278    bool result_ok;
5279 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
5280
5281
5282
5283 /**
5284  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
5285  * with our counterparty.
5286  */
5287 typedef struct MUST_USE_STRUCT LDKChannelConfig {
5288    /**
5289     * A pointer to the opaque Rust object.
5290     * Nearly everywhere, inner must be non-null, however in places where
5291     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5292     */
5293    LDKnativeChannelConfig *inner;
5294    /**
5295     * Indicates that this is the only struct which contains the same pointer.
5296     * Rust functions which take ownership of an object provided via an argument require
5297     * this to be true and invalidate the object pointed to by inner.
5298     */
5299    bool is_owned;
5300 } LDKChannelConfig;
5301
5302 /**
5303  * The contents of CResult_ChannelConfigDecodeErrorZ
5304  */
5305 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
5306    /**
5307     * A pointer to the contents in the success state.
5308     * Reading from this pointer when `result_ok` is not set is undefined.
5309     */
5310    struct LDKChannelConfig *result;
5311    /**
5312     * A pointer to the contents in the error state.
5313     * Reading from this pointer when `result_ok` is set is undefined.
5314     */
5315    struct LDKDecodeError *err;
5316 } LDKCResult_ChannelConfigDecodeErrorZPtr;
5317
5318 /**
5319  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5320  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5321  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5322  */
5323 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
5324    /**
5325     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5326     * `err` or `result` depending on the state of `result_ok`.
5327     */
5328    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
5329    /**
5330     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5331     */
5332    bool result_ok;
5333 } LDKCResult_ChannelConfigDecodeErrorZ;
5334
5335 /**
5336  * The contents of CResult_OutPointDecodeErrorZ
5337  */
5338 typedef union LDKCResult_OutPointDecodeErrorZPtr {
5339    /**
5340     * A pointer to the contents in the success state.
5341     * Reading from this pointer when `result_ok` is not set is undefined.
5342     */
5343    struct LDKOutPoint *result;
5344    /**
5345     * A pointer to the contents in the error state.
5346     * Reading from this pointer when `result_ok` is set is undefined.
5347     */
5348    struct LDKDecodeError *err;
5349 } LDKCResult_OutPointDecodeErrorZPtr;
5350
5351 /**
5352  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5353  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5354  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5355  */
5356 typedef struct LDKCResult_OutPointDecodeErrorZ {
5357    /**
5358     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5359     * `err` or `result` depending on the state of `result_ok`.
5360     */
5361    union LDKCResult_OutPointDecodeErrorZPtr contents;
5362    /**
5363     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
5364     */
5365    bool result_ok;
5366 } LDKCResult_OutPointDecodeErrorZ;
5367
5368 /**
5369  * Defines a type identifier for sending messages over the wire.
5370  *
5371  * Messages implementing this trait specify a type and must be [`Writeable`].
5372  */
5373 typedef struct LDKType {
5374    /**
5375     * An opaque pointer which is passed to your function implementations as an argument.
5376     * This has no meaning in the LDK, and can be NULL or any other value.
5377     */
5378    void *this_arg;
5379    /**
5380     * Returns the type identifying the message payload.
5381     */
5382    uint16_t (*type_id)(const void *this_arg);
5383    /**
5384     * Return a human-readable "debug" string describing this object
5385     */
5386    struct LDKStr (*debug_str)(const void *this_arg);
5387    /**
5388     * Serialize the object into a byte array
5389     */
5390    struct LDKCVec_u8Z (*write)(const void *this_arg);
5391    /**
5392     * Frees any resources associated with this object given its this_arg pointer.
5393     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5394     */
5395    void (*free)(void *this_arg);
5396 } LDKType;
5397
5398 /**
5399  * An enum which can either contain a crate::lightning::ln::wire::Type or not
5400  */
5401 typedef enum LDKCOption_TypeZ_Tag {
5402    /**
5403     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5404     */
5405    LDKCOption_TypeZ_Some,
5406    /**
5407     * When we're in this state, this COption_TypeZ contains nothing
5408     */
5409    LDKCOption_TypeZ_None,
5410    /**
5411     * Must be last for serialization purposes
5412     */
5413    LDKCOption_TypeZ_Sentinel,
5414 } LDKCOption_TypeZ_Tag;
5415
5416 typedef struct LDKCOption_TypeZ {
5417    LDKCOption_TypeZ_Tag tag;
5418    union {
5419       struct {
5420          struct LDKType some;
5421       };
5422    };
5423 } LDKCOption_TypeZ;
5424
5425 /**
5426  * The contents of CResult_COption_TypeZDecodeErrorZ
5427  */
5428 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
5429    /**
5430     * A pointer to the contents in the success state.
5431     * Reading from this pointer when `result_ok` is not set is undefined.
5432     */
5433    struct LDKCOption_TypeZ *result;
5434    /**
5435     * A pointer to the contents in the error state.
5436     * Reading from this pointer when `result_ok` is set is undefined.
5437     */
5438    struct LDKDecodeError *err;
5439 } LDKCResult_COption_TypeZDecodeErrorZPtr;
5440
5441 /**
5442  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5443  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5444  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5445  */
5446 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
5447    /**
5448     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5449     * `err` or `result` depending on the state of `result_ok`.
5450     */
5451    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
5452    /**
5453     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5454     */
5455    bool result_ok;
5456 } LDKCResult_COption_TypeZDecodeErrorZ;
5457
5458 /**
5459  * An error that may occur when making a payment.
5460  */
5461 typedef enum LDKPaymentError_Tag {
5462    /**
5463     * An error resulting from the provided [`Invoice`] or payment hash.
5464     */
5465    LDKPaymentError_Invoice,
5466    /**
5467     * An error occurring when finding a route.
5468     */
5469    LDKPaymentError_Routing,
5470    /**
5471     * An error occurring when sending a payment.
5472     */
5473    LDKPaymentError_Sending,
5474    /**
5475     * Must be last for serialization purposes
5476     */
5477    LDKPaymentError_Sentinel,
5478 } LDKPaymentError_Tag;
5479
5480 typedef struct MUST_USE_STRUCT LDKPaymentError {
5481    LDKPaymentError_Tag tag;
5482    union {
5483       struct {
5484          struct LDKStr invoice;
5485       };
5486       struct {
5487          struct LDKLightningError routing;
5488       };
5489       struct {
5490          struct LDKPaymentSendFailure sending;
5491       };
5492    };
5493 } LDKPaymentError;
5494
5495 /**
5496  * The contents of CResult_PaymentIdPaymentErrorZ
5497  */
5498 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
5499    /**
5500     * A pointer to the contents in the success state.
5501     * Reading from this pointer when `result_ok` is not set is undefined.
5502     */
5503    struct LDKThirtyTwoBytes *result;
5504    /**
5505     * A pointer to the contents in the error state.
5506     * Reading from this pointer when `result_ok` is set is undefined.
5507     */
5508    struct LDKPaymentError *err;
5509 } LDKCResult_PaymentIdPaymentErrorZPtr;
5510
5511 /**
5512  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5513  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5514  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5515  */
5516 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
5517    /**
5518     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5519     * `err` or `result` depending on the state of `result_ok`.
5520     */
5521    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
5522    /**
5523     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5524     */
5525    bool result_ok;
5526 } LDKCResult_PaymentIdPaymentErrorZ;
5527
5528 /**
5529  * The contents of CResult_SiPrefixNoneZ
5530  */
5531 typedef union LDKCResult_SiPrefixNoneZPtr {
5532    /**
5533     * A pointer to the contents in the success state.
5534     * Reading from this pointer when `result_ok` is not set is undefined.
5535     */
5536    enum LDKSiPrefix *result;
5537    /**
5538     * Note that this value is always NULL, as there are no contents in the Err variant
5539     */
5540    void *err;
5541 } LDKCResult_SiPrefixNoneZPtr;
5542
5543 /**
5544  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5545  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5547  */
5548 typedef struct LDKCResult_SiPrefixNoneZ {
5549    /**
5550     * The contents of this CResult_SiPrefixNoneZ, accessible via either
5551     * `err` or `result` depending on the state of `result_ok`.
5552     */
5553    union LDKCResult_SiPrefixNoneZPtr contents;
5554    /**
5555     * Whether this CResult_SiPrefixNoneZ represents a success state.
5556     */
5557    bool result_ok;
5558 } LDKCResult_SiPrefixNoneZ;
5559
5560
5561
5562 /**
5563  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
5564  *
5565  * There are three ways to construct an `Invoice`:
5566  *  1. using `InvoiceBuilder`
5567  *  2. using `Invoice::from_signed(SignedRawInvoice)`
5568  *  3. using `str::parse::<Invoice>(&str)`
5569  */
5570 typedef struct MUST_USE_STRUCT LDKInvoice {
5571    /**
5572     * A pointer to the opaque Rust object.
5573     * Nearly everywhere, inner must be non-null, however in places where
5574     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5575     */
5576    LDKnativeInvoice *inner;
5577    /**
5578     * Indicates that this is the only struct which contains the same pointer.
5579     * Rust functions which take ownership of an object provided via an argument require
5580     * this to be true and invalidate the object pointed to by inner.
5581     */
5582    bool is_owned;
5583 } LDKInvoice;
5584
5585 /**
5586  * The contents of CResult_InvoiceNoneZ
5587  */
5588 typedef union LDKCResult_InvoiceNoneZPtr {
5589    /**
5590     * A pointer to the contents in the success state.
5591     * Reading from this pointer when `result_ok` is not set is undefined.
5592     */
5593    struct LDKInvoice *result;
5594    /**
5595     * Note that this value is always NULL, as there are no contents in the Err variant
5596     */
5597    void *err;
5598 } LDKCResult_InvoiceNoneZPtr;
5599
5600 /**
5601  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
5602  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
5603  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5604  */
5605 typedef struct LDKCResult_InvoiceNoneZ {
5606    /**
5607     * The contents of this CResult_InvoiceNoneZ, accessible via either
5608     * `err` or `result` depending on the state of `result_ok`.
5609     */
5610    union LDKCResult_InvoiceNoneZPtr contents;
5611    /**
5612     * Whether this CResult_InvoiceNoneZ represents a success state.
5613     */
5614    bool result_ok;
5615 } LDKCResult_InvoiceNoneZ;
5616
5617
5618
5619 /**
5620  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
5621  * invalid.
5622  *
5623  * # Invariants
5624  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
5625  */
5626 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
5627    /**
5628     * A pointer to the opaque Rust object.
5629     * Nearly everywhere, inner must be non-null, however in places where
5630     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5631     */
5632    LDKnativeSignedRawInvoice *inner;
5633    /**
5634     * Indicates that this is the only struct which contains the same pointer.
5635     * Rust functions which take ownership of an object provided via an argument require
5636     * this to be true and invalidate the object pointed to by inner.
5637     */
5638    bool is_owned;
5639 } LDKSignedRawInvoice;
5640
5641 /**
5642  * The contents of CResult_SignedRawInvoiceNoneZ
5643  */
5644 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
5645    /**
5646     * A pointer to the contents in the success state.
5647     * Reading from this pointer when `result_ok` is not set is undefined.
5648     */
5649    struct LDKSignedRawInvoice *result;
5650    /**
5651     * Note that this value is always NULL, as there are no contents in the Err variant
5652     */
5653    void *err;
5654 } LDKCResult_SignedRawInvoiceNoneZPtr;
5655
5656 /**
5657  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5658  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5660  */
5661 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
5662    /**
5663     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5664     * `err` or `result` depending on the state of `result_ok`.
5665     */
5666    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
5667    /**
5668     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5669     */
5670    bool result_ok;
5671 } LDKCResult_SignedRawInvoiceNoneZ;
5672
5673
5674
5675 /**
5676  * Represents an syntactically correct Invoice for a payment on the lightning network,
5677  * but without the signature information.
5678  * De- and encoding should not lead to information loss but may lead to different hashes.
5679  *
5680  * For methods without docs see the corresponding methods in `Invoice`.
5681  */
5682 typedef struct MUST_USE_STRUCT LDKRawInvoice {
5683    /**
5684     * A pointer to the opaque Rust object.
5685     * Nearly everywhere, inner must be non-null, however in places where
5686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5687     */
5688    LDKnativeRawInvoice *inner;
5689    /**
5690     * Indicates that this is the only struct which contains the same pointer.
5691     * Rust functions which take ownership of an object provided via an argument require
5692     * this to be true and invalidate the object pointed to by inner.
5693     */
5694    bool is_owned;
5695 } LDKRawInvoice;
5696
5697
5698
5699 /**
5700  * Recoverable signature
5701  */
5702 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
5703    /**
5704     * A pointer to the opaque Rust object.
5705     * Nearly everywhere, inner must be non-null, however in places where
5706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5707     */
5708    LDKnativeInvoiceSignature *inner;
5709    /**
5710     * Indicates that this is the only struct which contains the same pointer.
5711     * Rust functions which take ownership of an object provided via an argument require
5712     * this to be true and invalidate the object pointed to by inner.
5713     */
5714    bool is_owned;
5715 } LDKInvoiceSignature;
5716
5717 /**
5718  * A tuple of 3 elements. See the individual fields for the types contained.
5719  */
5720 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
5721    /**
5722     * The element at position 0
5723     */
5724    struct LDKRawInvoice a;
5725    /**
5726     * The element at position 1
5727     */
5728    struct LDKThirtyTwoBytes b;
5729    /**
5730     * The element at position 2
5731     */
5732    struct LDKInvoiceSignature c;
5733 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
5734
5735
5736
5737 /**
5738  * Payee public key
5739  */
5740 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
5741    /**
5742     * A pointer to the opaque Rust object.
5743     * Nearly everywhere, inner must be non-null, however in places where
5744     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5745     */
5746    LDKnativePayeePubKey *inner;
5747    /**
5748     * Indicates that this is the only struct which contains the same pointer.
5749     * Rust functions which take ownership of an object provided via an argument require
5750     * this to be true and invalidate the object pointed to by inner.
5751     */
5752    bool is_owned;
5753 } LDKPayeePubKey;
5754
5755 /**
5756  * The contents of CResult_PayeePubKeyErrorZ
5757  */
5758 typedef union LDKCResult_PayeePubKeyErrorZPtr {
5759    /**
5760     * A pointer to the contents in the success state.
5761     * Reading from this pointer when `result_ok` is not set is undefined.
5762     */
5763    struct LDKPayeePubKey *result;
5764    /**
5765     * A pointer to the contents in the error state.
5766     * Reading from this pointer when `result_ok` is set is undefined.
5767     */
5768    enum LDKSecp256k1Error *err;
5769 } LDKCResult_PayeePubKeyErrorZPtr;
5770
5771 /**
5772  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5773  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5775  */
5776 typedef struct LDKCResult_PayeePubKeyErrorZ {
5777    /**
5778     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5779     * `err` or `result` depending on the state of `result_ok`.
5780     */
5781    union LDKCResult_PayeePubKeyErrorZPtr contents;
5782    /**
5783     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
5784     */
5785    bool result_ok;
5786 } LDKCResult_PayeePubKeyErrorZ;
5787
5788
5789
5790 /**
5791  * Private routing information
5792  *
5793  * # Invariants
5794  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
5795  *
5796  */
5797 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
5798    /**
5799     * A pointer to the opaque Rust object.
5800     * Nearly everywhere, inner must be non-null, however in places where
5801     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5802     */
5803    LDKnativePrivateRoute *inner;
5804    /**
5805     * Indicates that this is the only struct which contains the same pointer.
5806     * Rust functions which take ownership of an object provided via an argument require
5807     * this to be true and invalidate the object pointed to by inner.
5808     */
5809    bool is_owned;
5810 } LDKPrivateRoute;
5811
5812 /**
5813  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5814  * This corresponds to std::vector in C++
5815  */
5816 typedef struct LDKCVec_PrivateRouteZ {
5817    /**
5818     * The elements in the array.
5819     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5820     */
5821    struct LDKPrivateRoute *data;
5822    /**
5823     * The number of elements pointed to by `data`.
5824     */
5825    uintptr_t datalen;
5826 } LDKCVec_PrivateRouteZ;
5827
5828
5829
5830 /**
5831  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
5832  * timestamp is positive.
5833  *
5834  * # Invariants
5835  * The UNIX timestamp representing the stored time has to be positive and small enough so that
5836  * a `EpiryTime` can be added to it without an overflow.
5837  */
5838 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
5839    /**
5840     * A pointer to the opaque Rust object.
5841     * Nearly everywhere, inner must be non-null, however in places where
5842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5843     */
5844    LDKnativePositiveTimestamp *inner;
5845    /**
5846     * Indicates that this is the only struct which contains the same pointer.
5847     * Rust functions which take ownership of an object provided via an argument require
5848     * this to be true and invalidate the object pointed to by inner.
5849     */
5850    bool is_owned;
5851 } LDKPositiveTimestamp;
5852
5853 /**
5854  * The contents of CResult_PositiveTimestampCreationErrorZ
5855  */
5856 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
5857    /**
5858     * A pointer to the contents in the success state.
5859     * Reading from this pointer when `result_ok` is not set is undefined.
5860     */
5861    struct LDKPositiveTimestamp *result;
5862    /**
5863     * A pointer to the contents in the error state.
5864     * Reading from this pointer when `result_ok` is set is undefined.
5865     */
5866    enum LDKCreationError *err;
5867 } LDKCResult_PositiveTimestampCreationErrorZPtr;
5868
5869 /**
5870  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5871  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5873  */
5874 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
5875    /**
5876     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5877     * `err` or `result` depending on the state of `result_ok`.
5878     */
5879    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
5880    /**
5881     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5882     */
5883    bool result_ok;
5884 } LDKCResult_PositiveTimestampCreationErrorZ;
5885
5886 /**
5887  * The contents of CResult_NoneSemanticErrorZ
5888  */
5889 typedef union LDKCResult_NoneSemanticErrorZPtr {
5890    /**
5891     * Note that this value is always NULL, as there are no contents in the OK variant
5892     */
5893    void *result;
5894    /**
5895     * A pointer to the contents in the error state.
5896     * Reading from this pointer when `result_ok` is set is undefined.
5897     */
5898    enum LDKSemanticError *err;
5899 } LDKCResult_NoneSemanticErrorZPtr;
5900
5901 /**
5902  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5903  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5904  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5905  */
5906 typedef struct LDKCResult_NoneSemanticErrorZ {
5907    /**
5908     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
5909     * `err` or `result` depending on the state of `result_ok`.
5910     */
5911    union LDKCResult_NoneSemanticErrorZPtr contents;
5912    /**
5913     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5914     */
5915    bool result_ok;
5916 } LDKCResult_NoneSemanticErrorZ;
5917
5918 /**
5919  * The contents of CResult_InvoiceSemanticErrorZ
5920  */
5921 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5922    /**
5923     * A pointer to the contents in the success state.
5924     * Reading from this pointer when `result_ok` is not set is undefined.
5925     */
5926    struct LDKInvoice *result;
5927    /**
5928     * A pointer to the contents in the error state.
5929     * Reading from this pointer when `result_ok` is set is undefined.
5930     */
5931    enum LDKSemanticError *err;
5932 } LDKCResult_InvoiceSemanticErrorZPtr;
5933
5934 /**
5935  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5936  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5938  */
5939 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5940    /**
5941     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5942     * `err` or `result` depending on the state of `result_ok`.
5943     */
5944    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5945    /**
5946     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5947     */
5948    bool result_ok;
5949 } LDKCResult_InvoiceSemanticErrorZ;
5950
5951
5952
5953 /**
5954  * Description string
5955  *
5956  * # Invariants
5957  * The description can be at most 639 __bytes__ long
5958  */
5959 typedef struct MUST_USE_STRUCT LDKDescription {
5960    /**
5961     * A pointer to the opaque Rust object.
5962     * Nearly everywhere, inner must be non-null, however in places where
5963     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5964     */
5965    LDKnativeDescription *inner;
5966    /**
5967     * Indicates that this is the only struct which contains the same pointer.
5968     * Rust functions which take ownership of an object provided via an argument require
5969     * this to be true and invalidate the object pointed to by inner.
5970     */
5971    bool is_owned;
5972 } LDKDescription;
5973
5974 /**
5975  * The contents of CResult_DescriptionCreationErrorZ
5976  */
5977 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5978    /**
5979     * A pointer to the contents in the success state.
5980     * Reading from this pointer when `result_ok` is not set is undefined.
5981     */
5982    struct LDKDescription *result;
5983    /**
5984     * A pointer to the contents in the error state.
5985     * Reading from this pointer when `result_ok` is set is undefined.
5986     */
5987    enum LDKCreationError *err;
5988 } LDKCResult_DescriptionCreationErrorZPtr;
5989
5990 /**
5991  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5992  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5993  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5994  */
5995 typedef struct LDKCResult_DescriptionCreationErrorZ {
5996    /**
5997     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5998     * `err` or `result` depending on the state of `result_ok`.
5999     */
6000    union LDKCResult_DescriptionCreationErrorZPtr contents;
6001    /**
6002     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
6003     */
6004    bool result_ok;
6005 } LDKCResult_DescriptionCreationErrorZ;
6006
6007
6008
6009 /**
6010  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
6011  * expires
6012  *
6013  * # Invariants
6014  * The number of seconds this expiry time represents has to be in the range
6015  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
6016  * timestamp
6017  */
6018 typedef struct MUST_USE_STRUCT LDKExpiryTime {
6019    /**
6020     * A pointer to the opaque Rust object.
6021     * Nearly everywhere, inner must be non-null, however in places where
6022     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6023     */
6024    LDKnativeExpiryTime *inner;
6025    /**
6026     * Indicates that this is the only struct which contains the same pointer.
6027     * Rust functions which take ownership of an object provided via an argument require
6028     * this to be true and invalidate the object pointed to by inner.
6029     */
6030    bool is_owned;
6031 } LDKExpiryTime;
6032
6033 /**
6034  * The contents of CResult_ExpiryTimeCreationErrorZ
6035  */
6036 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
6037    /**
6038     * A pointer to the contents in the success state.
6039     * Reading from this pointer when `result_ok` is not set is undefined.
6040     */
6041    struct LDKExpiryTime *result;
6042    /**
6043     * A pointer to the contents in the error state.
6044     * Reading from this pointer when `result_ok` is set is undefined.
6045     */
6046    enum LDKCreationError *err;
6047 } LDKCResult_ExpiryTimeCreationErrorZPtr;
6048
6049 /**
6050  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6051  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6052  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6053  */
6054 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
6055    /**
6056     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6057     * `err` or `result` depending on the state of `result_ok`.
6058     */
6059    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
6060    /**
6061     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6062     */
6063    bool result_ok;
6064 } LDKCResult_ExpiryTimeCreationErrorZ;
6065
6066 /**
6067  * The contents of CResult_PrivateRouteCreationErrorZ
6068  */
6069 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
6070    /**
6071     * A pointer to the contents in the success state.
6072     * Reading from this pointer when `result_ok` is not set is undefined.
6073     */
6074    struct LDKPrivateRoute *result;
6075    /**
6076     * A pointer to the contents in the error state.
6077     * Reading from this pointer when `result_ok` is set is undefined.
6078     */
6079    enum LDKCreationError *err;
6080 } LDKCResult_PrivateRouteCreationErrorZPtr;
6081
6082 /**
6083  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6084  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6085  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6086  */
6087 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
6088    /**
6089     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6090     * `err` or `result` depending on the state of `result_ok`.
6091     */
6092    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
6093    /**
6094     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6095     */
6096    bool result_ok;
6097 } LDKCResult_PrivateRouteCreationErrorZ;
6098
6099 /**
6100  * The contents of CResult_StringErrorZ
6101  */
6102 typedef union LDKCResult_StringErrorZPtr {
6103    /**
6104     * A pointer to the contents in the success state.
6105     * Reading from this pointer when `result_ok` is not set is undefined.
6106     */
6107    struct LDKStr *result;
6108    /**
6109     * A pointer to the contents in the error state.
6110     * Reading from this pointer when `result_ok` is set is undefined.
6111     */
6112    enum LDKSecp256k1Error *err;
6113 } LDKCResult_StringErrorZPtr;
6114
6115 /**
6116  * A CResult_StringErrorZ represents the result of a fallible operation,
6117  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6119  */
6120 typedef struct LDKCResult_StringErrorZ {
6121    /**
6122     * The contents of this CResult_StringErrorZ, accessible via either
6123     * `err` or `result` depending on the state of `result_ok`.
6124     */
6125    union LDKCResult_StringErrorZPtr contents;
6126    /**
6127     * Whether this CResult_StringErrorZ represents a success state.
6128     */
6129    bool result_ok;
6130 } LDKCResult_StringErrorZ;
6131
6132 /**
6133  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6134  */
6135 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
6136    /**
6137     * A pointer to the contents in the success state.
6138     * Reading from this pointer when `result_ok` is not set is undefined.
6139     */
6140    struct LDKChannelMonitorUpdate *result;
6141    /**
6142     * A pointer to the contents in the error state.
6143     * Reading from this pointer when `result_ok` is set is undefined.
6144     */
6145    struct LDKDecodeError *err;
6146 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
6147
6148 /**
6149  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6150  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6152  */
6153 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
6154    /**
6155     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6156     * `err` or `result` depending on the state of `result_ok`.
6157     */
6158    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
6159    /**
6160     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6161     */
6162    bool result_ok;
6163 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
6164
6165 /**
6166  * The contents of CResult_HTLCUpdateDecodeErrorZ
6167  */
6168 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
6169    /**
6170     * A pointer to the contents in the success state.
6171     * Reading from this pointer when `result_ok` is not set is undefined.
6172     */
6173    struct LDKHTLCUpdate *result;
6174    /**
6175     * A pointer to the contents in the error state.
6176     * Reading from this pointer when `result_ok` is set is undefined.
6177     */
6178    struct LDKDecodeError *err;
6179 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
6180
6181 /**
6182  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6183  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6184  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6185  */
6186 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
6187    /**
6188     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6189     * `err` or `result` depending on the state of `result_ok`.
6190     */
6191    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
6192    /**
6193     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6194     */
6195    bool result_ok;
6196 } LDKCResult_HTLCUpdateDecodeErrorZ;
6197
6198
6199
6200 /**
6201  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
6202  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
6203  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
6204  * corrupted.
6205  * Contains a developer-readable error message.
6206  */
6207 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
6208    /**
6209     * A pointer to the opaque Rust object.
6210     * Nearly everywhere, inner must be non-null, however in places where
6211     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6212     */
6213    LDKnativeMonitorUpdateError *inner;
6214    /**
6215     * Indicates that this is the only struct which contains the same pointer.
6216     * Rust functions which take ownership of an object provided via an argument require
6217     * this to be true and invalidate the object pointed to by inner.
6218     */
6219    bool is_owned;
6220 } LDKMonitorUpdateError;
6221
6222 /**
6223  * The contents of CResult_NoneMonitorUpdateErrorZ
6224  */
6225 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
6226    /**
6227     * Note that this value is always NULL, as there are no contents in the OK variant
6228     */
6229    void *result;
6230    /**
6231     * A pointer to the contents in the error state.
6232     * Reading from this pointer when `result_ok` is set is undefined.
6233     */
6234    struct LDKMonitorUpdateError *err;
6235 } LDKCResult_NoneMonitorUpdateErrorZPtr;
6236
6237 /**
6238  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6239  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6241  */
6242 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
6243    /**
6244     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6245     * `err` or `result` depending on the state of `result_ok`.
6246     */
6247    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
6248    /**
6249     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6250     */
6251    bool result_ok;
6252 } LDKCResult_NoneMonitorUpdateErrorZ;
6253
6254 /**
6255  * A tuple of 2 elements. See the individual fields for the types contained.
6256  */
6257 typedef struct LDKC2Tuple_OutPointScriptZ {
6258    /**
6259     * The element at position 0
6260     */
6261    struct LDKOutPoint a;
6262    /**
6263     * The element at position 1
6264     */
6265    struct LDKCVec_u8Z b;
6266 } LDKC2Tuple_OutPointScriptZ;
6267
6268 /**
6269  * A tuple of 2 elements. See the individual fields for the types contained.
6270  */
6271 typedef struct LDKC2Tuple_u32ScriptZ {
6272    /**
6273     * The element at position 0
6274     */
6275    uint32_t a;
6276    /**
6277     * The element at position 1
6278     */
6279    struct LDKCVec_u8Z b;
6280 } LDKC2Tuple_u32ScriptZ;
6281
6282 /**
6283  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6284  * This corresponds to std::vector in C++
6285  */
6286 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
6287    /**
6288     * The elements in the array.
6289     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6290     */
6291    struct LDKC2Tuple_u32ScriptZ *data;
6292    /**
6293     * The number of elements pointed to by `data`.
6294     */
6295    uintptr_t datalen;
6296 } LDKCVec_C2Tuple_u32ScriptZZ;
6297
6298 /**
6299  * A tuple of 2 elements. See the individual fields for the types contained.
6300  */
6301 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6302    /**
6303     * The element at position 0
6304     */
6305    struct LDKThirtyTwoBytes a;
6306    /**
6307     * The element at position 1
6308     */
6309    struct LDKCVec_C2Tuple_u32ScriptZZ b;
6310 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
6311
6312 /**
6313  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6314  * This corresponds to std::vector in C++
6315  */
6316 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6317    /**
6318     * The elements in the array.
6319     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6320     */
6321    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
6322    /**
6323     * The number of elements pointed to by `data`.
6324     */
6325    uintptr_t datalen;
6326 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
6327
6328 /**
6329  * Some information provided on receipt of payment depends on whether the payment received is a
6330  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
6331  */
6332 typedef enum LDKPaymentPurpose_Tag {
6333    /**
6334     * Information for receiving a payment that we generated an invoice for.
6335     */
6336    LDKPaymentPurpose_InvoicePayment,
6337    /**
6338     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
6339     * (the payee) providing a preimage.
6340     */
6341    LDKPaymentPurpose_SpontaneousPayment,
6342    /**
6343     * Must be last for serialization purposes
6344     */
6345    LDKPaymentPurpose_Sentinel,
6346 } LDKPaymentPurpose_Tag;
6347
6348 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
6349    /**
6350     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
6351     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
6352     * [`ChannelManager::claim_funds`].
6353     *
6354     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6355     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
6356     *
6357     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6358     */
6359    struct LDKThirtyTwoBytes payment_preimage;
6360    /**
6361     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
6362     * number of deanonymization attacks during the routing process.
6363     * It is provided here for your reference, however its accuracy is enforced directly by
6364     * [`ChannelManager`] using the values you previously provided to
6365     * [`ChannelManager::create_inbound_payment`] or
6366     * [`ChannelManager::create_inbound_payment_for_hash`].
6367     *
6368     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
6369     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6370     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
6371     */
6372    struct LDKThirtyTwoBytes payment_secret;
6373    /**
6374     * This is the `user_payment_id` which was provided to
6375     * [`ChannelManager::create_inbound_payment_for_hash`] or
6376     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
6377     * simply copied here. It may be used to correlate PaymentReceived events with invoice
6378     * metadata stored elsewhere.
6379     *
6380     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6381     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
6382     */
6383    uint64_t user_payment_id;
6384 } LDKPaymentPurpose_LDKInvoicePayment_Body;
6385
6386 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
6387    LDKPaymentPurpose_Tag tag;
6388    union {
6389       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
6390       struct {
6391          struct LDKThirtyTwoBytes spontaneous_payment;
6392       };
6393    };
6394 } LDKPaymentPurpose;
6395
6396 /**
6397  * The reason the channel was closed. See individual variants more details.
6398  */
6399 typedef enum LDKClosureReason_Tag {
6400    /**
6401     * Closure generated from receiving a peer error message.
6402     *
6403     * Our counterparty may have broadcasted their latest commitment state, and we have
6404     * as well.
6405     */
6406    LDKClosureReason_CounterpartyForceClosed,
6407    /**
6408     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
6409     *
6410     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
6411     */
6412    LDKClosureReason_HolderForceClosed,
6413    /**
6414     * The channel was closed after negotiating a cooperative close and we've now broadcasted
6415     * the cooperative close transaction. Note the shutdown may have been initiated by us.
6416     */
6417    LDKClosureReason_CooperativeClosure,
6418    /**
6419     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
6420     * commitment transaction came from our counterparty, but it may also have come from
6421     * a copy of our own `ChannelMonitor`.
6422     */
6423    LDKClosureReason_CommitmentTxConfirmed,
6424    /**
6425     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
6426     */
6427    LDKClosureReason_ProcessingError,
6428    /**
6429     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
6430     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
6431     * peer again in the future or if the peer disconnected before we finished negotiating
6432     * the channel open. The first case may be caused by incompatible features which our
6433     * counterparty, or we, require.
6434     */
6435    LDKClosureReason_DisconnectedPeer,
6436    /**
6437     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
6438     * the ChannelManager deserialized.
6439     */
6440    LDKClosureReason_OutdatedChannelManager,
6441    /**
6442     * Must be last for serialization purposes
6443     */
6444    LDKClosureReason_Sentinel,
6445 } LDKClosureReason_Tag;
6446
6447 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
6448    /**
6449     * The error which the peer sent us.
6450     *
6451     * The string should be sanitized before it is used (e.g emitted to logs
6452     * or printed to stdout). Otherwise, a well crafted error message may exploit
6453     * a security vulnerability in the terminal emulator or the logging subsystem.
6454     */
6455    struct LDKStr peer_msg;
6456 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
6457
6458 typedef struct LDKClosureReason_LDKProcessingError_Body {
6459    /**
6460     * A developer-readable error message which we generated.
6461     */
6462    struct LDKStr err;
6463 } LDKClosureReason_LDKProcessingError_Body;
6464
6465 typedef struct MUST_USE_STRUCT LDKClosureReason {
6466    LDKClosureReason_Tag tag;
6467    union {
6468       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
6469       LDKClosureReason_LDKProcessingError_Body processing_error;
6470    };
6471 } LDKClosureReason;
6472
6473 /**
6474  * An Event which you should probably take some action in response to.
6475  *
6476  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
6477  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
6478  * written as it makes no sense to respond to it after reconnecting to peers).
6479  */
6480 typedef enum LDKEvent_Tag {
6481    /**
6482     * Used to indicate that the client should generate a funding transaction with the given
6483     * parameters and then call ChannelManager::funding_transaction_generated.
6484     * Generated in ChannelManager message handling.
6485     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
6486     * counterparty can steal your funds!
6487     */
6488    LDKEvent_FundingGenerationReady,
6489    /**
6490     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
6491     * [`ChannelManager::claim_funds`] to get it....
6492     * Note that if the preimage is not known, you should call
6493     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
6494     * network congestion.
6495     * If you fail to call either [`ChannelManager::claim_funds`] or
6496     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
6497     * automatically failed.
6498     *
6499     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
6500     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
6501     */
6502    LDKEvent_PaymentReceived,
6503    /**
6504     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
6505     * and we got back the payment preimage for it).
6506     *
6507     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
6508     * event. In this situation, you SHOULD treat this payment as having succeeded.
6509     */
6510    LDKEvent_PaymentSent,
6511    /**
6512     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
6513     * something. You may wish to retry with a different route.
6514     */
6515    LDKEvent_PaymentPathFailed,
6516    /**
6517     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
6518     * time in the future.
6519     */
6520    LDKEvent_PendingHTLCsForwardable,
6521    /**
6522     * Used to indicate that an output which you should know how to spend was confirmed on chain
6523     * and is now spendable.
6524     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
6525     * counterparty spending them due to some kind of timeout. Thus, you need to store them
6526     * somewhere and spend them when you create on-chain transactions.
6527     */
6528    LDKEvent_SpendableOutputs,
6529    /**
6530     * This event is generated when a payment has been successfully forwarded through us and a
6531     * forwarding fee earned.
6532     */
6533    LDKEvent_PaymentForwarded,
6534    /**
6535     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
6536     */
6537    LDKEvent_ChannelClosed,
6538    /**
6539     * Used to indicate to the user that they can abandon the funding transaction and recycle the
6540     * inputs for another purpose.
6541     */
6542    LDKEvent_DiscardFunding,
6543    /**
6544     * Must be last for serialization purposes
6545     */
6546    LDKEvent_Sentinel,
6547 } LDKEvent_Tag;
6548
6549 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
6550    /**
6551     * The random channel_id we picked which you'll need to pass into
6552     * ChannelManager::funding_transaction_generated.
6553     */
6554    struct LDKThirtyTwoBytes temporary_channel_id;
6555    /**
6556     * The value, in satoshis, that the output should have.
6557     */
6558    uint64_t channel_value_satoshis;
6559    /**
6560     * The script which should be used in the transaction output.
6561     */
6562    struct LDKCVec_u8Z output_script;
6563    /**
6564     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6565     * an inbound channel.
6566     *
6567     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6568     */
6569    uint64_t user_channel_id;
6570 } LDKEvent_LDKFundingGenerationReady_Body;
6571
6572 typedef struct LDKEvent_LDKPaymentReceived_Body {
6573    /**
6574     * The hash for which the preimage should be handed to the ChannelManager.
6575     */
6576    struct LDKThirtyTwoBytes payment_hash;
6577    /**
6578     * The value, in thousandths of a satoshi, that this payment is for.
6579     */
6580    uint64_t amt;
6581    /**
6582     * Information for claiming this received payment, based on whether the purpose of the
6583     * payment is to pay an invoice or to send a spontaneous payment.
6584     */
6585    struct LDKPaymentPurpose purpose;
6586 } LDKEvent_LDKPaymentReceived_Body;
6587
6588 typedef struct LDKEvent_LDKPaymentSent_Body {
6589    /**
6590     * The id returned by [`ChannelManager::send_payment`] and used with
6591     * [`ChannelManager::retry_payment`].
6592     *
6593     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6594     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
6595     *
6596     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6597     */
6598    struct LDKThirtyTwoBytes payment_id;
6599    /**
6600     * The preimage to the hash given to ChannelManager::send_payment.
6601     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
6602     * store it somehow!
6603     */
6604    struct LDKThirtyTwoBytes payment_preimage;
6605    /**
6606     * The hash which was given to [`ChannelManager::send_payment`].
6607     *
6608     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6609     */
6610    struct LDKThirtyTwoBytes payment_hash;
6611    /**
6612     * The total fee which was spent at intermediate hops in this payment, across all paths.
6613     *
6614     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
6615     * overpayment to the recipient node.
6616     *
6617     * If the recipient or an intermediate node misbehaves and gives us free money, this may
6618     * overstate the amount paid, though this is unlikely.
6619     *
6620     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
6621     */
6622    struct LDKCOption_u64Z fee_paid_msat;
6623 } LDKEvent_LDKPaymentSent_Body;
6624
6625 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
6626    /**
6627     * The id returned by [`ChannelManager::send_payment`] and used with
6628     * [`ChannelManager::retry_payment`].
6629     *
6630     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6631     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
6632     *
6633     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6634     */
6635    struct LDKThirtyTwoBytes payment_id;
6636    /**
6637     * The hash which was given to ChannelManager::send_payment.
6638     */
6639    struct LDKThirtyTwoBytes payment_hash;
6640    /**
6641     * Indicates the payment was rejected for some reason by the recipient. This implies that
6642     * the payment has failed, not just the route in question. If this is not set, you may
6643     * retry the payment via a different route.
6644     */
6645    bool rejected_by_dest;
6646    /**
6647     * Any failure information conveyed via the Onion return packet by a node along the failed
6648     * payment route.
6649     *
6650     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
6651     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
6652     *
6653     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
6654     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
6655     */
6656    struct LDKCOption_NetworkUpdateZ network_update;
6657    /**
6658     * For both single-path and multi-path payments, this is set if all paths of the payment have
6659     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
6660     * larger MPP payment were still in flight when this event was generated.
6661     */
6662    bool all_paths_failed;
6663    /**
6664     * The payment path that failed.
6665     */
6666    struct LDKCVec_RouteHopZ path;
6667    /**
6668     * The channel responsible for the failed payment path.
6669     *
6670     * If this is `Some`, then the corresponding channel should be avoided when the payment is
6671     * retried. May be `None` for older [`Event`] serializations.
6672     */
6673    struct LDKCOption_u64Z short_channel_id;
6674    /**
6675     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
6676     *
6677     * See [`find_route`] for details.
6678     *
6679     * [`Route`]: crate::routing::router::Route
6680     * [`find_route`]: crate::routing::router::find_route
6681     *
6682     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6683     */
6684    struct LDKRouteParameters retry;
6685 } LDKEvent_LDKPaymentPathFailed_Body;
6686
6687 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
6688    /**
6689     * The minimum amount of time that should be waited prior to calling
6690     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
6691     * you should wait a random amount of time in roughly the range (now + time_forwardable,
6692     * now + 5*time_forwardable).
6693     */
6694    uint64_t time_forwardable;
6695 } LDKEvent_LDKPendingHTLCsForwardable_Body;
6696
6697 typedef struct LDKEvent_LDKSpendableOutputs_Body {
6698    /**
6699     * The outputs which you should store as spendable by you.
6700     */
6701    struct LDKCVec_SpendableOutputDescriptorZ outputs;
6702 } LDKEvent_LDKSpendableOutputs_Body;
6703
6704 typedef struct LDKEvent_LDKPaymentForwarded_Body {
6705    /**
6706     * The fee, in milli-satoshis, which was earned as a result of the payment.
6707     *
6708     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
6709     * was pending, the amount the next hop claimed will have been rounded down to the nearest
6710     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
6711     * claimed the full value in millisatoshis from the source. In this case,
6712     * `claim_from_onchain_tx` will be set.
6713     *
6714     * If the channel which sent us the payment has been force-closed, we will claim the funds
6715     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
6716     * fees which we will spend and will instead set this to `None`. It is possible duplicate
6717     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
6718     * `None`.
6719     */
6720    struct LDKCOption_u64Z fee_earned_msat;
6721    /**
6722     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
6723     * transaction.
6724     */
6725    bool claim_from_onchain_tx;
6726 } LDKEvent_LDKPaymentForwarded_Body;
6727
6728 typedef struct LDKEvent_LDKChannelClosed_Body {
6729    /**
6730     * The channel_id of the channel which has been closed. Note that on-chain transactions
6731     * resolving the channel are likely still awaiting confirmation.
6732     */
6733    struct LDKThirtyTwoBytes channel_id;
6734    /**
6735     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6736     * an inbound channel. This will always be zero for objects serialized with LDK versions
6737     * prior to 0.0.102.
6738     *
6739     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6740     */
6741    uint64_t user_channel_id;
6742    /**
6743     * The reason the channel was closed.
6744     */
6745    struct LDKClosureReason reason;
6746 } LDKEvent_LDKChannelClosed_Body;
6747
6748 typedef struct LDKEvent_LDKDiscardFunding_Body {
6749    /**
6750     * The channel_id of the channel which has been closed.
6751     */
6752    struct LDKThirtyTwoBytes channel_id;
6753    /**
6754     * The full transaction received from the user
6755     */
6756    struct LDKTransaction transaction;
6757 } LDKEvent_LDKDiscardFunding_Body;
6758
6759 typedef struct MUST_USE_STRUCT LDKEvent {
6760    LDKEvent_Tag tag;
6761    union {
6762       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
6763       LDKEvent_LDKPaymentReceived_Body payment_received;
6764       LDKEvent_LDKPaymentSent_Body payment_sent;
6765       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
6766       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
6767       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
6768       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
6769       LDKEvent_LDKChannelClosed_Body channel_closed;
6770       LDKEvent_LDKDiscardFunding_Body discard_funding;
6771    };
6772 } LDKEvent;
6773
6774 /**
6775  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6776  * This corresponds to std::vector in C++
6777  */
6778 typedef struct LDKCVec_EventZ {
6779    /**
6780     * The elements in the array.
6781     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6782     */
6783    struct LDKEvent *data;
6784    /**
6785     * The number of elements pointed to by `data`.
6786     */
6787    uintptr_t datalen;
6788 } LDKCVec_EventZ;
6789
6790 /**
6791  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6792  * This corresponds to std::vector in C++
6793  */
6794 typedef struct LDKCVec_TransactionZ {
6795    /**
6796     * The elements in the array.
6797     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6798     */
6799    struct LDKTransaction *data;
6800    /**
6801     * The number of elements pointed to by `data`.
6802     */
6803    uintptr_t datalen;
6804 } LDKCVec_TransactionZ;
6805
6806 /**
6807  * A tuple of 2 elements. See the individual fields for the types contained.
6808  */
6809 typedef struct LDKC2Tuple_u32TxOutZ {
6810    /**
6811     * The element at position 0
6812     */
6813    uint32_t a;
6814    /**
6815     * The element at position 1
6816     */
6817    struct LDKTxOut b;
6818 } LDKC2Tuple_u32TxOutZ;
6819
6820 /**
6821  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6822  * This corresponds to std::vector in C++
6823  */
6824 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
6825    /**
6826     * The elements in the array.
6827     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6828     */
6829    struct LDKC2Tuple_u32TxOutZ *data;
6830    /**
6831     * The number of elements pointed to by `data`.
6832     */
6833    uintptr_t datalen;
6834 } LDKCVec_C2Tuple_u32TxOutZZ;
6835
6836 /**
6837  * A tuple of 2 elements. See the individual fields for the types contained.
6838  */
6839 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6840    /**
6841     * The element at position 0
6842     */
6843    struct LDKThirtyTwoBytes a;
6844    /**
6845     * The element at position 1
6846     */
6847    struct LDKCVec_C2Tuple_u32TxOutZZ b;
6848 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
6849
6850 /**
6851  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6852  * This corresponds to std::vector in C++
6853  */
6854 typedef struct LDKCVec_TransactionOutputsZ {
6855    /**
6856     * The elements in the array.
6857     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6858     */
6859    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
6860    /**
6861     * The number of elements pointed to by `data`.
6862     */
6863    uintptr_t datalen;
6864 } LDKCVec_TransactionOutputsZ;
6865
6866 /**
6867  * Details about the balance(s) available for spending once the channel appears on chain.
6868  *
6869  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
6870  * be provided.
6871  */
6872 typedef enum LDKBalance_Tag {
6873    /**
6874     * The channel is not yet closed (or the commitment or closing transaction has not yet
6875     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
6876     * force-closed now.
6877     */
6878    LDKBalance_ClaimableOnChannelClose,
6879    /**
6880     * The channel has been closed, and the given balance is ours but awaiting confirmations until
6881     * we consider it spendable.
6882     */
6883    LDKBalance_ClaimableAwaitingConfirmations,
6884    /**
6885     * The channel has been closed, and the given balance should be ours but awaiting spending
6886     * transaction confirmation. If the spending transaction does not confirm in time, it is
6887     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
6888     *
6889     * Once the spending transaction confirms, before it has reached enough confirmations to be
6890     * considered safe from chain reorganizations, the balance will instead be provided via
6891     * [`Balance::ClaimableAwaitingConfirmations`].
6892     */
6893    LDKBalance_ContentiousClaimable,
6894    /**
6895     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
6896     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
6897     * likely to be claimed by our counterparty before we do.
6898     */
6899    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
6900    /**
6901     * Must be last for serialization purposes
6902     */
6903    LDKBalance_Sentinel,
6904 } LDKBalance_Tag;
6905
6906 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
6907    /**
6908     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6909     * required to do so.
6910     */
6911    uint64_t claimable_amount_satoshis;
6912 } LDKBalance_LDKClaimableOnChannelClose_Body;
6913
6914 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
6915    /**
6916     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
6917     * were spent in broadcasting the transaction.
6918     */
6919    uint64_t claimable_amount_satoshis;
6920    /**
6921     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
6922     * amount.
6923     */
6924    uint32_t confirmation_height;
6925 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
6926
6927 typedef struct LDKBalance_LDKContentiousClaimable_Body {
6928    /**
6929     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6930     * required to do so.
6931     */
6932    uint64_t claimable_amount_satoshis;
6933    /**
6934     * The height at which the counterparty may be able to claim the balance if we have not
6935     * done so.
6936     */
6937    uint32_t timeout_height;
6938 } LDKBalance_LDKContentiousClaimable_Body;
6939
6940 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
6941    /**
6942     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6943     * required to do so.
6944     */
6945    uint64_t claimable_amount_satoshis;
6946    /**
6947     * The height at which we will be able to claim the balance if our counterparty has not
6948     * done so.
6949     */
6950    uint32_t claimable_height;
6951 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
6952
6953 typedef struct MUST_USE_STRUCT LDKBalance {
6954    LDKBalance_Tag tag;
6955    union {
6956       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
6957       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
6958       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
6959       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
6960    };
6961 } LDKBalance;
6962
6963 /**
6964  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6965  * This corresponds to std::vector in C++
6966  */
6967 typedef struct LDKCVec_BalanceZ {
6968    /**
6969     * The elements in the array.
6970     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6971     */
6972    struct LDKBalance *data;
6973    /**
6974     * The number of elements pointed to by `data`.
6975     */
6976    uintptr_t datalen;
6977 } LDKCVec_BalanceZ;
6978
6979 /**
6980  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6981  */
6982 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6983    /**
6984     * A pointer to the contents in the success state.
6985     * Reading from this pointer when `result_ok` is not set is undefined.
6986     */
6987    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
6988    /**
6989     * A pointer to the contents in the error state.
6990     * Reading from this pointer when `result_ok` is set is undefined.
6991     */
6992    struct LDKDecodeError *err;
6993 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
6994
6995 /**
6996  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6997  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6999  */
7000 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7001    /**
7002     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7003     * `err` or `result` depending on the state of `result_ok`.
7004     */
7005    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
7006    /**
7007     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7008     */
7009    bool result_ok;
7010 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
7011
7012 /**
7013  * The contents of CResult_NoneLightningErrorZ
7014  */
7015 typedef union LDKCResult_NoneLightningErrorZPtr {
7016    /**
7017     * Note that this value is always NULL, as there are no contents in the OK variant
7018     */
7019    void *result;
7020    /**
7021     * A pointer to the contents in the error state.
7022     * Reading from this pointer when `result_ok` is set is undefined.
7023     */
7024    struct LDKLightningError *err;
7025 } LDKCResult_NoneLightningErrorZPtr;
7026
7027 /**
7028  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7029  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7030  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7031  */
7032 typedef struct LDKCResult_NoneLightningErrorZ {
7033    /**
7034     * The contents of this CResult_NoneLightningErrorZ, accessible via either
7035     * `err` or `result` depending on the state of `result_ok`.
7036     */
7037    union LDKCResult_NoneLightningErrorZPtr contents;
7038    /**
7039     * Whether this CResult_NoneLightningErrorZ represents a success state.
7040     */
7041    bool result_ok;
7042 } LDKCResult_NoneLightningErrorZ;
7043
7044 /**
7045  * A tuple of 2 elements. See the individual fields for the types contained.
7046  */
7047 typedef struct LDKC2Tuple_PublicKeyTypeZ {
7048    /**
7049     * The element at position 0
7050     */
7051    struct LDKPublicKey a;
7052    /**
7053     * The element at position 1
7054     */
7055    struct LDKType b;
7056 } LDKC2Tuple_PublicKeyTypeZ;
7057
7058 /**
7059  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7060  * This corresponds to std::vector in C++
7061  */
7062 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
7063    /**
7064     * The elements in the array.
7065     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7066     */
7067    struct LDKC2Tuple_PublicKeyTypeZ *data;
7068    /**
7069     * The number of elements pointed to by `data`.
7070     */
7071    uintptr_t datalen;
7072 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
7073
7074 /**
7075  * The contents of CResult_boolLightningErrorZ
7076  */
7077 typedef union LDKCResult_boolLightningErrorZPtr {
7078    /**
7079     * A pointer to the contents in the success state.
7080     * Reading from this pointer when `result_ok` is not set is undefined.
7081     */
7082    bool *result;
7083    /**
7084     * A pointer to the contents in the error state.
7085     * Reading from this pointer when `result_ok` is set is undefined.
7086     */
7087    struct LDKLightningError *err;
7088 } LDKCResult_boolLightningErrorZPtr;
7089
7090 /**
7091  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
7092  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7093  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7094  */
7095 typedef struct LDKCResult_boolLightningErrorZ {
7096    /**
7097     * The contents of this CResult_boolLightningErrorZ, accessible via either
7098     * `err` or `result` depending on the state of `result_ok`.
7099     */
7100    union LDKCResult_boolLightningErrorZPtr contents;
7101    /**
7102     * Whether this CResult_boolLightningErrorZ represents a success state.
7103     */
7104    bool result_ok;
7105 } LDKCResult_boolLightningErrorZ;
7106
7107 /**
7108  * A tuple of 3 elements. See the individual fields for the types contained.
7109  */
7110 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7111    /**
7112     * The element at position 0
7113     */
7114    struct LDKChannelAnnouncement a;
7115    /**
7116     * The element at position 1
7117     */
7118    struct LDKChannelUpdate b;
7119    /**
7120     * The element at position 2
7121     */
7122    struct LDKChannelUpdate c;
7123 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
7124
7125 /**
7126  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7127  * This corresponds to std::vector in C++
7128  */
7129 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7130    /**
7131     * The elements in the array.
7132     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7133     */
7134    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
7135    /**
7136     * The number of elements pointed to by `data`.
7137     */
7138    uintptr_t datalen;
7139 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
7140
7141 /**
7142  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7143  * This corresponds to std::vector in C++
7144  */
7145 typedef struct LDKCVec_NodeAnnouncementZ {
7146    /**
7147     * The elements in the array.
7148     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7149     */
7150    struct LDKNodeAnnouncement *data;
7151    /**
7152     * The number of elements pointed to by `data`.
7153     */
7154    uintptr_t datalen;
7155 } LDKCVec_NodeAnnouncementZ;
7156
7157 /**
7158  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7159  * This corresponds to std::vector in C++
7160  */
7161 typedef struct LDKCVec_PublicKeyZ {
7162    /**
7163     * The elements in the array.
7164     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7165     */
7166    struct LDKPublicKey *data;
7167    /**
7168     * The number of elements pointed to by `data`.
7169     */
7170    uintptr_t datalen;
7171 } LDKCVec_PublicKeyZ;
7172
7173
7174
7175 /**
7176  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
7177  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
7178  * descriptor.
7179  */
7180 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
7181    /**
7182     * A pointer to the opaque Rust object.
7183     * Nearly everywhere, inner must be non-null, however in places where
7184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7185     */
7186    LDKnativePeerHandleError *inner;
7187    /**
7188     * Indicates that this is the only struct which contains the same pointer.
7189     * Rust functions which take ownership of an object provided via an argument require
7190     * this to be true and invalidate the object pointed to by inner.
7191     */
7192    bool is_owned;
7193 } LDKPeerHandleError;
7194
7195 /**
7196  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
7197  */
7198 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
7199    /**
7200     * A pointer to the contents in the success state.
7201     * Reading from this pointer when `result_ok` is not set is undefined.
7202     */
7203    struct LDKCVec_u8Z *result;
7204    /**
7205     * A pointer to the contents in the error state.
7206     * Reading from this pointer when `result_ok` is set is undefined.
7207     */
7208    struct LDKPeerHandleError *err;
7209 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
7210
7211 /**
7212  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7213  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7214  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7215  */
7216 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
7217    /**
7218     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7219     * `err` or `result` depending on the state of `result_ok`.
7220     */
7221    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
7222    /**
7223     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7224     */
7225    bool result_ok;
7226 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
7227
7228 /**
7229  * The contents of CResult_NonePeerHandleErrorZ
7230  */
7231 typedef union LDKCResult_NonePeerHandleErrorZPtr {
7232    /**
7233     * Note that this value is always NULL, as there are no contents in the OK variant
7234     */
7235    void *result;
7236    /**
7237     * A pointer to the contents in the error state.
7238     * Reading from this pointer when `result_ok` is set is undefined.
7239     */
7240    struct LDKPeerHandleError *err;
7241 } LDKCResult_NonePeerHandleErrorZPtr;
7242
7243 /**
7244  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7245  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7247  */
7248 typedef struct LDKCResult_NonePeerHandleErrorZ {
7249    /**
7250     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7251     * `err` or `result` depending on the state of `result_ok`.
7252     */
7253    union LDKCResult_NonePeerHandleErrorZPtr contents;
7254    /**
7255     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
7256     */
7257    bool result_ok;
7258 } LDKCResult_NonePeerHandleErrorZ;
7259
7260 /**
7261  * The contents of CResult_boolPeerHandleErrorZ
7262  */
7263 typedef union LDKCResult_boolPeerHandleErrorZPtr {
7264    /**
7265     * A pointer to the contents in the success state.
7266     * Reading from this pointer when `result_ok` is not set is undefined.
7267     */
7268    bool *result;
7269    /**
7270     * A pointer to the contents in the error state.
7271     * Reading from this pointer when `result_ok` is set is undefined.
7272     */
7273    struct LDKPeerHandleError *err;
7274 } LDKCResult_boolPeerHandleErrorZPtr;
7275
7276 /**
7277  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7278  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7280  */
7281 typedef struct LDKCResult_boolPeerHandleErrorZ {
7282    /**
7283     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7284     * `err` or `result` depending on the state of `result_ok`.
7285     */
7286    union LDKCResult_boolPeerHandleErrorZPtr contents;
7287    /**
7288     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
7289     */
7290    bool result_ok;
7291 } LDKCResult_boolPeerHandleErrorZ;
7292
7293
7294
7295 /**
7296  * Represents the compressed public key of a node
7297  */
7298 typedef struct MUST_USE_STRUCT LDKNodeId {
7299    /**
7300     * A pointer to the opaque Rust object.
7301     * Nearly everywhere, inner must be non-null, however in places where
7302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7303     */
7304    LDKnativeNodeId *inner;
7305    /**
7306     * Indicates that this is the only struct which contains the same pointer.
7307     * Rust functions which take ownership of an object provided via an argument require
7308     * this to be true and invalidate the object pointed to by inner.
7309     */
7310    bool is_owned;
7311 } LDKNodeId;
7312
7313 /**
7314  * The contents of CResult_NodeIdDecodeErrorZ
7315  */
7316 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
7317    /**
7318     * A pointer to the contents in the success state.
7319     * Reading from this pointer when `result_ok` is not set is undefined.
7320     */
7321    struct LDKNodeId *result;
7322    /**
7323     * A pointer to the contents in the error state.
7324     * Reading from this pointer when `result_ok` is set is undefined.
7325     */
7326    struct LDKDecodeError *err;
7327 } LDKCResult_NodeIdDecodeErrorZPtr;
7328
7329 /**
7330  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7331  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7332  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7333  */
7334 typedef struct LDKCResult_NodeIdDecodeErrorZ {
7335    /**
7336     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7337     * `err` or `result` depending on the state of `result_ok`.
7338     */
7339    union LDKCResult_NodeIdDecodeErrorZPtr contents;
7340    /**
7341     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7342     */
7343    bool result_ok;
7344 } LDKCResult_NodeIdDecodeErrorZ;
7345
7346 /**
7347  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7348  * UTXOs.
7349  */
7350 typedef struct LDKAccess {
7351    /**
7352     * An opaque pointer which is passed to your function implementations as an argument.
7353     * This has no meaning in the LDK, and can be NULL or any other value.
7354     */
7355    void *this_arg;
7356    /**
7357     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7358     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7359     * is unknown.
7360     *
7361     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7362     */
7363    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7364    /**
7365     * Frees any resources associated with this object given its this_arg pointer.
7366     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7367     */
7368    void (*free)(void *this_arg);
7369 } LDKAccess;
7370
7371 /**
7372  * An enum which can either contain a crate::lightning::chain::Access or not
7373  */
7374 typedef enum LDKCOption_AccessZ_Tag {
7375    /**
7376     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7377     */
7378    LDKCOption_AccessZ_Some,
7379    /**
7380     * When we're in this state, this COption_AccessZ contains nothing
7381     */
7382    LDKCOption_AccessZ_None,
7383    /**
7384     * Must be last for serialization purposes
7385     */
7386    LDKCOption_AccessZ_Sentinel,
7387 } LDKCOption_AccessZ_Tag;
7388
7389 typedef struct LDKCOption_AccessZ {
7390    LDKCOption_AccessZ_Tag tag;
7391    union {
7392       struct {
7393          struct LDKAccess some;
7394       };
7395    };
7396 } LDKCOption_AccessZ;
7397
7398
7399
7400 /**
7401  * Details about one direction of a channel. Received
7402  * within a channel update.
7403  */
7404 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
7405    /**
7406     * A pointer to the opaque Rust object.
7407     * Nearly everywhere, inner must be non-null, however in places where
7408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7409     */
7410    LDKnativeDirectionalChannelInfo *inner;
7411    /**
7412     * Indicates that this is the only struct which contains the same pointer.
7413     * Rust functions which take ownership of an object provided via an argument require
7414     * this to be true and invalidate the object pointed to by inner.
7415     */
7416    bool is_owned;
7417 } LDKDirectionalChannelInfo;
7418
7419 /**
7420  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7421  */
7422 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
7423    /**
7424     * A pointer to the contents in the success state.
7425     * Reading from this pointer when `result_ok` is not set is undefined.
7426     */
7427    struct LDKDirectionalChannelInfo *result;
7428    /**
7429     * A pointer to the contents in the error state.
7430     * Reading from this pointer when `result_ok` is set is undefined.
7431     */
7432    struct LDKDecodeError *err;
7433 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
7434
7435 /**
7436  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7437  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7439  */
7440 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
7441    /**
7442     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7443     * `err` or `result` depending on the state of `result_ok`.
7444     */
7445    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
7446    /**
7447     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7448     */
7449    bool result_ok;
7450 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
7451
7452
7453
7454 /**
7455  * Details about a channel (both directions).
7456  * Received within a channel announcement.
7457  */
7458 typedef struct MUST_USE_STRUCT LDKChannelInfo {
7459    /**
7460     * A pointer to the opaque Rust object.
7461     * Nearly everywhere, inner must be non-null, however in places where
7462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7463     */
7464    LDKnativeChannelInfo *inner;
7465    /**
7466     * Indicates that this is the only struct which contains the same pointer.
7467     * Rust functions which take ownership of an object provided via an argument require
7468     * this to be true and invalidate the object pointed to by inner.
7469     */
7470    bool is_owned;
7471 } LDKChannelInfo;
7472
7473 /**
7474  * The contents of CResult_ChannelInfoDecodeErrorZ
7475  */
7476 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
7477    /**
7478     * A pointer to the contents in the success state.
7479     * Reading from this pointer when `result_ok` is not set is undefined.
7480     */
7481    struct LDKChannelInfo *result;
7482    /**
7483     * A pointer to the contents in the error state.
7484     * Reading from this pointer when `result_ok` is set is undefined.
7485     */
7486    struct LDKDecodeError *err;
7487 } LDKCResult_ChannelInfoDecodeErrorZPtr;
7488
7489 /**
7490  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7491  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7492  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7493  */
7494 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
7495    /**
7496     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7497     * `err` or `result` depending on the state of `result_ok`.
7498     */
7499    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7500    /**
7501     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7502     */
7503    bool result_ok;
7504 } LDKCResult_ChannelInfoDecodeErrorZ;
7505
7506
7507
7508 /**
7509  * Fees for routing via a given channel or a node
7510  */
7511 typedef struct MUST_USE_STRUCT LDKRoutingFees {
7512    /**
7513     * A pointer to the opaque Rust object.
7514     * Nearly everywhere, inner must be non-null, however in places where
7515     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7516     */
7517    LDKnativeRoutingFees *inner;
7518    /**
7519     * Indicates that this is the only struct which contains the same pointer.
7520     * Rust functions which take ownership of an object provided via an argument require
7521     * this to be true and invalidate the object pointed to by inner.
7522     */
7523    bool is_owned;
7524 } LDKRoutingFees;
7525
7526 /**
7527  * The contents of CResult_RoutingFeesDecodeErrorZ
7528  */
7529 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
7530    /**
7531     * A pointer to the contents in the success state.
7532     * Reading from this pointer when `result_ok` is not set is undefined.
7533     */
7534    struct LDKRoutingFees *result;
7535    /**
7536     * A pointer to the contents in the error state.
7537     * Reading from this pointer when `result_ok` is set is undefined.
7538     */
7539    struct LDKDecodeError *err;
7540 } LDKCResult_RoutingFeesDecodeErrorZPtr;
7541
7542 /**
7543  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7544  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7545  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7546  */
7547 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
7548    /**
7549     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7550     * `err` or `result` depending on the state of `result_ok`.
7551     */
7552    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
7553    /**
7554     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7555     */
7556    bool result_ok;
7557 } LDKCResult_RoutingFeesDecodeErrorZ;
7558
7559
7560
7561 /**
7562  * Information received in the latest node_announcement from this node.
7563  */
7564 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7565    /**
7566     * A pointer to the opaque Rust object.
7567     * Nearly everywhere, inner must be non-null, however in places where
7568     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7569     */
7570    LDKnativeNodeAnnouncementInfo *inner;
7571    /**
7572     * Indicates that this is the only struct which contains the same pointer.
7573     * Rust functions which take ownership of an object provided via an argument require
7574     * this to be true and invalidate the object pointed to by inner.
7575     */
7576    bool is_owned;
7577 } LDKNodeAnnouncementInfo;
7578
7579 /**
7580  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7581  */
7582 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7583    /**
7584     * A pointer to the contents in the success state.
7585     * Reading from this pointer when `result_ok` is not set is undefined.
7586     */
7587    struct LDKNodeAnnouncementInfo *result;
7588    /**
7589     * A pointer to the contents in the error state.
7590     * Reading from this pointer when `result_ok` is set is undefined.
7591     */
7592    struct LDKDecodeError *err;
7593 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7594
7595 /**
7596  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7597  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7598  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7599  */
7600 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7601    /**
7602     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7603     * `err` or `result` depending on the state of `result_ok`.
7604     */
7605    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7606    /**
7607     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7608     */
7609    bool result_ok;
7610 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7611
7612 /**
7613  * A dynamically-allocated array of u64s of arbitrary size.
7614  * This corresponds to std::vector in C++
7615  */
7616 typedef struct LDKCVec_u64Z {
7617    /**
7618     * The elements in the array.
7619     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7620     */
7621    uint64_t *data;
7622    /**
7623     * The number of elements pointed to by `data`.
7624     */
7625    uintptr_t datalen;
7626 } LDKCVec_u64Z;
7627
7628
7629
7630 /**
7631  * Details about a node in the network, known from the network announcement.
7632  */
7633 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7634    /**
7635     * A pointer to the opaque Rust object.
7636     * Nearly everywhere, inner must be non-null, however in places where
7637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7638     */
7639    LDKnativeNodeInfo *inner;
7640    /**
7641     * Indicates that this is the only struct which contains the same pointer.
7642     * Rust functions which take ownership of an object provided via an argument require
7643     * this to be true and invalidate the object pointed to by inner.
7644     */
7645    bool is_owned;
7646 } LDKNodeInfo;
7647
7648 /**
7649  * The contents of CResult_NodeInfoDecodeErrorZ
7650  */
7651 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7652    /**
7653     * A pointer to the contents in the success state.
7654     * Reading from this pointer when `result_ok` is not set is undefined.
7655     */
7656    struct LDKNodeInfo *result;
7657    /**
7658     * A pointer to the contents in the error state.
7659     * Reading from this pointer when `result_ok` is set is undefined.
7660     */
7661    struct LDKDecodeError *err;
7662 } LDKCResult_NodeInfoDecodeErrorZPtr;
7663
7664 /**
7665  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7666  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7667  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7668  */
7669 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7670    /**
7671     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7672     * `err` or `result` depending on the state of `result_ok`.
7673     */
7674    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7675    /**
7676     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7677     */
7678    bool result_ok;
7679 } LDKCResult_NodeInfoDecodeErrorZ;
7680
7681
7682
7683 /**
7684  * Represents the network as nodes and channels between them
7685  */
7686 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
7687    /**
7688     * A pointer to the opaque Rust object.
7689     * Nearly everywhere, inner must be non-null, however in places where
7690     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7691     */
7692    LDKnativeNetworkGraph *inner;
7693    /**
7694     * Indicates that this is the only struct which contains the same pointer.
7695     * Rust functions which take ownership of an object provided via an argument require
7696     * this to be true and invalidate the object pointed to by inner.
7697     */
7698    bool is_owned;
7699 } LDKNetworkGraph;
7700
7701 /**
7702  * The contents of CResult_NetworkGraphDecodeErrorZ
7703  */
7704 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7705    /**
7706     * A pointer to the contents in the success state.
7707     * Reading from this pointer when `result_ok` is not set is undefined.
7708     */
7709    struct LDKNetworkGraph *result;
7710    /**
7711     * A pointer to the contents in the error state.
7712     * Reading from this pointer when `result_ok` is set is undefined.
7713     */
7714    struct LDKDecodeError *err;
7715 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7716
7717 /**
7718  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7719  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7721  */
7722 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7723    /**
7724     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7725     * `err` or `result` depending on the state of `result_ok`.
7726     */
7727    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7728    /**
7729     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7730     */
7731    bool result_ok;
7732 } LDKCResult_NetworkGraphDecodeErrorZ;
7733
7734 /**
7735  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7736  */
7737 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7738    /**
7739     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7740     */
7741    LDKCOption_CVec_NetAddressZZ_Some,
7742    /**
7743     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7744     */
7745    LDKCOption_CVec_NetAddressZZ_None,
7746    /**
7747     * Must be last for serialization purposes
7748     */
7749    LDKCOption_CVec_NetAddressZZ_Sentinel,
7750 } LDKCOption_CVec_NetAddressZZ_Tag;
7751
7752 typedef struct LDKCOption_CVec_NetAddressZZ {
7753    LDKCOption_CVec_NetAddressZZ_Tag tag;
7754    union {
7755       struct {
7756          struct LDKCVec_NetAddressZ some;
7757       };
7758    };
7759 } LDKCOption_CVec_NetAddressZZ;
7760
7761 /**
7762  * The contents of CResult_NetAddressDecodeErrorZ
7763  */
7764 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
7765    /**
7766     * A pointer to the contents in the success state.
7767     * Reading from this pointer when `result_ok` is not set is undefined.
7768     */
7769    struct LDKNetAddress *result;
7770    /**
7771     * A pointer to the contents in the error state.
7772     * Reading from this pointer when `result_ok` is set is undefined.
7773     */
7774    struct LDKDecodeError *err;
7775 } LDKCResult_NetAddressDecodeErrorZPtr;
7776
7777 /**
7778  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7779  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7781  */
7782 typedef struct LDKCResult_NetAddressDecodeErrorZ {
7783    /**
7784     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7785     * `err` or `result` depending on the state of `result_ok`.
7786     */
7787    union LDKCResult_NetAddressDecodeErrorZPtr contents;
7788    /**
7789     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7790     */
7791    bool result_ok;
7792 } LDKCResult_NetAddressDecodeErrorZ;
7793
7794
7795
7796 /**
7797  * An update_add_htlc message to be sent or received from a peer
7798  */
7799 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
7800    /**
7801     * A pointer to the opaque Rust object.
7802     * Nearly everywhere, inner must be non-null, however in places where
7803     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7804     */
7805    LDKnativeUpdateAddHTLC *inner;
7806    /**
7807     * Indicates that this is the only struct which contains the same pointer.
7808     * Rust functions which take ownership of an object provided via an argument require
7809     * this to be true and invalidate the object pointed to by inner.
7810     */
7811    bool is_owned;
7812 } LDKUpdateAddHTLC;
7813
7814 /**
7815  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7816  * This corresponds to std::vector in C++
7817  */
7818 typedef struct LDKCVec_UpdateAddHTLCZ {
7819    /**
7820     * The elements in the array.
7821     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7822     */
7823    struct LDKUpdateAddHTLC *data;
7824    /**
7825     * The number of elements pointed to by `data`.
7826     */
7827    uintptr_t datalen;
7828 } LDKCVec_UpdateAddHTLCZ;
7829
7830
7831
7832 /**
7833  * An update_fulfill_htlc message to be sent or received from a peer
7834  */
7835 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
7836    /**
7837     * A pointer to the opaque Rust object.
7838     * Nearly everywhere, inner must be non-null, however in places where
7839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7840     */
7841    LDKnativeUpdateFulfillHTLC *inner;
7842    /**
7843     * Indicates that this is the only struct which contains the same pointer.
7844     * Rust functions which take ownership of an object provided via an argument require
7845     * this to be true and invalidate the object pointed to by inner.
7846     */
7847    bool is_owned;
7848 } LDKUpdateFulfillHTLC;
7849
7850 /**
7851  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7852  * This corresponds to std::vector in C++
7853  */
7854 typedef struct LDKCVec_UpdateFulfillHTLCZ {
7855    /**
7856     * The elements in the array.
7857     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7858     */
7859    struct LDKUpdateFulfillHTLC *data;
7860    /**
7861     * The number of elements pointed to by `data`.
7862     */
7863    uintptr_t datalen;
7864 } LDKCVec_UpdateFulfillHTLCZ;
7865
7866
7867
7868 /**
7869  * An update_fail_htlc message to be sent or received from a peer
7870  */
7871 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
7872    /**
7873     * A pointer to the opaque Rust object.
7874     * Nearly everywhere, inner must be non-null, however in places where
7875     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7876     */
7877    LDKnativeUpdateFailHTLC *inner;
7878    /**
7879     * Indicates that this is the only struct which contains the same pointer.
7880     * Rust functions which take ownership of an object provided via an argument require
7881     * this to be true and invalidate the object pointed to by inner.
7882     */
7883    bool is_owned;
7884 } LDKUpdateFailHTLC;
7885
7886 /**
7887  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
7888  * This corresponds to std::vector in C++
7889  */
7890 typedef struct LDKCVec_UpdateFailHTLCZ {
7891    /**
7892     * The elements in the array.
7893     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7894     */
7895    struct LDKUpdateFailHTLC *data;
7896    /**
7897     * The number of elements pointed to by `data`.
7898     */
7899    uintptr_t datalen;
7900 } LDKCVec_UpdateFailHTLCZ;
7901
7902
7903
7904 /**
7905  * An update_fail_malformed_htlc message to be sent or received from a peer
7906  */
7907 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
7908    /**
7909     * A pointer to the opaque Rust object.
7910     * Nearly everywhere, inner must be non-null, however in places where
7911     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7912     */
7913    LDKnativeUpdateFailMalformedHTLC *inner;
7914    /**
7915     * Indicates that this is the only struct which contains the same pointer.
7916     * Rust functions which take ownership of an object provided via an argument require
7917     * this to be true and invalidate the object pointed to by inner.
7918     */
7919    bool is_owned;
7920 } LDKUpdateFailMalformedHTLC;
7921
7922 /**
7923  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
7924  * This corresponds to std::vector in C++
7925  */
7926 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
7927    /**
7928     * The elements in the array.
7929     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7930     */
7931    struct LDKUpdateFailMalformedHTLC *data;
7932    /**
7933     * The number of elements pointed to by `data`.
7934     */
7935    uintptr_t datalen;
7936 } LDKCVec_UpdateFailMalformedHTLCZ;
7937
7938 /**
7939  * The contents of CResult_AcceptChannelDecodeErrorZ
7940  */
7941 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
7942    /**
7943     * A pointer to the contents in the success state.
7944     * Reading from this pointer when `result_ok` is not set is undefined.
7945     */
7946    struct LDKAcceptChannel *result;
7947    /**
7948     * A pointer to the contents in the error state.
7949     * Reading from this pointer when `result_ok` is set is undefined.
7950     */
7951    struct LDKDecodeError *err;
7952 } LDKCResult_AcceptChannelDecodeErrorZPtr;
7953
7954 /**
7955  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
7956  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7957  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7958  */
7959 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
7960    /**
7961     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
7962     * `err` or `result` depending on the state of `result_ok`.
7963     */
7964    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
7965    /**
7966     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
7967     */
7968    bool result_ok;
7969 } LDKCResult_AcceptChannelDecodeErrorZ;
7970
7971 /**
7972  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
7973  */
7974 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
7975    /**
7976     * A pointer to the contents in the success state.
7977     * Reading from this pointer when `result_ok` is not set is undefined.
7978     */
7979    struct LDKAnnouncementSignatures *result;
7980    /**
7981     * A pointer to the contents in the error state.
7982     * Reading from this pointer when `result_ok` is set is undefined.
7983     */
7984    struct LDKDecodeError *err;
7985 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
7986
7987 /**
7988  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
7989  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
7990  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7991  */
7992 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
7993    /**
7994     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
7995     * `err` or `result` depending on the state of `result_ok`.
7996     */
7997    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
7998    /**
7999     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8000     */
8001    bool result_ok;
8002 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
8003
8004 /**
8005  * The contents of CResult_ChannelReestablishDecodeErrorZ
8006  */
8007 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
8008    /**
8009     * A pointer to the contents in the success state.
8010     * Reading from this pointer when `result_ok` is not set is undefined.
8011     */
8012    struct LDKChannelReestablish *result;
8013    /**
8014     * A pointer to the contents in the error state.
8015     * Reading from this pointer when `result_ok` is set is undefined.
8016     */
8017    struct LDKDecodeError *err;
8018 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
8019
8020 /**
8021  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8022  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8023  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8024  */
8025 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
8026    /**
8027     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8028     * `err` or `result` depending on the state of `result_ok`.
8029     */
8030    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
8031    /**
8032     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8033     */
8034    bool result_ok;
8035 } LDKCResult_ChannelReestablishDecodeErrorZ;
8036
8037 /**
8038  * The contents of CResult_ClosingSignedDecodeErrorZ
8039  */
8040 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
8041    /**
8042     * A pointer to the contents in the success state.
8043     * Reading from this pointer when `result_ok` is not set is undefined.
8044     */
8045    struct LDKClosingSigned *result;
8046    /**
8047     * A pointer to the contents in the error state.
8048     * Reading from this pointer when `result_ok` is set is undefined.
8049     */
8050    struct LDKDecodeError *err;
8051 } LDKCResult_ClosingSignedDecodeErrorZPtr;
8052
8053 /**
8054  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8055  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8056  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8057  */
8058 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
8059    /**
8060     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8061     * `err` or `result` depending on the state of `result_ok`.
8062     */
8063    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
8064    /**
8065     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8066     */
8067    bool result_ok;
8068 } LDKCResult_ClosingSignedDecodeErrorZ;
8069
8070
8071
8072 /**
8073  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
8074  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
8075  * to use.
8076  */
8077 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
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    LDKnativeClosingSignedFeeRange *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 } LDKClosingSignedFeeRange;
8091
8092 /**
8093  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
8094  */
8095 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8096    /**
8097     * A pointer to the contents in the success state.
8098     * Reading from this pointer when `result_ok` is not set is undefined.
8099     */
8100    struct LDKClosingSignedFeeRange *result;
8101    /**
8102     * A pointer to the contents in the error state.
8103     * Reading from this pointer when `result_ok` is set is undefined.
8104     */
8105    struct LDKDecodeError *err;
8106 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
8107
8108 /**
8109  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
8110  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8111  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8112  */
8113 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
8114    /**
8115     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8116     * `err` or `result` depending on the state of `result_ok`.
8117     */
8118    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
8119    /**
8120     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8121     */
8122    bool result_ok;
8123 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
8124
8125
8126
8127 /**
8128  * A commitment_signed message to be sent or received from a peer
8129  */
8130 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
8131    /**
8132     * A pointer to the opaque Rust object.
8133     * Nearly everywhere, inner must be non-null, however in places where
8134     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8135     */
8136    LDKnativeCommitmentSigned *inner;
8137    /**
8138     * Indicates that this is the only struct which contains the same pointer.
8139     * Rust functions which take ownership of an object provided via an argument require
8140     * this to be true and invalidate the object pointed to by inner.
8141     */
8142    bool is_owned;
8143 } LDKCommitmentSigned;
8144
8145 /**
8146  * The contents of CResult_CommitmentSignedDecodeErrorZ
8147  */
8148 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
8149    /**
8150     * A pointer to the contents in the success state.
8151     * Reading from this pointer when `result_ok` is not set is undefined.
8152     */
8153    struct LDKCommitmentSigned *result;
8154    /**
8155     * A pointer to the contents in the error state.
8156     * Reading from this pointer when `result_ok` is set is undefined.
8157     */
8158    struct LDKDecodeError *err;
8159 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
8160
8161 /**
8162  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8163  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8164  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8165  */
8166 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
8167    /**
8168     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8169     * `err` or `result` depending on the state of `result_ok`.
8170     */
8171    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
8172    /**
8173     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8174     */
8175    bool result_ok;
8176 } LDKCResult_CommitmentSignedDecodeErrorZ;
8177
8178 /**
8179  * The contents of CResult_FundingCreatedDecodeErrorZ
8180  */
8181 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
8182    /**
8183     * A pointer to the contents in the success state.
8184     * Reading from this pointer when `result_ok` is not set is undefined.
8185     */
8186    struct LDKFundingCreated *result;
8187    /**
8188     * A pointer to the contents in the error state.
8189     * Reading from this pointer when `result_ok` is set is undefined.
8190     */
8191    struct LDKDecodeError *err;
8192 } LDKCResult_FundingCreatedDecodeErrorZPtr;
8193
8194 /**
8195  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8196  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8197  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8198  */
8199 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
8200    /**
8201     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8202     * `err` or `result` depending on the state of `result_ok`.
8203     */
8204    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
8205    /**
8206     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8207     */
8208    bool result_ok;
8209 } LDKCResult_FundingCreatedDecodeErrorZ;
8210
8211 /**
8212  * The contents of CResult_FundingSignedDecodeErrorZ
8213  */
8214 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
8215    /**
8216     * A pointer to the contents in the success state.
8217     * Reading from this pointer when `result_ok` is not set is undefined.
8218     */
8219    struct LDKFundingSigned *result;
8220    /**
8221     * A pointer to the contents in the error state.
8222     * Reading from this pointer when `result_ok` is set is undefined.
8223     */
8224    struct LDKDecodeError *err;
8225 } LDKCResult_FundingSignedDecodeErrorZPtr;
8226
8227 /**
8228  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8229  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8230  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8231  */
8232 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
8233    /**
8234     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8235     * `err` or `result` depending on the state of `result_ok`.
8236     */
8237    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
8238    /**
8239     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8240     */
8241    bool result_ok;
8242 } LDKCResult_FundingSignedDecodeErrorZ;
8243
8244 /**
8245  * The contents of CResult_FundingLockedDecodeErrorZ
8246  */
8247 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
8248    /**
8249     * A pointer to the contents in the success state.
8250     * Reading from this pointer when `result_ok` is not set is undefined.
8251     */
8252    struct LDKFundingLocked *result;
8253    /**
8254     * A pointer to the contents in the error state.
8255     * Reading from this pointer when `result_ok` is set is undefined.
8256     */
8257    struct LDKDecodeError *err;
8258 } LDKCResult_FundingLockedDecodeErrorZPtr;
8259
8260 /**
8261  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8262  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8263  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8264  */
8265 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
8266    /**
8267     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8268     * `err` or `result` depending on the state of `result_ok`.
8269     */
8270    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
8271    /**
8272     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8273     */
8274    bool result_ok;
8275 } LDKCResult_FundingLockedDecodeErrorZ;
8276
8277
8278
8279 /**
8280  * An init message to be sent or received from a peer
8281  */
8282 typedef struct MUST_USE_STRUCT LDKInit {
8283    /**
8284     * A pointer to the opaque Rust object.
8285     * Nearly everywhere, inner must be non-null, however in places where
8286     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8287     */
8288    LDKnativeInit *inner;
8289    /**
8290     * Indicates that this is the only struct which contains the same pointer.
8291     * Rust functions which take ownership of an object provided via an argument require
8292     * this to be true and invalidate the object pointed to by inner.
8293     */
8294    bool is_owned;
8295 } LDKInit;
8296
8297 /**
8298  * The contents of CResult_InitDecodeErrorZ
8299  */
8300 typedef union LDKCResult_InitDecodeErrorZPtr {
8301    /**
8302     * A pointer to the contents in the success state.
8303     * Reading from this pointer when `result_ok` is not set is undefined.
8304     */
8305    struct LDKInit *result;
8306    /**
8307     * A pointer to the contents in the error state.
8308     * Reading from this pointer when `result_ok` is set is undefined.
8309     */
8310    struct LDKDecodeError *err;
8311 } LDKCResult_InitDecodeErrorZPtr;
8312
8313 /**
8314  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8315  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8316  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8317  */
8318 typedef struct LDKCResult_InitDecodeErrorZ {
8319    /**
8320     * The contents of this CResult_InitDecodeErrorZ, accessible via either
8321     * `err` or `result` depending on the state of `result_ok`.
8322     */
8323    union LDKCResult_InitDecodeErrorZPtr contents;
8324    /**
8325     * Whether this CResult_InitDecodeErrorZ represents a success state.
8326     */
8327    bool result_ok;
8328 } LDKCResult_InitDecodeErrorZ;
8329
8330 /**
8331  * The contents of CResult_OpenChannelDecodeErrorZ
8332  */
8333 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
8334    /**
8335     * A pointer to the contents in the success state.
8336     * Reading from this pointer when `result_ok` is not set is undefined.
8337     */
8338    struct LDKOpenChannel *result;
8339    /**
8340     * A pointer to the contents in the error state.
8341     * Reading from this pointer when `result_ok` is set is undefined.
8342     */
8343    struct LDKDecodeError *err;
8344 } LDKCResult_OpenChannelDecodeErrorZPtr;
8345
8346 /**
8347  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8348  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8350  */
8351 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
8352    /**
8353     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8354     * `err` or `result` depending on the state of `result_ok`.
8355     */
8356    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
8357    /**
8358     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8359     */
8360    bool result_ok;
8361 } LDKCResult_OpenChannelDecodeErrorZ;
8362
8363 /**
8364  * The contents of CResult_RevokeAndACKDecodeErrorZ
8365  */
8366 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
8367    /**
8368     * A pointer to the contents in the success state.
8369     * Reading from this pointer when `result_ok` is not set is undefined.
8370     */
8371    struct LDKRevokeAndACK *result;
8372    /**
8373     * A pointer to the contents in the error state.
8374     * Reading from this pointer when `result_ok` is set is undefined.
8375     */
8376    struct LDKDecodeError *err;
8377 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
8378
8379 /**
8380  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
8381  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
8382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8383  */
8384 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
8385    /**
8386     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
8387     * `err` or `result` depending on the state of `result_ok`.
8388     */
8389    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
8390    /**
8391     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
8392     */
8393    bool result_ok;
8394 } LDKCResult_RevokeAndACKDecodeErrorZ;
8395
8396 /**
8397  * The contents of CResult_ShutdownDecodeErrorZ
8398  */
8399 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
8400    /**
8401     * A pointer to the contents in the success state.
8402     * Reading from this pointer when `result_ok` is not set is undefined.
8403     */
8404    struct LDKShutdown *result;
8405    /**
8406     * A pointer to the contents in the error state.
8407     * Reading from this pointer when `result_ok` is set is undefined.
8408     */
8409    struct LDKDecodeError *err;
8410 } LDKCResult_ShutdownDecodeErrorZPtr;
8411
8412 /**
8413  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
8414  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
8415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8416  */
8417 typedef struct LDKCResult_ShutdownDecodeErrorZ {
8418    /**
8419     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
8420     * `err` or `result` depending on the state of `result_ok`.
8421     */
8422    union LDKCResult_ShutdownDecodeErrorZPtr contents;
8423    /**
8424     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
8425     */
8426    bool result_ok;
8427 } LDKCResult_ShutdownDecodeErrorZ;
8428
8429 /**
8430  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
8431  */
8432 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
8433    /**
8434     * A pointer to the contents in the success state.
8435     * Reading from this pointer when `result_ok` is not set is undefined.
8436     */
8437    struct LDKUpdateFailHTLC *result;
8438    /**
8439     * A pointer to the contents in the error state.
8440     * Reading from this pointer when `result_ok` is set is undefined.
8441     */
8442    struct LDKDecodeError *err;
8443 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
8444
8445 /**
8446  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
8447  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8448  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8449  */
8450 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
8451    /**
8452     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
8453     * `err` or `result` depending on the state of `result_ok`.
8454     */
8455    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
8456    /**
8457     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
8458     */
8459    bool result_ok;
8460 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
8461
8462 /**
8463  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
8464  */
8465 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
8466    /**
8467     * A pointer to the contents in the success state.
8468     * Reading from this pointer when `result_ok` is not set is undefined.
8469     */
8470    struct LDKUpdateFailMalformedHTLC *result;
8471    /**
8472     * A pointer to the contents in the error state.
8473     * Reading from this pointer when `result_ok` is set is undefined.
8474     */
8475    struct LDKDecodeError *err;
8476 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
8477
8478 /**
8479  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
8480  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8481  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8482  */
8483 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
8484    /**
8485     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
8486     * `err` or `result` depending on the state of `result_ok`.
8487     */
8488    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
8489    /**
8490     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
8491     */
8492    bool result_ok;
8493 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
8494
8495
8496
8497 /**
8498  * An update_fee message to be sent or received from a peer
8499  */
8500 typedef struct MUST_USE_STRUCT LDKUpdateFee {
8501    /**
8502     * A pointer to the opaque Rust object.
8503     * Nearly everywhere, inner must be non-null, however in places where
8504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8505     */
8506    LDKnativeUpdateFee *inner;
8507    /**
8508     * Indicates that this is the only struct which contains the same pointer.
8509     * Rust functions which take ownership of an object provided via an argument require
8510     * this to be true and invalidate the object pointed to by inner.
8511     */
8512    bool is_owned;
8513 } LDKUpdateFee;
8514
8515 /**
8516  * The contents of CResult_UpdateFeeDecodeErrorZ
8517  */
8518 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
8519    /**
8520     * A pointer to the contents in the success state.
8521     * Reading from this pointer when `result_ok` is not set is undefined.
8522     */
8523    struct LDKUpdateFee *result;
8524    /**
8525     * A pointer to the contents in the error state.
8526     * Reading from this pointer when `result_ok` is set is undefined.
8527     */
8528    struct LDKDecodeError *err;
8529 } LDKCResult_UpdateFeeDecodeErrorZPtr;
8530
8531 /**
8532  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
8533  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
8534  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8535  */
8536 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
8537    /**
8538     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
8539     * `err` or `result` depending on the state of `result_ok`.
8540     */
8541    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
8542    /**
8543     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
8544     */
8545    bool result_ok;
8546 } LDKCResult_UpdateFeeDecodeErrorZ;
8547
8548 /**
8549  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
8550  */
8551 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
8552    /**
8553     * A pointer to the contents in the success state.
8554     * Reading from this pointer when `result_ok` is not set is undefined.
8555     */
8556    struct LDKUpdateFulfillHTLC *result;
8557    /**
8558     * A pointer to the contents in the error state.
8559     * Reading from this pointer when `result_ok` is set is undefined.
8560     */
8561    struct LDKDecodeError *err;
8562 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
8563
8564 /**
8565  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
8566  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8567  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8568  */
8569 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
8570    /**
8571     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
8572     * `err` or `result` depending on the state of `result_ok`.
8573     */
8574    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
8575    /**
8576     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
8577     */
8578    bool result_ok;
8579 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
8580
8581 /**
8582  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
8583  */
8584 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
8585    /**
8586     * A pointer to the contents in the success state.
8587     * Reading from this pointer when `result_ok` is not set is undefined.
8588     */
8589    struct LDKUpdateAddHTLC *result;
8590    /**
8591     * A pointer to the contents in the error state.
8592     * Reading from this pointer when `result_ok` is set is undefined.
8593     */
8594    struct LDKDecodeError *err;
8595 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
8596
8597 /**
8598  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
8599  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8600  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8601  */
8602 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
8603    /**
8604     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
8605     * `err` or `result` depending on the state of `result_ok`.
8606     */
8607    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
8608    /**
8609     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
8610     */
8611    bool result_ok;
8612 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
8613
8614
8615
8616 /**
8617  * A ping message to be sent or received from a peer
8618  */
8619 typedef struct MUST_USE_STRUCT LDKPing {
8620    /**
8621     * A pointer to the opaque Rust object.
8622     * Nearly everywhere, inner must be non-null, however in places where
8623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8624     */
8625    LDKnativePing *inner;
8626    /**
8627     * Indicates that this is the only struct which contains the same pointer.
8628     * Rust functions which take ownership of an object provided via an argument require
8629     * this to be true and invalidate the object pointed to by inner.
8630     */
8631    bool is_owned;
8632 } LDKPing;
8633
8634 /**
8635  * The contents of CResult_PingDecodeErrorZ
8636  */
8637 typedef union LDKCResult_PingDecodeErrorZPtr {
8638    /**
8639     * A pointer to the contents in the success state.
8640     * Reading from this pointer when `result_ok` is not set is undefined.
8641     */
8642    struct LDKPing *result;
8643    /**
8644     * A pointer to the contents in the error state.
8645     * Reading from this pointer when `result_ok` is set is undefined.
8646     */
8647    struct LDKDecodeError *err;
8648 } LDKCResult_PingDecodeErrorZPtr;
8649
8650 /**
8651  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
8652  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
8653  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8654  */
8655 typedef struct LDKCResult_PingDecodeErrorZ {
8656    /**
8657     * The contents of this CResult_PingDecodeErrorZ, accessible via either
8658     * `err` or `result` depending on the state of `result_ok`.
8659     */
8660    union LDKCResult_PingDecodeErrorZPtr contents;
8661    /**
8662     * Whether this CResult_PingDecodeErrorZ represents a success state.
8663     */
8664    bool result_ok;
8665 } LDKCResult_PingDecodeErrorZ;
8666
8667
8668
8669 /**
8670  * A pong message to be sent or received from a peer
8671  */
8672 typedef struct MUST_USE_STRUCT LDKPong {
8673    /**
8674     * A pointer to the opaque Rust object.
8675     * Nearly everywhere, inner must be non-null, however in places where
8676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8677     */
8678    LDKnativePong *inner;
8679    /**
8680     * Indicates that this is the only struct which contains the same pointer.
8681     * Rust functions which take ownership of an object provided via an argument require
8682     * this to be true and invalidate the object pointed to by inner.
8683     */
8684    bool is_owned;
8685 } LDKPong;
8686
8687 /**
8688  * The contents of CResult_PongDecodeErrorZ
8689  */
8690 typedef union LDKCResult_PongDecodeErrorZPtr {
8691    /**
8692     * A pointer to the contents in the success state.
8693     * Reading from this pointer when `result_ok` is not set is undefined.
8694     */
8695    struct LDKPong *result;
8696    /**
8697     * A pointer to the contents in the error state.
8698     * Reading from this pointer when `result_ok` is set is undefined.
8699     */
8700    struct LDKDecodeError *err;
8701 } LDKCResult_PongDecodeErrorZPtr;
8702
8703 /**
8704  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
8705  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
8706  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8707  */
8708 typedef struct LDKCResult_PongDecodeErrorZ {
8709    /**
8710     * The contents of this CResult_PongDecodeErrorZ, accessible via either
8711     * `err` or `result` depending on the state of `result_ok`.
8712     */
8713    union LDKCResult_PongDecodeErrorZPtr contents;
8714    /**
8715     * Whether this CResult_PongDecodeErrorZ represents a success state.
8716     */
8717    bool result_ok;
8718 } LDKCResult_PongDecodeErrorZ;
8719
8720 /**
8721  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
8722  */
8723 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8724    /**
8725     * A pointer to the contents in the success state.
8726     * Reading from this pointer when `result_ok` is not set is undefined.
8727     */
8728    struct LDKUnsignedChannelAnnouncement *result;
8729    /**
8730     * A pointer to the contents in the error state.
8731     * Reading from this pointer when `result_ok` is set is undefined.
8732     */
8733    struct LDKDecodeError *err;
8734 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
8735
8736 /**
8737  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8738  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8739  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8740  */
8741 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
8742    /**
8743     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
8744     * `err` or `result` depending on the state of `result_ok`.
8745     */
8746    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
8747    /**
8748     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
8749     */
8750    bool result_ok;
8751 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
8752
8753 /**
8754  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
8755  */
8756 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
8757    /**
8758     * A pointer to the contents in the success state.
8759     * Reading from this pointer when `result_ok` is not set is undefined.
8760     */
8761    struct LDKChannelAnnouncement *result;
8762    /**
8763     * A pointer to the contents in the error state.
8764     * Reading from this pointer when `result_ok` is set is undefined.
8765     */
8766    struct LDKDecodeError *err;
8767 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
8768
8769 /**
8770  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8771  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8772  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8773  */
8774 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
8775    /**
8776     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8777     * `err` or `result` depending on the state of `result_ok`.
8778     */
8779    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
8780    /**
8781     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8782     */
8783    bool result_ok;
8784 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
8785
8786
8787
8788 /**
8789  * The unsigned part of a channel_update
8790  */
8791 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8792    /**
8793     * A pointer to the opaque Rust object.
8794     * Nearly everywhere, inner must be non-null, however in places where
8795     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8796     */
8797    LDKnativeUnsignedChannelUpdate *inner;
8798    /**
8799     * Indicates that this is the only struct which contains the same pointer.
8800     * Rust functions which take ownership of an object provided via an argument require
8801     * this to be true and invalidate the object pointed to by inner.
8802     */
8803    bool is_owned;
8804 } LDKUnsignedChannelUpdate;
8805
8806 /**
8807  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8808  */
8809 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
8810    /**
8811     * A pointer to the contents in the success state.
8812     * Reading from this pointer when `result_ok` is not set is undefined.
8813     */
8814    struct LDKUnsignedChannelUpdate *result;
8815    /**
8816     * A pointer to the contents in the error state.
8817     * Reading from this pointer when `result_ok` is set is undefined.
8818     */
8819    struct LDKDecodeError *err;
8820 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
8821
8822 /**
8823  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8824  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8825  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8826  */
8827 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
8828    /**
8829     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8830     * `err` or `result` depending on the state of `result_ok`.
8831     */
8832    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
8833    /**
8834     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8835     */
8836    bool result_ok;
8837 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
8838
8839 /**
8840  * The contents of CResult_ChannelUpdateDecodeErrorZ
8841  */
8842 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
8843    /**
8844     * A pointer to the contents in the success state.
8845     * Reading from this pointer when `result_ok` is not set is undefined.
8846     */
8847    struct LDKChannelUpdate *result;
8848    /**
8849     * A pointer to the contents in the error state.
8850     * Reading from this pointer when `result_ok` is set is undefined.
8851     */
8852    struct LDKDecodeError *err;
8853 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
8854
8855 /**
8856  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8857  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8858  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8859  */
8860 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
8861    /**
8862     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8863     * `err` or `result` depending on the state of `result_ok`.
8864     */
8865    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
8866    /**
8867     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8868     */
8869    bool result_ok;
8870 } LDKCResult_ChannelUpdateDecodeErrorZ;
8871
8872 /**
8873  * The contents of CResult_ErrorMessageDecodeErrorZ
8874  */
8875 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
8876    /**
8877     * A pointer to the contents in the success state.
8878     * Reading from this pointer when `result_ok` is not set is undefined.
8879     */
8880    struct LDKErrorMessage *result;
8881    /**
8882     * A pointer to the contents in the error state.
8883     * Reading from this pointer when `result_ok` is set is undefined.
8884     */
8885    struct LDKDecodeError *err;
8886 } LDKCResult_ErrorMessageDecodeErrorZPtr;
8887
8888 /**
8889  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8890  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8891  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8892  */
8893 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
8894    /**
8895     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8896     * `err` or `result` depending on the state of `result_ok`.
8897     */
8898    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
8899    /**
8900     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8901     */
8902    bool result_ok;
8903 } LDKCResult_ErrorMessageDecodeErrorZ;
8904
8905
8906
8907 /**
8908  * The unsigned part of a node_announcement
8909  */
8910 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8911    /**
8912     * A pointer to the opaque Rust object.
8913     * Nearly everywhere, inner must be non-null, however in places where
8914     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8915     */
8916    LDKnativeUnsignedNodeAnnouncement *inner;
8917    /**
8918     * Indicates that this is the only struct which contains the same pointer.
8919     * Rust functions which take ownership of an object provided via an argument require
8920     * this to be true and invalidate the object pointed to by inner.
8921     */
8922    bool is_owned;
8923 } LDKUnsignedNodeAnnouncement;
8924
8925 /**
8926  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8927  */
8928 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8929    /**
8930     * A pointer to the contents in the success state.
8931     * Reading from this pointer when `result_ok` is not set is undefined.
8932     */
8933    struct LDKUnsignedNodeAnnouncement *result;
8934    /**
8935     * A pointer to the contents in the error state.
8936     * Reading from this pointer when `result_ok` is set is undefined.
8937     */
8938    struct LDKDecodeError *err;
8939 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
8940
8941 /**
8942  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8943  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8944  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8945  */
8946 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
8947    /**
8948     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8949     * `err` or `result` depending on the state of `result_ok`.
8950     */
8951    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
8952    /**
8953     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8954     */
8955    bool result_ok;
8956 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
8957
8958 /**
8959  * The contents of CResult_NodeAnnouncementDecodeErrorZ
8960  */
8961 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
8962    /**
8963     * A pointer to the contents in the success state.
8964     * Reading from this pointer when `result_ok` is not set is undefined.
8965     */
8966    struct LDKNodeAnnouncement *result;
8967    /**
8968     * A pointer to the contents in the error state.
8969     * Reading from this pointer when `result_ok` is set is undefined.
8970     */
8971    struct LDKDecodeError *err;
8972 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
8973
8974 /**
8975  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8976  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8977  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8978  */
8979 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
8980    /**
8981     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8982     * `err` or `result` depending on the state of `result_ok`.
8983     */
8984    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
8985    /**
8986     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8987     */
8988    bool result_ok;
8989 } LDKCResult_NodeAnnouncementDecodeErrorZ;
8990
8991 /**
8992  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8993  */
8994 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
8995    /**
8996     * A pointer to the contents in the success state.
8997     * Reading from this pointer when `result_ok` is not set is undefined.
8998     */
8999    struct LDKQueryShortChannelIds *result;
9000    /**
9001     * A pointer to the contents in the error state.
9002     * Reading from this pointer when `result_ok` is set is undefined.
9003     */
9004    struct LDKDecodeError *err;
9005 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
9006
9007 /**
9008  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
9009  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
9010  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9011  */
9012 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
9013    /**
9014     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
9015     * `err` or `result` depending on the state of `result_ok`.
9016     */
9017    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
9018    /**
9019     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
9020     */
9021    bool result_ok;
9022 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
9023
9024
9025
9026 /**
9027  * A reply_short_channel_ids_end message is sent as a reply to a
9028  * query_short_channel_ids message. The query recipient makes a best
9029  * effort to respond based on their local network view which may not be
9030  * a perfect view of the network.
9031  */
9032 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
9033    /**
9034     * A pointer to the opaque Rust object.
9035     * Nearly everywhere, inner must be non-null, however in places where
9036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9037     */
9038    LDKnativeReplyShortChannelIdsEnd *inner;
9039    /**
9040     * Indicates that this is the only struct which contains the same pointer.
9041     * Rust functions which take ownership of an object provided via an argument require
9042     * this to be true and invalidate the object pointed to by inner.
9043     */
9044    bool is_owned;
9045 } LDKReplyShortChannelIdsEnd;
9046
9047 /**
9048  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
9049  */
9050 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
9051    /**
9052     * A pointer to the contents in the success state.
9053     * Reading from this pointer when `result_ok` is not set is undefined.
9054     */
9055    struct LDKReplyShortChannelIdsEnd *result;
9056    /**
9057     * A pointer to the contents in the error state.
9058     * Reading from this pointer when `result_ok` is set is undefined.
9059     */
9060    struct LDKDecodeError *err;
9061 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
9062
9063 /**
9064  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
9065  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
9066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9067  */
9068 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
9069    /**
9070     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
9071     * `err` or `result` depending on the state of `result_ok`.
9072     */
9073    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
9074    /**
9075     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
9076     */
9077    bool result_ok;
9078 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
9079
9080 /**
9081  * The contents of CResult_QueryChannelRangeDecodeErrorZ
9082  */
9083 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
9084    /**
9085     * A pointer to the contents in the success state.
9086     * Reading from this pointer when `result_ok` is not set is undefined.
9087     */
9088    struct LDKQueryChannelRange *result;
9089    /**
9090     * A pointer to the contents in the error state.
9091     * Reading from this pointer when `result_ok` is set is undefined.
9092     */
9093    struct LDKDecodeError *err;
9094 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
9095
9096 /**
9097  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
9098  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9100  */
9101 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
9102    /**
9103     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
9104     * `err` or `result` depending on the state of `result_ok`.
9105     */
9106    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
9107    /**
9108     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
9109     */
9110    bool result_ok;
9111 } LDKCResult_QueryChannelRangeDecodeErrorZ;
9112
9113 /**
9114  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
9115  */
9116 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
9117    /**
9118     * A pointer to the contents in the success state.
9119     * Reading from this pointer when `result_ok` is not set is undefined.
9120     */
9121    struct LDKReplyChannelRange *result;
9122    /**
9123     * A pointer to the contents in the error state.
9124     * Reading from this pointer when `result_ok` is set is undefined.
9125     */
9126    struct LDKDecodeError *err;
9127 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
9128
9129 /**
9130  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
9131  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9132  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9133  */
9134 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
9135    /**
9136     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
9137     * `err` or `result` depending on the state of `result_ok`.
9138     */
9139    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
9140    /**
9141     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
9142     */
9143    bool result_ok;
9144 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
9145
9146
9147
9148 /**
9149  * A gossip_timestamp_filter message is used by a node to request
9150  * gossip relay for messages in the requested time range when the
9151  * gossip_queries feature has been negotiated.
9152  */
9153 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
9154    /**
9155     * A pointer to the opaque Rust object.
9156     * Nearly everywhere, inner must be non-null, however in places where
9157     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9158     */
9159    LDKnativeGossipTimestampFilter *inner;
9160    /**
9161     * Indicates that this is the only struct which contains the same pointer.
9162     * Rust functions which take ownership of an object provided via an argument require
9163     * this to be true and invalidate the object pointed to by inner.
9164     */
9165    bool is_owned;
9166 } LDKGossipTimestampFilter;
9167
9168 /**
9169  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
9170  */
9171 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
9172    /**
9173     * A pointer to the contents in the success state.
9174     * Reading from this pointer when `result_ok` is not set is undefined.
9175     */
9176    struct LDKGossipTimestampFilter *result;
9177    /**
9178     * A pointer to the contents in the error state.
9179     * Reading from this pointer when `result_ok` is set is undefined.
9180     */
9181    struct LDKDecodeError *err;
9182 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
9183
9184 /**
9185  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
9186  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
9187  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9188  */
9189 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
9190    /**
9191     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
9192     * `err` or `result` depending on the state of `result_ok`.
9193     */
9194    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
9195    /**
9196     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
9197     */
9198    bool result_ok;
9199 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
9200
9201 /**
9202  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
9203  * may occur.
9204  */
9205 typedef enum LDKSignOrCreationError_Tag {
9206    /**
9207     * An error occurred during signing
9208     */
9209    LDKSignOrCreationError_SignError,
9210    /**
9211     * An error occurred while building the transaction
9212     */
9213    LDKSignOrCreationError_CreationError,
9214    /**
9215     * Must be last for serialization purposes
9216     */
9217    LDKSignOrCreationError_Sentinel,
9218 } LDKSignOrCreationError_Tag;
9219
9220 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
9221    LDKSignOrCreationError_Tag tag;
9222    union {
9223       struct {
9224          enum LDKCreationError creation_error;
9225       };
9226    };
9227 } LDKSignOrCreationError;
9228
9229 /**
9230  * The contents of CResult_InvoiceSignOrCreationErrorZ
9231  */
9232 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
9233    /**
9234     * A pointer to the contents in the success state.
9235     * Reading from this pointer when `result_ok` is not set is undefined.
9236     */
9237    struct LDKInvoice *result;
9238    /**
9239     * A pointer to the contents in the error state.
9240     * Reading from this pointer when `result_ok` is set is undefined.
9241     */
9242    struct LDKSignOrCreationError *err;
9243 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
9244
9245 /**
9246  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9247  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9248  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9249  */
9250 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
9251    /**
9252     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9253     * `err` or `result` depending on the state of `result_ok`.
9254     */
9255    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
9256    /**
9257     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9258     */
9259    bool result_ok;
9260 } LDKCResult_InvoiceSignOrCreationErrorZ;
9261
9262
9263
9264 /**
9265  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
9266  *
9267  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
9268  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
9269  * the return value of [`Filter::register_output`].
9270  *
9271  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
9272  * may have been spent there. See [`Filter::register_output`] for details.
9273  *
9274  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
9275  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
9276  */
9277 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
9278    /**
9279     * A pointer to the opaque Rust object.
9280     * Nearly everywhere, inner must be non-null, however in places where
9281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9282     */
9283    LDKnativeWatchedOutput *inner;
9284    /**
9285     * Indicates that this is the only struct which contains the same pointer.
9286     * Rust functions which take ownership of an object provided via an argument require
9287     * this to be true and invalidate the object pointed to by inner.
9288     */
9289    bool is_owned;
9290 } LDKWatchedOutput;
9291
9292 /**
9293  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
9294  * channels.
9295  *
9296  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
9297  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
9298  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
9299  * receiving full blocks from a chain source, any further filtering is unnecessary.
9300  *
9301  * After an output has been registered, subsequent block retrievals from the chain source must not
9302  * exclude any transactions matching the new criteria nor any in-block descendants of such
9303  * transactions.
9304  *
9305  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
9306  * should not block on I/O. Implementations should instead queue the newly monitored data to be
9307  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
9308  * invocation that has called the `Filter` must return [`TemporaryFailure`].
9309  *
9310  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
9311  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
9312  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
9313  */
9314 typedef struct LDKFilter {
9315    /**
9316     * An opaque pointer which is passed to your function implementations as an argument.
9317     * This has no meaning in the LDK, and can be NULL or any other value.
9318     */
9319    void *this_arg;
9320    /**
9321     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
9322     * a spending condition.
9323     */
9324    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
9325    /**
9326     * Registers interest in spends of a transaction output.
9327     *
9328     * Optionally, when `output.block_hash` is set, should return any transaction spending the
9329     * output that is found in the corresponding block along with its index.
9330     *
9331     * This return value is useful for Electrum clients in order to supply in-block descendant
9332     * transactions which otherwise were not included. This is not necessary for other clients if
9333     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
9334     * full block).
9335     */
9336    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
9337    /**
9338     * Frees any resources associated with this object given its this_arg pointer.
9339     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9340     */
9341    void (*free)(void *this_arg);
9342 } LDKFilter;
9343
9344 /**
9345  * An enum which can either contain a crate::lightning::chain::Filter or not
9346  */
9347 typedef enum LDKCOption_FilterZ_Tag {
9348    /**
9349     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
9350     */
9351    LDKCOption_FilterZ_Some,
9352    /**
9353     * When we're in this state, this COption_FilterZ contains nothing
9354     */
9355    LDKCOption_FilterZ_None,
9356    /**
9357     * Must be last for serialization purposes
9358     */
9359    LDKCOption_FilterZ_Sentinel,
9360 } LDKCOption_FilterZ_Tag;
9361
9362 typedef struct LDKCOption_FilterZ {
9363    LDKCOption_FilterZ_Tag tag;
9364    union {
9365       struct {
9366          struct LDKFilter some;
9367       };
9368    };
9369 } LDKCOption_FilterZ;
9370
9371
9372
9373 /**
9374  * A read-only reference to a current ChannelMonitor.
9375  *
9376  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
9377  * released.
9378  */
9379 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
9380    /**
9381     * A pointer to the opaque Rust object.
9382     * Nearly everywhere, inner must be non-null, however in places where
9383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9384     */
9385    LDKnativeLockedChannelMonitor *inner;
9386    /**
9387     * Indicates that this is the only struct which contains the same pointer.
9388     * Rust functions which take ownership of an object provided via an argument require
9389     * this to be true and invalidate the object pointed to by inner.
9390     */
9391    bool is_owned;
9392 } LDKLockedChannelMonitor;
9393
9394 /**
9395  * The contents of CResult_LockedChannelMonitorNoneZ
9396  */
9397 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
9398    /**
9399     * A pointer to the contents in the success state.
9400     * Reading from this pointer when `result_ok` is not set is undefined.
9401     */
9402    struct LDKLockedChannelMonitor *result;
9403    /**
9404     * Note that this value is always NULL, as there are no contents in the Err variant
9405     */
9406    void *err;
9407 } LDKCResult_LockedChannelMonitorNoneZPtr;
9408
9409 /**
9410  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
9411  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
9412  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9413  */
9414 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
9415    /**
9416     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
9417     * `err` or `result` depending on the state of `result_ok`.
9418     */
9419    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
9420    /**
9421     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
9422     */
9423    bool result_ok;
9424 } LDKCResult_LockedChannelMonitorNoneZ;
9425
9426 /**
9427  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
9428  * This corresponds to std::vector in C++
9429  */
9430 typedef struct LDKCVec_OutPointZ {
9431    /**
9432     * The elements in the array.
9433     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9434     */
9435    struct LDKOutPoint *data;
9436    /**
9437     * The number of elements pointed to by `data`.
9438     */
9439    uintptr_t datalen;
9440 } LDKCVec_OutPointZ;
9441
9442 /**
9443  * A trait indicating an object may generate message send events
9444  */
9445 typedef struct LDKMessageSendEventsProvider {
9446    /**
9447     * An opaque pointer which is passed to your function implementations as an argument.
9448     * This has no meaning in the LDK, and can be NULL or any other value.
9449     */
9450    void *this_arg;
9451    /**
9452     * Gets the list of pending events which were generated by previous actions, clearing the list
9453     * in the process.
9454     */
9455    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
9456    /**
9457     * Frees any resources associated with this object given its this_arg pointer.
9458     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9459     */
9460    void (*free)(void *this_arg);
9461 } LDKMessageSendEventsProvider;
9462
9463 /**
9464  * A trait implemented for objects handling events from [`EventsProvider`].
9465  */
9466 typedef struct LDKEventHandler {
9467    /**
9468     * An opaque pointer which is passed to your function implementations as an argument.
9469     * This has no meaning in the LDK, and can be NULL or any other value.
9470     */
9471    void *this_arg;
9472    /**
9473     * Handles the given [`Event`].
9474     *
9475     * See [`EventsProvider`] for details that must be considered when implementing this method.
9476     */
9477    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
9478    /**
9479     * Frees any resources associated with this object given its this_arg pointer.
9480     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9481     */
9482    void (*free)(void *this_arg);
9483 } LDKEventHandler;
9484
9485 /**
9486  * A trait indicating an object may generate events.
9487  *
9488  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
9489  *
9490  * # Requirements
9491  *
9492  * See [`process_pending_events`] for requirements around event processing.
9493  *
9494  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
9495  * event since the last invocation. The handler must either act upon the event immediately
9496  * or preserve it for later handling.
9497  *
9498  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
9499  * consult the provider's documentation on the implication of processing events and how a handler
9500  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
9501  * [`ChainMonitor::process_pending_events`]).
9502  *
9503  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
9504  * own type(s).
9505  *
9506  * [`process_pending_events`]: Self::process_pending_events
9507  * [`handle_event`]: EventHandler::handle_event
9508  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
9509  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
9510  */
9511 typedef struct LDKEventsProvider {
9512    /**
9513     * An opaque pointer which is passed to your function implementations as an argument.
9514     * This has no meaning in the LDK, and can be NULL or any other value.
9515     */
9516    void *this_arg;
9517    /**
9518     * Processes any events generated since the last call using the given event handler.
9519     *
9520     * Subsequent calls must only process new events. However, handlers must be capable of handling
9521     * duplicate events across process restarts. This may occur if the provider was recovered from
9522     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
9523     */
9524    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
9525    /**
9526     * Frees any resources associated with this object given its this_arg pointer.
9527     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9528     */
9529    void (*free)(void *this_arg);
9530 } LDKEventsProvider;
9531
9532
9533
9534 /**
9535  * Configuration we set when applicable.
9536  *
9537  * Default::default() provides sane defaults.
9538  */
9539 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
9540    /**
9541     * A pointer to the opaque Rust object.
9542     * Nearly everywhere, inner must be non-null, however in places where
9543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9544     */
9545    LDKnativeChannelHandshakeConfig *inner;
9546    /**
9547     * Indicates that this is the only struct which contains the same pointer.
9548     * Rust functions which take ownership of an object provided via an argument require
9549     * this to be true and invalidate the object pointed to by inner.
9550     */
9551    bool is_owned;
9552 } LDKChannelHandshakeConfig;
9553
9554
9555
9556 /**
9557  * Optional channel limits which are applied during channel creation.
9558  *
9559  * These limits are only applied to our counterparty's limits, not our own.
9560  *
9561  * Use 0/<type>::max_value() as appropriate to skip checking.
9562  *
9563  * Provides sane defaults for most configurations.
9564  *
9565  * Most additional limits are disabled except those with which specify a default in individual
9566  * field documentation. Note that this may result in barely-usable channels, but since they
9567  * are applied mostly only to incoming channels that's not much of a problem.
9568  */
9569 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
9570    /**
9571     * A pointer to the opaque Rust object.
9572     * Nearly everywhere, inner must be non-null, however in places where
9573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9574     */
9575    LDKnativeChannelHandshakeLimits *inner;
9576    /**
9577     * Indicates that this is the only struct which contains the same pointer.
9578     * Rust functions which take ownership of an object provided via an argument require
9579     * this to be true and invalidate the object pointed to by inner.
9580     */
9581    bool is_owned;
9582 } LDKChannelHandshakeLimits;
9583
9584
9585
9586 /**
9587  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
9588  *
9589  * Default::default() provides sane defaults for most configurations
9590  * (but currently with 0 relay fees!)
9591  */
9592 typedef struct MUST_USE_STRUCT LDKUserConfig {
9593    /**
9594     * A pointer to the opaque Rust object.
9595     * Nearly everywhere, inner must be non-null, however in places where
9596     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9597     */
9598    LDKnativeUserConfig *inner;
9599    /**
9600     * Indicates that this is the only struct which contains the same pointer.
9601     * Rust functions which take ownership of an object provided via an argument require
9602     * this to be true and invalidate the object pointed to by inner.
9603     */
9604    bool is_owned;
9605 } LDKUserConfig;
9606
9607
9608
9609 /**
9610  * The best known block as identified by its hash and height.
9611  */
9612 typedef struct MUST_USE_STRUCT LDKBestBlock {
9613    /**
9614     * A pointer to the opaque Rust object.
9615     * Nearly everywhere, inner must be non-null, however in places where
9616     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9617     */
9618    LDKnativeBestBlock *inner;
9619    /**
9620     * Indicates that this is the only struct which contains the same pointer.
9621     * Rust functions which take ownership of an object provided via an argument require
9622     * this to be true and invalidate the object pointed to by inner.
9623     */
9624    bool is_owned;
9625 } LDKBestBlock;
9626
9627 /**
9628  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
9629  * chain.
9630  *
9631  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
9632  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
9633  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
9634  * when needed.
9635  */
9636 typedef struct LDKListen {
9637    /**
9638     * An opaque pointer which is passed to your function implementations as an argument.
9639     * This has no meaning in the LDK, and can be NULL or any other value.
9640     */
9641    void *this_arg;
9642    /**
9643     * Notifies the listener that a block was added at the given height.
9644     */
9645    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
9646    /**
9647     * Notifies the listener that a block was removed at the given height.
9648     */
9649    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9650    /**
9651     * Frees any resources associated with this object given its this_arg pointer.
9652     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9653     */
9654    void (*free)(void *this_arg);
9655 } LDKListen;
9656
9657 /**
9658  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
9659  * unconfirmed during a chain reorganization.
9660  *
9661  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
9662  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
9663  * related to registered transactions and outputs. Upon notification, it would pass along the
9664  * matching transactions using this interface.
9665  *
9666  * # Use
9667  *
9668  * The intended use is as follows:
9669  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
9670  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
9671  *   that has been reorganized out of the chain.
9672  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
9673  *
9674  * # Order
9675  *
9676  * Clients must call these methods in chain order. Specifically:
9677  * - Transactions confirmed in a block must be given before transactions confirmed in a later
9678  *   block.
9679  * - Dependent transactions within the same block must be given in topological order, possibly in
9680  *   separate calls.
9681  * - Unconfirmed transactions must be given after the original confirmations and before any
9682  *   reconfirmation.
9683  *
9684  * See individual method documentation for further details.
9685  *
9686  * [`transactions_confirmed`]: Self::transactions_confirmed
9687  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9688  * [`best_block_updated`]: Self::best_block_updated
9689  * [`get_relevant_txids`]: Self::get_relevant_txids
9690  */
9691 typedef struct LDKConfirm {
9692    /**
9693     * An opaque pointer which is passed to your function implementations as an argument.
9694     * This has no meaning in the LDK, and can be NULL or any other value.
9695     */
9696    void *this_arg;
9697    /**
9698     * Processes transactions confirmed in a block with a given header and height.
9699     *
9700     * Should be called for any transactions registered by [`Filter::register_tx`] or any
9701     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
9702     * appearing in the same block do not need to be included in the same call; instead, multiple
9703     * calls with additional transactions may be made so long as they are made in [chain order].
9704     *
9705     * May be called before or after [`best_block_updated`] for the corresponding block. However,
9706     * in the event of a chain reorganization, it must not be called with a `header` that is no
9707     * longer in the chain as of the last call to [`best_block_updated`].
9708     *
9709     * [chain order]: Confirm#Order
9710     * [`best_block_updated`]: Self::best_block_updated
9711     */
9712    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
9713    /**
9714     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
9715     *
9716     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
9717     * reorganized out of the best chain. Once called, the given transaction should not be returned
9718     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
9719     *
9720     * [`get_relevant_txids`]: Self::get_relevant_txids
9721     * [`transactions_confirmed`]: Self::transactions_confirmed
9722     */
9723    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
9724    /**
9725     * Processes an update to the best header connected at the given height.
9726     *
9727     * Should be called when a new header is available but may be skipped for intermediary blocks
9728     * if they become available at the same time.
9729     */
9730    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9731    /**
9732     * Returns transactions that should be monitored for reorganization out of the chain.
9733     *
9734     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
9735     * confirmations to be safe from a chain reorganization. Should not include any transactions
9736     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
9737     *
9738     * May be called to determine the subset of transactions that must still be monitored for
9739     * reorganization. Will be idempotent between calls but may change as a result of calls to the
9740     * other interface methods. Thus, this is useful to determine which transactions may need to be
9741     * given to [`transaction_unconfirmed`].
9742     *
9743     * [`transactions_confirmed`]: Self::transactions_confirmed
9744     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9745     */
9746    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
9747    /**
9748     * Frees any resources associated with this object given its this_arg pointer.
9749     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9750     */
9751    void (*free)(void *this_arg);
9752 } LDKConfirm;
9753
9754
9755
9756 /**
9757  * An opaque identifier describing a specific [`Persist`] method call.
9758  */
9759 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
9760    /**
9761     * A pointer to the opaque Rust object.
9762     * Nearly everywhere, inner must be non-null, however in places where
9763     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9764     */
9765    LDKnativeMonitorUpdateId *inner;
9766    /**
9767     * Indicates that this is the only struct which contains the same pointer.
9768     * Rust functions which take ownership of an object provided via an argument require
9769     * this to be true and invalidate the object pointed to by inner.
9770     */
9771    bool is_owned;
9772 } LDKMonitorUpdateId;
9773
9774 /**
9775  * `Persist` defines behavior for persisting channel monitors: this could mean
9776  * writing once to disk, and/or uploading to one or more backup services.
9777  *
9778  * Each method can return three possible values:
9779  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
9780  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
9781  *  * If persistence happens asynchronously, implementations should first ensure the
9782  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
9783  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
9784  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
9785  *    called with the corresponding [`MonitorUpdateId`].
9786  *
9787  *    Note that unlike the direct [`chain::Watch`] interface,
9788  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
9789  *
9790  *  * If persistence fails for some reason, implementations should return
9791  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
9792  *    closed without broadcasting the latest state. See
9793  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
9794  */
9795 typedef struct LDKPersist {
9796    /**
9797     * An opaque pointer which is passed to your function implementations as an argument.
9798     * This has no meaning in the LDK, and can be NULL or any other value.
9799     */
9800    void *this_arg;
9801    /**
9802     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
9803     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
9804     *
9805     * The data can be stored any way you want, but the identifier provided by LDK is the
9806     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
9807     * and the stored channel data). Note that you **must** persist every new monitor to disk.
9808     *
9809     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
9810     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
9811     *
9812     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
9813     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9814     *
9815     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9816     * [`Writeable::write`]: crate::util::ser::Writeable::write
9817     */
9818    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
9819    /**
9820     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
9821     * update.
9822     *
9823     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
9824     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
9825     * details.
9826     *
9827     * During blockchain synchronization operations, this may be called with no
9828     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
9829     * Note that after the full [`ChannelMonitor`] is persisted any previous
9830     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
9831     * applied to the persisted [`ChannelMonitor`] as they were already applied.
9832     *
9833     * If an implementer chooses to persist the updates only, they need to make
9834     * sure that all the updates are applied to the `ChannelMonitors` *before*
9835     * the set of channel monitors is given to the `ChannelManager`
9836     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
9837     * applying a monitor update to a monitor. If full `ChannelMonitors` are
9838     * persisted, then there is no need to persist individual updates.
9839     *
9840     * Note that there could be a performance tradeoff between persisting complete
9841     * channel monitors on every update vs. persisting only updates and applying
9842     * them in batches. The size of each monitor grows `O(number of state updates)`
9843     * whereas updates are small and `O(1)`.
9844     *
9845     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
9846     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
9847     *
9848     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
9849     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
9850     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9851     *
9852     * [`Writeable::write`]: crate::util::ser::Writeable::write
9853     *
9854     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
9855     */
9856    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
9857    /**
9858     * Frees any resources associated with this object given its this_arg pointer.
9859     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9860     */
9861    void (*free)(void *this_arg);
9862 } LDKPersist;
9863
9864
9865
9866 /**
9867  * An implementation of [`chain::Watch`] for monitoring channels.
9868  *
9869  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
9870  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
9871  * or used independently to monitor channels remotely. See the [module-level documentation] for
9872  * details.
9873  *
9874  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9875  * [module-level documentation]: crate::chain::chainmonitor
9876  */
9877 typedef struct MUST_USE_STRUCT LDKChainMonitor {
9878    /**
9879     * A pointer to the opaque Rust object.
9880     * Nearly everywhere, inner must be non-null, however in places where
9881     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9882     */
9883    LDKnativeChainMonitor *inner;
9884    /**
9885     * Indicates that this is the only struct which contains the same pointer.
9886     * Rust functions which take ownership of an object provided via an argument require
9887     * this to be true and invalidate the object pointed to by inner.
9888     */
9889    bool is_owned;
9890 } LDKChainMonitor;
9891
9892
9893
9894 /**
9895  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
9896  * and derives keys from that.
9897  *
9898  * Your node_id is seed/0'
9899  * ChannelMonitor closes may use seed/1'
9900  * Cooperative closes may use seed/2'
9901  * The two close keys may be needed to claim on-chain funds!
9902  */
9903 typedef struct MUST_USE_STRUCT LDKKeysManager {
9904    /**
9905     * A pointer to the opaque Rust object.
9906     * Nearly everywhere, inner must be non-null, however in places where
9907     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9908     */
9909    LDKnativeKeysManager *inner;
9910    /**
9911     * Indicates that this is the only struct which contains the same pointer.
9912     * Rust functions which take ownership of an object provided via an argument require
9913     * this to be true and invalidate the object pointed to by inner.
9914     */
9915    bool is_owned;
9916 } LDKKeysManager;
9917
9918
9919
9920 /**
9921  * Chain-related parameters used to construct a new `ChannelManager`.
9922  *
9923  * Typically, the block-specific parameters are derived from the best block hash for the network,
9924  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
9925  * are not needed when deserializing a previously constructed `ChannelManager`.
9926  */
9927 typedef struct MUST_USE_STRUCT LDKChainParameters {
9928    /**
9929     * A pointer to the opaque Rust object.
9930     * Nearly everywhere, inner must be non-null, however in places where
9931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9932     */
9933    LDKnativeChainParameters *inner;
9934    /**
9935     * Indicates that this is the only struct which contains the same pointer.
9936     * Rust functions which take ownership of an object provided via an argument require
9937     * this to be true and invalidate the object pointed to by inner.
9938     */
9939    bool is_owned;
9940 } LDKChainParameters;
9941
9942
9943
9944 /**
9945  * Information needed for constructing an invoice route hint for this channel.
9946  */
9947 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
9948    /**
9949     * A pointer to the opaque Rust object.
9950     * Nearly everywhere, inner must be non-null, however in places where
9951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9952     */
9953    LDKnativeCounterpartyForwardingInfo *inner;
9954    /**
9955     * Indicates that this is the only struct which contains the same pointer.
9956     * Rust functions which take ownership of an object provided via an argument require
9957     * this to be true and invalidate the object pointed to by inner.
9958     */
9959    bool is_owned;
9960 } LDKCounterpartyForwardingInfo;
9961
9962
9963
9964 /**
9965  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
9966  * to better separate parameters.
9967  */
9968 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
9969    /**
9970     * A pointer to the opaque Rust object.
9971     * Nearly everywhere, inner must be non-null, however in places where
9972     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9973     */
9974    LDKnativeChannelCounterparty *inner;
9975    /**
9976     * Indicates that this is the only struct which contains the same pointer.
9977     * Rust functions which take ownership of an object provided via an argument require
9978     * this to be true and invalidate the object pointed to by inner.
9979     */
9980    bool is_owned;
9981 } LDKChannelCounterparty;
9982
9983 /**
9984  * A 3-byte byte array.
9985  */
9986 typedef struct LDKThreeBytes {
9987    /**
9988     * The three bytes
9989     */
9990    uint8_t data[3];
9991 } LDKThreeBytes;
9992
9993 /**
9994  * A trait to describe an object which can receive channel messages.
9995  *
9996  * Messages MAY be called in parallel when they originate from different their_node_ids, however
9997  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
9998  */
9999 typedef struct LDKChannelMessageHandler {
10000    /**
10001     * An opaque pointer which is passed to your function implementations as an argument.
10002     * This has no meaning in the LDK, and can be NULL or any other value.
10003     */
10004    void *this_arg;
10005    /**
10006     * Handle an incoming open_channel message from the given peer.
10007     */
10008    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
10009    /**
10010     * Handle an incoming accept_channel message from the given peer.
10011     */
10012    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
10013    /**
10014     * Handle an incoming funding_created message from the given peer.
10015     */
10016    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
10017    /**
10018     * Handle an incoming funding_signed message from the given peer.
10019     */
10020    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
10021    /**
10022     * Handle an incoming funding_locked message from the given peer.
10023     */
10024    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
10025    /**
10026     * Handle an incoming shutdown message from the given peer.
10027     */
10028    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);
10029    /**
10030     * Handle an incoming closing_signed message from the given peer.
10031     */
10032    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
10033    /**
10034     * Handle an incoming update_add_htlc message from the given peer.
10035     */
10036    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
10037    /**
10038     * Handle an incoming update_fulfill_htlc message from the given peer.
10039     */
10040    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
10041    /**
10042     * Handle an incoming update_fail_htlc message from the given peer.
10043     */
10044    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
10045    /**
10046     * Handle an incoming update_fail_malformed_htlc message from the given peer.
10047     */
10048    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
10049    /**
10050     * Handle an incoming commitment_signed message from the given peer.
10051     */
10052    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
10053    /**
10054     * Handle an incoming revoke_and_ack message from the given peer.
10055     */
10056    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
10057    /**
10058     * Handle an incoming update_fee message from the given peer.
10059     */
10060    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
10061    /**
10062     * Handle an incoming announcement_signatures message from the given peer.
10063     */
10064    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
10065    /**
10066     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
10067     * is believed to be possible in the future (eg they're sending us messages we don't
10068     * understand or indicate they require unknown feature bits), no_connection_possible is set
10069     * and any outstanding channels should be failed.
10070     */
10071    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
10072    /**
10073     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
10074     */
10075    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
10076    /**
10077     * Handle an incoming channel_reestablish message from the given peer.
10078     */
10079    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
10080    /**
10081     * Handle an incoming channel update from the given peer.
10082     */
10083    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
10084    /**
10085     * Handle an incoming error message from the given peer.
10086     */
10087    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
10088    /**
10089     * Implementation of MessageSendEventsProvider for this object.
10090     */
10091    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10092    /**
10093     * Frees any resources associated with this object given its this_arg pointer.
10094     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10095     */
10096    void (*free)(void *this_arg);
10097 } LDKChannelMessageHandler;
10098
10099
10100
10101 /**
10102  * Arguments for the creation of a ChannelManager that are not deserialized.
10103  *
10104  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
10105  * is:
10106  * 1) Deserialize all stored [`ChannelMonitor`]s.
10107  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
10108  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
10109  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
10110  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
10111  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
10112  *    same way you would handle a [`chain::Filter`] call using
10113  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
10114  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
10115  * 5) Disconnect/connect blocks on the [`ChannelManager`].
10116  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
10117  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
10118  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
10119  *    the next step.
10120  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
10121  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
10122  *
10123  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
10124  * call any other methods on the newly-deserialized [`ChannelManager`].
10125  *
10126  * Note that because some channels may be closed during deserialization, it is critical that you
10127  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
10128  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
10129  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
10130  * not force-close the same channels but consider them live), you may end up revoking a state for
10131  * which you've already broadcasted the transaction.
10132  *
10133  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
10134  */
10135 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
10136    /**
10137     * A pointer to the opaque Rust object.
10138     * Nearly everywhere, inner must be non-null, however in places where
10139     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10140     */
10141    LDKnativeChannelManagerReadArgs *inner;
10142    /**
10143     * Indicates that this is the only struct which contains the same pointer.
10144     * Rust functions which take ownership of an object provided via an argument require
10145     * this to be true and invalidate the object pointed to by inner.
10146     */
10147    bool is_owned;
10148 } LDKChannelManagerReadArgs;
10149
10150
10151
10152 /**
10153  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
10154  * This is used to convince the recipient that the channel is at a certain commitment
10155  * number even if they lost that data due to a local failure.  Of course, the peer may lie
10156  * and even later commitments may have been revoked.
10157  */
10158 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
10159    /**
10160     * A pointer to the opaque Rust object.
10161     * Nearly everywhere, inner must be non-null, however in places where
10162     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10163     */
10164    LDKnativeDataLossProtect *inner;
10165    /**
10166     * Indicates that this is the only struct which contains the same pointer.
10167     * Rust functions which take ownership of an object provided via an argument require
10168     * this to be true and invalidate the object pointed to by inner.
10169     */
10170    bool is_owned;
10171 } LDKDataLossProtect;
10172
10173 /**
10174  * A trait to describe an object which can receive routing messages.
10175  *
10176  * # Implementor DoS Warnings
10177  *
10178  * For `gossip_queries` messages there are potential DoS vectors when handling
10179  * inbound queries. Implementors using an on-disk network graph should be aware of
10180  * repeated disk I/O for queries accessing different parts of the network graph.
10181  */
10182 typedef struct LDKRoutingMessageHandler {
10183    /**
10184     * An opaque pointer which is passed to your function implementations as an argument.
10185     * This has no meaning in the LDK, and can be NULL or any other value.
10186     */
10187    void *this_arg;
10188    /**
10189     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
10190     * false or returning an Err otherwise.
10191     */
10192    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
10193    /**
10194     * Handle a channel_announcement message, returning true if it should be forwarded on, false
10195     * or returning an Err otherwise.
10196     */
10197    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
10198    /**
10199     * Handle an incoming channel_update message, returning true if it should be forwarded on,
10200     * false or returning an Err otherwise.
10201     */
10202    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
10203    /**
10204     * Gets a subset of the channel announcements and updates required to dump our routing table
10205     * to a remote node, starting at the short_channel_id indicated by starting_point and
10206     * including the batch_amount entries immediately higher in numerical value than starting_point.
10207     */
10208    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
10209    /**
10210     * Gets a subset of the node announcements required to dump our routing table to a remote node,
10211     * starting at the node *after* the provided publickey and including batch_amount entries
10212     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
10213     * If None is provided for starting_point, we start at the first node.
10214     *
10215     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
10216     */
10217    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
10218    /**
10219     * Called when a connection is established with a peer. This can be used to
10220     * perform routing table synchronization using a strategy defined by the
10221     * implementor.
10222     */
10223    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
10224    /**
10225     * Handles the reply of a query we initiated to learn about channels
10226     * for a given range of blocks. We can expect to receive one or more
10227     * replies to a single query.
10228     */
10229    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
10230    /**
10231     * Handles the reply of a query we initiated asking for routing gossip
10232     * messages for a list of channels. We should receive this message when
10233     * a node has completed its best effort to send us the pertaining routing
10234     * gossip messages.
10235     */
10236    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
10237    /**
10238     * Handles when a peer asks us to send a list of short_channel_ids
10239     * for the requested range of blocks.
10240     */
10241    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
10242    /**
10243     * Handles when a peer asks us to send routing gossip messages for a
10244     * list of short_channel_ids.
10245     */
10246    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
10247    /**
10248     * Implementation of MessageSendEventsProvider for this object.
10249     */
10250    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10251    /**
10252     * Frees any resources associated with this object given its this_arg pointer.
10253     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10254     */
10255    void (*free)(void *this_arg);
10256 } LDKRoutingMessageHandler;
10257
10258 /**
10259  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
10260  * decoders.
10261  */
10262 typedef struct LDKCustomMessageReader {
10263    /**
10264     * An opaque pointer which is passed to your function implementations as an argument.
10265     * This has no meaning in the LDK, and can be NULL or any other value.
10266     */
10267    void *this_arg;
10268    /**
10269     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
10270     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
10271     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
10272     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
10273     */
10274    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
10275    /**
10276     * Frees any resources associated with this object given its this_arg pointer.
10277     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10278     */
10279    void (*free)(void *this_arg);
10280 } LDKCustomMessageReader;
10281
10282 /**
10283  * Handler for BOLT1-compliant messages.
10284  */
10285 typedef struct LDKCustomMessageHandler {
10286    /**
10287     * An opaque pointer which is passed to your function implementations as an argument.
10288     * This has no meaning in the LDK, and can be NULL or any other value.
10289     */
10290    void *this_arg;
10291    /**
10292     * Called with the message type that was received and the buffer to be read.
10293     * Can return a `MessageHandlingError` if the message could not be handled.
10294     */
10295    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
10296    /**
10297     * Gets the list of pending messages which were generated by the custom message
10298     * handler, clearing the list in the process. The first tuple element must
10299     * correspond to the intended recipients node ids. If no connection to one of the
10300     * specified node does not exist, the message is simply not sent to it.
10301     */
10302    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
10303    /**
10304     * Implementation of CustomMessageReader for this object.
10305     */
10306    struct LDKCustomMessageReader CustomMessageReader;
10307    /**
10308     * Frees any resources associated with this object given its this_arg pointer.
10309     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10310     */
10311    void (*free)(void *this_arg);
10312 } LDKCustomMessageHandler;
10313
10314
10315
10316 /**
10317  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
10318  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
10319  */
10320 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
10321    /**
10322     * A pointer to the opaque Rust object.
10323     * Nearly everywhere, inner must be non-null, however in places where
10324     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10325     */
10326    LDKnativeIgnoringMessageHandler *inner;
10327    /**
10328     * Indicates that this is the only struct which contains the same pointer.
10329     * Rust functions which take ownership of an object provided via an argument require
10330     * this to be true and invalidate the object pointed to by inner.
10331     */
10332    bool is_owned;
10333 } LDKIgnoringMessageHandler;
10334
10335
10336
10337 /**
10338  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
10339  * You can provide one of these as the route_handler in a MessageHandler.
10340  */
10341 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
10342    /**
10343     * A pointer to the opaque Rust object.
10344     * Nearly everywhere, inner must be non-null, however in places where
10345     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10346     */
10347    LDKnativeErroringMessageHandler *inner;
10348    /**
10349     * Indicates that this is the only struct which contains the same pointer.
10350     * Rust functions which take ownership of an object provided via an argument require
10351     * this to be true and invalidate the object pointed to by inner.
10352     */
10353    bool is_owned;
10354 } LDKErroringMessageHandler;
10355
10356
10357
10358 /**
10359  * Provides references to trait impls which handle different types of messages.
10360  */
10361 typedef struct MUST_USE_STRUCT LDKMessageHandler {
10362    /**
10363     * A pointer to the opaque Rust object.
10364     * Nearly everywhere, inner must be non-null, however in places where
10365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10366     */
10367    LDKnativeMessageHandler *inner;
10368    /**
10369     * Indicates that this is the only struct which contains the same pointer.
10370     * Rust functions which take ownership of an object provided via an argument require
10371     * this to be true and invalidate the object pointed to by inner.
10372     */
10373    bool is_owned;
10374 } LDKMessageHandler;
10375
10376 /**
10377  * Provides an object which can be used to send data to and which uniquely identifies a connection
10378  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
10379  * implement Hash to meet the PeerManager API.
10380  *
10381  * For efficiency, Clone should be relatively cheap for this type.
10382  *
10383  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
10384  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
10385  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
10386  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
10387  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
10388  * to simply use another value which is guaranteed to be globally unique instead.
10389  */
10390 typedef struct LDKSocketDescriptor {
10391    /**
10392     * An opaque pointer which is passed to your function implementations as an argument.
10393     * This has no meaning in the LDK, and can be NULL or any other value.
10394     */
10395    void *this_arg;
10396    /**
10397     * Attempts to send some data from the given slice to the peer.
10398     *
10399     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
10400     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
10401     * called and further write attempts may occur until that time.
10402     *
10403     * If the returned size is smaller than `data.len()`, a
10404     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
10405     * written. Additionally, until a `send_data` event completes fully, no further
10406     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
10407     * prevent denial-of-service issues, you should not read or buffer any data from the socket
10408     * until then.
10409     *
10410     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
10411     * (indicating that read events should be paused to prevent DoS in the send buffer),
10412     * `resume_read` may be set indicating that read events on this descriptor should resume. A
10413     * `resume_read` of false carries no meaning, and should not cause any action.
10414     */
10415    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
10416    /**
10417     * Disconnect the socket pointed to by this SocketDescriptor.
10418     *
10419     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
10420     * call (doing so is a noop).
10421     */
10422    void (*disconnect_socket)(void *this_arg);
10423    /**
10424     * Checks if two objects are equal given this object's this_arg pointer and another object.
10425     */
10426    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
10427    /**
10428     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
10429     * This is used, for example, for inclusion of this object in a hash map.
10430     */
10431    uint64_t (*hash)(const void *this_arg);
10432    /**
10433     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
10434     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
10435     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
10436     */
10437    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
10438    /**
10439     * Frees any resources associated with this object given its this_arg pointer.
10440     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10441     */
10442    void (*free)(void *this_arg);
10443 } LDKSocketDescriptor;
10444
10445
10446
10447 /**
10448  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
10449  * socket events into messages which it passes on to its [`MessageHandler`].
10450  *
10451  * Locks are taken internally, so you must never assume that reentrancy from a
10452  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
10453  *
10454  * Calls to [`read_event`] will decode relevant messages and pass them to the
10455  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
10456  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
10457  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
10458  * calls only after previous ones have returned.
10459  *
10460  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
10461  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
10462  * essentially you should default to using a SimpleRefPeerManager, and use a
10463  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
10464  * you're using lightning-net-tokio.
10465  *
10466  * [`read_event`]: PeerManager::read_event
10467  */
10468 typedef struct MUST_USE_STRUCT LDKPeerManager {
10469    /**
10470     * A pointer to the opaque Rust object.
10471     * Nearly everywhere, inner must be non-null, however in places where
10472     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10473     */
10474    LDKnativePeerManager *inner;
10475    /**
10476     * Indicates that this is the only struct which contains the same pointer.
10477     * Rust functions which take ownership of an object provided via an argument require
10478     * this to be true and invalidate the object pointed to by inner.
10479     */
10480    bool is_owned;
10481 } LDKPeerManager;
10482
10483
10484
10485 /**
10486  * Static channel fields used to build transactions given per-commitment fields, organized by
10487  * broadcaster/countersignatory.
10488  *
10489  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
10490  * as_holder_broadcastable and as_counterparty_broadcastable functions.
10491  */
10492 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
10493    /**
10494     * A pointer to the opaque Rust object.
10495     * Nearly everywhere, inner must be non-null, however in places where
10496     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10497     */
10498    LDKnativeDirectedChannelTransactionParameters *inner;
10499    /**
10500     * Indicates that this is the only struct which contains the same pointer.
10501     * Rust functions which take ownership of an object provided via an argument require
10502     * this to be true and invalidate the object pointed to by inner.
10503     */
10504    bool is_owned;
10505 } LDKDirectedChannelTransactionParameters;
10506
10507 /**
10508  * An interface used to score payment channels for path finding.
10509  *
10510  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
10511  */
10512 typedef struct LDKScore {
10513    /**
10514     * An opaque pointer which is passed to your function implementations as an argument.
10515     * This has no meaning in the LDK, and can be NULL or any other value.
10516     */
10517    void *this_arg;
10518    /**
10519     * Returns the fee in msats willing to be paid to avoid routing through the given channel
10520     * in the direction from `source` to `target`.
10521     */
10522    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
10523    /**
10524     * Handles updating channel penalties after failing to route through a channel.
10525     */
10526    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
10527    /**
10528     * Serialize the object into a byte array
10529     */
10530    struct LDKCVec_u8Z (*write)(const void *this_arg);
10531    /**
10532     * Frees any resources associated with this object given its this_arg pointer.
10533     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10534     */
10535    void (*free)(void *this_arg);
10536 } LDKScore;
10537
10538
10539
10540 /**
10541  * A scorer that is accessed under a lock.
10542  *
10543  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
10544  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
10545  * implementations. Internal locking would be detrimental to route finding performance and could
10546  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
10547  *
10548  * [`find_route`]: crate::routing::router::find_route
10549  */
10550 typedef struct MUST_USE_STRUCT LDKLockableScore {
10551    /**
10552     * A pointer to the opaque Rust object.
10553     * Nearly everywhere, inner must be non-null, however in places where
10554     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10555     */
10556    LDKnativeLockableScore *inner;
10557    /**
10558     * Indicates that this is the only struct which contains the same pointer.
10559     * Rust functions which take ownership of an object provided via an argument require
10560     * this to be true and invalidate the object pointed to by inner.
10561     */
10562    bool is_owned;
10563 } LDKLockableScore;
10564
10565
10566
10567 /**
10568  * A read-only view of [`NetworkGraph`].
10569  */
10570 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
10571    /**
10572     * A pointer to the opaque Rust object.
10573     * Nearly everywhere, inner must be non-null, however in places where
10574     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10575     */
10576    LDKnativeReadOnlyNetworkGraph *inner;
10577    /**
10578     * Indicates that this is the only struct which contains the same pointer.
10579     * Rust functions which take ownership of an object provided via an argument require
10580     * this to be true and invalidate the object pointed to by inner.
10581     */
10582    bool is_owned;
10583 } LDKReadOnlyNetworkGraph;
10584
10585
10586
10587 /**
10588  * Receives and validates network updates from peers,
10589  * stores authentic and relevant data as a network graph.
10590  * This network graph is then used for routing payments.
10591  * Provides interface to help with initial routing sync by
10592  * serving historical announcements.
10593  *
10594  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
10595  * [`NetworkGraph`].
10596  */
10597 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
10598    /**
10599     * A pointer to the opaque Rust object.
10600     * Nearly everywhere, inner must be non-null, however in places where
10601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10602     */
10603    LDKnativeNetGraphMsgHandler *inner;
10604    /**
10605     * Indicates that this is the only struct which contains the same pointer.
10606     * Rust functions which take ownership of an object provided via an argument require
10607     * this to be true and invalidate the object pointed to by inner.
10608     */
10609    bool is_owned;
10610 } LDKNetGraphMsgHandler;
10611
10612
10613
10614 /**
10615  * FilesystemPersister persists channel data on disk, where each channel's
10616  * data is stored in a file named after its funding outpoint.
10617  *
10618  * Warning: this module does the best it can with calls to persist data, but it
10619  * can only guarantee that the data is passed to the drive. It is up to the
10620  * drive manufacturers to do the actual persistence properly, which they often
10621  * don't (especially on consumer-grade hardware). Therefore, it is up to the
10622  * user to validate their entire storage stack, to ensure the writes are
10623  * persistent.
10624  * Corollary: especially when dealing with larger amounts of money, it is best
10625  * practice to have multiple channel data backups and not rely only on one
10626  * FilesystemPersister.
10627  */
10628 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
10629    /**
10630     * A pointer to the opaque Rust object.
10631     * Nearly everywhere, inner must be non-null, however in places where
10632     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10633     */
10634    LDKnativeFilesystemPersister *inner;
10635    /**
10636     * Indicates that this is the only struct which contains the same pointer.
10637     * Rust functions which take ownership of an object provided via an argument require
10638     * this to be true and invalidate the object pointed to by inner.
10639     */
10640    bool is_owned;
10641 } LDKFilesystemPersister;
10642
10643
10644
10645 /**
10646  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
10647  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
10648  * responsibilities are:
10649  * * Processing [`Event`]s with a user-provided [`EventHandler`].
10650  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
10651  *   writing it to disk/backups by invoking the callback given to it at startup.
10652  *   [`ChannelManager`] persistence should be done in the background.
10653  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
10654  *   at the appropriate intervals.
10655  *
10656  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
10657  * upon as doing so may result in high latency.
10658  *
10659  * # Note
10660  *
10661  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
10662  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
10663  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
10664  * unilateral chain closure fees are at risk.
10665  *
10666  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
10667  * [`Event`]: lightning::util::events::Event
10668  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
10669  */
10670 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
10671    /**
10672     * A pointer to the opaque Rust object.
10673     * Nearly everywhere, inner must be non-null, however in places where
10674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10675     */
10676    LDKnativeBackgroundProcessor *inner;
10677    /**
10678     * Indicates that this is the only struct which contains the same pointer.
10679     * Rust functions which take ownership of an object provided via an argument require
10680     * this to be true and invalidate the object pointed to by inner.
10681     */
10682    bool is_owned;
10683 } LDKBackgroundProcessor;
10684
10685 /**
10686  * Trait which handles persisting a [`ChannelManager`] to disk.
10687  *
10688  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10689  */
10690 typedef struct LDKChannelManagerPersister {
10691    /**
10692     * An opaque pointer which is passed to your function implementations as an argument.
10693     * This has no meaning in the LDK, and can be NULL or any other value.
10694     */
10695    void *this_arg;
10696    /**
10697     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
10698     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
10699     *
10700     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10701     */
10702    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
10703    /**
10704     * Frees any resources associated with this object given its this_arg pointer.
10705     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10706     */
10707    void (*free)(void *this_arg);
10708 } LDKChannelManagerPersister;
10709
10710
10711
10712 /**
10713  * Data of the `RawInvoice` that is encoded in the data part
10714  */
10715 typedef struct MUST_USE_STRUCT LDKRawDataPart {
10716    /**
10717     * A pointer to the opaque Rust object.
10718     * Nearly everywhere, inner must be non-null, however in places where
10719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10720     */
10721    LDKnativeRawDataPart *inner;
10722    /**
10723     * Indicates that this is the only struct which contains the same pointer.
10724     * Rust functions which take ownership of an object provided via an argument require
10725     * this to be true and invalidate the object pointed to by inner.
10726     */
10727    bool is_owned;
10728 } LDKRawDataPart;
10729
10730
10731
10732 /**
10733  * SHA-256 hash
10734  */
10735 typedef struct MUST_USE_STRUCT LDKSha256 {
10736    /**
10737     * A pointer to the opaque Rust object.
10738     * Nearly everywhere, inner must be non-null, however in places where
10739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10740     */
10741    LDKnativeSha256 *inner;
10742    /**
10743     * Indicates that this is the only struct which contains the same pointer.
10744     * Rust functions which take ownership of an object provided via an argument require
10745     * this to be true and invalidate the object pointed to by inner.
10746     */
10747    bool is_owned;
10748 } LDKSha256;
10749
10750
10751
10752 /**
10753  * `min_final_cltv_expiry` to use for the last HTLC in the route
10754  */
10755 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
10756    /**
10757     * A pointer to the opaque Rust object.
10758     * Nearly everywhere, inner must be non-null, however in places where
10759     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10760     */
10761    LDKnativeMinFinalCltvExpiry *inner;
10762    /**
10763     * Indicates that this is the only struct which contains the same pointer.
10764     * Rust functions which take ownership of an object provided via an argument require
10765     * this to be true and invalidate the object pointed to by inner.
10766     */
10767    bool is_owned;
10768 } LDKMinFinalCltvExpiry;
10769
10770 /**
10771  * Integer in the range `0..32`
10772  */
10773 typedef struct LDKu5 {
10774    uint8_t _0;
10775 } LDKu5;
10776
10777 /**
10778  * A 20-byte byte array.
10779  */
10780 typedef struct LDKTwentyBytes {
10781    /**
10782     * The twenty bytes
10783     */
10784    uint8_t data[20];
10785 } LDKTwentyBytes;
10786
10787 /**
10788  * Fallback address in case no LN payment is possible
10789  */
10790 typedef enum LDKFallback_Tag {
10791    LDKFallback_SegWitProgram,
10792    LDKFallback_PubKeyHash,
10793    LDKFallback_ScriptHash,
10794    /**
10795     * Must be last for serialization purposes
10796     */
10797    LDKFallback_Sentinel,
10798 } LDKFallback_Tag;
10799
10800 typedef struct LDKFallback_LDKSegWitProgram_Body {
10801    struct LDKu5 version;
10802    struct LDKCVec_u8Z program;
10803 } LDKFallback_LDKSegWitProgram_Body;
10804
10805 typedef struct MUST_USE_STRUCT LDKFallback {
10806    LDKFallback_Tag tag;
10807    union {
10808       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
10809       struct {
10810          struct LDKTwentyBytes pub_key_hash;
10811       };
10812       struct {
10813          struct LDKTwentyBytes script_hash;
10814       };
10815    };
10816 } LDKFallback;
10817
10818 /**
10819  * A trait defining behavior of an [`Invoice`] payer.
10820  */
10821 typedef struct LDKPayer {
10822    /**
10823     * An opaque pointer which is passed to your function implementations as an argument.
10824     * This has no meaning in the LDK, and can be NULL or any other value.
10825     */
10826    void *this_arg;
10827    /**
10828     * Returns the payer's node id.
10829     */
10830    struct LDKPublicKey (*node_id)(const void *this_arg);
10831    /**
10832     * Returns the payer's channels.
10833     */
10834    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
10835    /**
10836     * Sends a payment over the Lightning Network using the given [`Route`].
10837     *
10838     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
10839     */
10840    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
10841    /**
10842     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
10843     */
10844    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
10845    /**
10846     * Frees any resources associated with this object given its this_arg pointer.
10847     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10848     */
10849    void (*free)(void *this_arg);
10850 } LDKPayer;
10851
10852 /**
10853  * A trait defining behavior for routing an [`Invoice`] payment.
10854  */
10855 typedef struct LDKRouter {
10856    /**
10857     * An opaque pointer which is passed to your function implementations as an argument.
10858     * This has no meaning in the LDK, and can be NULL or any other value.
10859     */
10860    void *this_arg;
10861    /**
10862     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
10863     *
10864     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
10865     */
10866    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
10867    /**
10868     * Frees any resources associated with this object given its this_arg pointer.
10869     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10870     */
10871    void (*free)(void *this_arg);
10872 } LDKRouter;
10873
10874
10875
10876 /**
10877  * A utility for paying [`Invoice]`s.
10878  */
10879 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
10880    /**
10881     * A pointer to the opaque Rust object.
10882     * Nearly everywhere, inner must be non-null, however in places where
10883     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10884     */
10885    LDKnativeInvoicePayer *inner;
10886    /**
10887     * Indicates that this is the only struct which contains the same pointer.
10888     * Rust functions which take ownership of an object provided via an argument require
10889     * this to be true and invalidate the object pointed to by inner.
10890     */
10891    bool is_owned;
10892 } LDKInvoicePayer;
10893
10894
10895
10896 /**
10897  * Number of attempts to retry payment path failures for an [`Invoice`].
10898  *
10899  * Note that this is the number of *path* failures, not full payment retries. For multi-path
10900  * payments, if this is less than the total number of paths, we will never even retry all of the
10901  * payment's paths.
10902  */
10903 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
10904    /**
10905     * A pointer to the opaque Rust object.
10906     * Nearly everywhere, inner must be non-null, however in places where
10907     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10908     */
10909    LDKnativeRetryAttempts *inner;
10910    /**
10911     * Indicates that this is the only struct which contains the same pointer.
10912     * Rust functions which take ownership of an object provided via an argument require
10913     * this to be true and invalidate the object pointed to by inner.
10914     */
10915    bool is_owned;
10916 } LDKRetryAttempts;
10917
10918
10919
10920 /**
10921  * A [`Router`] implemented using [`find_route`].
10922  */
10923 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
10924    /**
10925     * A pointer to the opaque Rust object.
10926     * Nearly everywhere, inner must be non-null, however in places where
10927     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10928     */
10929    LDKnativeDefaultRouter *inner;
10930    /**
10931     * Indicates that this is the only struct which contains the same pointer.
10932     * Rust functions which take ownership of an object provided via an argument require
10933     * this to be true and invalidate the object pointed to by inner.
10934     */
10935    bool is_owned;
10936 } LDKDefaultRouter;
10937
10938 extern const uintptr_t MAX_BUF_SIZE;
10939
10940 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
10941
10942 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
10943
10944 extern const uint32_t ANTI_REORG_DELAY;
10945
10946 extern const uint16_t BREAKDOWN_TIMEOUT;
10947
10948 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
10949
10950 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
10951
10952 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
10953
10954 extern const uint64_t DEFAULT_EXPIRY_TIME;
10955
10956 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
10957
10958 extern const uint8_t TAG_PAYMENT_HASH;
10959
10960 extern const uint8_t TAG_DESCRIPTION;
10961
10962 extern const uint8_t TAG_PAYEE_PUB_KEY;
10963
10964 extern const uint8_t TAG_DESCRIPTION_HASH;
10965
10966 extern const uint8_t TAG_EXPIRY_TIME;
10967
10968 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
10969
10970 extern const uint8_t TAG_FALLBACK;
10971
10972 extern const uint8_t TAG_PRIVATE_ROUTE;
10973
10974 extern const uint8_t TAG_PAYMENT_SECRET;
10975
10976 extern const uint8_t TAG_FEATURES;
10977
10978 struct LDKStr _ldk_get_compiled_version(void);
10979
10980 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
10981
10982 /**
10983  * Frees the data buffer, if data_is_owned is set and datalen > 0.
10984  */
10985 void Transaction_free(struct LDKTransaction _res);
10986
10987 /**
10988  * Convenience function for constructing a new TxOut
10989  */
10990 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
10991
10992 /**
10993  * Frees the data pointed to by script_pubkey.
10994  */
10995 void TxOut_free(struct LDKTxOut _res);
10996
10997 /**
10998  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
10999  */
11000 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
11001
11002 /**
11003  * Frees the data buffer, if chars_is_owned is set and len > 0.
11004  */
11005 void Str_free(struct LDKStr _res);
11006
11007 /**
11008  * Creates a new CResult_SecretKeyErrorZ in the success state.
11009  */
11010 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
11011
11012 /**
11013  * Creates a new CResult_SecretKeyErrorZ in the error state.
11014  */
11015 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
11016
11017 /**
11018  * Frees any resources used by the CResult_SecretKeyErrorZ.
11019  */
11020 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
11021
11022 /**
11023  * Creates a new CResult_PublicKeyErrorZ in the success state.
11024  */
11025 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
11026
11027 /**
11028  * Creates a new CResult_PublicKeyErrorZ in the error state.
11029  */
11030 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
11031
11032 /**
11033  * Frees any resources used by the CResult_PublicKeyErrorZ.
11034  */
11035 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
11036
11037 /**
11038  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
11039  * but with all dynamically-allocated buffers duplicated in new buffers.
11040  */
11041 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
11042
11043 /**
11044  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
11045  */
11046 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
11047
11048 /**
11049  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
11050  */
11051 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
11052
11053 /**
11054  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
11055  */
11056 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
11057
11058 /**
11059  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
11060  * but with all dynamically-allocated buffers duplicated in new buffers.
11061  */
11062 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
11063
11064 /**
11065  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
11066  */
11067 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
11068
11069 /**
11070  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
11071  */
11072 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
11073
11074 /**
11075  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
11076  */
11077 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
11078
11079 /**
11080  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
11081  * but with all dynamically-allocated buffers duplicated in new buffers.
11082  */
11083 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
11084
11085 /**
11086  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
11087  */
11088 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
11089
11090 /**
11091  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
11092  */
11093 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
11094
11095 /**
11096  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
11097  */
11098 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
11099
11100 /**
11101  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
11102  * but with all dynamically-allocated buffers duplicated in new buffers.
11103  */
11104 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
11105
11106 /**
11107  * Constructs a new COption_u32Z containing a u32
11108  */
11109 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
11110
11111 /**
11112  * Constructs a new COption_u32Z containing nothing
11113  */
11114 struct LDKCOption_u32Z COption_u32Z_none(void);
11115
11116 /**
11117  * Frees any resources associated with the u32, if we are in the Some state
11118  */
11119 void COption_u32Z_free(struct LDKCOption_u32Z _res);
11120
11121 /**
11122  * Creates a new COption_u32Z which has the same data as `orig`
11123  * but with all dynamically-allocated buffers duplicated in new buffers.
11124  */
11125 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
11126
11127 /**
11128  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
11129  */
11130 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
11131
11132 /**
11133  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
11134  */
11135 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
11136
11137 /**
11138  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
11139  */
11140 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
11141
11142 /**
11143  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
11144  * but with all dynamically-allocated buffers duplicated in new buffers.
11145  */
11146 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
11147
11148 /**
11149  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
11150  */
11151 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
11152
11153 /**
11154  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
11155  */
11156 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11157
11158 /**
11159  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
11160  */
11161 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
11162
11163 /**
11164  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11165  * but with all dynamically-allocated buffers duplicated in new buffers.
11166  */
11167 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11168
11169 /**
11170  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
11171  */
11172 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
11173
11174 /**
11175  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
11176  */
11177 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11178
11179 /**
11180  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
11181  */
11182 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
11183
11184 /**
11185  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11186  * but with all dynamically-allocated buffers duplicated in new buffers.
11187  */
11188 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11189
11190 /**
11191  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11192  */
11193 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
11194
11195 /**
11196  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
11197  */
11198 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
11199
11200 /**
11201  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
11202  */
11203 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11204
11205 /**
11206  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
11207  */
11208 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
11209
11210 /**
11211  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11212  * but with all dynamically-allocated buffers duplicated in new buffers.
11213  */
11214 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11215
11216 /**
11217  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
11218  */
11219 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
11220
11221 /**
11222  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
11223  */
11224 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11225
11226 /**
11227  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
11228  */
11229 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
11230
11231 /**
11232  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11233  * but with all dynamically-allocated buffers duplicated in new buffers.
11234  */
11235 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11236
11237 /**
11238  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
11239  */
11240 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
11241
11242 /**
11243  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
11244  */
11245 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
11246
11247 /**
11248  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
11249  */
11250 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
11251
11252 /**
11253  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
11254  */
11255 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
11256
11257 /**
11258  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
11259  */
11260 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11261
11262 /**
11263  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
11264  */
11265 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
11266
11267 /**
11268  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
11269  * but with all dynamically-allocated buffers duplicated in new buffers.
11270  */
11271 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11272
11273 /**
11274  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
11275  */
11276 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
11277
11278 /**
11279  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
11280  */
11281 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
11282
11283 /**
11284  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
11285  */
11286 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
11287
11288 /**
11289  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
11290  */
11291 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
11292
11293 /**
11294  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
11295  */
11296 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
11297
11298 /**
11299  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
11300  */
11301 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
11302
11303 /**
11304  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
11305  * but with all dynamically-allocated buffers duplicated in new buffers.
11306  */
11307 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
11308
11309 /**
11310  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
11311  */
11312 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
11313
11314 /**
11315  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
11316  */
11317 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
11318
11319 /**
11320  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
11321  */
11322 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
11323
11324 /**
11325  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
11326  * but with all dynamically-allocated buffers duplicated in new buffers.
11327  */
11328 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
11329
11330 /**
11331  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
11332  */
11333 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
11334
11335 /**
11336  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
11337  */
11338 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
11339
11340 /**
11341  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
11342  */
11343 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
11344
11345 /**
11346  * Creates a new CResult_NoneErrorZ in the success state.
11347  */
11348 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11349
11350 /**
11351  * Creates a new CResult_NoneErrorZ in the error state.
11352  */
11353 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
11354
11355 /**
11356  * Frees any resources used by the CResult_NoneErrorZ.
11357  */
11358 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
11359
11360 /**
11361  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
11362  * but with all dynamically-allocated buffers duplicated in new buffers.
11363  */
11364 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
11365
11366 /**
11367  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
11368  */
11369 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
11370
11371 /**
11372  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
11373  */
11374 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
11375
11376 /**
11377  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
11378  */
11379 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
11380
11381 /**
11382  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
11383  * but with all dynamically-allocated buffers duplicated in new buffers.
11384  */
11385 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
11386
11387 /**
11388  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11389  */
11390 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
11391
11392 /**
11393  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11394  */
11395 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
11396
11397 /**
11398  * Creates a new CResult_RouteDecodeErrorZ in the success state.
11399  */
11400 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
11401
11402 /**
11403  * Creates a new CResult_RouteDecodeErrorZ in the error state.
11404  */
11405 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
11406
11407 /**
11408  * Frees any resources used by the CResult_RouteDecodeErrorZ.
11409  */
11410 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
11411
11412 /**
11413  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
11414  * but with all dynamically-allocated buffers duplicated in new buffers.
11415  */
11416 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
11417
11418 /**
11419  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
11420  */
11421 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
11422
11423 /**
11424  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
11425  */
11426 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
11427
11428 /**
11429  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
11430  */
11431 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
11432
11433 /**
11434  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
11435  * but with all dynamically-allocated buffers duplicated in new buffers.
11436  */
11437 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
11438
11439 /**
11440  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11441  */
11442 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
11443
11444 /**
11445  * Constructs a new COption_u64Z containing a u64
11446  */
11447 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
11448
11449 /**
11450  * Constructs a new COption_u64Z containing nothing
11451  */
11452 struct LDKCOption_u64Z COption_u64Z_none(void);
11453
11454 /**
11455  * Frees any resources associated with the u64, if we are in the Some state
11456  */
11457 void COption_u64Z_free(struct LDKCOption_u64Z _res);
11458
11459 /**
11460  * Creates a new COption_u64Z which has the same data as `orig`
11461  * but with all dynamically-allocated buffers duplicated in new buffers.
11462  */
11463 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
11464
11465 /**
11466  * Creates a new CResult_PayeeDecodeErrorZ in the success state.
11467  */
11468 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
11469
11470 /**
11471  * Creates a new CResult_PayeeDecodeErrorZ in the error state.
11472  */
11473 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
11474
11475 /**
11476  * Frees any resources used by the CResult_PayeeDecodeErrorZ.
11477  */
11478 void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
11479
11480 /**
11481  * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
11482  * but with all dynamically-allocated buffers duplicated in new buffers.
11483  */
11484 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
11485
11486 /**
11487  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11488  */
11489 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
11490
11491 /**
11492  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
11493  */
11494 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
11495
11496 /**
11497  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
11498  */
11499 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
11500
11501 /**
11502  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
11503  */
11504 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
11505
11506 /**
11507  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
11508  * but with all dynamically-allocated buffers duplicated in new buffers.
11509  */
11510 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
11511
11512 /**
11513  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
11514  */
11515 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
11516
11517 /**
11518  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
11519  */
11520 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
11521
11522 /**
11523  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
11524  */
11525 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
11526
11527 /**
11528  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
11529  * but with all dynamically-allocated buffers duplicated in new buffers.
11530  */
11531 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
11532
11533 /**
11534  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11535  */
11536 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
11537
11538 /**
11539  * Creates a new CResult_RouteLightningErrorZ in the success state.
11540  */
11541 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
11542
11543 /**
11544  * Creates a new CResult_RouteLightningErrorZ in the error state.
11545  */
11546 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
11547
11548 /**
11549  * Frees any resources used by the CResult_RouteLightningErrorZ.
11550  */
11551 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
11552
11553 /**
11554  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
11555  * but with all dynamically-allocated buffers duplicated in new buffers.
11556  */
11557 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
11558
11559 /**
11560  * Creates a new CResult_TxOutAccessErrorZ in the success state.
11561  */
11562 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
11563
11564 /**
11565  * Creates a new CResult_TxOutAccessErrorZ in the error state.
11566  */
11567 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
11568
11569 /**
11570  * Frees any resources used by the CResult_TxOutAccessErrorZ.
11571  */
11572 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
11573
11574 /**
11575  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
11576  * but with all dynamically-allocated buffers duplicated in new buffers.
11577  */
11578 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
11579
11580 /**
11581  * Creates a new tuple which has the same data as `orig`
11582  * but with all dynamically-allocated buffers duplicated in new buffers.
11583  */
11584 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
11585
11586 /**
11587  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
11588  */
11589 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
11590
11591 /**
11592  * Frees any resources used by the C2Tuple_usizeTransactionZ.
11593  */
11594 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
11595
11596 /**
11597  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11598  */
11599 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
11600
11601 /**
11602  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11603  */
11604 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
11605
11606 /**
11607  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
11608  */
11609 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
11610
11611 /**
11612  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
11613  */
11614 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
11615
11616 /**
11617  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
11618  */
11619 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
11620
11621 /**
11622  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
11623  * but with all dynamically-allocated buffers duplicated in new buffers.
11624  */
11625 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
11626
11627 /**
11628  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11629  */
11630 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
11631
11632 /**
11633  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
11634  */
11635 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
11636
11637 /**
11638  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
11639  */
11640 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
11641
11642 /**
11643  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
11644  */
11645 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
11646
11647 /**
11648  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
11649  * but with all dynamically-allocated buffers duplicated in new buffers.
11650  */
11651 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
11652
11653 /**
11654  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
11655  */
11656 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
11657
11658 /**
11659  * Constructs a new COption_NetworkUpdateZ containing nothing
11660  */
11661 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
11662
11663 /**
11664  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
11665  */
11666 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
11667
11668 /**
11669  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
11670  * but with all dynamically-allocated buffers duplicated in new buffers.
11671  */
11672 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
11673
11674 /**
11675  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11676  */
11677 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
11678
11679 /**
11680  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11681  */
11682 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
11683
11684 /**
11685  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
11686  */
11687 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
11688
11689 /**
11690  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
11691  */
11692 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11693
11694 /**
11695  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
11696  */
11697 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
11698
11699 /**
11700  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
11701  */
11702 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
11703
11704 /**
11705  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
11706  */
11707 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11708
11709 /**
11710  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
11711  */
11712 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
11713
11714 /**
11715  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
11716  */
11717 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
11718
11719 /**
11720  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
11721  */
11722 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11723
11724 /**
11725  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
11726  */
11727 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
11728
11729 /**
11730  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
11731  */
11732 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
11733
11734 /**
11735  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
11736  */
11737 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11738
11739 /**
11740  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
11741  */
11742 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
11743
11744 /**
11745  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
11746  */
11747 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
11748
11749 /**
11750  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
11751  */
11752 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
11753
11754 /**
11755  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
11756  */
11757 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
11758
11759 /**
11760  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
11761  */
11762 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
11763
11764 /**
11765  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
11766  */
11767 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
11768
11769 /**
11770  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
11771  */
11772 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
11773
11774 /**
11775  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
11776  */
11777 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
11778
11779 /**
11780  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
11781  */
11782 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11783
11784 /**
11785  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
11786  */
11787 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
11788
11789 /**
11790  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11791  * but with all dynamically-allocated buffers duplicated in new buffers.
11792  */
11793 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11794
11795 /**
11796  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
11797  */
11798 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
11799
11800 /**
11801  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
11802  */
11803 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11804
11805 /**
11806  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
11807  */
11808 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
11809
11810 /**
11811  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11812  * but with all dynamically-allocated buffers duplicated in new buffers.
11813  */
11814 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11815
11816 /**
11817  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
11818  */
11819 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
11820
11821 /**
11822  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
11823  */
11824 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11825
11826 /**
11827  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
11828  */
11829 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
11830
11831 /**
11832  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
11833  * but with all dynamically-allocated buffers duplicated in new buffers.
11834  */
11835 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11836
11837 /**
11838  * Creates a new CResult_NoneNoneZ in the success state.
11839  */
11840 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
11841
11842 /**
11843  * Creates a new CResult_NoneNoneZ in the error state.
11844  */
11845 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
11846
11847 /**
11848  * Frees any resources used by the CResult_NoneNoneZ.
11849  */
11850 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
11851
11852 /**
11853  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
11854  * but with all dynamically-allocated buffers duplicated in new buffers.
11855  */
11856 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
11857
11858 /**
11859  * Creates a new tuple which has the same data as `orig`
11860  * but with all dynamically-allocated buffers duplicated in new buffers.
11861  */
11862 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
11863
11864 /**
11865  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
11866  */
11867 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
11868
11869 /**
11870  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
11871  */
11872 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
11873
11874 /**
11875  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
11876  */
11877 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
11878
11879 /**
11880  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
11881  */
11882 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
11883
11884 /**
11885  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
11886  */
11887 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
11888
11889 /**
11890  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
11891  * but with all dynamically-allocated buffers duplicated in new buffers.
11892  */
11893 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
11894
11895 /**
11896  * Creates a new CResult_SignatureNoneZ in the success state.
11897  */
11898 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
11899
11900 /**
11901  * Creates a new CResult_SignatureNoneZ in the error state.
11902  */
11903 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
11904
11905 /**
11906  * Frees any resources used by the CResult_SignatureNoneZ.
11907  */
11908 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
11909
11910 /**
11911  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
11912  * but with all dynamically-allocated buffers duplicated in new buffers.
11913  */
11914 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
11915
11916 /**
11917  * Creates a new CResult_SignDecodeErrorZ in the success state.
11918  */
11919 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
11920
11921 /**
11922  * Creates a new CResult_SignDecodeErrorZ in the error state.
11923  */
11924 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
11925
11926 /**
11927  * Frees any resources used by the CResult_SignDecodeErrorZ.
11928  */
11929 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
11930
11931 /**
11932  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
11933  * but with all dynamically-allocated buffers duplicated in new buffers.
11934  */
11935 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
11936
11937 /**
11938  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11939  */
11940 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
11941
11942 /**
11943  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
11944  */
11945 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
11946
11947 /**
11948  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
11949  */
11950 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
11951
11952 /**
11953  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
11954  */
11955 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
11956
11957 /**
11958  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
11959  * but with all dynamically-allocated buffers duplicated in new buffers.
11960  */
11961 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
11962
11963 /**
11964  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11965  */
11966 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
11967
11968 /**
11969  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
11970  */
11971 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
11972
11973 /**
11974  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
11975  */
11976 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
11977
11978 /**
11979  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
11980  */
11981 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
11982
11983 /**
11984  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
11985  * but with all dynamically-allocated buffers duplicated in new buffers.
11986  */
11987 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
11988
11989 /**
11990  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
11991  */
11992 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
11993
11994 /**
11995  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
11996  */
11997 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
11998
11999 /**
12000  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
12001  */
12002 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
12003
12004 /**
12005  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
12006  * but with all dynamically-allocated buffers duplicated in new buffers.
12007  */
12008 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
12009
12010 /**
12011  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12012  */
12013 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
12014
12015 /**
12016  * Creates a new CResult_TransactionNoneZ in the success state.
12017  */
12018 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
12019
12020 /**
12021  * Creates a new CResult_TransactionNoneZ in the error state.
12022  */
12023 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
12024
12025 /**
12026  * Frees any resources used by the CResult_TransactionNoneZ.
12027  */
12028 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
12029
12030 /**
12031  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
12032  * but with all dynamically-allocated buffers duplicated in new buffers.
12033  */
12034 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
12035
12036 /**
12037  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
12038  */
12039 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
12040
12041 /**
12042  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
12043  */
12044 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
12045
12046 /**
12047  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12048  */
12049 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
12050
12051 /**
12052  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
12053  */
12054 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
12055
12056 /**
12057  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
12058  */
12059 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
12060
12061 /**
12062  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
12063  */
12064 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
12065
12066 /**
12067  * Constructs a new COption_u16Z containing a u16
12068  */
12069 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
12070
12071 /**
12072  * Constructs a new COption_u16Z containing nothing
12073  */
12074 struct LDKCOption_u16Z COption_u16Z_none(void);
12075
12076 /**
12077  * Frees any resources associated with the u16, if we are in the Some state
12078  */
12079 void COption_u16Z_free(struct LDKCOption_u16Z _res);
12080
12081 /**
12082  * Creates a new COption_u16Z which has the same data as `orig`
12083  * but with all dynamically-allocated buffers duplicated in new buffers.
12084  */
12085 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
12086
12087 /**
12088  * Creates a new CResult_NoneAPIErrorZ in the success state.
12089  */
12090 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
12091
12092 /**
12093  * Creates a new CResult_NoneAPIErrorZ in the error state.
12094  */
12095 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
12096
12097 /**
12098  * Frees any resources used by the CResult_NoneAPIErrorZ.
12099  */
12100 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
12101
12102 /**
12103  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
12104  * but with all dynamically-allocated buffers duplicated in new buffers.
12105  */
12106 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
12107
12108 /**
12109  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12110  */
12111 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
12112
12113 /**
12114  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12115  */
12116 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
12117
12118 /**
12119  * Creates a new CResult__u832APIErrorZ in the success state.
12120  */
12121 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
12122
12123 /**
12124  * Creates a new CResult__u832APIErrorZ in the error state.
12125  */
12126 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
12127
12128 /**
12129  * Frees any resources used by the CResult__u832APIErrorZ.
12130  */
12131 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
12132
12133 /**
12134  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
12135  * but with all dynamically-allocated buffers duplicated in new buffers.
12136  */
12137 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
12138
12139 /**
12140  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
12141  */
12142 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
12143
12144 /**
12145  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
12146  */
12147 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12148
12149 /**
12150  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
12151  */
12152 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
12153
12154 /**
12155  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
12156  * but with all dynamically-allocated buffers duplicated in new buffers.
12157  */
12158 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
12159
12160 /**
12161  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
12162  */
12163 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
12164
12165 /**
12166  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
12167  */
12168 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12169
12170 /**
12171  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
12172  */
12173 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
12174
12175 /**
12176  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
12177  * but with all dynamically-allocated buffers duplicated in new buffers.
12178  */
12179 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
12180
12181 /**
12182  * Creates a new tuple which has the same data as `orig`
12183  * but with all dynamically-allocated buffers duplicated in new buffers.
12184  */
12185 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
12186
12187 /**
12188  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
12189  */
12190 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12191
12192 /**
12193  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
12194  */
12195 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
12196
12197 /**
12198  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
12199  */
12200 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
12201
12202 /**
12203  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
12204  */
12205 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12206
12207 /**
12208  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
12209  */
12210 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
12211
12212 /**
12213  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
12214  * but with all dynamically-allocated buffers duplicated in new buffers.
12215  */
12216 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
12217
12218 /**
12219  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12220  */
12221 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
12222
12223 /**
12224  * Creates a new tuple which has the same data as `orig`
12225  * but with all dynamically-allocated buffers duplicated in new buffers.
12226  */
12227 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
12228
12229 /**
12230  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
12231  */
12232 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12233
12234 /**
12235  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
12236  */
12237 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
12238
12239 /**
12240  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
12241  */
12242 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
12243
12244 /**
12245  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
12246  */
12247 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
12248
12249 /**
12250  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
12251  */
12252 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
12253
12254 /**
12255  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
12256  * but with all dynamically-allocated buffers duplicated in new buffers.
12257  */
12258 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
12259
12260 /**
12261  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12262  */
12263 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
12264
12265 /**
12266  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
12267  */
12268 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
12269
12270 /**
12271  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
12272  */
12273 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
12274
12275 /**
12276  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
12277  */
12278 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
12279
12280 /**
12281  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
12282  */
12283 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
12284
12285 /**
12286  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
12287  */
12288 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
12289
12290 /**
12291  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
12292  */
12293 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
12294
12295 /**
12296  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
12297  */
12298 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
12299
12300 /**
12301  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
12302  */
12303 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
12304
12305 /**
12306  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12307  * but with all dynamically-allocated buffers duplicated in new buffers.
12308  */
12309 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
12310
12311 /**
12312  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
12313  */
12314 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
12315
12316 /**
12317  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
12318  */
12319 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
12320
12321 /**
12322  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
12323  */
12324 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
12325
12326 /**
12327  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
12328  * but with all dynamically-allocated buffers duplicated in new buffers.
12329  */
12330 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
12331
12332 /**
12333  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
12334  */
12335 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
12336
12337 /**
12338  * Constructs a new COption_TypeZ containing nothing
12339  */
12340 struct LDKCOption_TypeZ COption_TypeZ_none(void);
12341
12342 /**
12343  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
12344  */
12345 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
12346
12347 /**
12348  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
12349  */
12350 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
12351
12352 /**
12353  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
12354  */
12355 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
12356
12357 /**
12358  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
12359  */
12360 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
12361
12362 /**
12363  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
12364  */
12365 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
12366
12367 /**
12368  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
12369  */
12370 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
12371
12372 /**
12373  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
12374  */
12375 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
12376
12377 /**
12378  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
12379  * but with all dynamically-allocated buffers duplicated in new buffers.
12380  */
12381 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
12382
12383 /**
12384  * Creates a new CResult_SiPrefixNoneZ in the success state.
12385  */
12386 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
12387
12388 /**
12389  * Creates a new CResult_SiPrefixNoneZ in the error state.
12390  */
12391 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
12392
12393 /**
12394  * Frees any resources used by the CResult_SiPrefixNoneZ.
12395  */
12396 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
12397
12398 /**
12399  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
12400  * but with all dynamically-allocated buffers duplicated in new buffers.
12401  */
12402 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
12403
12404 /**
12405  * Creates a new CResult_InvoiceNoneZ in the success state.
12406  */
12407 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
12408
12409 /**
12410  * Creates a new CResult_InvoiceNoneZ in the error state.
12411  */
12412 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
12413
12414 /**
12415  * Frees any resources used by the CResult_InvoiceNoneZ.
12416  */
12417 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
12418
12419 /**
12420  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
12421  * but with all dynamically-allocated buffers duplicated in new buffers.
12422  */
12423 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
12424
12425 /**
12426  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
12427  */
12428 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
12429
12430 /**
12431  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
12432  */
12433 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
12434
12435 /**
12436  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
12437  */
12438 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
12439
12440 /**
12441  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
12442  * but with all dynamically-allocated buffers duplicated in new buffers.
12443  */
12444 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
12445
12446 /**
12447  * Creates a new tuple which has the same data as `orig`
12448  * but with all dynamically-allocated buffers duplicated in new buffers.
12449  */
12450 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
12451
12452 /**
12453  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12454  */
12455 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
12456
12457 /**
12458  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12459  */
12460 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
12461
12462 /**
12463  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
12464  */
12465 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
12466
12467 /**
12468  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
12469  */
12470 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
12471
12472 /**
12473  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
12474  */
12475 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
12476
12477 /**
12478  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12479  * but with all dynamically-allocated buffers duplicated in new buffers.
12480  */
12481 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
12482
12483 /**
12484  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12485  */
12486 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
12487
12488 /**
12489  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12490  */
12491 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
12492
12493 /**
12494  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12495  */
12496 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
12497
12498 /**
12499  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12500  */
12501 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
12502
12503 /**
12504  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
12505  * but with all dynamically-allocated buffers duplicated in new buffers.
12506  */
12507 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
12508
12509 /**
12510  * Creates a new CResult_NoneSemanticErrorZ in the success state.
12511  */
12512 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
12513
12514 /**
12515  * Creates a new CResult_NoneSemanticErrorZ in the error state.
12516  */
12517 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
12518
12519 /**
12520  * Frees any resources used by the CResult_NoneSemanticErrorZ.
12521  */
12522 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
12523
12524 /**
12525  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
12526  * but with all dynamically-allocated buffers duplicated in new buffers.
12527  */
12528 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
12529
12530 /**
12531  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
12532  */
12533 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
12534
12535 /**
12536  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
12537  */
12538 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
12539
12540 /**
12541  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
12542  */
12543 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
12544
12545 /**
12546  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
12547  * but with all dynamically-allocated buffers duplicated in new buffers.
12548  */
12549 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
12550
12551 /**
12552  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
12553  */
12554 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
12555
12556 /**
12557  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
12558  */
12559 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
12560
12561 /**
12562  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
12563  */
12564 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
12565
12566 /**
12567  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
12568  * but with all dynamically-allocated buffers duplicated in new buffers.
12569  */
12570 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
12571
12572 /**
12573  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
12574  */
12575 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
12576
12577 /**
12578  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
12579  */
12580 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
12581
12582 /**
12583  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
12584  */
12585 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
12586
12587 /**
12588  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
12589  * but with all dynamically-allocated buffers duplicated in new buffers.
12590  */
12591 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
12592
12593 /**
12594  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
12595  */
12596 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
12597
12598 /**
12599  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
12600  */
12601 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
12602
12603 /**
12604  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
12605  */
12606 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
12607
12608 /**
12609  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
12610  * but with all dynamically-allocated buffers duplicated in new buffers.
12611  */
12612 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
12613
12614 /**
12615  * Creates a new CResult_StringErrorZ in the success state.
12616  */
12617 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
12618
12619 /**
12620  * Creates a new CResult_StringErrorZ in the error state.
12621  */
12622 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
12623
12624 /**
12625  * Frees any resources used by the CResult_StringErrorZ.
12626  */
12627 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
12628
12629 /**
12630  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12631  */
12632 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
12633
12634 /**
12635  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12636  */
12637 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12638
12639 /**
12640  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12641  */
12642 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
12643
12644 /**
12645  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12646  * but with all dynamically-allocated buffers duplicated in new buffers.
12647  */
12648 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
12649
12650 /**
12651  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12652  */
12653 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
12654
12655 /**
12656  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12657  */
12658 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12659
12660 /**
12661  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12662  */
12663 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
12664
12665 /**
12666  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12667  * but with all dynamically-allocated buffers duplicated in new buffers.
12668  */
12669 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
12670
12671 /**
12672  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
12673  */
12674 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
12675
12676 /**
12677  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
12678  */
12679 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
12680
12681 /**
12682  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
12683  */
12684 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
12685
12686 /**
12687  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
12688  * but with all dynamically-allocated buffers duplicated in new buffers.
12689  */
12690 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
12691
12692 /**
12693  * Creates a new tuple which has the same data as `orig`
12694  * but with all dynamically-allocated buffers duplicated in new buffers.
12695  */
12696 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
12697
12698 /**
12699  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
12700  */
12701 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
12702
12703 /**
12704  * Frees any resources used by the C2Tuple_OutPointScriptZ.
12705  */
12706 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
12707
12708 /**
12709  * Creates a new tuple which has the same data as `orig`
12710  * but with all dynamically-allocated buffers duplicated in new buffers.
12711  */
12712 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
12713
12714 /**
12715  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
12716  */
12717 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
12718
12719 /**
12720  * Frees any resources used by the C2Tuple_u32ScriptZ.
12721  */
12722 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
12723
12724 /**
12725  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12726  */
12727 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
12728
12729 /**
12730  * Creates a new tuple which has the same data as `orig`
12731  * but with all dynamically-allocated buffers duplicated in new buffers.
12732  */
12733 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
12734
12735 /**
12736  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
12737  */
12738 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
12739
12740 /**
12741  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
12742  */
12743 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
12744
12745 /**
12746  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12747  */
12748 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
12749
12750 /**
12751  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12752  */
12753 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
12754
12755 /**
12756  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12757  */
12758 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
12759
12760 /**
12761  * Creates a new tuple which has the same data as `orig`
12762  * but with all dynamically-allocated buffers duplicated in new buffers.
12763  */
12764 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
12765
12766 /**
12767  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
12768  */
12769 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
12770
12771 /**
12772  * Frees any resources used by the C2Tuple_u32TxOutZ.
12773  */
12774 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
12775
12776 /**
12777  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12778  */
12779 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
12780
12781 /**
12782  * Creates a new tuple which has the same data as `orig`
12783  * but with all dynamically-allocated buffers duplicated in new buffers.
12784  */
12785 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
12786
12787 /**
12788  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12789  */
12790 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
12791
12792 /**
12793  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12794  */
12795 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
12796
12797 /**
12798  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12799  */
12800 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
12801
12802 /**
12803  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12804  */
12805 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
12806
12807 /**
12808  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12809  */
12810 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
12811
12812 /**
12813  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12814  */
12815 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
12816
12817 /**
12818  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12819  */
12820 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
12821
12822 /**
12823  * Creates a new CResult_NoneLightningErrorZ in the success state.
12824  */
12825 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
12826
12827 /**
12828  * Creates a new CResult_NoneLightningErrorZ in the error state.
12829  */
12830 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
12831
12832 /**
12833  * Frees any resources used by the CResult_NoneLightningErrorZ.
12834  */
12835 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
12836
12837 /**
12838  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
12839  * but with all dynamically-allocated buffers duplicated in new buffers.
12840  */
12841 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
12842
12843 /**
12844  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12845  */
12846 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
12847
12848 /**
12849  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12850  */
12851 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
12852
12853 /**
12854  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12855  */
12856 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
12857
12858 /**
12859  * Creates a new CResult_boolLightningErrorZ in the success state.
12860  */
12861 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
12862
12863 /**
12864  * Creates a new CResult_boolLightningErrorZ in the error state.
12865  */
12866 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
12867
12868 /**
12869  * Frees any resources used by the CResult_boolLightningErrorZ.
12870  */
12871 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
12872
12873 /**
12874  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
12875  * but with all dynamically-allocated buffers duplicated in new buffers.
12876  */
12877 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
12878
12879 /**
12880  * Creates a new tuple which has the same data as `orig`
12881  * but with all dynamically-allocated buffers duplicated in new buffers.
12882  */
12883 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
12884
12885 /**
12886  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
12887  */
12888 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
12889
12890 /**
12891  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
12892  */
12893 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
12894
12895 /**
12896  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12897  */
12898 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
12899
12900 /**
12901  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12902  */
12903 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
12904
12905 /**
12906  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12907  */
12908 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
12909
12910 /**
12911  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12912  */
12913 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
12914
12915 /**
12916  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12917  */
12918 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12919
12920 /**
12921  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12922  */
12923 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
12924
12925 /**
12926  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12927  * but with all dynamically-allocated buffers duplicated in new buffers.
12928  */
12929 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
12930
12931 /**
12932  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
12933  */
12934 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
12935
12936 /**
12937  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
12938  */
12939 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
12940
12941 /**
12942  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
12943  */
12944 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
12945
12946 /**
12947  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12948  * but with all dynamically-allocated buffers duplicated in new buffers.
12949  */
12950 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
12951
12952 /**
12953  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
12954  */
12955 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
12956
12957 /**
12958  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
12959  */
12960 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12961
12962 /**
12963  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
12964  */
12965 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
12966
12967 /**
12968  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12969  * but with all dynamically-allocated buffers duplicated in new buffers.
12970  */
12971 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
12972
12973 /**
12974  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
12975  */
12976 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
12977
12978 /**
12979  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
12980  */
12981 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
12982
12983 /**
12984  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
12985  */
12986 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
12987
12988 /**
12989  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
12990  * but with all dynamically-allocated buffers duplicated in new buffers.
12991  */
12992 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
12993
12994 /**
12995  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
12996  */
12997 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
12998
12999 /**
13000  * Constructs a new COption_AccessZ containing nothing
13001  */
13002 struct LDKCOption_AccessZ COption_AccessZ_none(void);
13003
13004 /**
13005  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
13006  */
13007 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
13008
13009 /**
13010  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
13011  */
13012 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
13013
13014 /**
13015  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
13016  */
13017 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
13018
13019 /**
13020  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
13021  */
13022 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
13023
13024 /**
13025  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
13026  * but with all dynamically-allocated buffers duplicated in new buffers.
13027  */
13028 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
13029
13030 /**
13031  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
13032  */
13033 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
13034
13035 /**
13036  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
13037  */
13038 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
13039
13040 /**
13041  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
13042  */
13043 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
13044
13045 /**
13046  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
13047  * but with all dynamically-allocated buffers duplicated in new buffers.
13048  */
13049 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
13050
13051 /**
13052  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
13053  */
13054 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
13055
13056 /**
13057  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
13058  */
13059 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
13060
13061 /**
13062  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
13063  */
13064 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
13065
13066 /**
13067  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
13068  * but with all dynamically-allocated buffers duplicated in new buffers.
13069  */
13070 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
13071
13072 /**
13073  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
13074  */
13075 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
13076
13077 /**
13078  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
13079  */
13080 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
13081
13082 /**
13083  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
13084  */
13085 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
13086
13087 /**
13088  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
13089  * but with all dynamically-allocated buffers duplicated in new buffers.
13090  */
13091 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
13092
13093 /**
13094  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13095  */
13096 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
13097
13098 /**
13099  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
13100  */
13101 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
13102
13103 /**
13104  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
13105  */
13106 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
13107
13108 /**
13109  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
13110  */
13111 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
13112
13113 /**
13114  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
13115  * but with all dynamically-allocated buffers duplicated in new buffers.
13116  */
13117 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
13118
13119 /**
13120  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
13121  */
13122 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
13123
13124 /**
13125  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
13126  */
13127 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
13128
13129 /**
13130  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
13131  */
13132 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
13133
13134 /**
13135  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
13136  * but with all dynamically-allocated buffers duplicated in new buffers.
13137  */
13138 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
13139
13140 /**
13141  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
13142  */
13143 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
13144
13145 /**
13146  * Constructs a new COption_CVec_NetAddressZZ containing nothing
13147  */
13148 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
13149
13150 /**
13151  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
13152  */
13153 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
13154
13155 /**
13156  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
13157  * but with all dynamically-allocated buffers duplicated in new buffers.
13158  */
13159 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
13160
13161 /**
13162  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13163  */
13164 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
13165
13166 /**
13167  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13168  */
13169 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
13170
13171 /**
13172  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13173  */
13174 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
13175
13176 /**
13177  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13178  * but with all dynamically-allocated buffers duplicated in new buffers.
13179  */
13180 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
13181
13182 /**
13183  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13184  */
13185 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
13186
13187 /**
13188  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13189  */
13190 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
13191
13192 /**
13193  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13194  */
13195 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
13196
13197 /**
13198  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13199  */
13200 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
13201
13202 /**
13203  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13204  */
13205 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
13206
13207 /**
13208  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13209  */
13210 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
13211
13212 /**
13213  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13214  */
13215 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
13216
13217 /**
13218  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13219  * but with all dynamically-allocated buffers duplicated in new buffers.
13220  */
13221 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
13222
13223 /**
13224  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13225  */
13226 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
13227
13228 /**
13229  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13230  */
13231 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
13232
13233 /**
13234  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13235  */
13236 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
13237
13238 /**
13239  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13240  * but with all dynamically-allocated buffers duplicated in new buffers.
13241  */
13242 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
13243
13244 /**
13245  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13246  */
13247 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
13248
13249 /**
13250  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13251  */
13252 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
13253
13254 /**
13255  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13256  */
13257 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
13258
13259 /**
13260  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13261  * but with all dynamically-allocated buffers duplicated in new buffers.
13262  */
13263 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
13264
13265 /**
13266  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13267  */
13268 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
13269
13270 /**
13271  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13272  */
13273 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
13274
13275 /**
13276  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13277  */
13278 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
13279
13280 /**
13281  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13282  * but with all dynamically-allocated buffers duplicated in new buffers.
13283  */
13284 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
13285
13286 /**
13287  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13288  */
13289 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
13290
13291 /**
13292  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13293  */
13294 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
13295
13296 /**
13297  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13298  */
13299 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
13300
13301 /**
13302  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13303  * but with all dynamically-allocated buffers duplicated in new buffers.
13304  */
13305 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
13306
13307 /**
13308  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13309  */
13310 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
13311
13312 /**
13313  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13314  */
13315 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
13316
13317 /**
13318  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13319  */
13320 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
13321
13322 /**
13323  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13324  * but with all dynamically-allocated buffers duplicated in new buffers.
13325  */
13326 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
13327
13328 /**
13329  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13330  */
13331 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
13332
13333 /**
13334  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13335  */
13336 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
13337
13338 /**
13339  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13340  */
13341 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
13342
13343 /**
13344  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13345  * but with all dynamically-allocated buffers duplicated in new buffers.
13346  */
13347 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
13348
13349 /**
13350  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13351  */
13352 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
13353
13354 /**
13355  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13356  */
13357 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
13358
13359 /**
13360  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13361  */
13362 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
13363
13364 /**
13365  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13366  * but with all dynamically-allocated buffers duplicated in new buffers.
13367  */
13368 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
13369
13370 /**
13371  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
13372  */
13373 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
13374
13375 /**
13376  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
13377  */
13378 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
13379
13380 /**
13381  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
13382  */
13383 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
13384
13385 /**
13386  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
13387  * but with all dynamically-allocated buffers duplicated in new buffers.
13388  */
13389 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
13390
13391 /**
13392  * Creates a new CResult_InitDecodeErrorZ in the success state.
13393  */
13394 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
13395
13396 /**
13397  * Creates a new CResult_InitDecodeErrorZ in the error state.
13398  */
13399 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
13400
13401 /**
13402  * Frees any resources used by the CResult_InitDecodeErrorZ.
13403  */
13404 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
13405
13406 /**
13407  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13408  * but with all dynamically-allocated buffers duplicated in new buffers.
13409  */
13410 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
13411
13412 /**
13413  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13414  */
13415 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
13416
13417 /**
13418  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13419  */
13420 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
13421
13422 /**
13423  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13424  */
13425 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
13426
13427 /**
13428  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13429  * but with all dynamically-allocated buffers duplicated in new buffers.
13430  */
13431 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
13432
13433 /**
13434  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13435  */
13436 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
13437
13438 /**
13439  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13440  */
13441 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
13442
13443 /**
13444  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13445  */
13446 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
13447
13448 /**
13449  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13450  * but with all dynamically-allocated buffers duplicated in new buffers.
13451  */
13452 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
13453
13454 /**
13455  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13456  */
13457 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
13458
13459 /**
13460  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13461  */
13462 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
13463
13464 /**
13465  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13466  */
13467 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
13468
13469 /**
13470  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13471  * but with all dynamically-allocated buffers duplicated in new buffers.
13472  */
13473 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
13474
13475 /**
13476  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13477  */
13478 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
13479
13480 /**
13481  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13482  */
13483 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13484
13485 /**
13486  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13487  */
13488 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
13489
13490 /**
13491  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13492  * but with all dynamically-allocated buffers duplicated in new buffers.
13493  */
13494 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
13495
13496 /**
13497  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13498  */
13499 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
13500
13501 /**
13502  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13503  */
13504 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13505
13506 /**
13507  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13508  */
13509 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
13510
13511 /**
13512  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13513  * but with all dynamically-allocated buffers duplicated in new buffers.
13514  */
13515 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
13516
13517 /**
13518  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13519  */
13520 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
13521
13522 /**
13523  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13524  */
13525 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
13526
13527 /**
13528  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13529  */
13530 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
13531
13532 /**
13533  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13534  * but with all dynamically-allocated buffers duplicated in new buffers.
13535  */
13536 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
13537
13538 /**
13539  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13540  */
13541 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
13542
13543 /**
13544  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13545  */
13546 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13547
13548 /**
13549  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13550  */
13551 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
13552
13553 /**
13554  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13555  * but with all dynamically-allocated buffers duplicated in new buffers.
13556  */
13557 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
13558
13559 /**
13560  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13561  */
13562 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
13563
13564 /**
13565  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13566  */
13567 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13568
13569 /**
13570  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13571  */
13572 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
13573
13574 /**
13575  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13576  * but with all dynamically-allocated buffers duplicated in new buffers.
13577  */
13578 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
13579
13580 /**
13581  * Creates a new CResult_PingDecodeErrorZ in the success state.
13582  */
13583 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
13584
13585 /**
13586  * Creates a new CResult_PingDecodeErrorZ in the error state.
13587  */
13588 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
13589
13590 /**
13591  * Frees any resources used by the CResult_PingDecodeErrorZ.
13592  */
13593 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
13594
13595 /**
13596  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13597  * but with all dynamically-allocated buffers duplicated in new buffers.
13598  */
13599 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
13600
13601 /**
13602  * Creates a new CResult_PongDecodeErrorZ in the success state.
13603  */
13604 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
13605
13606 /**
13607  * Creates a new CResult_PongDecodeErrorZ in the error state.
13608  */
13609 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
13610
13611 /**
13612  * Frees any resources used by the CResult_PongDecodeErrorZ.
13613  */
13614 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
13615
13616 /**
13617  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13618  * but with all dynamically-allocated buffers duplicated in new buffers.
13619  */
13620 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
13621
13622 /**
13623  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13624  */
13625 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
13626
13627 /**
13628  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13629  */
13630 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13631
13632 /**
13633  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13634  */
13635 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
13636
13637 /**
13638  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13639  * but with all dynamically-allocated buffers duplicated in new buffers.
13640  */
13641 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13642
13643 /**
13644  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13645  */
13646 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
13647
13648 /**
13649  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13650  */
13651 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13652
13653 /**
13654  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13655  */
13656 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
13657
13658 /**
13659  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13660  * but with all dynamically-allocated buffers duplicated in new buffers.
13661  */
13662 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13663
13664 /**
13665  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13666  */
13667 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
13668
13669 /**
13670  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13671  */
13672 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13673
13674 /**
13675  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13676  */
13677 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
13678
13679 /**
13680  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13681  * but with all dynamically-allocated buffers duplicated in new buffers.
13682  */
13683 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13684
13685 /**
13686  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13687  */
13688 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
13689
13690 /**
13691  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13692  */
13693 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13694
13695 /**
13696  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13697  */
13698 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
13699
13700 /**
13701  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13702  * but with all dynamically-allocated buffers duplicated in new buffers.
13703  */
13704 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13705
13706 /**
13707  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13708  */
13709 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
13710
13711 /**
13712  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13713  */
13714 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
13715
13716 /**
13717  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13718  */
13719 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
13720
13721 /**
13722  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13723  * but with all dynamically-allocated buffers duplicated in new buffers.
13724  */
13725 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
13726
13727 /**
13728  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13729  */
13730 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
13731
13732 /**
13733  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13734  */
13735 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13736
13737 /**
13738  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13739  */
13740 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
13741
13742 /**
13743  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13744  * but with all dynamically-allocated buffers duplicated in new buffers.
13745  */
13746 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13747
13748 /**
13749  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13750  */
13751 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
13752
13753 /**
13754  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13755  */
13756 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13757
13758 /**
13759  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13760  */
13761 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
13762
13763 /**
13764  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13765  * but with all dynamically-allocated buffers duplicated in new buffers.
13766  */
13767 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13768
13769 /**
13770  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13771  */
13772 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
13773
13774 /**
13775  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13776  */
13777 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
13778
13779 /**
13780  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13781  */
13782 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
13783
13784 /**
13785  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13786  * but with all dynamically-allocated buffers duplicated in new buffers.
13787  */
13788 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
13789
13790 /**
13791  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13792  */
13793 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
13794
13795 /**
13796  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13797  */
13798 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
13799
13800 /**
13801  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13802  */
13803 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
13804
13805 /**
13806  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13807  * but with all dynamically-allocated buffers duplicated in new buffers.
13808  */
13809 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
13810
13811 /**
13812  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13813  */
13814 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
13815
13816 /**
13817  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13818  */
13819 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13820
13821 /**
13822  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13823  */
13824 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
13825
13826 /**
13827  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13828  * but with all dynamically-allocated buffers duplicated in new buffers.
13829  */
13830 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13831
13832 /**
13833  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13834  */
13835 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
13836
13837 /**
13838  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13839  */
13840 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13841
13842 /**
13843  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13844  */
13845 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
13846
13847 /**
13848  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13849  * but with all dynamically-allocated buffers duplicated in new buffers.
13850  */
13851 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13852
13853 /**
13854  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
13855  */
13856 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
13857
13858 /**
13859  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
13860  */
13861 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
13862
13863 /**
13864  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
13865  */
13866 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
13867
13868 /**
13869  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
13870  * but with all dynamically-allocated buffers duplicated in new buffers.
13871  */
13872 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
13873
13874 /**
13875  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
13876  */
13877 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
13878
13879 /**
13880  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
13881  */
13882 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
13883
13884 /**
13885  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
13886  */
13887 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
13888
13889 /**
13890  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
13891  * but with all dynamically-allocated buffers duplicated in new buffers.
13892  */
13893 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
13894
13895 /**
13896  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
13897  */
13898 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
13899
13900 /**
13901  * Constructs a new COption_FilterZ containing nothing
13902  */
13903 struct LDKCOption_FilterZ COption_FilterZ_none(void);
13904
13905 /**
13906  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
13907  */
13908 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
13909
13910 /**
13911  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
13912  */
13913 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
13914
13915 /**
13916  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
13917  */
13918 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
13919
13920 /**
13921  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
13922  */
13923 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
13924
13925 /**
13926  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13927  */
13928 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
13929
13930 /**
13931  * Frees any resources used by the PaymentPurpose
13932  */
13933 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
13934
13935 /**
13936  * Creates a copy of the PaymentPurpose
13937  */
13938 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
13939
13940 /**
13941  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
13942  */
13943 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
13944
13945 /**
13946  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
13947  */
13948 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
13949
13950 /**
13951  * Frees any resources used by the ClosureReason
13952  */
13953 void ClosureReason_free(struct LDKClosureReason this_ptr);
13954
13955 /**
13956  * Creates a copy of the ClosureReason
13957  */
13958 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
13959
13960 /**
13961  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
13962  */
13963 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
13964
13965 /**
13966  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
13967  */
13968 struct LDKClosureReason ClosureReason_holder_force_closed(void);
13969
13970 /**
13971  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
13972  */
13973 struct LDKClosureReason ClosureReason_cooperative_closure(void);
13974
13975 /**
13976  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
13977  */
13978 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
13979
13980 /**
13981  * Utility method to constructs a new ProcessingError-variant ClosureReason
13982  */
13983 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
13984
13985 /**
13986  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
13987  */
13988 struct LDKClosureReason ClosureReason_disconnected_peer(void);
13989
13990 /**
13991  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
13992  */
13993 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
13994
13995 /**
13996  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
13997  */
13998 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
13999
14000 /**
14001  * Frees any resources used by the Event
14002  */
14003 void Event_free(struct LDKEvent this_ptr);
14004
14005 /**
14006  * Creates a copy of the Event
14007  */
14008 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
14009
14010 /**
14011  * Utility method to constructs a new FundingGenerationReady-variant Event
14012  */
14013 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
14014
14015 /**
14016  * Utility method to constructs a new PaymentReceived-variant Event
14017  */
14018 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
14019
14020 /**
14021  * Utility method to constructs a new PaymentSent-variant Event
14022  */
14023 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
14024
14025 /**
14026  * Utility method to constructs a new PaymentPathFailed-variant Event
14027  */
14028 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
14029
14030 /**
14031  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
14032  */
14033 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
14034
14035 /**
14036  * Utility method to constructs a new SpendableOutputs-variant Event
14037  */
14038 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
14039
14040 /**
14041  * Utility method to constructs a new PaymentForwarded-variant Event
14042  */
14043 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
14044
14045 /**
14046  * Utility method to constructs a new ChannelClosed-variant Event
14047  */
14048 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
14049
14050 /**
14051  * Utility method to constructs a new DiscardFunding-variant Event
14052  */
14053 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
14054
14055 /**
14056  * Serialize the Event object into a byte array which can be read by Event_read
14057  */
14058 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
14059
14060 /**
14061  * Frees any resources used by the MessageSendEvent
14062  */
14063 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
14064
14065 /**
14066  * Creates a copy of the MessageSendEvent
14067  */
14068 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
14069
14070 /**
14071  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
14072  */
14073 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
14074
14075 /**
14076  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
14077  */
14078 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
14079
14080 /**
14081  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
14082  */
14083 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
14084
14085 /**
14086  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
14087  */
14088 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
14089
14090 /**
14091  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
14092  */
14093 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
14094
14095 /**
14096  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
14097  */
14098 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
14099
14100 /**
14101  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
14102  */
14103 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
14104
14105 /**
14106  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
14107  */
14108 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
14109
14110 /**
14111  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
14112  */
14113 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
14114
14115 /**
14116  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
14117  */
14118 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
14119
14120 /**
14121  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
14122  */
14123 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
14124
14125 /**
14126  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
14127  */
14128 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
14129
14130 /**
14131  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
14132  */
14133 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
14134
14135 /**
14136  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
14137  */
14138 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
14139
14140 /**
14141  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
14142  */
14143 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
14144
14145 /**
14146  * Utility method to constructs a new HandleError-variant MessageSendEvent
14147  */
14148 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
14149
14150 /**
14151  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
14152  */
14153 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
14154
14155 /**
14156  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
14157  */
14158 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
14159
14160 /**
14161  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
14162  */
14163 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
14164
14165 /**
14166  * Calls the free function if one is set
14167  */
14168 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
14169
14170 /**
14171  * Calls the free function if one is set
14172  */
14173 void EventsProvider_free(struct LDKEventsProvider this_ptr);
14174
14175 /**
14176  * Calls the free function if one is set
14177  */
14178 void EventHandler_free(struct LDKEventHandler this_ptr);
14179
14180 /**
14181  * Frees any resources used by the APIError
14182  */
14183 void APIError_free(struct LDKAPIError this_ptr);
14184
14185 /**
14186  * Creates a copy of the APIError
14187  */
14188 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
14189
14190 /**
14191  * Utility method to constructs a new APIMisuseError-variant APIError
14192  */
14193 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
14194
14195 /**
14196  * Utility method to constructs a new FeeRateTooHigh-variant APIError
14197  */
14198 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
14199
14200 /**
14201  * Utility method to constructs a new RouteError-variant APIError
14202  */
14203 struct LDKAPIError APIError_route_error(struct LDKStr err);
14204
14205 /**
14206  * Utility method to constructs a new ChannelUnavailable-variant APIError
14207  */
14208 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
14209
14210 /**
14211  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
14212  */
14213 struct LDKAPIError APIError_monitor_update_failed(void);
14214
14215 /**
14216  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
14217  */
14218 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
14219
14220 /**
14221  * Creates a digital signature of a message given a SecretKey, like the node's secret.
14222  * 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.
14223  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
14224  */
14225 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
14226
14227 /**
14228  * Recovers the PublicKey of the signer of the message given the message and the signature.
14229  */
14230 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
14231
14232 /**
14233  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
14234  * and the PublicKey.
14235  */
14236 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
14237
14238 /**
14239  * Creates a copy of the Level
14240  */
14241 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
14242
14243 /**
14244  * Utility method to constructs a new Trace-variant Level
14245  */
14246 enum LDKLevel Level_trace(void);
14247
14248 /**
14249  * Utility method to constructs a new Debug-variant Level
14250  */
14251 enum LDKLevel Level_debug(void);
14252
14253 /**
14254  * Utility method to constructs a new Info-variant Level
14255  */
14256 enum LDKLevel Level_info(void);
14257
14258 /**
14259  * Utility method to constructs a new Warn-variant Level
14260  */
14261 enum LDKLevel Level_warn(void);
14262
14263 /**
14264  * Utility method to constructs a new Error-variant Level
14265  */
14266 enum LDKLevel Level_error(void);
14267
14268 /**
14269  * Checks if two Levels contain equal inner contents.
14270  * This ignores pointers and is_owned flags and looks at the values in fields.
14271  */
14272 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
14273
14274 /**
14275  * Checks if two Levels contain equal inner contents.
14276  */
14277 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
14278
14279 /**
14280  * Returns the most verbose logging level.
14281  */
14282 MUST_USE_RES enum LDKLevel Level_max(void);
14283
14284 /**
14285  * Calls the free function if one is set
14286  */
14287 void Logger_free(struct LDKLogger this_ptr);
14288
14289 /**
14290  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
14291  */
14292 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
14293
14294 /**
14295  * Confirmations we will wait for before considering the channel locked in.
14296  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
14297  * equivalent limit applied to outbound channels).
14298  *
14299  * Default value: 6.
14300  */
14301 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14302
14303 /**
14304  * Confirmations we will wait for before considering the channel locked in.
14305  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
14306  * equivalent limit applied to outbound channels).
14307  *
14308  * Default value: 6.
14309  */
14310 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
14311
14312 /**
14313  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
14314  * the number of blocks we have to punish our counterparty if they broadcast a revoked
14315  * transaction).
14316  *
14317  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
14318  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
14319  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
14320  * possibly with time in between to RBF the spending transaction).
14321  *
14322  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
14323  * case of an honest unilateral channel close, which implicitly decrease the economic value of
14324  * our channel.
14325  *
14326  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
14327  * can tweak config to ask for more security, not less.
14328  */
14329 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14330
14331 /**
14332  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
14333  * the number of blocks we have to punish our counterparty if they broadcast a revoked
14334  * transaction).
14335  *
14336  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
14337  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
14338  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
14339  * possibly with time in between to RBF the spending transaction).
14340  *
14341  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
14342  * case of an honest unilateral channel close, which implicitly decrease the economic value of
14343  * our channel.
14344  *
14345  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
14346  * can tweak config to ask for more security, not less.
14347  */
14348 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
14349
14350 /**
14351  * Set to the smallest value HTLC we will accept to process.
14352  *
14353  * This value is sent to our counterparty on channel-open and we close the channel any time
14354  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
14355  *
14356  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
14357  * by the protocol.
14358  */
14359 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14360
14361 /**
14362  * Set to the smallest value HTLC we will accept to process.
14363  *
14364  * This value is sent to our counterparty on channel-open and we close the channel any time
14365  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
14366  *
14367  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
14368  * by the protocol.
14369  */
14370 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
14371
14372 /**
14373  * Constructs a new ChannelHandshakeConfig given each field
14374  */
14375 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);
14376
14377 /**
14378  * Creates a copy of the ChannelHandshakeConfig
14379  */
14380 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
14381
14382 /**
14383  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
14384  */
14385 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
14386
14387 /**
14388  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
14389  */
14390 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
14391
14392 /**
14393  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
14394  * only applies to inbound channels.
14395  *
14396  * Default value: 0.
14397  */
14398 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14399
14400 /**
14401  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
14402  * only applies to inbound channels.
14403  *
14404  * Default value: 0.
14405  */
14406 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14407
14408 /**
14409  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
14410  * you to limit the maximum minimum-size they can require.
14411  *
14412  * Default value: u64::max_value.
14413  */
14414 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14415
14416 /**
14417  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
14418  * you to limit the maximum minimum-size they can require.
14419  *
14420  * Default value: u64::max_value.
14421  */
14422 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14423
14424 /**
14425  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
14426  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
14427  *
14428  * Default value: 0.
14429  */
14430 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14431
14432 /**
14433  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
14434  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
14435  *
14436  * Default value: 0.
14437  */
14438 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14439
14440 /**
14441  * The remote node will require we keep a certain amount in direct payment to ourselves at all
14442  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
14443  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
14444  *
14445  * Default value: u64::max_value.
14446  */
14447 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14448
14449 /**
14450  * The remote node will require we keep a certain amount in direct payment to ourselves at all
14451  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
14452  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
14453  *
14454  * Default value: u64::max_value.
14455  */
14456 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14457
14458 /**
14459  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
14460  * time. This allows you to set a minimum such value.
14461  *
14462  * Default value: 0.
14463  */
14464 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14465
14466 /**
14467  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
14468  * time. This allows you to set a minimum such value.
14469  *
14470  * Default value: 0.
14471  */
14472 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
14473
14474 /**
14475  * Before a channel is usable the funding transaction will need to be confirmed by at least a
14476  * certain number of blocks, specified by the node which is not the funder (as the funder can
14477  * assume they aren't going to double-spend themselves).
14478  * This config allows you to set a limit on the maximum amount of time to wait.
14479  *
14480  * Default value: 144, or roughly one day and only applies to outbound channels.
14481  */
14482 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14483
14484 /**
14485  * Before a channel is usable the funding transaction will need to be confirmed by at least a
14486  * certain number of blocks, specified by the node which is not the funder (as the funder can
14487  * assume they aren't going to double-spend themselves).
14488  * This config allows you to set a limit on the maximum amount of time to wait.
14489  *
14490  * Default value: 144, or roughly one day and only applies to outbound channels.
14491  */
14492 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
14493
14494 /**
14495  * Set to force an incoming channel to match our announced channel preference in
14496  * [`ChannelConfig::announced_channel`].
14497  *
14498  * For a node which is not online reliably, this should be set to true and
14499  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
14500  * channels will ever be opened.
14501  *
14502  * Default value: true.
14503  */
14504 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14505
14506 /**
14507  * Set to force an incoming channel to match our announced channel preference in
14508  * [`ChannelConfig::announced_channel`].
14509  *
14510  * For a node which is not online reliably, this should be set to true and
14511  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
14512  * channels will ever be opened.
14513  *
14514  * Default value: true.
14515  */
14516 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
14517
14518 /**
14519  * Set to the amount of time we're willing to wait to claim money back to us.
14520  *
14521  * Not checking this value would be a security issue, as our peer would be able to set it to
14522  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
14523  *
14524  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
14525  * reduce the loss of having useless locked funds (if your peer accepts)
14526  */
14527 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14528
14529 /**
14530  * Set to the amount of time we're willing to wait to claim money back to us.
14531  *
14532  * Not checking this value would be a security issue, as our peer would be able to set it to
14533  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
14534  *
14535  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
14536  * reduce the loss of having useless locked funds (if your peer accepts)
14537  */
14538 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
14539
14540 /**
14541  * Constructs a new ChannelHandshakeLimits given each field
14542  */
14543 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
14544
14545 /**
14546  * Creates a copy of the ChannelHandshakeLimits
14547  */
14548 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
14549
14550 /**
14551  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
14552  */
14553 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
14554
14555 /**
14556  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
14557  */
14558 void ChannelConfig_free(struct LDKChannelConfig this_obj);
14559
14560 /**
14561  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
14562  * over the channel.
14563  * This may be allowed to change at runtime in a later update, however doing so must result in
14564  * update messages sent to notify all nodes of our updated relay fee.
14565  *
14566  * Default value: 0.
14567  */
14568 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14569
14570 /**
14571  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
14572  * over the channel.
14573  * This may be allowed to change at runtime in a later update, however doing so must result in
14574  * update messages sent to notify all nodes of our updated relay fee.
14575  *
14576  * Default value: 0.
14577  */
14578 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
14579
14580 /**
14581  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
14582  * excess of [`forwarding_fee_proportional_millionths`].
14583  * This may be allowed to change at runtime in a later update, however doing so must result in
14584  * update messages sent to notify all nodes of our updated relay fee.
14585  *
14586  * The default value of a single satoshi roughly matches the market rate on many routing nodes
14587  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
14588  * this node.
14589  *
14590  * Default value: 1000.
14591  *
14592  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
14593  */
14594 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14595
14596 /**
14597  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
14598  * excess of [`forwarding_fee_proportional_millionths`].
14599  * This may be allowed to change at runtime in a later update, however doing so must result in
14600  * update messages sent to notify all nodes of our updated relay fee.
14601  *
14602  * The default value of a single satoshi roughly matches the market rate on many routing nodes
14603  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
14604  * this node.
14605  *
14606  * Default value: 1000.
14607  *
14608  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
14609  */
14610 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
14611
14612 /**
14613  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
14614  * the channel this config applies to.
14615  *
14616  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
14617  * HTLC balance when a channel appears on-chain whereas
14618  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14619  * (non-HTLC-encumbered) balance.
14620  *
14621  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14622  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14623  * commitment transaction at least once per this many blocks (minus some margin to allow us
14624  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14625  * the spending transaction).
14626  *
14627  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14628  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14629  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14630  *
14631  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14632  */
14633 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14634
14635 /**
14636  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
14637  * the channel this config applies to.
14638  *
14639  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
14640  * HTLC balance when a channel appears on-chain whereas
14641  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14642  * (non-HTLC-encumbered) balance.
14643  *
14644  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14645  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14646  * commitment transaction at least once per this many blocks (minus some margin to allow us
14647  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14648  * the spending transaction).
14649  *
14650  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14651  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14652  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14653  *
14654  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14655  */
14656 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
14657
14658 /**
14659  * Set to announce the channel publicly and notify all nodes that they can route via this
14660  * channel.
14661  *
14662  * This should only be set to true for nodes which expect to be online reliably.
14663  *
14664  * As the node which funds a channel picks this value this will only apply for new outbound
14665  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14666  *
14667  * This cannot be changed after the initial channel handshake.
14668  *
14669  * Default value: false.
14670  */
14671 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14672
14673 /**
14674  * Set to announce the channel publicly and notify all nodes that they can route via this
14675  * channel.
14676  *
14677  * This should only be set to true for nodes which expect to be online reliably.
14678  *
14679  * As the node which funds a channel picks this value this will only apply for new outbound
14680  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14681  *
14682  * This cannot be changed after the initial channel handshake.
14683  *
14684  * Default value: false.
14685  */
14686 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14687
14688 /**
14689  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14690  * supports it, they will then enforce the mutual-close output to us matches what we provided
14691  * at intialization, preventing us from closing to an alternate pubkey.
14692  *
14693  * This is set to true by default to provide a slight increase in security, though ultimately
14694  * any attacker who is able to take control of a channel can just as easily send the funds via
14695  * lightning payments, so we never require that our counterparties support this option.
14696  *
14697  * This cannot be changed after a channel has been initialized.
14698  *
14699  * Default value: true.
14700  */
14701 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14702
14703 /**
14704  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14705  * supports it, they will then enforce the mutual-close output to us matches what we provided
14706  * at intialization, preventing us from closing to an alternate pubkey.
14707  *
14708  * This is set to true by default to provide a slight increase in security, though ultimately
14709  * any attacker who is able to take control of a channel can just as easily send the funds via
14710  * lightning payments, so we never require that our counterparties support this option.
14711  *
14712  * This cannot be changed after a channel has been initialized.
14713  *
14714  * Default value: true.
14715  */
14716 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14717
14718 /**
14719  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14720  * small to claim on-chain.
14721  *
14722  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14723  * not be claimable on-chain, instead being turned into additional miner fees if either
14724  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14725  * to such payments may be sustantial if there are many dust HTLCs present when the
14726  * channel is force-closed.
14727  *
14728  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14729  * exposure across all three types per-channel. Setting this too low may prevent the
14730  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14731  * important to prevent stealing of dust HTLCs by miners.
14732  *
14733  * Default value: 5_000_000 msat.
14734  */
14735 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14736
14737 /**
14738  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14739  * small to claim on-chain.
14740  *
14741  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14742  * not be claimable on-chain, instead being turned into additional miner fees if either
14743  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14744  * to such payments may be sustantial if there are many dust HTLCs present when the
14745  * channel is force-closed.
14746  *
14747  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14748  * exposure across all three types per-channel. Setting this too low may prevent the
14749  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14750  * important to prevent stealing of dust HTLCs by miners.
14751  *
14752  * Default value: 5_000_000 msat.
14753  */
14754 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14755
14756 /**
14757  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14758  * `to_self_delay` to reclaim funds.
14759  *
14760  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14761  * closing transaction which both sides find acceptable, ultimately paid by the channel
14762  * funder/initiator.
14763  *
14764  * When we are the funder, because we have to pay the channel closing fee, we bound the
14765  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14766  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14767  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14768  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14769  * funds.
14770  *
14771  * When we are not the funder, we require the closing transaction fee pay at least our
14772  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14773  * Thus, this value is ignored when we are not the funder.
14774  *
14775  * Default value: 1000 satoshis.
14776  *
14777  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14778  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14779  */
14780 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14781
14782 /**
14783  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14784  * `to_self_delay` to reclaim funds.
14785  *
14786  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14787  * closing transaction which both sides find acceptable, ultimately paid by the channel
14788  * funder/initiator.
14789  *
14790  * When we are the funder, because we have to pay the channel closing fee, we bound the
14791  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14792  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14793  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14794  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14795  * funds.
14796  *
14797  * When we are not the funder, we require the closing transaction fee pay at least our
14798  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14799  * Thus, this value is ignored when we are not the funder.
14800  *
14801  * Default value: 1000 satoshis.
14802  *
14803  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14804  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14805  */
14806 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14807
14808 /**
14809  * Constructs a new ChannelConfig given each field
14810  */
14811 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
14812
14813 /**
14814  * Creates a copy of the ChannelConfig
14815  */
14816 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
14817
14818 /**
14819  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
14820  */
14821 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
14822
14823 /**
14824  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
14825  */
14826 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
14827
14828 /**
14829  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
14830  */
14831 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
14832
14833 /**
14834  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
14835  */
14836 void UserConfig_free(struct LDKUserConfig this_obj);
14837
14838 /**
14839  * Channel config that we propose to our counterparty.
14840  */
14841 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14842
14843 /**
14844  * Channel config that we propose to our counterparty.
14845  */
14846 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
14847
14848 /**
14849  * Limits applied to our counterparty's proposed channel config settings.
14850  */
14851 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14852
14853 /**
14854  * Limits applied to our counterparty's proposed channel config settings.
14855  */
14856 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
14857
14858 /**
14859  * Channel config which affects behavior during channel lifetime.
14860  */
14861 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14862
14863 /**
14864  * Channel config which affects behavior during channel lifetime.
14865  */
14866 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
14867
14868 /**
14869  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14870  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14871  * node which is not online reliably.
14872  *
14873  * For nodes which are not online reliably, you should set all channels to *not* be announced
14874  * (using [`ChannelConfig::announced_channel`] and
14875  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14876  * ensure you are not exposed to any forwarding risk.
14877  *
14878  * Note that because you cannot change a channel's announced state after creation, there is no
14879  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14880  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14881  * all your channels and open new ones. For privacy, you should also change your node_id
14882  * (swapping all private and public key material for new ones) at that time.
14883  *
14884  * Default value: false.
14885  */
14886 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14887
14888 /**
14889  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14890  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14891  * node which is not online reliably.
14892  *
14893  * For nodes which are not online reliably, you should set all channels to *not* be announced
14894  * (using [`ChannelConfig::announced_channel`] and
14895  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14896  * ensure you are not exposed to any forwarding risk.
14897  *
14898  * Note that because you cannot change a channel's announced state after creation, there is no
14899  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14900  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14901  * all your channels and open new ones. For privacy, you should also change your node_id
14902  * (swapping all private and public key material for new ones) at that time.
14903  *
14904  * Default value: false.
14905  */
14906 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
14907
14908 /**
14909  * Constructs a new UserConfig given each field
14910  */
14911 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, bool accept_forwards_to_priv_channels_arg);
14912
14913 /**
14914  * Creates a copy of the UserConfig
14915  */
14916 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
14917
14918 /**
14919  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
14920  */
14921 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
14922
14923 /**
14924  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
14925  */
14926 void BestBlock_free(struct LDKBestBlock this_obj);
14927
14928 /**
14929  * Creates a copy of the BestBlock
14930  */
14931 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
14932
14933 /**
14934  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
14935  * network.
14936  */
14937 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
14938
14939 /**
14940  * Returns a `BestBlock` as identified by the given block hash and height.
14941  */
14942 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
14943
14944 /**
14945  * Returns the best block hash.
14946  */
14947 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
14948
14949 /**
14950  * Returns the best block height.
14951  */
14952 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
14953
14954 /**
14955  * Creates a copy of the AccessError
14956  */
14957 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
14958
14959 /**
14960  * Utility method to constructs a new UnknownChain-variant AccessError
14961  */
14962 enum LDKAccessError AccessError_unknown_chain(void);
14963
14964 /**
14965  * Utility method to constructs a new UnknownTx-variant AccessError
14966  */
14967 enum LDKAccessError AccessError_unknown_tx(void);
14968
14969 /**
14970  * Calls the free function if one is set
14971  */
14972 void Access_free(struct LDKAccess this_ptr);
14973
14974 /**
14975  * Calls the free function if one is set
14976  */
14977 void Listen_free(struct LDKListen this_ptr);
14978
14979 /**
14980  * Calls the free function if one is set
14981  */
14982 void Confirm_free(struct LDKConfirm this_ptr);
14983
14984 /**
14985  * Creates a copy of the ChannelMonitorUpdateErr
14986  */
14987 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
14988
14989 /**
14990  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
14991  */
14992 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
14993
14994 /**
14995  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
14996  */
14997 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
14998
14999 /**
15000  * Calls the free function if one is set
15001  */
15002 void Watch_free(struct LDKWatch this_ptr);
15003
15004 /**
15005  * Calls the free function if one is set
15006  */
15007 void Filter_free(struct LDKFilter this_ptr);
15008
15009 /**
15010  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
15011  */
15012 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
15013
15014 /**
15015  * First block where the transaction output may have been spent.
15016  *
15017  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
15018  */
15019 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
15020
15021 /**
15022  * First block where the transaction output may have been spent.
15023  *
15024  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
15025  */
15026 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15027
15028 /**
15029  * Outpoint identifying the transaction output.
15030  */
15031 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
15032
15033 /**
15034  * Outpoint identifying the transaction output.
15035  */
15036 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15037
15038 /**
15039  * Spending condition of the transaction output.
15040  */
15041 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
15042
15043 /**
15044  * Spending condition of the transaction output.
15045  */
15046 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
15047
15048 /**
15049  * Constructs a new WatchedOutput given each field
15050  */
15051 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
15052
15053 /**
15054  * Creates a copy of the WatchedOutput
15055  */
15056 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
15057
15058 /**
15059  * Checks if two WatchedOutputs contain equal inner contents.
15060  */
15061 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
15062
15063 /**
15064  * Calls the free function if one is set
15065  */
15066 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
15067
15068 /**
15069  * Creates a copy of the ConfirmationTarget
15070  */
15071 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
15072
15073 /**
15074  * Utility method to constructs a new Background-variant ConfirmationTarget
15075  */
15076 enum LDKConfirmationTarget ConfirmationTarget_background(void);
15077
15078 /**
15079  * Utility method to constructs a new Normal-variant ConfirmationTarget
15080  */
15081 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
15082
15083 /**
15084  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
15085  */
15086 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
15087
15088 /**
15089  * Checks if two ConfirmationTargets contain equal inner contents.
15090  * This ignores pointers and is_owned flags and looks at the values in fields.
15091  */
15092 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
15093
15094 /**
15095  * Calls the free function if one is set
15096  */
15097 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
15098
15099 /**
15100  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
15101  */
15102 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
15103
15104 /**
15105  * Creates a copy of the MonitorUpdateId
15106  */
15107 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
15108
15109 /**
15110  * Checks if two MonitorUpdateIds contain equal inner contents.
15111  */
15112 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
15113
15114 /**
15115  * Checks if two MonitorUpdateIds contain equal inner contents.
15116  * This ignores pointers and is_owned flags and looks at the values in fields.
15117  * Two objects with NULL inner values will be considered "equal" here.
15118  */
15119 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
15120
15121 /**
15122  * Calls the free function if one is set
15123  */
15124 void Persist_free(struct LDKPersist this_ptr);
15125
15126 /**
15127  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
15128  */
15129 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
15130
15131 /**
15132  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
15133  */
15134 void ChainMonitor_free(struct LDKChainMonitor this_obj);
15135
15136 /**
15137  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
15138  *
15139  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
15140  * will call back to it indicating transactions and outputs of interest. This allows clients to
15141  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
15142  * always need to fetch full blocks absent another means for determining which blocks contain
15143  * transactions relevant to the watched channels.
15144  */
15145 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
15146
15147 /**
15148  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
15149  * claims which are awaiting confirmation.
15150  *
15151  * Includes the balances from each [`ChannelMonitor`] *except* those included in
15152  * `ignored_channels`, allowing you to filter out balances from channels which are still open
15153  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
15154  *
15155  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
15156  * inclusion in the return value.
15157  */
15158 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
15159
15160 /**
15161  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
15162  * such [`ChannelMonitor`] is currently being monitored for.
15163  *
15164  * Note that the result holds a mutex over our monitor set, and should not be held
15165  * indefinitely.
15166  */
15167 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
15168
15169 /**
15170  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
15171  *
15172  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
15173  * monitoring for on-chain state resolutions.
15174  */
15175 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15176
15177 /**
15178  * Indicates the persistence of a [`ChannelMonitor`] has completed after
15179  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
15180  *
15181  * Thus, the anticipated use is, at a high level:
15182  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
15183  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
15184  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
15185  *  2) once all remote copies are updated, you call this function with the
15186  *     `completed_update_id` that completed, and once all pending updates have completed the
15187  *     channel will be re-enabled.
15188  *
15189  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
15190  * registered [`ChannelMonitor`]s.
15191  */
15192 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
15193
15194 /**
15195  * Constructs a new Listen which calls the relevant methods on this_arg.
15196  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
15197  */
15198 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15199
15200 /**
15201  * Constructs a new Confirm which calls the relevant methods on this_arg.
15202  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
15203  */
15204 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15205
15206 /**
15207  * Constructs a new Watch which calls the relevant methods on this_arg.
15208  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
15209  */
15210 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15211
15212 /**
15213  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
15214  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
15215  */
15216 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15217
15218 /**
15219  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
15220  */
15221 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
15222
15223 /**
15224  * The sequence number of this update. Updates *must* be replayed in-order according to this
15225  * sequence number (and updates may panic if they are not). The update_id values are strictly
15226  * increasing and increase by one for each new update, with one exception specified below.
15227  *
15228  * This sequence number is also used to track up to which points updates which returned
15229  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
15230  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
15231  *
15232  * The only instance where update_id values are not strictly increasing is the case where we
15233  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
15234  * its docs for more details.
15235  */
15236 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
15237
15238 /**
15239  * The sequence number of this update. Updates *must* be replayed in-order according to this
15240  * sequence number (and updates may panic if they are not). The update_id values are strictly
15241  * increasing and increase by one for each new update, with one exception specified below.
15242  *
15243  * This sequence number is also used to track up to which points updates which returned
15244  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
15245  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
15246  *
15247  * The only instance where update_id values are not strictly increasing is the case where we
15248  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
15249  * its docs for more details.
15250  */
15251 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
15252
15253 /**
15254  * Creates a copy of the ChannelMonitorUpdate
15255  */
15256 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
15257
15258 /**
15259  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
15260  */
15261 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
15262
15263 /**
15264  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
15265  */
15266 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
15267
15268 /**
15269  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
15270  */
15271 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
15272
15273 struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr);
15274
15275 void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val);
15276
15277 /**
15278  * Constructs a new MonitorUpdateError given each field
15279  */
15280 MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg);
15281
15282 /**
15283  * Creates a copy of the MonitorUpdateError
15284  */
15285 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
15286
15287 /**
15288  * Frees any resources used by the MonitorEvent
15289  */
15290 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
15291
15292 /**
15293  * Creates a copy of the MonitorEvent
15294  */
15295 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
15296
15297 /**
15298  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
15299  */
15300 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
15301
15302 /**
15303  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
15304  */
15305 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
15306
15307 /**
15308  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
15309  */
15310 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
15311
15312 /**
15313  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
15314  */
15315 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
15316
15317 /**
15318  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
15319  */
15320 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
15321
15322 /**
15323  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
15324  */
15325 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
15326
15327 /**
15328  * Creates a copy of the HTLCUpdate
15329  */
15330 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
15331
15332 /**
15333  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
15334  */
15335 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
15336
15337 /**
15338  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
15339  */
15340 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
15341
15342 /**
15343  * Frees any resources used by the Balance
15344  */
15345 void Balance_free(struct LDKBalance this_ptr);
15346
15347 /**
15348  * Creates a copy of the Balance
15349  */
15350 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
15351
15352 /**
15353  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
15354  */
15355 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
15356
15357 /**
15358  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
15359  */
15360 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
15361
15362 /**
15363  * Utility method to constructs a new ContentiousClaimable-variant Balance
15364  */
15365 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
15366
15367 /**
15368  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
15369  */
15370 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
15371
15372 /**
15373  * Checks if two Balances contain equal inner contents.
15374  * This ignores pointers and is_owned flags and looks at the values in fields.
15375  */
15376 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
15377
15378 /**
15379  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
15380  */
15381 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
15382
15383 /**
15384  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
15385  */
15386 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
15387
15388 /**
15389  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
15390  * itself.
15391  *
15392  * panics if the given update is not the next update by update_id.
15393  */
15394 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);
15395
15396 /**
15397  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
15398  * ChannelMonitor.
15399  */
15400 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15401
15402 /**
15403  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
15404  */
15405 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15406
15407 /**
15408  * Gets a list of txids, with their output scripts (in the order they appear in the
15409  * transaction), which we must learn about spends of via block_connected().
15410  */
15411 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15412
15413 /**
15414  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
15415  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
15416  * have been registered.
15417  */
15418 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
15419
15420 /**
15421  * Get the list of HTLCs who's status has been updated on chain. This should be called by
15422  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
15423  */
15424 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15425
15426 /**
15427  * Gets the list of pending events which were generated by previous actions, clearing the list
15428  * in the process.
15429  *
15430  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
15431  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
15432  * no internal locking in ChannelMonitors.
15433  */
15434 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15435
15436 /**
15437  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
15438  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
15439  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
15440  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
15441  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
15442  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
15443  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
15444  * out-of-band the other node operator to coordinate with him if option is available to you.
15445  * In any-case, choice is up to the user.
15446  */
15447 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);
15448
15449 /**
15450  * Processes transactions in a newly connected block, which may result in any of the following:
15451  * - update the monitor's state against resolved HTLCs
15452  * - punish the counterparty in the case of seeing a revoked commitment transaction
15453  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
15454  * - detect settled outputs for later spending
15455  * - schedule and bump any in-flight claims
15456  *
15457  * Returns any new outputs to watch from `txdata`; after called, these are also included in
15458  * [`get_outputs_to_watch`].
15459  *
15460  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
15461  */
15462 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);
15463
15464 /**
15465  * Determines if the disconnected block contained any transactions of interest and updates
15466  * appropriately.
15467  */
15468 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);
15469
15470 /**
15471  * Processes transactions confirmed in a block with the given header and height, returning new
15472  * outputs to watch. See [`block_connected`] for details.
15473  *
15474  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
15475  * blocks. See [`chain::Confirm`] for calling expectations.
15476  *
15477  * [`block_connected`]: Self::block_connected
15478  */
15479 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);
15480
15481 /**
15482  * Processes a transaction that was reorganized out of the chain.
15483  *
15484  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
15485  * than blocks. See [`chain::Confirm`] for calling expectations.
15486  *
15487  * [`block_disconnected`]: Self::block_disconnected
15488  */
15489 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);
15490
15491 /**
15492  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
15493  * [`block_connected`] for details.
15494  *
15495  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
15496  * blocks. See [`chain::Confirm`] for calling expectations.
15497  *
15498  * [`block_connected`]: Self::block_connected
15499  */
15500 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);
15501
15502 /**
15503  * Returns the set of txids that should be monitored for re-organization out of the chain.
15504  */
15505 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15506
15507 /**
15508  * Gets the latest best block which was connected either via the [`chain::Listen`] or
15509  * [`chain::Confirm`] interfaces.
15510  */
15511 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15512
15513 /**
15514  * Gets the balances in this channel which are either claimable by us if we were to
15515  * force-close the channel now or which are claimable on-chain (possibly awaiting
15516  * confirmation).
15517  *
15518  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
15519  * included here until an [`Event::SpendableOutputs`] event has been generated for the
15520  * balance, or until our counterparty has claimed the balance and accrued several
15521  * confirmations on the claim transaction.
15522  *
15523  * Note that the balances available when you or your counterparty have broadcasted revoked
15524  * state(s) may not be fully captured here.
15525  *
15526  * See [`Balance`] for additional details on the types of claimable balances which
15527  * may be returned here and their meanings.
15528  */
15529 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15530
15531 /**
15532  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
15533  */
15534 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
15535
15536 /**
15537  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
15538  */
15539 void OutPoint_free(struct LDKOutPoint this_obj);
15540
15541 /**
15542  * The referenced transaction's txid.
15543  */
15544 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
15545
15546 /**
15547  * The referenced transaction's txid.
15548  */
15549 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15550
15551 /**
15552  * The index of the referenced output in its transaction's vout.
15553  */
15554 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
15555
15556 /**
15557  * The index of the referenced output in its transaction's vout.
15558  */
15559 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
15560
15561 /**
15562  * Constructs a new OutPoint given each field
15563  */
15564 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
15565
15566 /**
15567  * Creates a copy of the OutPoint
15568  */
15569 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
15570
15571 /**
15572  * Checks if two OutPoints contain equal inner contents.
15573  * This ignores pointers and is_owned flags and looks at the values in fields.
15574  * Two objects with NULL inner values will be considered "equal" here.
15575  */
15576 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
15577
15578 /**
15579  * Checks if two OutPoints contain equal inner contents.
15580  */
15581 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
15582
15583 /**
15584  * Convert an `OutPoint` to a lightning channel id.
15585  */
15586 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
15587
15588 /**
15589  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
15590  */
15591 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
15592
15593 /**
15594  * Read a OutPoint from a byte array, created by OutPoint_write
15595  */
15596 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
15597
15598 /**
15599  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
15600  */
15601 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
15602
15603 /**
15604  * The outpoint which is spendable
15605  */
15606 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15607
15608 /**
15609  * The outpoint which is spendable
15610  */
15611 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15612
15613 /**
15614  * Per commitment point to derive delayed_payment_key by key holder
15615  */
15616 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15617
15618 /**
15619  * Per commitment point to derive delayed_payment_key by key holder
15620  */
15621 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15622
15623 /**
15624  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
15625  * the witness_script.
15626  */
15627 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15628
15629 /**
15630  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
15631  * the witness_script.
15632  */
15633 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
15634
15635 /**
15636  * The output which is referenced by the given outpoint
15637  */
15638 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
15639
15640 /**
15641  * The revocation point specific to the commitment transaction which was broadcast. Used to
15642  * derive the witnessScript for this output.
15643  */
15644 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15645
15646 /**
15647  * The revocation point specific to the commitment transaction which was broadcast. Used to
15648  * derive the witnessScript for this output.
15649  */
15650 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15651
15652 /**
15653  * Arbitrary identification information returned by a call to
15654  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15655  * the channel to spend the output.
15656  */
15657 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
15658
15659 /**
15660  * Arbitrary identification information returned by a call to
15661  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15662  * the channel to spend the output.
15663  */
15664 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15665
15666 /**
15667  * The value of the channel which this output originated from, possibly indirectly.
15668  */
15669 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15670
15671 /**
15672  * The value of the channel which this output originated from, possibly indirectly.
15673  */
15674 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
15675
15676 /**
15677  * Constructs a new DelayedPaymentOutputDescriptor given each field
15678  */
15679 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);
15680
15681 /**
15682  * Creates a copy of the DelayedPaymentOutputDescriptor
15683  */
15684 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
15685
15686 /**
15687  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
15688  */
15689 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
15690
15691 /**
15692  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
15693  */
15694 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
15695
15696 /**
15697  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
15698  */
15699 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
15700
15701 /**
15702  * The outpoint which is spendable
15703  */
15704 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15705
15706 /**
15707  * The outpoint which is spendable
15708  */
15709 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15710
15711 /**
15712  * The output which is referenced by the given outpoint
15713  */
15714 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
15715
15716 /**
15717  * Arbitrary identification information returned by a call to
15718  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15719  * the channel to spend the output.
15720  */
15721 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
15722
15723 /**
15724  * Arbitrary identification information returned by a call to
15725  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15726  * the channel to spend the output.
15727  */
15728 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15729
15730 /**
15731  * The value of the channel which this transactions spends.
15732  */
15733 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15734
15735 /**
15736  * The value of the channel which this transactions spends.
15737  */
15738 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
15739
15740 /**
15741  * Constructs a new StaticPaymentOutputDescriptor given each field
15742  */
15743 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);
15744
15745 /**
15746  * Creates a copy of the StaticPaymentOutputDescriptor
15747  */
15748 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
15749
15750 /**
15751  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
15752  */
15753 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
15754
15755 /**
15756  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
15757  */
15758 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
15759
15760 /**
15761  * Frees any resources used by the SpendableOutputDescriptor
15762  */
15763 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
15764
15765 /**
15766  * Creates a copy of the SpendableOutputDescriptor
15767  */
15768 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
15769
15770 /**
15771  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
15772  */
15773 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
15774
15775 /**
15776  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
15777  */
15778 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
15779
15780 /**
15781  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
15782  */
15783 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
15784
15785 /**
15786  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
15787  */
15788 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
15789
15790 /**
15791  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
15792  */
15793 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
15794
15795 /**
15796  * Calls the free function if one is set
15797  */
15798 void BaseSign_free(struct LDKBaseSign this_ptr);
15799
15800 /**
15801  * Creates a copy of a Sign
15802  */
15803 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
15804
15805 /**
15806  * Calls the free function if one is set
15807  */
15808 void Sign_free(struct LDKSign this_ptr);
15809
15810 /**
15811  * Calls the free function if one is set
15812  */
15813 void KeysInterface_free(struct LDKKeysInterface this_ptr);
15814
15815 /**
15816  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
15817  */
15818 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
15819
15820 /**
15821  * Private key of anchor tx
15822  */
15823 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15824
15825 /**
15826  * Private key of anchor tx
15827  */
15828 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15829
15830 /**
15831  * Holder secret key for blinded revocation pubkey
15832  */
15833 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15834
15835 /**
15836  * Holder secret key for blinded revocation pubkey
15837  */
15838 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15839
15840 /**
15841  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15842  */
15843 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15844
15845 /**
15846  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15847  */
15848 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15849
15850 /**
15851  * Holder secret key used in HTLC tx
15852  */
15853 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15854
15855 /**
15856  * Holder secret key used in HTLC tx
15857  */
15858 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15859
15860 /**
15861  * Holder htlc secret key used in commitment tx htlc outputs
15862  */
15863 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15864
15865 /**
15866  * Holder htlc secret key used in commitment tx htlc outputs
15867  */
15868 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15869
15870 /**
15871  * Commitment seed
15872  */
15873 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15874
15875 /**
15876  * Commitment seed
15877  */
15878 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15879
15880 /**
15881  * Creates a copy of the InMemorySigner
15882  */
15883 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
15884
15885 /**
15886  * Create a new InMemorySigner
15887  */
15888 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);
15889
15890 /**
15891  * Counterparty pubkeys.
15892  * Will panic if ready_channel wasn't called.
15893  */
15894 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15895
15896 /**
15897  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
15898  * transactions, ie the amount of time that we have to wait to recover our funds if we
15899  * broadcast a transaction.
15900  * Will panic if ready_channel wasn't called.
15901  */
15902 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15903
15904 /**
15905  * The contest_delay value specified by us and applied on transactions broadcastable
15906  * by our counterparty, ie the amount of time that they have to wait to recover their funds
15907  * if they broadcast a transaction.
15908  * Will panic if ready_channel wasn't called.
15909  */
15910 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15911
15912 /**
15913  * Whether the holder is the initiator
15914  * Will panic if ready_channel wasn't called.
15915  */
15916 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15917
15918 /**
15919  * Funding outpoint
15920  * Will panic if ready_channel wasn't called.
15921  */
15922 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15923
15924 /**
15925  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
15926  * building transactions.
15927  *
15928  * Will panic if ready_channel wasn't called.
15929  */
15930 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15931
15932 /**
15933  * Sign the single input of spend_tx at index `input_idx` which spends the output
15934  * described by descriptor, returning the witness stack for the input.
15935  *
15936  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15937  * or is not spending the outpoint described by `descriptor.outpoint`.
15938  */
15939 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);
15940
15941 /**
15942  * Sign the single input of spend_tx at index `input_idx` which spends the output
15943  * described by descriptor, returning the witness stack for the input.
15944  *
15945  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15946  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
15947  * sequence set to `descriptor.to_self_delay`.
15948  */
15949 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);
15950
15951 /**
15952  * Constructs a new BaseSign which calls the relevant methods on this_arg.
15953  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
15954  */
15955 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15956
15957 /**
15958  * Constructs a new Sign which calls the relevant methods on this_arg.
15959  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
15960  */
15961 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15962
15963 /**
15964  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
15965  */
15966 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
15967
15968 /**
15969  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
15970  */
15971 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
15972
15973 /**
15974  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
15975  */
15976 void KeysManager_free(struct LDKKeysManager this_obj);
15977
15978 /**
15979  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
15980  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
15981  * starting_time isn't strictly required to actually be a time, but it must absolutely,
15982  * without a doubt, be unique to this instance. ie if you start multiple times with the same
15983  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
15984  * simply use the current time (with very high precision).
15985  *
15986  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
15987  * obviously, starting_time should be unique every time you reload the library - it is only
15988  * used to generate new ephemeral key data (which will be stored by the individual channel if
15989  * necessary).
15990  *
15991  * Note that the seed is required to recover certain on-chain funds independent of
15992  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
15993  * channel, and some on-chain during-closing funds.
15994  *
15995  * Note that until the 0.1 release there is no guarantee of backward compatibility between
15996  * versions. Once the library is more fully supported, the docs will be updated to include a
15997  * detailed description of the guarantee.
15998  */
15999 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
16000
16001 /**
16002  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
16003  *
16004  * Key derivation parameters are accessible through a per-channel secrets
16005  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
16006  * onchain output detection for which a corresponding delayed_payment_key must be derived.
16007  */
16008 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]);
16009
16010 /**
16011  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
16012  * output to the given change destination (if sufficient change value remains). The
16013  * transaction will have a feerate, at least, of the given value.
16014  *
16015  * Returns `Err(())` if the output value is greater than the input value minus required fee or
16016  * if a descriptor was duplicated.
16017  *
16018  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
16019  *
16020  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
16021  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
16022  */
16023 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);
16024
16025 /**
16026  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
16027  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
16028  */
16029 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
16030
16031 /**
16032  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
16033  */
16034 void ChannelManager_free(struct LDKChannelManager this_obj);
16035
16036 /**
16037  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
16038  */
16039 void ChainParameters_free(struct LDKChainParameters this_obj);
16040
16041 /**
16042  * The network for determining the `chain_hash` in Lightning messages.
16043  */
16044 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
16045
16046 /**
16047  * The network for determining the `chain_hash` in Lightning messages.
16048  */
16049 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
16050
16051 /**
16052  * The hash and height of the latest block successfully connected.
16053  *
16054  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
16055  */
16056 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
16057
16058 /**
16059  * The hash and height of the latest block successfully connected.
16060  *
16061  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
16062  */
16063 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
16064
16065 /**
16066  * Constructs a new ChainParameters given each field
16067  */
16068 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
16069
16070 /**
16071  * Creates a copy of the ChainParameters
16072  */
16073 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
16074
16075 /**
16076  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
16077  */
16078 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
16079
16080 /**
16081  * Base routing fee in millisatoshis.
16082  */
16083 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
16084
16085 /**
16086  * Base routing fee in millisatoshis.
16087  */
16088 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
16089
16090 /**
16091  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
16092  */
16093 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
16094
16095 /**
16096  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
16097  */
16098 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
16099
16100 /**
16101  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
16102  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
16103  * `cltv_expiry_delta` for more details.
16104  */
16105 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
16106
16107 /**
16108  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
16109  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
16110  * `cltv_expiry_delta` for more details.
16111  */
16112 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
16113
16114 /**
16115  * Constructs a new CounterpartyForwardingInfo given each field
16116  */
16117 MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg);
16118
16119 /**
16120  * Creates a copy of the CounterpartyForwardingInfo
16121  */
16122 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
16123
16124 /**
16125  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
16126  */
16127 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
16128
16129 /**
16130  * The node_id of our counterparty
16131  */
16132 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16133
16134 /**
16135  * The node_id of our counterparty
16136  */
16137 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16138
16139 /**
16140  * The Features the channel counterparty provided upon last connection.
16141  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
16142  * many routing-relevant features are present in the init context.
16143  */
16144 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16145
16146 /**
16147  * The Features the channel counterparty provided upon last connection.
16148  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
16149  * many routing-relevant features are present in the init context.
16150  */
16151 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
16152
16153 /**
16154  * The value, in satoshis, that must always be held in the channel for our counterparty. This
16155  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
16156  * claiming at least this value on chain.
16157  *
16158  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
16159  *
16160  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
16161  */
16162 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16163
16164 /**
16165  * The value, in satoshis, that must always be held in the channel for our counterparty. This
16166  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
16167  * claiming at least this value on chain.
16168  *
16169  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
16170  *
16171  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
16172  */
16173 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
16174
16175 /**
16176  * Information on the fees and requirements that the counterparty requires when forwarding
16177  * payments to us through this channel.
16178  *
16179  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16180  */
16181 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16182
16183 /**
16184  * Information on the fees and requirements that the counterparty requires when forwarding
16185  * payments to us through this channel.
16186  *
16187  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16188  */
16189 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
16190
16191 /**
16192  * Constructs a new ChannelCounterparty given each field
16193  */
16194 MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg);
16195
16196 /**
16197  * Creates a copy of the ChannelCounterparty
16198  */
16199 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
16200
16201 /**
16202  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
16203  */
16204 void ChannelDetails_free(struct LDKChannelDetails this_obj);
16205
16206 /**
16207  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
16208  * thereafter this is the txid of the funding transaction xor the funding transaction output).
16209  * Note that this means this value is *not* persistent - it can change once during the
16210  * lifetime of the channel.
16211  */
16212 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
16213
16214 /**
16215  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
16216  * thereafter this is the txid of the funding transaction xor the funding transaction output).
16217  * Note that this means this value is *not* persistent - it can change once during the
16218  * lifetime of the channel.
16219  */
16220 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16221
16222 /**
16223  * Parameters which apply to our counterparty. See individual fields for more information.
16224  */
16225 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16226
16227 /**
16228  * Parameters which apply to our counterparty. See individual fields for more information.
16229  */
16230 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
16231
16232 /**
16233  * The Channel's funding transaction output, if we've negotiated the funding transaction with
16234  * our counterparty already.
16235  *
16236  * Note that, if this has been set, `channel_id` will be equivalent to
16237  * `funding_txo.unwrap().to_channel_id()`.
16238  *
16239  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16240  */
16241 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16242
16243 /**
16244  * The Channel's funding transaction output, if we've negotiated the funding transaction with
16245  * our counterparty already.
16246  *
16247  * Note that, if this has been set, `channel_id` will be equivalent to
16248  * `funding_txo.unwrap().to_channel_id()`.
16249  *
16250  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16251  */
16252 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16253
16254 /**
16255  * The position of the funding transaction in the chain. None if the funding transaction has
16256  * not yet been confirmed and the channel fully opened.
16257  */
16258 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16259
16260 /**
16261  * The position of the funding transaction in the chain. None if the funding transaction has
16262  * not yet been confirmed and the channel fully opened.
16263  */
16264 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16265
16266 /**
16267  * The value, in satoshis, of this channel as appears in the funding output
16268  */
16269 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16270
16271 /**
16272  * The value, in satoshis, of this channel as appears in the funding output
16273  */
16274 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16275
16276 /**
16277  * The value, in satoshis, that must always be held in the channel for us. This value ensures
16278  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
16279  * this value on chain.
16280  *
16281  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
16282  *
16283  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16284  *
16285  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
16286  */
16287 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16288
16289 /**
16290  * The value, in satoshis, that must always be held in the channel for us. This value ensures
16291  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
16292  * this value on chain.
16293  *
16294  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
16295  *
16296  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16297  *
16298  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
16299  */
16300 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16301
16302 /**
16303  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
16304  */
16305 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16306
16307 /**
16308  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
16309  */
16310 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16311
16312 /**
16313  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
16314  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16315  * available for inclusion in new outbound HTLCs). This further does not include any pending
16316  * outgoing HTLCs which are awaiting some other resolution to be sent.
16317  *
16318  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16319  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
16320  * should be able to spend nearly this amount.
16321  */
16322 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16323
16324 /**
16325  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
16326  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16327  * available for inclusion in new outbound HTLCs). This further does not include any pending
16328  * outgoing HTLCs which are awaiting some other resolution to be sent.
16329  *
16330  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16331  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
16332  * should be able to spend nearly this amount.
16333  */
16334 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16335
16336 /**
16337  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
16338  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16339  * available for inclusion in new inbound HTLCs).
16340  * Note that there are some corner cases not fully handled here, so the actual available
16341  * inbound capacity may be slightly higher than this.
16342  *
16343  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16344  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
16345  * However, our counterparty should be able to spend nearly this amount.
16346  */
16347 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16348
16349 /**
16350  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
16351  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16352  * available for inclusion in new inbound HTLCs).
16353  * Note that there are some corner cases not fully handled here, so the actual available
16354  * inbound capacity may be slightly higher than this.
16355  *
16356  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16357  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
16358  * However, our counterparty should be able to spend nearly this amount.
16359  */
16360 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16361
16362 /**
16363  * The number of required confirmations on the funding transaction before the funding will be
16364  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
16365  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
16366  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
16367  * [`ChannelHandshakeLimits::max_minimum_depth`].
16368  *
16369  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16370  *
16371  * [`is_outbound`]: ChannelDetails::is_outbound
16372  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
16373  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
16374  */
16375 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16376
16377 /**
16378  * The number of required confirmations on the funding transaction before the funding will be
16379  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
16380  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
16381  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
16382  * [`ChannelHandshakeLimits::max_minimum_depth`].
16383  *
16384  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16385  *
16386  * [`is_outbound`]: ChannelDetails::is_outbound
16387  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
16388  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
16389  */
16390 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16391
16392 /**
16393  * The number of blocks (after our commitment transaction confirms) that we will need to wait
16394  * until we can claim our funds after we force-close the channel. During this time our
16395  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
16396  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
16397  * time to claim our non-HTLC-encumbered funds.
16398  *
16399  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16400  */
16401 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16402
16403 /**
16404  * The number of blocks (after our commitment transaction confirms) that we will need to wait
16405  * until we can claim our funds after we force-close the channel. During this time our
16406  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
16407  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
16408  * time to claim our non-HTLC-encumbered funds.
16409  *
16410  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16411  */
16412 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
16413
16414 /**
16415  * True if the channel was initiated (and thus funded) by us.
16416  */
16417 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16418
16419 /**
16420  * True if the channel was initiated (and thus funded) by us.
16421  */
16422 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16423
16424 /**
16425  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
16426  * channel is not currently being shut down. `funding_locked` message exchange implies the
16427  * required confirmation count has been reached (and we were connected to the peer at some
16428  * point after the funding transaction received enough confirmations). The required
16429  * confirmation count is provided in [`confirmations_required`].
16430  *
16431  * [`confirmations_required`]: ChannelDetails::confirmations_required
16432  */
16433 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16434
16435 /**
16436  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
16437  * channel is not currently being shut down. `funding_locked` message exchange implies the
16438  * required confirmation count has been reached (and we were connected to the peer at some
16439  * point after the funding transaction received enough confirmations). The required
16440  * confirmation count is provided in [`confirmations_required`].
16441  *
16442  * [`confirmations_required`]: ChannelDetails::confirmations_required
16443  */
16444 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16445
16446 /**
16447  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
16448  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
16449  *
16450  * This is a strict superset of `is_funding_locked`.
16451  */
16452 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16453
16454 /**
16455  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
16456  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
16457  *
16458  * This is a strict superset of `is_funding_locked`.
16459  */
16460 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16461
16462 /**
16463  * True if this channel is (or will be) publicly-announced.
16464  */
16465 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16466
16467 /**
16468  * True if this channel is (or will be) publicly-announced.
16469  */
16470 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16471
16472 /**
16473  * Constructs a new ChannelDetails given each field
16474  */
16475 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
16476
16477 /**
16478  * Creates a copy of the ChannelDetails
16479  */
16480 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
16481
16482 /**
16483  * Frees any resources used by the PaymentSendFailure
16484  */
16485 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
16486
16487 /**
16488  * Creates a copy of the PaymentSendFailure
16489  */
16490 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
16491
16492 /**
16493  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
16494  */
16495 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
16496
16497 /**
16498  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
16499  */
16500 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
16501
16502 /**
16503  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
16504  */
16505 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
16506
16507 /**
16508  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
16509  */
16510 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
16511
16512 /**
16513  * Constructs a new ChannelManager to hold several channels and route between them.
16514  *
16515  * This is the main \"logic hub\" for all channel-related actions, and implements
16516  * ChannelMessageHandler.
16517  *
16518  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
16519  *
16520  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
16521  *
16522  * Users need to notify the new ChannelManager when a new block is connected or
16523  * disconnected using its `block_connected` and `block_disconnected` methods, starting
16524  * from after `params.latest_hash`.
16525  */
16526 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);
16527
16528 /**
16529  * Gets the current configuration applied to all new channels,  as
16530  */
16531 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
16532
16533 /**
16534  * Creates a new outbound channel to the given remote node and with the given value.
16535  *
16536  * `user_channel_id` will be provided back as in
16537  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
16538  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
16539  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
16540  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
16541  * ignored.
16542  *
16543  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
16544  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
16545  *
16546  * Note that we do not check if you are currently connected to the given peer. If no
16547  * connection is available, the outbound `open_channel` message may fail to send, resulting in
16548  * the channel eventually being silently forgotten (dropped on reload).
16549  *
16550  * Returns the new Channel's temporary `channel_id`. This ID will appear as
16551  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
16552  * [`ChannelDetails::channel_id`] until after
16553  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
16554  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
16555  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
16556  *
16557  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
16558  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
16559  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
16560  *
16561  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
16562  */
16563 MUST_USE_RES struct LDKCResult__u832APIErrorZ 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_channel_id, struct LDKUserConfig override_config);
16564
16565 /**
16566  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
16567  * more information.
16568  */
16569 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16570
16571 /**
16572  * Gets the list of usable channels, in random order. Useful as an argument to
16573  * get_route to ensure non-announced channels are used.
16574  *
16575  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
16576  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
16577  * are.
16578  */
16579 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16580
16581 /**
16582  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
16583  * will be accepted on the given channel, and after additional timeout/the closing of all
16584  * pending HTLCs, the channel will be closed on chain.
16585  *
16586  *  * If we are the channel initiator, we will pay between our [`Background`] and
16587  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
16588  *    estimate.
16589  *  * If our counterparty is the channel initiator, we will require a channel closing
16590  *    transaction feerate of at least our [`Background`] feerate or the feerate which
16591  *    would appear on a force-closure transaction, whichever is lower. We will allow our
16592  *    counterparty to pay as much fee as they'd like, however.
16593  *
16594  * May generate a SendShutdown message event on success, which should be relayed.
16595  *
16596  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
16597  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16598  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16599  */
16600 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
16601
16602 /**
16603  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
16604  * will be accepted on the given channel, and after additional timeout/the closing of all
16605  * pending HTLCs, the channel will be closed on chain.
16606  *
16607  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
16608  * the channel being closed or not:
16609  *  * If we are the channel initiator, we will pay at least this feerate on the closing
16610  *    transaction. The upper-bound is set by
16611  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
16612  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
16613  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
16614  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
16615  *    will appear on a force-closure transaction, whichever is lower).
16616  *
16617  * May generate a SendShutdown message event on success, which should be relayed.
16618  *
16619  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
16620  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16621  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16622  */
16623 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
16624
16625 /**
16626  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
16627  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
16628  */
16629 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
16630
16631 /**
16632  * Force close all channels, immediately broadcasting the latest local commitment transaction
16633  * for each to the chain and rejecting new HTLCs on each.
16634  */
16635 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16636
16637 /**
16638  * Sends a payment along a given route.
16639  *
16640  * Value parameters are provided via the last hop in route, see documentation for RouteHop
16641  * fields for more info.
16642  *
16643  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
16644  * payment), we don't do anything to stop you! We always try to ensure that if the provided
16645  * next hop knows the preimage to payment_hash they can claim an additional amount as
16646  * specified in the last hop in the route! Thus, you should probably do your own
16647  * payment_preimage tracking (which you should already be doing as they represent \"proof of
16648  * payment\") and prevent double-sends yourself.
16649  *
16650  * May generate SendHTLCs message(s) event on success, which should be relayed.
16651  *
16652  * Each path may have a different return value, and PaymentSendValue may return a Vec with
16653  * each entry matching the corresponding-index entry in the route paths, see
16654  * PaymentSendFailure for more info.
16655  *
16656  * In general, a path may raise:
16657  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
16658  *    node public key) is specified.
16659  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
16660  *    (including due to previous monitor update failure or new permanent monitor update
16661  *    failure).
16662  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
16663  *    relevant updates.
16664  *
16665  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
16666  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
16667  * different route unless you intend to pay twice!
16668  *
16669  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
16670  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
16671  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
16672  * must not contain multiple paths as multi-path payments require a recipient-provided
16673  * payment_secret.
16674  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
16675  * bit set (either as required or as available). If multiple paths are present in the Route,
16676  * we assume the invoice had the basic_mpp feature set.
16677  *
16678  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
16679  */
16680 MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
16681
16682 /**
16683  * Retries a payment along the given [`Route`].
16684  *
16685  * Errors returned are a superset of those returned from [`send_payment`], so see
16686  * [`send_payment`] documentation for more details on errors. This method will also error if the
16687  * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
16688  * for the given `payment_id` cannot be found (likely due to timeout or success).
16689  *
16690  * [`send_payment`]: [`ChannelManager::send_payment`]
16691  */
16692 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
16693
16694 /**
16695  * Send a spontaneous payment, which is a payment that does not require the recipient to have
16696  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
16697  * the preimage, it must be a cryptographically secure random value that no intermediate node
16698  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
16699  * never reach the recipient.
16700  *
16701  * See [`send_payment`] documentation for more details on the return value of this function.
16702  *
16703  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
16704  * [`send_payment`] for more information about the risks of duplicate preimage usage.
16705  *
16706  * Note that `route` must have exactly one path.
16707  *
16708  * [`send_payment`]: Self::send_payment
16709  *
16710  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
16711  */
16712 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
16713
16714 /**
16715  * Call this upon creation of a funding transaction for the given channel.
16716  *
16717  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
16718  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
16719  *
16720  * Panics if a funding transaction has already been provided for this channel.
16721  *
16722  * May panic if the output found in the funding transaction is duplicative with some other
16723  * channel (note that this should be trivially prevented by using unique funding transaction
16724  * keys per-channel).
16725  *
16726  * Do NOT broadcast the funding transaction yourself. When we have safely received our
16727  * counterparty's signature the funding transaction will automatically be broadcast via the
16728  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
16729  *
16730  * Note that this includes RBF or similar transaction replacement strategies - lightning does
16731  * not currently support replacing a funding transaction on an existing channel. Instead,
16732  * create a new channel with a conflicting funding transaction.
16733  *
16734  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
16735  */
16736 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);
16737
16738 /**
16739  * Regenerates channel_announcements and generates a signed node_announcement from the given
16740  * arguments, providing them in corresponding events via
16741  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
16742  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
16743  * announcement to ensure that the lightning P2P network is aware of the channels we have and
16744  * our network addresses.
16745  *
16746  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
16747  * node to humans. They carry no in-protocol meaning.
16748  *
16749  * `addresses` represent the set (possibly empty) of socket addresses on which this node
16750  * accepts incoming connections. These will be included in the node_announcement, publicly
16751  * tying these addresses together and to this node. If you wish to preserve user privacy,
16752  * addresses should likely contain only Tor Onion addresses.
16753  *
16754  * Panics if `addresses` is absurdly large (more than 500).
16755  *
16756  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
16757  */
16758 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
16759
16760 /**
16761  * Processes HTLCs which are pending waiting on random forward delay.
16762  *
16763  * Should only really ever be called in response to a PendingHTLCsForwardable event.
16764  * Will likely generate further events.
16765  */
16766 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
16767
16768 /**
16769  * Performs actions which should happen on startup and roughly once per minute thereafter.
16770  *
16771  * This currently includes:
16772  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
16773  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
16774  *    than a minute, informing the network that they should no longer attempt to route over
16775  *    the channel.
16776  *
16777  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
16778  * estimate fetches.
16779  */
16780 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
16781
16782 /**
16783  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
16784  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
16785  * along the path (including in our own channel on which we received it).
16786  * Returns false if no payment was found to fail backwards, true if the process of failing the
16787  * HTLC backwards has been started.
16788  */
16789 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
16790
16791 /**
16792  * Provides a payment preimage in response to a PaymentReceived event, returning true and
16793  * generating message events for the net layer to claim the payment, if possible. Thus, you
16794  * should probably kick the net layer to go send messages if this returns true!
16795  *
16796  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
16797  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
16798  * event matches your expectation. If you fail to do so and call this method, you may provide
16799  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
16800  *
16801  * May panic if called except in response to a PaymentReceived event.
16802  *
16803  * [`create_inbound_payment`]: Self::create_inbound_payment
16804  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16805  */
16806 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
16807
16808 /**
16809  * Gets the node_id held by this ChannelManager
16810  */
16811 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
16812
16813 /**
16814  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
16815  * to pay us.
16816  *
16817  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
16818  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
16819  *
16820  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
16821  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
16822  * passed directly to [`claim_funds`].
16823  *
16824  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
16825  *
16826  * [`claim_funds`]: Self::claim_funds
16827  * [`PaymentReceived`]: events::Event::PaymentReceived
16828  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
16829  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16830  */
16831 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);
16832
16833 /**
16834  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
16835  * stored external to LDK.
16836  *
16837  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
16838  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
16839  * the `min_value_msat` provided here, if one is provided.
16840  *
16841  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
16842  * method may return an Err if another payment with the same payment_hash is still pending.
16843  *
16844  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
16845  * allow tracking of which events correspond with which calls to this and
16846  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
16847  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
16848  * with invoice metadata stored elsewhere.
16849  *
16850  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
16851  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
16852  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
16853  * sender \"proof-of-payment\" unless they have paid the required amount.
16854  *
16855  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
16856  * in excess of the current time. This should roughly match the expiry time set in the invoice.
16857  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
16858  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
16859  * invoices when no timeout is set.
16860  *
16861  * Note that we use block header time to time-out pending inbound payments (with some margin
16862  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
16863  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
16864  * If you need exact expiry semantics, you should enforce them upon receipt of
16865  * [`PaymentReceived`].
16866  *
16867  * Pending inbound payments are stored in memory and in serialized versions of this
16868  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
16869  * space is limited, you may wish to rate-limit inbound payment creation.
16870  *
16871  * May panic if `invoice_expiry_delta_secs` is greater than one year.
16872  *
16873  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
16874  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
16875  *
16876  * [`create_inbound_payment`]: Self::create_inbound_payment
16877  * [`PaymentReceived`]: events::Event::PaymentReceived
16878  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
16879  */
16880 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);
16881
16882 /**
16883  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16884  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16885  */
16886 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16887
16888 /**
16889  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
16890  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
16891  */
16892 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16893
16894 /**
16895  * Constructs a new Listen which calls the relevant methods on this_arg.
16896  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
16897  */
16898 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
16899
16900 /**
16901  * Constructs a new Confirm which calls the relevant methods on this_arg.
16902  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
16903  */
16904 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
16905
16906 /**
16907  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
16908  * indicating whether persistence is necessary. Only one listener on
16909  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16910  * up.
16911  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
16912  */
16913 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
16914
16915 /**
16916  * Blocks until ChannelManager needs to be persisted. Only one listener on
16917  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16918  * up.
16919  */
16920 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
16921
16922 /**
16923  * Gets the latest best block which was connected either via the [`chain::Listen`] or
16924  * [`chain::Confirm`] interfaces.
16925  */
16926 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
16927
16928 /**
16929  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
16930  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
16931  */
16932 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
16933
16934 /**
16935  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
16936  */
16937 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
16938
16939 /**
16940  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
16941  */
16942 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
16943
16944 /**
16945  * The keys provider which will give us relevant keys. Some keys will be loaded during
16946  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16947  * signing data.
16948  */
16949 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16950
16951 /**
16952  * The keys provider which will give us relevant keys. Some keys will be loaded during
16953  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16954  * signing data.
16955  */
16956 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
16957
16958 /**
16959  * The fee_estimator for use in the ChannelManager in the future.
16960  *
16961  * No calls to the FeeEstimator will be made during deserialization.
16962  */
16963 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16964
16965 /**
16966  * The fee_estimator for use in the ChannelManager in the future.
16967  *
16968  * No calls to the FeeEstimator will be made during deserialization.
16969  */
16970 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
16971
16972 /**
16973  * The chain::Watch for use in the ChannelManager in the future.
16974  *
16975  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16976  * you have deserialized ChannelMonitors separately and will add them to your
16977  * chain::Watch after deserializing this ChannelManager.
16978  */
16979 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16980
16981 /**
16982  * The chain::Watch for use in the ChannelManager in the future.
16983  *
16984  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16985  * you have deserialized ChannelMonitors separately and will add them to your
16986  * chain::Watch after deserializing this ChannelManager.
16987  */
16988 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
16989
16990 /**
16991  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16992  * used to broadcast the latest local commitment transactions of channels which must be
16993  * force-closed during deserialization.
16994  */
16995 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16996
16997 /**
16998  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16999  * used to broadcast the latest local commitment transactions of channels which must be
17000  * force-closed during deserialization.
17001  */
17002 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
17003
17004 /**
17005  * The Logger for use in the ChannelManager and which may be used to log information during
17006  * deserialization.
17007  */
17008 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
17009
17010 /**
17011  * The Logger for use in the ChannelManager and which may be used to log information during
17012  * deserialization.
17013  */
17014 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
17015
17016 /**
17017  * Default settings used for new channels. Any existing channels will continue to use the
17018  * runtime settings which were stored when the ChannelManager was serialized.
17019  */
17020 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
17021
17022 /**
17023  * Default settings used for new channels. Any existing channels will continue to use the
17024  * runtime settings which were stored when the ChannelManager was serialized.
17025  */
17026 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
17027
17028 /**
17029  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
17030  * HashMap for you. This is primarily useful for C bindings where it is not practical to
17031  * populate a HashMap directly from C.
17032  */
17033 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);
17034
17035 /**
17036  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
17037  */
17038 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
17039
17040 /**
17041  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
17042  */
17043 void DecodeError_free(struct LDKDecodeError this_obj);
17044
17045 /**
17046  * Creates a copy of the DecodeError
17047  */
17048 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
17049
17050 /**
17051  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
17052  */
17053 void Init_free(struct LDKInit this_obj);
17054
17055 /**
17056  * The relevant features which the sender supports
17057  */
17058 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
17059
17060 /**
17061  * The relevant features which the sender supports
17062  */
17063 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
17064
17065 /**
17066  * Constructs a new Init given each field
17067  */
17068 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
17069
17070 /**
17071  * Creates a copy of the Init
17072  */
17073 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
17074
17075 /**
17076  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
17077  */
17078 void ErrorMessage_free(struct LDKErrorMessage this_obj);
17079
17080 /**
17081  * The channel ID involved in the error
17082  */
17083 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
17084
17085 /**
17086  * The channel ID involved in the error
17087  */
17088 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17089
17090 /**
17091  * A possibly human-readable error description.
17092  * The string should be sanitized before it is used (e.g. emitted to logs
17093  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
17094  * vulnerability in the terminal emulator or the logging subsystem.
17095  */
17096 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
17097
17098 /**
17099  * A possibly human-readable error description.
17100  * The string should be sanitized before it is used (e.g. emitted to logs
17101  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
17102  * vulnerability in the terminal emulator or the logging subsystem.
17103  */
17104 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
17105
17106 /**
17107  * Constructs a new ErrorMessage given each field
17108  */
17109 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
17110
17111 /**
17112  * Creates a copy of the ErrorMessage
17113  */
17114 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
17115
17116 /**
17117  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
17118  */
17119 void Ping_free(struct LDKPing this_obj);
17120
17121 /**
17122  * The desired response length
17123  */
17124 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
17125
17126 /**
17127  * The desired response length
17128  */
17129 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
17130
17131 /**
17132  * The ping packet size.
17133  * This field is not sent on the wire. byteslen zeros are sent.
17134  */
17135 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
17136
17137 /**
17138  * The ping packet size.
17139  * This field is not sent on the wire. byteslen zeros are sent.
17140  */
17141 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
17142
17143 /**
17144  * Constructs a new Ping given each field
17145  */
17146 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
17147
17148 /**
17149  * Creates a copy of the Ping
17150  */
17151 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
17152
17153 /**
17154  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
17155  */
17156 void Pong_free(struct LDKPong this_obj);
17157
17158 /**
17159  * The pong packet size.
17160  * This field is not sent on the wire. byteslen zeros are sent.
17161  */
17162 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
17163
17164 /**
17165  * The pong packet size.
17166  * This field is not sent on the wire. byteslen zeros are sent.
17167  */
17168 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
17169
17170 /**
17171  * Constructs a new Pong given each field
17172  */
17173 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
17174
17175 /**
17176  * Creates a copy of the Pong
17177  */
17178 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
17179
17180 /**
17181  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
17182  */
17183 void OpenChannel_free(struct LDKOpenChannel this_obj);
17184
17185 /**
17186  * The genesis hash of the blockchain where the channel is to be opened
17187  */
17188 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
17189
17190 /**
17191  * The genesis hash of the blockchain where the channel is to be opened
17192  */
17193 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17194
17195 /**
17196  * A temporary channel ID, until the funding outpoint is announced
17197  */
17198 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
17199
17200 /**
17201  * A temporary channel ID, until the funding outpoint is announced
17202  */
17203 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17204
17205 /**
17206  * The channel value
17207  */
17208 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17209
17210 /**
17211  * The channel value
17212  */
17213 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17214
17215 /**
17216  * The amount to push to the counterparty as part of the open, in milli-satoshi
17217  */
17218 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17219
17220 /**
17221  * The amount to push to the counterparty as part of the open, in milli-satoshi
17222  */
17223 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17224
17225 /**
17226  * The threshold below which outputs on transactions broadcast by sender will be omitted
17227  */
17228 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17229
17230 /**
17231  * The threshold below which outputs on transactions broadcast by sender will be omitted
17232  */
17233 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17234
17235 /**
17236  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17237  */
17238 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17239
17240 /**
17241  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17242  */
17243 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17244
17245 /**
17246  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17247  */
17248 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17249
17250 /**
17251  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17252  */
17253 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17254
17255 /**
17256  * The minimum HTLC size incoming to sender, in milli-satoshi
17257  */
17258 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17259
17260 /**
17261  * The minimum HTLC size incoming to sender, in milli-satoshi
17262  */
17263 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17264
17265 /**
17266  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
17267  */
17268 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17269
17270 /**
17271  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
17272  */
17273 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
17274
17275 /**
17276  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17277  */
17278 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17279
17280 /**
17281  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17282  */
17283 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
17284
17285 /**
17286  * The maximum number of inbound HTLCs towards sender
17287  */
17288 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17289
17290 /**
17291  * The maximum number of inbound HTLCs towards sender
17292  */
17293 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
17294
17295 /**
17296  * The sender's key controlling the funding transaction
17297  */
17298 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17299
17300 /**
17301  * The sender's key controlling the funding transaction
17302  */
17303 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17304
17305 /**
17306  * Used to derive a revocation key for transactions broadcast by counterparty
17307  */
17308 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17309
17310 /**
17311  * Used to derive a revocation key for transactions broadcast by counterparty
17312  */
17313 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17314
17315 /**
17316  * A payment key to sender for transactions broadcast by counterparty
17317  */
17318 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17319
17320 /**
17321  * A payment key to sender for transactions broadcast by counterparty
17322  */
17323 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17324
17325 /**
17326  * Used to derive a payment key to sender for transactions broadcast by sender
17327  */
17328 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17329
17330 /**
17331  * Used to derive a payment key to sender for transactions broadcast by sender
17332  */
17333 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17334
17335 /**
17336  * Used to derive an HTLC payment key to sender
17337  */
17338 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17339
17340 /**
17341  * Used to derive an HTLC payment key to sender
17342  */
17343 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17344
17345 /**
17346  * The first to-be-broadcast-by-sender transaction's per commitment point
17347  */
17348 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17349
17350 /**
17351  * The first to-be-broadcast-by-sender transaction's per commitment point
17352  */
17353 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17354
17355 /**
17356  * Channel flags
17357  */
17358 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17359
17360 /**
17361  * Channel flags
17362  */
17363 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
17364
17365 /**
17366  * Creates a copy of the OpenChannel
17367  */
17368 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
17369
17370 /**
17371  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
17372  */
17373 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
17374
17375 /**
17376  * A temporary channel ID, until the funding outpoint is announced
17377  */
17378 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
17379
17380 /**
17381  * A temporary channel ID, until the funding outpoint is announced
17382  */
17383 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17384
17385 /**
17386  * The threshold below which outputs on transactions broadcast by sender will be omitted
17387  */
17388 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17389
17390 /**
17391  * The threshold below which outputs on transactions broadcast by sender will be omitted
17392  */
17393 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17394
17395 /**
17396  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17397  */
17398 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17399
17400 /**
17401  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17402  */
17403 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17404
17405 /**
17406  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17407  */
17408 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17409
17410 /**
17411  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17412  */
17413 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17414
17415 /**
17416  * The minimum HTLC size incoming to sender, in milli-satoshi
17417  */
17418 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17419
17420 /**
17421  * The minimum HTLC size incoming to sender, in milli-satoshi
17422  */
17423 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17424
17425 /**
17426  * Minimum depth of the funding transaction before the channel is considered open
17427  */
17428 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17429
17430 /**
17431  * Minimum depth of the funding transaction before the channel is considered open
17432  */
17433 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
17434
17435 /**
17436  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17437  */
17438 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17439
17440 /**
17441  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17442  */
17443 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
17444
17445 /**
17446  * The maximum number of inbound HTLCs towards sender
17447  */
17448 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17449
17450 /**
17451  * The maximum number of inbound HTLCs towards sender
17452  */
17453 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
17454
17455 /**
17456  * The sender's key controlling the funding transaction
17457  */
17458 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17459
17460 /**
17461  * The sender's key controlling the funding transaction
17462  */
17463 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17464
17465 /**
17466  * Used to derive a revocation key for transactions broadcast by counterparty
17467  */
17468 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17469
17470 /**
17471  * Used to derive a revocation key for transactions broadcast by counterparty
17472  */
17473 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17474
17475 /**
17476  * A payment key to sender for transactions broadcast by counterparty
17477  */
17478 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17479
17480 /**
17481  * A payment key to sender for transactions broadcast by counterparty
17482  */
17483 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17484
17485 /**
17486  * Used to derive a payment key to sender for transactions broadcast by sender
17487  */
17488 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17489
17490 /**
17491  * Used to derive a payment key to sender for transactions broadcast by sender
17492  */
17493 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17494
17495 /**
17496  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
17497  */
17498 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17499
17500 /**
17501  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
17502  */
17503 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17504
17505 /**
17506  * The first to-be-broadcast-by-sender transaction's per commitment point
17507  */
17508 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17509
17510 /**
17511  * The first to-be-broadcast-by-sender transaction's per commitment point
17512  */
17513 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17514
17515 /**
17516  * Creates a copy of the AcceptChannel
17517  */
17518 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
17519
17520 /**
17521  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
17522  */
17523 void FundingCreated_free(struct LDKFundingCreated this_obj);
17524
17525 /**
17526  * A temporary channel ID, until the funding is established
17527  */
17528 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
17529
17530 /**
17531  * A temporary channel ID, until the funding is established
17532  */
17533 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17534
17535 /**
17536  * The funding transaction ID
17537  */
17538 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
17539
17540 /**
17541  * The funding transaction ID
17542  */
17543 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17544
17545 /**
17546  * The specific output index funding this channel
17547  */
17548 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
17549
17550 /**
17551  * The specific output index funding this channel
17552  */
17553 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
17554
17555 /**
17556  * The signature of the channel initiator (funder) on the initial commitment transaction
17557  */
17558 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
17559
17560 /**
17561  * The signature of the channel initiator (funder) on the initial commitment transaction
17562  */
17563 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
17564
17565 /**
17566  * Constructs a new FundingCreated given each field
17567  */
17568 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);
17569
17570 /**
17571  * Creates a copy of the FundingCreated
17572  */
17573 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
17574
17575 /**
17576  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
17577  */
17578 void FundingSigned_free(struct LDKFundingSigned this_obj);
17579
17580 /**
17581  * The channel ID
17582  */
17583 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
17584
17585 /**
17586  * The channel ID
17587  */
17588 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17589
17590 /**
17591  * The signature of the channel acceptor (fundee) on the initial commitment transaction
17592  */
17593 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
17594
17595 /**
17596  * The signature of the channel acceptor (fundee) on the initial commitment transaction
17597  */
17598 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17599
17600 /**
17601  * Constructs a new FundingSigned given each field
17602  */
17603 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
17604
17605 /**
17606  * Creates a copy of the FundingSigned
17607  */
17608 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
17609
17610 /**
17611  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
17612  */
17613 void FundingLocked_free(struct LDKFundingLocked this_obj);
17614
17615 /**
17616  * The channel ID
17617  */
17618 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
17619
17620 /**
17621  * The channel ID
17622  */
17623 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17624
17625 /**
17626  * The per-commitment point of the second commitment transaction
17627  */
17628 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
17629
17630 /**
17631  * The per-commitment point of the second commitment transaction
17632  */
17633 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17634
17635 /**
17636  * Constructs a new FundingLocked given each field
17637  */
17638 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
17639
17640 /**
17641  * Creates a copy of the FundingLocked
17642  */
17643 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
17644
17645 /**
17646  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
17647  */
17648 void Shutdown_free(struct LDKShutdown this_obj);
17649
17650 /**
17651  * The channel ID
17652  */
17653 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
17654
17655 /**
17656  * The channel ID
17657  */
17658 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17659
17660 /**
17661  * The destination of this peer's funds on closing.
17662  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17663  */
17664 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
17665
17666 /**
17667  * The destination of this peer's funds on closing.
17668  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17669  */
17670 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17671
17672 /**
17673  * Constructs a new Shutdown given each field
17674  */
17675 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
17676
17677 /**
17678  * Creates a copy of the Shutdown
17679  */
17680 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
17681
17682 /**
17683  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
17684  */
17685 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
17686
17687 /**
17688  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17689  * transaction.
17690  */
17691 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17692
17693 /**
17694  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17695  * transaction.
17696  */
17697 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17698
17699 /**
17700  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17701  * transaction.
17702  */
17703 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17704
17705 /**
17706  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17707  * transaction.
17708  */
17709 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17710
17711 /**
17712  * Constructs a new ClosingSignedFeeRange given each field
17713  */
17714 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
17715
17716 /**
17717  * Creates a copy of the ClosingSignedFeeRange
17718  */
17719 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
17720
17721 /**
17722  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
17723  */
17724 void ClosingSigned_free(struct LDKClosingSigned this_obj);
17725
17726 /**
17727  * The channel ID
17728  */
17729 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
17730
17731 /**
17732  * The channel ID
17733  */
17734 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17735
17736 /**
17737  * The proposed total fee for the closing transaction
17738  */
17739 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17740
17741 /**
17742  * The proposed total fee for the closing transaction
17743  */
17744 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
17745
17746 /**
17747  * A signature on the closing transaction
17748  */
17749 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17750
17751 /**
17752  * A signature on the closing transaction
17753  */
17754 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17755
17756 /**
17757  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17758  * nodes.
17759  *
17760  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17761  */
17762 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17763
17764 /**
17765  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17766  * nodes.
17767  *
17768  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17769  */
17770 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
17771
17772 /**
17773  * Constructs a new ClosingSigned given each field
17774  */
17775 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
17776
17777 /**
17778  * Creates a copy of the ClosingSigned
17779  */
17780 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
17781
17782 /**
17783  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
17784  */
17785 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
17786
17787 /**
17788  * The channel ID
17789  */
17790 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17791
17792 /**
17793  * The channel ID
17794  */
17795 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17796
17797 /**
17798  * The HTLC ID
17799  */
17800 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17801
17802 /**
17803  * The HTLC ID
17804  */
17805 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17806
17807 /**
17808  * The HTLC value in milli-satoshi
17809  */
17810 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17811
17812 /**
17813  * The HTLC value in milli-satoshi
17814  */
17815 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17816
17817 /**
17818  * The payment hash, the pre-image of which controls HTLC redemption
17819  */
17820 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17821
17822 /**
17823  * The payment hash, the pre-image of which controls HTLC redemption
17824  */
17825 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17826
17827 /**
17828  * The expiry height of the HTLC
17829  */
17830 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17831
17832 /**
17833  * The expiry height of the HTLC
17834  */
17835 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
17836
17837 /**
17838  * Creates a copy of the UpdateAddHTLC
17839  */
17840 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
17841
17842 /**
17843  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
17844  */
17845 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
17846
17847 /**
17848  * The channel ID
17849  */
17850 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17851
17852 /**
17853  * The channel ID
17854  */
17855 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17856
17857 /**
17858  * The HTLC ID
17859  */
17860 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
17861
17862 /**
17863  * The HTLC ID
17864  */
17865 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
17866
17867 /**
17868  * The pre-image of the payment hash, allowing HTLC redemption
17869  */
17870 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17871
17872 /**
17873  * The pre-image of the payment hash, allowing HTLC redemption
17874  */
17875 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17876
17877 /**
17878  * Constructs a new UpdateFulfillHTLC given each field
17879  */
17880 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
17881
17882 /**
17883  * Creates a copy of the UpdateFulfillHTLC
17884  */
17885 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
17886
17887 /**
17888  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
17889  */
17890 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
17891
17892 /**
17893  * The channel ID
17894  */
17895 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
17896
17897 /**
17898  * The channel ID
17899  */
17900 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17901
17902 /**
17903  * The HTLC ID
17904  */
17905 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
17906
17907 /**
17908  * The HTLC ID
17909  */
17910 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
17911
17912 /**
17913  * Creates a copy of the UpdateFailHTLC
17914  */
17915 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
17916
17917 /**
17918  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
17919  */
17920 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
17921
17922 /**
17923  * The channel ID
17924  */
17925 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
17926
17927 /**
17928  * The channel ID
17929  */
17930 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17931
17932 /**
17933  * The HTLC ID
17934  */
17935 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17936
17937 /**
17938  * The HTLC ID
17939  */
17940 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
17941
17942 /**
17943  * The failure code
17944  */
17945 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17946
17947 /**
17948  * The failure code
17949  */
17950 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
17951
17952 /**
17953  * Creates a copy of the UpdateFailMalformedHTLC
17954  */
17955 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
17956
17957 /**
17958  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
17959  */
17960 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
17961
17962 /**
17963  * The channel ID
17964  */
17965 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
17966
17967 /**
17968  * The channel ID
17969  */
17970 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17971
17972 /**
17973  * A signature on the commitment transaction
17974  */
17975 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
17976
17977 /**
17978  * A signature on the commitment transaction
17979  */
17980 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17981
17982 /**
17983  * Signatures on the HTLC transactions
17984  */
17985 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
17986
17987 /**
17988  * Constructs a new CommitmentSigned given each field
17989  */
17990 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
17991
17992 /**
17993  * Creates a copy of the CommitmentSigned
17994  */
17995 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
17996
17997 /**
17998  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
17999  */
18000 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
18001
18002 /**
18003  * The channel ID
18004  */
18005 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
18006
18007 /**
18008  * The channel ID
18009  */
18010 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18011
18012 /**
18013  * The secret corresponding to the per-commitment point
18014  */
18015 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
18016
18017 /**
18018  * The secret corresponding to the per-commitment point
18019  */
18020 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18021
18022 /**
18023  * The next sender-broadcast commitment transaction's per-commitment point
18024  */
18025 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
18026
18027 /**
18028  * The next sender-broadcast commitment transaction's per-commitment point
18029  */
18030 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18031
18032 /**
18033  * Constructs a new RevokeAndACK given each field
18034  */
18035 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);
18036
18037 /**
18038  * Creates a copy of the RevokeAndACK
18039  */
18040 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
18041
18042 /**
18043  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
18044  */
18045 void UpdateFee_free(struct LDKUpdateFee this_obj);
18046
18047 /**
18048  * The channel ID
18049  */
18050 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
18051
18052 /**
18053  * The channel ID
18054  */
18055 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18056
18057 /**
18058  * Fee rate per 1000-weight of the transaction
18059  */
18060 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
18061
18062 /**
18063  * Fee rate per 1000-weight of the transaction
18064  */
18065 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
18066
18067 /**
18068  * Constructs a new UpdateFee given each field
18069  */
18070 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
18071
18072 /**
18073  * Creates a copy of the UpdateFee
18074  */
18075 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
18076
18077 /**
18078  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
18079  */
18080 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
18081
18082 /**
18083  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
18084  * belonging to the recipient
18085  */
18086 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
18087
18088 /**
18089  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
18090  * belonging to the recipient
18091  */
18092 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18093
18094 /**
18095  * The sender's per-commitment point for their current commitment transaction
18096  */
18097 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
18098
18099 /**
18100  * The sender's per-commitment point for their current commitment transaction
18101  */
18102 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18103
18104 /**
18105  * Constructs a new DataLossProtect given each field
18106  */
18107 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
18108
18109 /**
18110  * Creates a copy of the DataLossProtect
18111  */
18112 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
18113
18114 /**
18115  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
18116  */
18117 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
18118
18119 /**
18120  * The channel ID
18121  */
18122 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
18123
18124 /**
18125  * The channel ID
18126  */
18127 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18128
18129 /**
18130  * The next commitment number for the sender
18131  */
18132 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
18133
18134 /**
18135  * The next commitment number for the sender
18136  */
18137 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
18138
18139 /**
18140  * The next commitment number for the recipient
18141  */
18142 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
18143
18144 /**
18145  * The next commitment number for the recipient
18146  */
18147 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
18148
18149 /**
18150  * Creates a copy of the ChannelReestablish
18151  */
18152 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
18153
18154 /**
18155  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
18156  */
18157 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
18158
18159 /**
18160  * The channel ID
18161  */
18162 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
18163
18164 /**
18165  * The channel ID
18166  */
18167 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18168
18169 /**
18170  * The short channel ID
18171  */
18172 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18173
18174 /**
18175  * The short channel ID
18176  */
18177 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
18178
18179 /**
18180  * A signature by the node key
18181  */
18182 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18183
18184 /**
18185  * A signature by the node key
18186  */
18187 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
18188
18189 /**
18190  * A signature by the funding key
18191  */
18192 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18193
18194 /**
18195  * A signature by the funding key
18196  */
18197 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
18198
18199 /**
18200  * Constructs a new AnnouncementSignatures given each field
18201  */
18202 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);
18203
18204 /**
18205  * Creates a copy of the AnnouncementSignatures
18206  */
18207 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
18208
18209 /**
18210  * Frees any resources used by the NetAddress
18211  */
18212 void NetAddress_free(struct LDKNetAddress this_ptr);
18213
18214 /**
18215  * Creates a copy of the NetAddress
18216  */
18217 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
18218
18219 /**
18220  * Utility method to constructs a new IPv4-variant NetAddress
18221  */
18222 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
18223
18224 /**
18225  * Utility method to constructs a new IPv6-variant NetAddress
18226  */
18227 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
18228
18229 /**
18230  * Utility method to constructs a new OnionV2-variant NetAddress
18231  */
18232 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
18233
18234 /**
18235  * Utility method to constructs a new OnionV3-variant NetAddress
18236  */
18237 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
18238
18239 /**
18240  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
18241  */
18242 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
18243
18244 /**
18245  * Read a NetAddress from a byte array, created by NetAddress_write
18246  */
18247 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
18248
18249 /**
18250  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
18251  */
18252 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
18253
18254 /**
18255  * The advertised features
18256  */
18257 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18258
18259 /**
18260  * The advertised features
18261  */
18262 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
18263
18264 /**
18265  * A strictly monotonic announcement counter, with gaps allowed
18266  */
18267 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18268
18269 /**
18270  * A strictly monotonic announcement counter, with gaps allowed
18271  */
18272 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
18273
18274 /**
18275  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
18276  * to this node).
18277  */
18278 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18279
18280 /**
18281  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
18282  * to this node).
18283  */
18284 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18285
18286 /**
18287  * An RGB color for UI purposes
18288  */
18289 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
18290
18291 /**
18292  * An RGB color for UI purposes
18293  */
18294 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
18295
18296 /**
18297  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
18298  * of uniqueness.
18299  */
18300 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
18301
18302 /**
18303  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
18304  * of uniqueness.
18305  */
18306 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18307
18308 /**
18309  * List of addresses on which this node is reachable
18310  */
18311 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
18312
18313 /**
18314  * Creates a copy of the UnsignedNodeAnnouncement
18315  */
18316 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
18317
18318 /**
18319  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
18320  */
18321 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
18322
18323 /**
18324  * The signature by the node key
18325  */
18326 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
18327
18328 /**
18329  * The signature by the node key
18330  */
18331 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18332
18333 /**
18334  * The actual content of the announcement
18335  */
18336 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
18337
18338 /**
18339  * The actual content of the announcement
18340  */
18341 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
18342
18343 /**
18344  * Constructs a new NodeAnnouncement given each field
18345  */
18346 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
18347
18348 /**
18349  * Creates a copy of the NodeAnnouncement
18350  */
18351 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
18352
18353 /**
18354  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
18355  */
18356 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
18357
18358 /**
18359  * The advertised channel features
18360  */
18361 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18362
18363 /**
18364  * The advertised channel features
18365  */
18366 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
18367
18368 /**
18369  * The genesis hash of the blockchain where the channel is to be opened
18370  */
18371 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
18372
18373 /**
18374  * The genesis hash of the blockchain where the channel is to be opened
18375  */
18376 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18377
18378 /**
18379  * The short channel ID
18380  */
18381 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18382
18383 /**
18384  * The short channel ID
18385  */
18386 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
18387
18388 /**
18389  * One of the two node_ids which are endpoints of this channel
18390  */
18391 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18392
18393 /**
18394  * One of the two node_ids which are endpoints of this channel
18395  */
18396 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18397
18398 /**
18399  * The other of the two node_ids which are endpoints of this channel
18400  */
18401 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18402
18403 /**
18404  * The other of the two node_ids which are endpoints of this channel
18405  */
18406 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18407
18408 /**
18409  * The funding key for the first node
18410  */
18411 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18412
18413 /**
18414  * The funding key for the first node
18415  */
18416 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18417
18418 /**
18419  * The funding key for the second node
18420  */
18421 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18422
18423 /**
18424  * The funding key for the second node
18425  */
18426 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18427
18428 /**
18429  * Creates a copy of the UnsignedChannelAnnouncement
18430  */
18431 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
18432
18433 /**
18434  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
18435  */
18436 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
18437
18438 /**
18439  * Authentication of the announcement by the first public node
18440  */
18441 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18442
18443 /**
18444  * Authentication of the announcement by the first public node
18445  */
18446 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18447
18448 /**
18449  * Authentication of the announcement by the second public node
18450  */
18451 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18452
18453 /**
18454  * Authentication of the announcement by the second public node
18455  */
18456 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18457
18458 /**
18459  * Proof of funding UTXO ownership by the first public node
18460  */
18461 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18462
18463 /**
18464  * Proof of funding UTXO ownership by the first public node
18465  */
18466 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18467
18468 /**
18469  * Proof of funding UTXO ownership by the second public node
18470  */
18471 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18472
18473 /**
18474  * Proof of funding UTXO ownership by the second public node
18475  */
18476 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18477
18478 /**
18479  * The actual announcement
18480  */
18481 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18482
18483 /**
18484  * The actual announcement
18485  */
18486 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
18487
18488 /**
18489  * Constructs a new ChannelAnnouncement given each field
18490  */
18491 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);
18492
18493 /**
18494  * Creates a copy of the ChannelAnnouncement
18495  */
18496 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
18497
18498 /**
18499  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
18500  */
18501 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
18502
18503 /**
18504  * The genesis hash of the blockchain where the channel is to be opened
18505  */
18506 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
18507
18508 /**
18509  * The genesis hash of the blockchain where the channel is to be opened
18510  */
18511 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18512
18513 /**
18514  * The short channel ID
18515  */
18516 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18517
18518 /**
18519  * The short channel ID
18520  */
18521 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
18522
18523 /**
18524  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
18525  */
18526 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18527
18528 /**
18529  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
18530  */
18531 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18532
18533 /**
18534  * Channel flags
18535  */
18536 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18537
18538 /**
18539  * Channel flags
18540  */
18541 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
18542
18543 /**
18544  * The number of blocks such that if:
18545  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
18546  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
18547  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
18548  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
18549  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
18550  * forwarding. Note that the HTLC sender is the one who originally sets this value when
18551  * constructing the route.
18552  */
18553 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18554
18555 /**
18556  * The number of blocks such that if:
18557  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
18558  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
18559  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
18560  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
18561  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
18562  * forwarding. Note that the HTLC sender is the one who originally sets this value when
18563  * constructing the route.
18564  */
18565 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
18566
18567 /**
18568  * The minimum HTLC size incoming to sender, in milli-satoshi
18569  */
18570 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18571
18572 /**
18573  * The minimum HTLC size incoming to sender, in milli-satoshi
18574  */
18575 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
18576
18577 /**
18578  * The base HTLC fee charged by sender, in milli-satoshi
18579  */
18580 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18581
18582 /**
18583  * The base HTLC fee charged by sender, in milli-satoshi
18584  */
18585 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18586
18587 /**
18588  * The amount to fee multiplier, in micro-satoshi
18589  */
18590 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18591
18592 /**
18593  * The amount to fee multiplier, in micro-satoshi
18594  */
18595 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18596
18597 /**
18598  * Creates a copy of the UnsignedChannelUpdate
18599  */
18600 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
18601
18602 /**
18603  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
18604  */
18605 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
18606
18607 /**
18608  * A signature of the channel update
18609  */
18610 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
18611
18612 /**
18613  * A signature of the channel update
18614  */
18615 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
18616
18617 /**
18618  * The actual channel update
18619  */
18620 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
18621
18622 /**
18623  * The actual channel update
18624  */
18625 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
18626
18627 /**
18628  * Constructs a new ChannelUpdate given each field
18629  */
18630 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
18631
18632 /**
18633  * Creates a copy of the ChannelUpdate
18634  */
18635 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
18636
18637 /**
18638  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
18639  */
18640 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
18641
18642 /**
18643  * The genesis hash of the blockchain being queried
18644  */
18645 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
18646
18647 /**
18648  * The genesis hash of the blockchain being queried
18649  */
18650 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18651
18652 /**
18653  * The height of the first block for the channel UTXOs being queried
18654  */
18655 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18656
18657 /**
18658  * The height of the first block for the channel UTXOs being queried
18659  */
18660 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18661
18662 /**
18663  * The number of blocks to include in the query results
18664  */
18665 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18666
18667 /**
18668  * The number of blocks to include in the query results
18669  */
18670 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18671
18672 /**
18673  * Constructs a new QueryChannelRange given each field
18674  */
18675 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
18676
18677 /**
18678  * Creates a copy of the QueryChannelRange
18679  */
18680 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
18681
18682 /**
18683  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
18684  */
18685 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
18686
18687 /**
18688  * The genesis hash of the blockchain being queried
18689  */
18690 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
18691
18692 /**
18693  * The genesis hash of the blockchain being queried
18694  */
18695 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18696
18697 /**
18698  * The height of the first block in the range of the reply
18699  */
18700 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18701
18702 /**
18703  * The height of the first block in the range of the reply
18704  */
18705 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18706
18707 /**
18708  * The number of blocks included in the range of the reply
18709  */
18710 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18711
18712 /**
18713  * The number of blocks included in the range of the reply
18714  */
18715 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18716
18717 /**
18718  * True when this is the final reply for a query
18719  */
18720 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18721
18722 /**
18723  * True when this is the final reply for a query
18724  */
18725 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
18726
18727 /**
18728  * The short_channel_ids in the channel range
18729  */
18730 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18731
18732 /**
18733  * Constructs a new ReplyChannelRange given each field
18734  */
18735 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);
18736
18737 /**
18738  * Creates a copy of the ReplyChannelRange
18739  */
18740 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
18741
18742 /**
18743  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
18744  */
18745 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
18746
18747 /**
18748  * The genesis hash of the blockchain being queried
18749  */
18750 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
18751
18752 /**
18753  * The genesis hash of the blockchain being queried
18754  */
18755 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18756
18757 /**
18758  * The short_channel_ids that are being queried
18759  */
18760 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18761
18762 /**
18763  * Constructs a new QueryShortChannelIds given each field
18764  */
18765 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
18766
18767 /**
18768  * Creates a copy of the QueryShortChannelIds
18769  */
18770 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
18771
18772 /**
18773  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
18774  */
18775 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
18776
18777 /**
18778  * The genesis hash of the blockchain that was queried
18779  */
18780 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
18781
18782 /**
18783  * The genesis hash of the blockchain that was queried
18784  */
18785 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18786
18787 /**
18788  * Indicates if the query recipient maintains up-to-date channel
18789  * information for the chain_hash
18790  */
18791 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
18792
18793 /**
18794  * Indicates if the query recipient maintains up-to-date channel
18795  * information for the chain_hash
18796  */
18797 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
18798
18799 /**
18800  * Constructs a new ReplyShortChannelIdsEnd given each field
18801  */
18802 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
18803
18804 /**
18805  * Creates a copy of the ReplyShortChannelIdsEnd
18806  */
18807 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
18808
18809 /**
18810  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
18811  */
18812 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
18813
18814 /**
18815  * The genesis hash of the blockchain for channel and node information
18816  */
18817 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
18818
18819 /**
18820  * The genesis hash of the blockchain for channel and node information
18821  */
18822 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18823
18824 /**
18825  * The starting unix timestamp
18826  */
18827 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18828
18829 /**
18830  * The starting unix timestamp
18831  */
18832 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18833
18834 /**
18835  * The range of information in seconds
18836  */
18837 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18838
18839 /**
18840  * The range of information in seconds
18841  */
18842 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18843
18844 /**
18845  * Constructs a new GossipTimestampFilter given each field
18846  */
18847 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
18848
18849 /**
18850  * Creates a copy of the GossipTimestampFilter
18851  */
18852 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
18853
18854 /**
18855  * Frees any resources used by the ErrorAction
18856  */
18857 void ErrorAction_free(struct LDKErrorAction this_ptr);
18858
18859 /**
18860  * Creates a copy of the ErrorAction
18861  */
18862 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
18863
18864 /**
18865  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
18866  */
18867 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
18868
18869 /**
18870  * Utility method to constructs a new IgnoreError-variant ErrorAction
18871  */
18872 struct LDKErrorAction ErrorAction_ignore_error(void);
18873
18874 /**
18875  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
18876  */
18877 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
18878
18879 /**
18880  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
18881  */
18882 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
18883
18884 /**
18885  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
18886  */
18887 void LightningError_free(struct LDKLightningError this_obj);
18888
18889 /**
18890  * A human-readable message describing the error
18891  */
18892 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
18893
18894 /**
18895  * A human-readable message describing the error
18896  */
18897 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
18898
18899 /**
18900  * The action which should be taken against the offending peer.
18901  */
18902 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
18903
18904 /**
18905  * The action which should be taken against the offending peer.
18906  */
18907 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
18908
18909 /**
18910  * Constructs a new LightningError given each field
18911  */
18912 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
18913
18914 /**
18915  * Creates a copy of the LightningError
18916  */
18917 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
18918
18919 /**
18920  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
18921  */
18922 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
18923
18924 /**
18925  * update_add_htlc messages which should be sent
18926  */
18927 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18928
18929 /**
18930  * update_add_htlc messages which should be sent
18931  */
18932 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
18933
18934 /**
18935  * update_fulfill_htlc messages which should be sent
18936  */
18937 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18938
18939 /**
18940  * update_fulfill_htlc messages which should be sent
18941  */
18942 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
18943
18944 /**
18945  * update_fail_htlc messages which should be sent
18946  */
18947 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18948
18949 /**
18950  * update_fail_htlc messages which should be sent
18951  */
18952 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
18953
18954 /**
18955  * update_fail_malformed_htlc messages which should be sent
18956  */
18957 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18958
18959 /**
18960  * update_fail_malformed_htlc messages which should be sent
18961  */
18962 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
18963
18964 /**
18965  * An update_fee message which should be sent
18966  *
18967  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18968  */
18969 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18970
18971 /**
18972  * An update_fee message which should be sent
18973  *
18974  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18975  */
18976 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
18977
18978 /**
18979  * Finally, the commitment_signed message which should be sent
18980  */
18981 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18982
18983 /**
18984  * Finally, the commitment_signed message which should be sent
18985  */
18986 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
18987
18988 /**
18989  * Constructs a new CommitmentUpdate given each field
18990  */
18991 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);
18992
18993 /**
18994  * Creates a copy of the CommitmentUpdate
18995  */
18996 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
18997
18998 /**
18999  * Calls the free function if one is set
19000  */
19001 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
19002
19003 /**
19004  * Calls the free function if one is set
19005  */
19006 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
19007
19008 /**
19009  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
19010  */
19011 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
19012
19013 /**
19014  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
19015  */
19016 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
19017
19018 /**
19019  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
19020  */
19021 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
19022
19023 /**
19024  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
19025  */
19026 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
19027
19028 /**
19029  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
19030  */
19031 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
19032
19033 /**
19034  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
19035  */
19036 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
19037
19038 /**
19039  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
19040  */
19041 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
19042
19043 /**
19044  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
19045  */
19046 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
19047
19048 /**
19049  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
19050  */
19051 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
19052
19053 /**
19054  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
19055  */
19056 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
19057
19058 /**
19059  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
19060  */
19061 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
19062
19063 /**
19064  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
19065  */
19066 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
19067
19068 /**
19069  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
19070  */
19071 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
19072
19073 /**
19074  * Read a FundingCreated from a byte array, created by FundingCreated_write
19075  */
19076 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
19077
19078 /**
19079  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
19080  */
19081 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
19082
19083 /**
19084  * Read a FundingSigned from a byte array, created by FundingSigned_write
19085  */
19086 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
19087
19088 /**
19089  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
19090  */
19091 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
19092
19093 /**
19094  * Read a FundingLocked from a byte array, created by FundingLocked_write
19095  */
19096 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
19097
19098 /**
19099  * Serialize the Init object into a byte array which can be read by Init_read
19100  */
19101 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
19102
19103 /**
19104  * Read a Init from a byte array, created by Init_write
19105  */
19106 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
19107
19108 /**
19109  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
19110  */
19111 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
19112
19113 /**
19114  * Read a OpenChannel from a byte array, created by OpenChannel_write
19115  */
19116 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
19117
19118 /**
19119  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
19120  */
19121 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
19122
19123 /**
19124  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
19125  */
19126 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
19127
19128 /**
19129  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
19130  */
19131 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
19132
19133 /**
19134  * Read a Shutdown from a byte array, created by Shutdown_write
19135  */
19136 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
19137
19138 /**
19139  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
19140  */
19141 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
19142
19143 /**
19144  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
19145  */
19146 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
19147
19148 /**
19149  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
19150  */
19151 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
19152
19153 /**
19154  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
19155  */
19156 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
19157
19158 /**
19159  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
19160  */
19161 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
19162
19163 /**
19164  * Read a UpdateFee from a byte array, created by UpdateFee_write
19165  */
19166 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
19167
19168 /**
19169  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
19170  */
19171 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
19172
19173 /**
19174  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
19175  */
19176 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
19177
19178 /**
19179  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
19180  */
19181 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
19182
19183 /**
19184  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
19185  */
19186 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
19187
19188 /**
19189  * Serialize the Ping object into a byte array which can be read by Ping_read
19190  */
19191 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
19192
19193 /**
19194  * Read a Ping from a byte array, created by Ping_write
19195  */
19196 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
19197
19198 /**
19199  * Serialize the Pong object into a byte array which can be read by Pong_read
19200  */
19201 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
19202
19203 /**
19204  * Read a Pong from a byte array, created by Pong_write
19205  */
19206 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
19207
19208 /**
19209  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
19210  */
19211 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
19212
19213 /**
19214  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
19215  */
19216 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
19217
19218 /**
19219  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
19220  */
19221 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
19222
19223 /**
19224  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
19225  */
19226 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
19227
19228 /**
19229  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
19230  */
19231 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
19232
19233 /**
19234  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
19235  */
19236 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
19237
19238 /**
19239  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
19240  */
19241 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
19242
19243 /**
19244  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
19245  */
19246 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
19247
19248 /**
19249  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
19250  */
19251 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
19252
19253 /**
19254  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
19255  */
19256 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
19257
19258 /**
19259  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
19260  */
19261 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
19262
19263 /**
19264  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
19265  */
19266 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
19267
19268 /**
19269  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
19270  */
19271 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
19272
19273 /**
19274  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
19275  */
19276 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
19277
19278 /**
19279  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
19280  */
19281 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
19282
19283 /**
19284  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
19285  */
19286 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
19287
19288 /**
19289  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
19290  */
19291 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
19292
19293 /**
19294  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
19295  */
19296 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
19297
19298 /**
19299  *\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
19300  */
19301 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
19302
19303 /**
19304  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
19305  */
19306 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
19307
19308 /**
19309  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
19310  */
19311 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
19312
19313 /**
19314  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
19315  */
19316 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
19317
19318 /**
19319  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
19320  */
19321 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
19322
19323 /**
19324  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
19325  */
19326 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
19327
19328 /**
19329  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
19330  */
19331 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
19332
19333 /**
19334  * Calls the free function if one is set
19335  */
19336 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
19337
19338 /**
19339  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
19340  */
19341 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
19342
19343 /**
19344  * Constructs a new IgnoringMessageHandler given each field
19345  */
19346 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
19347
19348 /**
19349  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19350  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19351  */
19352 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19353
19354 /**
19355  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
19356  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
19357  */
19358 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19359
19360 /**
19361  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
19362  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
19363  */
19364 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19365
19366 /**
19367  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
19368  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
19369  */
19370 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19371
19372 /**
19373  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
19374  */
19375 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
19376
19377 /**
19378  * Constructs a new ErroringMessageHandler
19379  */
19380 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
19381
19382 /**
19383  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19384  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19385  */
19386 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
19387
19388 /**
19389  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
19390  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
19391  */
19392 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
19393
19394 /**
19395  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
19396  */
19397 void MessageHandler_free(struct LDKMessageHandler this_obj);
19398
19399 /**
19400  * A message handler which handles messages specific to channels. Usually this is just a
19401  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
19402  *
19403  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19404  */
19405 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
19406
19407 /**
19408  * A message handler which handles messages specific to channels. Usually this is just a
19409  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
19410  *
19411  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19412  */
19413 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
19414
19415 /**
19416  * A message handler which handles messages updating our knowledge of the network channel
19417  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
19418  * [`IgnoringMessageHandler`].
19419  *
19420  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
19421  */
19422 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
19423
19424 /**
19425  * A message handler which handles messages updating our knowledge of the network channel
19426  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
19427  * [`IgnoringMessageHandler`].
19428  *
19429  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
19430  */
19431 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
19432
19433 /**
19434  * Constructs a new MessageHandler given each field
19435  */
19436 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
19437
19438 /**
19439  * Creates a copy of a SocketDescriptor
19440  */
19441 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
19442
19443 /**
19444  * Calls the free function if one is set
19445  */
19446 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
19447
19448 /**
19449  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
19450  */
19451 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
19452
19453 /**
19454  * Used to indicate that we probably can't make any future connections to this peer, implying
19455  * we should go ahead and force-close any channels we have with it.
19456  */
19457 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
19458
19459 /**
19460  * Used to indicate that we probably can't make any future connections to this peer, implying
19461  * we should go ahead and force-close any channels we have with it.
19462  */
19463 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
19464
19465 /**
19466  * Constructs a new PeerHandleError given each field
19467  */
19468 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
19469
19470 /**
19471  * Creates a copy of the PeerHandleError
19472  */
19473 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
19474
19475 /**
19476  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
19477  */
19478 void PeerManager_free(struct LDKPeerManager this_obj);
19479
19480 /**
19481  * Constructs a new PeerManager with the given message handlers and node_id secret key
19482  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
19483  * cryptographically secure random bytes.
19484  */
19485 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, struct LDKCustomMessageHandler custom_message_handler);
19486
19487 /**
19488  * Get the list of node ids for peers which have completed the initial handshake.
19489  *
19490  * For outbound connections, this will be the same as the their_node_id parameter passed in to
19491  * new_outbound_connection, however entries will only appear once the initial handshake has
19492  * completed and we are sure the remote peer has the private key for the given node_id.
19493  */
19494 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
19495
19496 /**
19497  * Indicates a new outbound connection has been established to a node with the given node_id.
19498  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
19499  * descriptor but must disconnect the connection immediately.
19500  *
19501  * Returns a small number of bytes to send to the remote node (currently always 50).
19502  *
19503  * Panics if descriptor is duplicative with some other descriptor which has not yet been
19504  * [`socket_disconnected()`].
19505  *
19506  * [`socket_disconnected()`]: PeerManager::socket_disconnected
19507  */
19508 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);
19509
19510 /**
19511  * Indicates a new inbound connection has been established.
19512  *
19513  * May refuse the connection by returning an Err, but will never write bytes to the remote end
19514  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
19515  * call socket_disconnected for the new descriptor but must disconnect the connection
19516  * immediately.
19517  *
19518  * Panics if descriptor is duplicative with some other descriptor which has not yet been
19519  * [`socket_disconnected()`].
19520  *
19521  * [`socket_disconnected()`]: PeerManager::socket_disconnected
19522  */
19523 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
19524
19525 /**
19526  * Indicates that there is room to write data to the given socket descriptor.
19527  *
19528  * May return an Err to indicate that the connection should be closed.
19529  *
19530  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
19531  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
19532  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
19533  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
19534  * sufficient!
19535  *
19536  * [`send_data`]: SocketDescriptor::send_data
19537  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
19538  */
19539 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
19540
19541 /**
19542  * Indicates that data was read from the given socket descriptor.
19543  *
19544  * May return an Err to indicate that the connection should be closed.
19545  *
19546  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
19547  * Thus, however, you should call [`process_events`] after any `read_event` to generate
19548  * [`send_data`] calls to handle responses.
19549  *
19550  * If `Ok(true)` is returned, further read_events should not be triggered until a
19551  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
19552  * send buffer).
19553  *
19554  * [`send_data`]: SocketDescriptor::send_data
19555  * [`process_events`]: PeerManager::process_events
19556  */
19557 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);
19558
19559 /**
19560  * Checks for any events generated by our handlers and processes them. Includes sending most
19561  * response messages as well as messages generated by calls to handler functions directly (eg
19562  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
19563  *
19564  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
19565  * issues!
19566  *
19567  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
19568  * or one of the other clients provided in our language bindings.
19569  *
19570  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
19571  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
19572  * [`send_data`]: SocketDescriptor::send_data
19573  */
19574 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
19575
19576 /**
19577  * Indicates that the given socket descriptor's connection is now closed.
19578  */
19579 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
19580
19581 /**
19582  * Disconnect a peer given its node id.
19583  *
19584  * Set `no_connection_possible` to true to prevent any further connection with this peer,
19585  * force-closing any channels we have with it.
19586  *
19587  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
19588  * peer. Thus, be very careful about reentrancy issues.
19589  *
19590  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
19591  */
19592 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
19593
19594 /**
19595  * Disconnects all currently-connected peers. This is useful on platforms where there may be
19596  * an indication that TCP sockets have stalled even if we weren't around to time them out
19597  * using regular ping/pongs.
19598  */
19599 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
19600
19601 /**
19602  * Send pings to each peer and disconnect those which did not respond to the last round of
19603  * pings.
19604  *
19605  * This may be called on any timescale you want, however, roughly once every five to ten
19606  * seconds is preferred. The call rate determines both how often we send a ping to our peers
19607  * and how much time they have to respond before we disconnect them.
19608  *
19609  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
19610  * issues!
19611  *
19612  * [`send_data`]: SocketDescriptor::send_data
19613  */
19614 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
19615
19616 /**
19617  * Build the commitment secret from the seed and the commitment number
19618  */
19619 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
19620
19621 /**
19622  * Build a closing transaction
19623  */
19624 struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
19625
19626 /**
19627  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
19628  * from the base secret and the per_commitment_point.
19629  *
19630  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19631  * generated (ie our own).
19632  */
19633 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
19634
19635 /**
19636  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
19637  * from the base point and the per_commitment_key. This is the public equivalent of
19638  * derive_private_key - using only public keys to derive a public key instead of private keys.
19639  *
19640  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19641  * generated (ie our own).
19642  */
19643 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
19644
19645 /**
19646  * Derives a per-commitment-transaction revocation key from its constituent parts.
19647  *
19648  * Only the cheating participant owns a valid witness to propagate a revoked
19649  * commitment transaction, thus per_commitment_secret always come from cheater
19650  * and revocation_base_secret always come from punisher, which is the broadcaster
19651  * of the transaction spending with this key knowledge.
19652  *
19653  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19654  * generated (ie our own).
19655  */
19656 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
19657
19658 /**
19659  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
19660  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
19661  * public key instead of private keys.
19662  *
19663  * Only the cheating participant owns a valid witness to propagate a revoked
19664  * commitment transaction, thus per_commitment_point always come from cheater
19665  * and revocation_base_point always come from punisher, which is the broadcaster
19666  * of the transaction spending with this key knowledge.
19667  *
19668  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19669  * generated (ie our own).
19670  */
19671 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
19672
19673 /**
19674  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
19675  */
19676 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
19677
19678 /**
19679  * The broadcaster's per-commitment public key which was used to derive the other keys.
19680  */
19681 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19682
19683 /**
19684  * The broadcaster's per-commitment public key which was used to derive the other keys.
19685  */
19686 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19687
19688 /**
19689  * The revocation key which is used to allow the broadcaster of the commitment
19690  * transaction to provide their counterparty the ability to punish them if they broadcast
19691  * an old state.
19692  */
19693 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19694
19695 /**
19696  * The revocation key which is used to allow the broadcaster of the commitment
19697  * transaction to provide their counterparty the ability to punish them if they broadcast
19698  * an old state.
19699  */
19700 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19701
19702 /**
19703  * Broadcaster's HTLC Key
19704  */
19705 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19706
19707 /**
19708  * Broadcaster's HTLC Key
19709  */
19710 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19711
19712 /**
19713  * Countersignatory's HTLC Key
19714  */
19715 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19716
19717 /**
19718  * Countersignatory's HTLC Key
19719  */
19720 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19721
19722 /**
19723  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19724  */
19725 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19726
19727 /**
19728  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19729  */
19730 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19731
19732 /**
19733  * Constructs a new TxCreationKeys given each field
19734  */
19735 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);
19736
19737 /**
19738  * Creates a copy of the TxCreationKeys
19739  */
19740 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
19741
19742 /**
19743  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
19744  */
19745 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
19746
19747 /**
19748  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
19749  */
19750 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
19751
19752 /**
19753  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
19754  */
19755 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
19756
19757 /**
19758  * The public key which is used to sign all commitment transactions, as it appears in the
19759  * on-chain channel lock-in 2-of-2 multisig output.
19760  */
19761 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19762
19763 /**
19764  * The public key which is used to sign all commitment transactions, as it appears in the
19765  * on-chain channel lock-in 2-of-2 multisig output.
19766  */
19767 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19768
19769 /**
19770  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19771  * revocation keys. This is combined with the per-commitment-secret generated by the
19772  * counterparty to create a secret which the counterparty can reveal to revoke previous
19773  * states.
19774  */
19775 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19776
19777 /**
19778  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19779  * revocation keys. This is combined with the per-commitment-secret generated by the
19780  * counterparty to create a secret which the counterparty can reveal to revoke previous
19781  * states.
19782  */
19783 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19784
19785 /**
19786  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19787  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19788  * static across every commitment transaction.
19789  */
19790 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19791
19792 /**
19793  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19794  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19795  * static across every commitment transaction.
19796  */
19797 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19798
19799 /**
19800  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19801  * public key which receives non-HTLC-encumbered funds which are only available for spending
19802  * after some delay (or can be claimed via the revocation path).
19803  */
19804 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19805
19806 /**
19807  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19808  * public key which receives non-HTLC-encumbered funds which are only available for spending
19809  * after some delay (or can be claimed via the revocation path).
19810  */
19811 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19812
19813 /**
19814  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19815  * which is used to encumber HTLC-in-flight outputs.
19816  */
19817 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19818
19819 /**
19820  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19821  * which is used to encumber HTLC-in-flight outputs.
19822  */
19823 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19824
19825 /**
19826  * Constructs a new ChannelPublicKeys given each field
19827  */
19828 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);
19829
19830 /**
19831  * Creates a copy of the ChannelPublicKeys
19832  */
19833 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
19834
19835 /**
19836  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
19837  */
19838 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
19839
19840 /**
19841  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
19842  */
19843 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
19844
19845 /**
19846  * Create per-state keys from channel base points and the per-commitment point.
19847  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19848  */
19849 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);
19850
19851 /**
19852  * Generate per-state keys from channel static keys.
19853  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19854  */
19855 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);
19856
19857 /**
19858  * A script either spendable by the revocation
19859  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
19860  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
19861  */
19862 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
19863
19864 /**
19865  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
19866  */
19867 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
19868
19869 /**
19870  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19871  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19872  * need to compare this value to whether the commitment transaction in question is that of
19873  * the counterparty or our own.
19874  */
19875 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19876
19877 /**
19878  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19879  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19880  * need to compare this value to whether the commitment transaction in question is that of
19881  * the counterparty or our own.
19882  */
19883 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
19884
19885 /**
19886  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19887  * this divided by 1000.
19888  */
19889 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19890
19891 /**
19892  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19893  * this divided by 1000.
19894  */
19895 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
19896
19897 /**
19898  * The CLTV lock-time at which this HTLC expires.
19899  */
19900 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19901
19902 /**
19903  * The CLTV lock-time at which this HTLC expires.
19904  */
19905 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
19906
19907 /**
19908  * The hash of the preimage which unlocks this HTLC.
19909  */
19910 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
19911
19912 /**
19913  * The hash of the preimage which unlocks this HTLC.
19914  */
19915 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19916
19917 /**
19918  * The position within the commitment transactions' outputs. This may be None if the value is
19919  * below the dust limit (in which case no output appears in the commitment transaction and the
19920  * value is spent to additional transaction fees).
19921  */
19922 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19923
19924 /**
19925  * The position within the commitment transactions' outputs. This may be None if the value is
19926  * below the dust limit (in which case no output appears in the commitment transaction and the
19927  * value is spent to additional transaction fees).
19928  */
19929 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19930
19931 /**
19932  * Constructs a new HTLCOutputInCommitment given each field
19933  */
19934 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);
19935
19936 /**
19937  * Creates a copy of the HTLCOutputInCommitment
19938  */
19939 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
19940
19941 /**
19942  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
19943  */
19944 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
19945
19946 /**
19947  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
19948  */
19949 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
19950
19951 /**
19952  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
19953  * does not need to have its previous_output_index filled.
19954  */
19955 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
19956
19957 /**
19958  * Gets the redeemscript for a funding output from the two funding public keys.
19959  * Note that the order of funding public keys does not matter.
19960  */
19961 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
19962
19963 /**
19964  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
19965  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
19966  * transaction which needs signing, and can be used to construct an HTLC transaction which is
19967  * broadcastable given a counterparty HTLC signature.
19968  *
19969  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
19970  * commitment transaction).
19971  */
19972 struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[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);
19973
19974 /**
19975  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19976  */
19977 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
19978
19979 /**
19980  * Holder public keys
19981  */
19982 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19983
19984 /**
19985  * Holder public keys
19986  */
19987 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
19988
19989 /**
19990  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19991  */
19992 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19993
19994 /**
19995  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19996  */
19997 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
19998
19999 /**
20000  * Whether the holder is the initiator of this channel.
20001  * This is an input to the commitment number obscure factor computation.
20002  */
20003 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
20004
20005 /**
20006  * Whether the holder is the initiator of this channel.
20007  * This is an input to the commitment number obscure factor computation.
20008  */
20009 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
20010
20011 /**
20012  * The late-bound counterparty channel transaction parameters.
20013  * These parameters are populated at the point in the protocol where the counterparty provides them.
20014  *
20015  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20016  */
20017 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
20018
20019 /**
20020  * The late-bound counterparty channel transaction parameters.
20021  * These parameters are populated at the point in the protocol where the counterparty provides them.
20022  *
20023  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20024  */
20025 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
20026
20027 /**
20028  * The late-bound funding outpoint
20029  *
20030  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20031  */
20032 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
20033
20034 /**
20035  * The late-bound funding outpoint
20036  *
20037  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20038  */
20039 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20040
20041 /**
20042  * Constructs a new ChannelTransactionParameters given each field
20043  */
20044 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);
20045
20046 /**
20047  * Creates a copy of the ChannelTransactionParameters
20048  */
20049 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
20050
20051 /**
20052  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
20053  */
20054 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
20055
20056 /**
20057  * Counter-party public keys
20058  */
20059 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
20060
20061 /**
20062  * Counter-party public keys
20063  */
20064 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
20065
20066 /**
20067  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
20068  */
20069 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
20070
20071 /**
20072  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
20073  */
20074 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
20075
20076 /**
20077  * Constructs a new CounterpartyChannelTransactionParameters given each field
20078  */
20079 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
20080
20081 /**
20082  * Creates a copy of the CounterpartyChannelTransactionParameters
20083  */
20084 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
20085
20086 /**
20087  * Whether the late bound parameters are populated.
20088  */
20089 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
20090
20091 /**
20092  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
20093  * given that the holder is the broadcaster.
20094  *
20095  * self.is_populated() must be true before calling this function.
20096  */
20097 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
20098
20099 /**
20100  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
20101  * given that the counterparty is the broadcaster.
20102  *
20103  * self.is_populated() must be true before calling this function.
20104  */
20105 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
20106
20107 /**
20108  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
20109  */
20110 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
20111
20112 /**
20113  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
20114  */
20115 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
20116
20117 /**
20118  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
20119  */
20120 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
20121
20122 /**
20123  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
20124  */
20125 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
20126
20127 /**
20128  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
20129  */
20130 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
20131
20132 /**
20133  * Get the channel pubkeys for the broadcaster
20134  */
20135 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20136
20137 /**
20138  * Get the channel pubkeys for the countersignatory
20139  */
20140 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20141
20142 /**
20143  * Get the contest delay applicable to the transactions.
20144  * Note that the contest delay was selected by the countersignatory.
20145  */
20146 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20147
20148 /**
20149  * Whether the channel is outbound from the broadcaster.
20150  *
20151  * The boolean representing the side that initiated the channel is
20152  * an input to the commitment number obscure factor computation.
20153  */
20154 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20155
20156 /**
20157  * The funding outpoint
20158  */
20159 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20160
20161 /**
20162  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
20163  */
20164 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
20165
20166 /**
20167  * Our counterparty's signature for the transaction
20168  */
20169 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
20170
20171 /**
20172  * Our counterparty's signature for the transaction
20173  */
20174 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
20175
20176 /**
20177  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
20178  */
20179 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
20180
20181 /**
20182  * Creates a copy of the HolderCommitmentTransaction
20183  */
20184 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
20185
20186 /**
20187  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
20188  */
20189 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
20190
20191 /**
20192  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
20193  */
20194 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
20195
20196 /**
20197  * Create a new holder transaction with the given counterparty signatures.
20198  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
20199  */
20200 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);
20201
20202 /**
20203  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
20204  */
20205 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
20206
20207 /**
20208  * The commitment transaction
20209  */
20210 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
20211
20212 /**
20213  * The commitment transaction
20214  */
20215 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
20216
20217 /**
20218  * The txid for the commitment transaction.
20219  *
20220  * This is provided as a performance optimization, instead of calling transaction.txid()
20221  * multiple times.
20222  */
20223 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
20224
20225 /**
20226  * The txid for the commitment transaction.
20227  *
20228  * This is provided as a performance optimization, instead of calling transaction.txid()
20229  * multiple times.
20230  */
20231 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20232
20233 /**
20234  * Constructs a new BuiltCommitmentTransaction given each field
20235  */
20236 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
20237
20238 /**
20239  * Creates a copy of the BuiltCommitmentTransaction
20240  */
20241 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
20242
20243 /**
20244  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
20245  */
20246 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
20247
20248 /**
20249  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
20250  */
20251 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
20252
20253 /**
20254  * Get the SIGHASH_ALL sighash value of the transaction.
20255  *
20256  * This can be used to verify a signature.
20257  */
20258 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);
20259
20260 /**
20261  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
20262  * because we are about to broadcast a holder transaction.
20263  */
20264 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);
20265
20266 /**
20267  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
20268  */
20269 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
20270
20271 /**
20272  * Construct an object of the class
20273  */
20274 MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
20275
20276 /**
20277  * Trust our pre-built transaction.
20278  *
20279  * Applies a wrapper which allows access to the transaction.
20280  *
20281  * This should only be used if you fully trust the builder of this object. It should not
20282  * be used by an external signer - instead use the verify function.
20283  */
20284 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20285
20286 /**
20287  * Verify our pre-built transaction.
20288  *
20289  * Applies a wrapper which allows access to the transaction.
20290  *
20291  * An external validating signer must call this method before signing
20292  * or using the built transaction.
20293  */
20294 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
20295
20296 /**
20297  * The value to be sent to the holder, or zero if the output will be omitted
20298  */
20299 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20300
20301 /**
20302  * The value to be sent to the counterparty, or zero if the output will be omitted
20303  */
20304 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20305
20306 /**
20307  * The destination of the holder's output
20308  */
20309 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20310
20311 /**
20312  * The destination of the counterparty's output
20313  */
20314 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20315
20316 /**
20317  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
20318  */
20319 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
20320
20321 /**
20322  * The pre-built Bitcoin commitment transaction
20323  */
20324 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
20325
20326 /**
20327  * Get the SIGHASH_ALL sighash value of the transaction.
20328  *
20329  * This can be used to verify a signature.
20330  */
20331 MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
20332
20333 /**
20334  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
20335  * because we are about to broadcast a holder transaction.
20336  */
20337 MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
20338
20339 /**
20340  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
20341  */
20342 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
20343
20344 /**
20345  * Creates a copy of the CommitmentTransaction
20346  */
20347 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
20348
20349 /**
20350  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
20351  */
20352 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
20353
20354 /**
20355  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
20356  */
20357 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
20358
20359 /**
20360  * The backwards-counting commitment number
20361  */
20362 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20363
20364 /**
20365  * The value to be sent to the broadcaster
20366  */
20367 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20368
20369 /**
20370  * The value to be sent to the counterparty
20371  */
20372 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20373
20374 /**
20375  * The feerate paid per 1000-weight-unit in this commitment transaction.
20376  */
20377 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20378
20379 /**
20380  * Trust our pre-built transaction and derived transaction creation public keys.
20381  *
20382  * Applies a wrapper which allows access to these fields.
20383  *
20384  * This should only be used if you fully trust the builder of this object.  It should not
20385  * be used by an external signer - instead use the verify function.
20386  */
20387 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20388
20389 /**
20390  * Verify our pre-built transaction and derived transaction creation public keys.
20391  *
20392  * Applies a wrapper which allows access to these fields.
20393  *
20394  * An external validating signer must call this method before signing
20395  * or using the built transaction.
20396  */
20397 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);
20398
20399 /**
20400  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
20401  */
20402 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
20403
20404 /**
20405  * The transaction ID of the built Bitcoin transaction
20406  */
20407 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20408
20409 /**
20410  * The pre-built Bitcoin commitment transaction
20411  */
20412 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20413
20414 /**
20415  * The pre-calculated transaction creation public keys.
20416  */
20417 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20418
20419 /**
20420  * Get a signature for each HTLC which was included in the commitment transaction (ie for
20421  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
20422  *
20423  * The returned Vec has one entry for each HTLC, and in the same order.
20424  */
20425 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);
20426
20427 /**
20428  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
20429  * shared secret first. This prevents on-chain observers from discovering how many commitment
20430  * transactions occurred in a channel before it was closed.
20431  *
20432  * This function gets the shared secret from relevant channel public keys and can be used to
20433  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
20434  */
20435 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
20436
20437 /**
20438  * Checks if two InitFeaturess contain equal inner contents.
20439  * This ignores pointers and is_owned flags and looks at the values in fields.
20440  * Two objects with NULL inner values will be considered "equal" here.
20441  */
20442 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
20443
20444 /**
20445  * Checks if two NodeFeaturess contain equal inner contents.
20446  * This ignores pointers and is_owned flags and looks at the values in fields.
20447  * Two objects with NULL inner values will be considered "equal" here.
20448  */
20449 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
20450
20451 /**
20452  * Checks if two ChannelFeaturess contain equal inner contents.
20453  * This ignores pointers and is_owned flags and looks at the values in fields.
20454  * Two objects with NULL inner values will be considered "equal" here.
20455  */
20456 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
20457
20458 /**
20459  * Checks if two InvoiceFeaturess contain equal inner contents.
20460  * This ignores pointers and is_owned flags and looks at the values in fields.
20461  * Two objects with NULL inner values will be considered "equal" here.
20462  */
20463 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
20464
20465 /**
20466  * Creates a copy of the InitFeatures
20467  */
20468 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
20469
20470 /**
20471  * Creates a copy of the NodeFeatures
20472  */
20473 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
20474
20475 /**
20476  * Creates a copy of the ChannelFeatures
20477  */
20478 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
20479
20480 /**
20481  * Creates a copy of the InvoiceFeatures
20482  */
20483 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
20484
20485 /**
20486  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
20487  */
20488 void InitFeatures_free(struct LDKInitFeatures this_obj);
20489
20490 /**
20491  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
20492  */
20493 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
20494
20495 /**
20496  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
20497  */
20498 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
20499
20500 /**
20501  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
20502  */
20503 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
20504
20505 /**
20506  * Create a blank Features with no features set
20507  */
20508 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
20509
20510 /**
20511  * Creates a Features with the bits set which are known by the implementation
20512  */
20513 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
20514
20515 /**
20516  * Returns true if this `Features` object contains unknown feature flags which are set as
20517  * \"required\".
20518  */
20519 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
20520
20521 /**
20522  * Create a blank Features with no features set
20523  */
20524 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
20525
20526 /**
20527  * Creates a Features with the bits set which are known by the implementation
20528  */
20529 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
20530
20531 /**
20532  * Returns true if this `Features` object contains unknown feature flags which are set as
20533  * \"required\".
20534  */
20535 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
20536
20537 /**
20538  * Create a blank Features with no features set
20539  */
20540 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
20541
20542 /**
20543  * Creates a Features with the bits set which are known by the implementation
20544  */
20545 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
20546
20547 /**
20548  * Returns true if this `Features` object contains unknown feature flags which are set as
20549  * \"required\".
20550  */
20551 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
20552
20553 /**
20554  * Create a blank Features with no features set
20555  */
20556 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
20557
20558 /**
20559  * Creates a Features with the bits set which are known by the implementation
20560  */
20561 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
20562
20563 /**
20564  * Returns true if this `Features` object contains unknown feature flags which are set as
20565  * \"required\".
20566  */
20567 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
20568
20569 /**
20570  * Returns whether the `payment_secret` feature is supported.
20571  */
20572 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
20573
20574 /**
20575  * Returns whether the `payment_secret` feature is supported.
20576  */
20577 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
20578
20579 /**
20580  * Returns whether the `payment_secret` feature is supported.
20581  */
20582 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
20583
20584 /**
20585  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
20586  */
20587 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
20588
20589 /**
20590  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
20591  */
20592 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
20593
20594 /**
20595  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
20596  */
20597 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
20598
20599 /**
20600  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
20601  */
20602 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
20603
20604 /**
20605  * Read a InitFeatures from a byte array, created by InitFeatures_write
20606  */
20607 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
20608
20609 /**
20610  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
20611  */
20612 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
20613
20614 /**
20615  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
20616  */
20617 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
20618
20619 /**
20620  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
20621  */
20622 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
20623
20624 /**
20625  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
20626  */
20627 void ShutdownScript_free(struct LDKShutdownScript this_obj);
20628
20629 /**
20630  * Creates a copy of the ShutdownScript
20631  */
20632 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
20633
20634 /**
20635  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
20636  */
20637 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
20638
20639 /**
20640  * The script that did not meet the requirements from [BOLT #2].
20641  *
20642  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20643  */
20644 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
20645
20646 /**
20647  * The script that did not meet the requirements from [BOLT #2].
20648  *
20649  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20650  */
20651 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20652
20653 /**
20654  * Constructs a new InvalidShutdownScript given each field
20655  */
20656 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
20657
20658 /**
20659  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
20660  */
20661 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
20662
20663 /**
20664  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
20665  */
20666 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
20667
20668 /**
20669  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
20670  */
20671 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
20672
20673 /**
20674  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
20675  */
20676 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
20677
20678 /**
20679  * Generates a witness script pubkey from the given segwit version and program.
20680  *
20681  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
20682  * [`ShutdownScript::new_p2wsh`] instead.
20683  *
20684  * # Errors
20685  *
20686  * This function may return an error if `program` is invalid for the segwit `version`.
20687  */
20688 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
20689
20690 /**
20691  * Converts the shutdown script into the underlying [`Script`].
20692  */
20693 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
20694
20695 /**
20696  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
20697  *
20698  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20699  */
20700 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
20701
20702 /**
20703  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
20704  *
20705  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
20706  */
20707 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
20708
20709 /**
20710  * Calls the free function if one is set
20711  */
20712 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
20713
20714 /**
20715  * Calls the free function if one is set
20716  */
20717 void Type_free(struct LDKType this_ptr);
20718
20719 /**
20720  * Calls the free function if one is set
20721  */
20722 void Score_free(struct LDKScore this_ptr);
20723
20724 /**
20725  * Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
20726  */
20727 void LockableScore_free(struct LDKLockableScore this_obj);
20728
20729 /**
20730  * Constructs a new LockableScore from a Score
20731  */
20732 MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score);
20733
20734 /**
20735  * Serialize the LockableScore object into a byte array which can be read by LockableScore_read
20736  */
20737 struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj);
20738
20739 /**
20740  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
20741  */
20742 void NodeId_free(struct LDKNodeId this_obj);
20743
20744 /**
20745  * Creates a copy of the NodeId
20746  */
20747 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
20748
20749 /**
20750  * Create a new NodeId from a public key
20751  */
20752 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
20753
20754 /**
20755  * Get the public key slice from this NodeId
20756  */
20757 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
20758
20759 /**
20760  * Checks if two NodeIds contain equal inner contents.
20761  */
20762 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
20763
20764 /**
20765  * Serialize the NodeId object into a byte array which can be read by NodeId_read
20766  */
20767 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
20768
20769 /**
20770  * Read a NodeId from a byte array, created by NodeId_write
20771  */
20772 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
20773
20774 /**
20775  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
20776  */
20777 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
20778
20779 /**
20780  * Creates a copy of the NetworkGraph
20781  */
20782 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
20783
20784 /**
20785  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
20786  */
20787 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
20788
20789 /**
20790  * Frees any resources used by the NetworkUpdate
20791  */
20792 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
20793
20794 /**
20795  * Creates a copy of the NetworkUpdate
20796  */
20797 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
20798
20799 /**
20800  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
20801  */
20802 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
20803
20804 /**
20805  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
20806  */
20807 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
20808
20809 /**
20810  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
20811  */
20812 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
20813
20814 /**
20815  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
20816  */
20817 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
20818
20819 /**
20820  * Constructs a new EventHandler which calls the relevant methods on this_arg.
20821  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
20822  */
20823 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20824
20825 /**
20826  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
20827  */
20828 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
20829
20830 /**
20831  * Creates a new tracker of the actual state of the network of channels and nodes,
20832  * assuming an existing Network Graph.
20833  * Chain monitor is used to make sure announced channels exist on-chain,
20834  * channel data is correct, and that the announcement is signed with
20835  * channel owners' keys.
20836  */
20837 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
20838
20839 /**
20840  * Adds a provider used to check new announcements. Does not affect
20841  * existing announcements unless they are updated.
20842  * Add, update or remove the provider would replace the current one.
20843  */
20844 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
20845
20846 /**
20847  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
20848  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
20849  */
20850 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20851
20852 /**
20853  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20854  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20855  */
20856 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20857
20858 /**
20859  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
20860  */
20861 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
20862
20863 /**
20864  * When the last update to the channel direction was issued.
20865  * Value is opaque, as set in the announcement.
20866  */
20867 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20868
20869 /**
20870  * When the last update to the channel direction was issued.
20871  * Value is opaque, as set in the announcement.
20872  */
20873 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
20874
20875 /**
20876  * Whether the channel can be currently used for payments (in this one direction).
20877  */
20878 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20879
20880 /**
20881  * Whether the channel can be currently used for payments (in this one direction).
20882  */
20883 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
20884
20885 /**
20886  * The difference in CLTV values that you must have when routing through this channel.
20887  */
20888 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20889
20890 /**
20891  * The difference in CLTV values that you must have when routing through this channel.
20892  */
20893 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
20894
20895 /**
20896  * The minimum value, which must be relayed to the next hop via the channel
20897  */
20898 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20899
20900 /**
20901  * The minimum value, which must be relayed to the next hop via the channel
20902  */
20903 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
20904
20905 /**
20906  * The maximum value which may be relayed to the next hop via the channel.
20907  */
20908 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20909
20910 /**
20911  * The maximum value which may be relayed to the next hop via the channel.
20912  */
20913 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20914
20915 /**
20916  * Fees charged when the channel is used for routing
20917  */
20918 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20919
20920 /**
20921  * Fees charged when the channel is used for routing
20922  */
20923 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20924
20925 /**
20926  * Most recent update for the channel received from the network
20927  * Mostly redundant with the data we store in fields explicitly.
20928  * Everything else is useful only for sending out for initial routing sync.
20929  * Not stored if contains excess data to prevent DoS.
20930  *
20931  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20932  */
20933 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20934
20935 /**
20936  * Most recent update for the channel received from the network
20937  * Mostly redundant with the data we store in fields explicitly.
20938  * Everything else is useful only for sending out for initial routing sync.
20939  * Not stored if contains excess data to prevent DoS.
20940  *
20941  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20942  */
20943 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
20944
20945 /**
20946  * Constructs a new DirectionalChannelInfo given each field
20947  */
20948 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);
20949
20950 /**
20951  * Creates a copy of the DirectionalChannelInfo
20952  */
20953 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
20954
20955 /**
20956  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
20957  */
20958 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
20959
20960 /**
20961  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
20962  */
20963 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
20964
20965 /**
20966  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
20967  */
20968 void ChannelInfo_free(struct LDKChannelInfo this_obj);
20969
20970 /**
20971  * Protocol features of a channel communicated during its announcement
20972  */
20973 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20974
20975 /**
20976  * Protocol features of a channel communicated during its announcement
20977  */
20978 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
20979
20980 /**
20981  * Source node of the first direction of a channel
20982  */
20983 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20984
20985 /**
20986  * Source node of the first direction of a channel
20987  */
20988 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
20989
20990 /**
20991  * Details about the first direction of a channel
20992  *
20993  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20994  */
20995 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20996
20997 /**
20998  * Details about the first direction of a channel
20999  *
21000  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21001  */
21002 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
21003
21004 /**
21005  * Source node of the second direction of a channel
21006  */
21007 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
21008
21009 /**
21010  * Source node of the second direction of a channel
21011  */
21012 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
21013
21014 /**
21015  * Details about the second direction of a channel
21016  *
21017  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21018  */
21019 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
21020
21021 /**
21022  * Details about the second direction of a channel
21023  *
21024  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21025  */
21026 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
21027
21028 /**
21029  * The channel capacity as seen on-chain, if chain lookup is available.
21030  */
21031 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
21032
21033 /**
21034  * The channel capacity as seen on-chain, if chain lookup is available.
21035  */
21036 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21037
21038 /**
21039  * An initial announcement of the channel
21040  * Mostly redundant with the data we store in fields explicitly.
21041  * Everything else is useful only for sending out for initial routing sync.
21042  * Not stored if contains excess data to prevent DoS.
21043  *
21044  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21045  */
21046 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
21047
21048 /**
21049  * An initial announcement of the channel
21050  * Mostly redundant with the data we store in fields explicitly.
21051  * Everything else is useful only for sending out for initial routing sync.
21052  * Not stored if contains excess data to prevent DoS.
21053  *
21054  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21055  */
21056 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
21057
21058 /**
21059  * Constructs a new ChannelInfo given each field
21060  */
21061 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
21062
21063 /**
21064  * Creates a copy of the ChannelInfo
21065  */
21066 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
21067
21068 /**
21069  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
21070  */
21071 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
21072
21073 /**
21074  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
21075  */
21076 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
21077
21078 /**
21079  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
21080  */
21081 void RoutingFees_free(struct LDKRoutingFees this_obj);
21082
21083 /**
21084  * Flat routing fee in satoshis
21085  */
21086 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
21087
21088 /**
21089  * Flat routing fee in satoshis
21090  */
21091 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
21092
21093 /**
21094  * Liquidity-based routing fee in millionths of a routed amount.
21095  * In other words, 10000 is 1%.
21096  */
21097 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
21098
21099 /**
21100  * Liquidity-based routing fee in millionths of a routed amount.
21101  * In other words, 10000 is 1%.
21102  */
21103 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
21104
21105 /**
21106  * Constructs a new RoutingFees given each field
21107  */
21108 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
21109
21110 /**
21111  * Checks if two RoutingFeess contain equal inner contents.
21112  * This ignores pointers and is_owned flags and looks at the values in fields.
21113  * Two objects with NULL inner values will be considered "equal" here.
21114  */
21115 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
21116
21117 /**
21118  * Creates a copy of the RoutingFees
21119  */
21120 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
21121
21122 /**
21123  * Checks if two RoutingFeess contain equal inner contents.
21124  */
21125 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
21126
21127 /**
21128  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
21129  */
21130 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
21131
21132 /**
21133  * Read a RoutingFees from a byte array, created by RoutingFees_write
21134  */
21135 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
21136
21137 /**
21138  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
21139  */
21140 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
21141
21142 /**
21143  * Protocol features the node announced support for
21144  */
21145 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21146
21147 /**
21148  * Protocol features the node announced support for
21149  */
21150 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21151
21152 /**
21153  * When the last known update to the node state was issued.
21154  * Value is opaque, as set in the announcement.
21155  */
21156 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21157
21158 /**
21159  * When the last known update to the node state was issued.
21160  * Value is opaque, as set in the announcement.
21161  */
21162 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
21163
21164 /**
21165  * Color assigned to the node
21166  */
21167 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
21168
21169 /**
21170  * Color assigned to the node
21171  */
21172 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21173
21174 /**
21175  * Moniker assigned to the node.
21176  * May be invalid or malicious (eg control chars),
21177  * should not be exposed to the user.
21178  */
21179 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
21180
21181 /**
21182  * Moniker assigned to the node.
21183  * May be invalid or malicious (eg control chars),
21184  * should not be exposed to the user.
21185  */
21186 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21187
21188 /**
21189  * Internet-level addresses via which one can connect to the node
21190  */
21191 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21192
21193 /**
21194  * An initial announcement of the node
21195  * Mostly redundant with the data we store in fields explicitly.
21196  * Everything else is useful only for sending out for initial routing sync.
21197  * Not stored if contains excess data to prevent DoS.
21198  *
21199  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21200  */
21201 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21202
21203 /**
21204  * An initial announcement of the node
21205  * Mostly redundant with the data we store in fields explicitly.
21206  * Everything else is useful only for sending out for initial routing sync.
21207  * Not stored if contains excess data to prevent DoS.
21208  *
21209  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21210  */
21211 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
21212
21213 /**
21214  * Constructs a new NodeAnnouncementInfo given each field
21215  */
21216 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);
21217
21218 /**
21219  * Creates a copy of the NodeAnnouncementInfo
21220  */
21221 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
21222
21223 /**
21224  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
21225  */
21226 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
21227
21228 /**
21229  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
21230  */
21231 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
21232
21233 /**
21234  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
21235  */
21236 void NodeInfo_free(struct LDKNodeInfo this_obj);
21237
21238 /**
21239  * All valid channels a node has announced
21240  */
21241 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21242
21243 /**
21244  * Lowest fees enabling routing via any of the enabled, known channels to a node.
21245  * The two fields (flat and proportional fee) are independent,
21246  * meaning they don't have to refer to the same channel.
21247  *
21248  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21249  */
21250 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
21251
21252 /**
21253  * Lowest fees enabling routing via any of the enabled, known channels to a node.
21254  * The two fields (flat and proportional fee) are independent,
21255  * meaning they don't have to refer to the same channel.
21256  *
21257  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21258  */
21259 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
21260
21261 /**
21262  * More information about a node from node_announcement.
21263  * Optional because we store a Node entry after learning about it from
21264  * a channel announcement, but before receiving a node announcement.
21265  *
21266  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21267  */
21268 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
21269
21270 /**
21271  * More information about a node from node_announcement.
21272  * Optional because we store a Node entry after learning about it from
21273  * a channel announcement, but before receiving a node announcement.
21274  *
21275  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21276  */
21277 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
21278
21279 /**
21280  * Constructs a new NodeInfo given each field
21281  */
21282 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
21283
21284 /**
21285  * Creates a copy of the NodeInfo
21286  */
21287 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
21288
21289 /**
21290  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
21291  */
21292 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
21293
21294 /**
21295  * Read a NodeInfo from a byte array, created by NodeInfo_write
21296  */
21297 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
21298
21299 /**
21300  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
21301  */
21302 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
21303
21304 /**
21305  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
21306  */
21307 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
21308
21309 /**
21310  * Creates a new, empty, network graph.
21311  */
21312 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
21313
21314 /**
21315  * Returns a read-only view of the network graph.
21316  */
21317 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
21318
21319 /**
21320  * For an already known node (from channel announcements), update its stored properties from a
21321  * given node announcement.
21322  *
21323  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21324  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21325  * routing messages from a source using a protocol other than the lightning P2P protocol.
21326  */
21327 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
21328
21329 /**
21330  * For an already known node (from channel announcements), update its stored properties from a
21331  * given node announcement without verifying the associated signatures. Because we aren't
21332  * given the associated signatures here we cannot relay the node announcement to any of our
21333  * peers.
21334  */
21335 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
21336
21337 /**
21338  * Store or update channel info from a channel announcement.
21339  *
21340  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21341  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21342  * routing messages from a source using a protocol other than the lightning P2P protocol.
21343  *
21344  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
21345  * the corresponding UTXO exists on chain and is correctly-formatted.
21346  */
21347 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
21348
21349 /**
21350  * Store or update channel info from a channel announcement without verifying the associated
21351  * signatures. Because we aren't given the associated signatures here we cannot relay the
21352  * channel announcement to any of our peers.
21353  *
21354  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
21355  * the corresponding UTXO exists on chain and is correctly-formatted.
21356  */
21357 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
21358
21359 /**
21360  * Close a channel if a corresponding HTLC fail was sent.
21361  * If permanent, removes a channel from the local storage.
21362  * May cause the removal of nodes too, if this was their last channel.
21363  * If not permanent, makes channels unavailable for routing.
21364  */
21365 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
21366
21367 /**
21368  * Marks a node in the graph as failed.
21369  */
21370 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
21371
21372 /**
21373  * For an already known (from announcement) channel, update info about one of the directions
21374  * of the channel.
21375  *
21376  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21377  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21378  * routing messages from a source using a protocol other than the lightning P2P protocol.
21379  */
21380 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
21381
21382 /**
21383  * For an already known (from announcement) channel, update info about one of the directions
21384  * of the channel without verifying the associated signatures. Because we aren't given the
21385  * associated signatures here we cannot relay the channel update to any of our peers.
21386  */
21387 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
21388
21389 /**
21390  * Get network addresses by node id.
21391  * Returns None if the requested node is completely unknown,
21392  * or if node announcement for the node was never received.
21393  */
21394 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
21395
21396 /**
21397  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
21398  */
21399 void RouteHop_free(struct LDKRouteHop this_obj);
21400
21401 /**
21402  * The node_id of the node at this hop.
21403  */
21404 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21405
21406 /**
21407  * The node_id of the node at this hop.
21408  */
21409 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21410
21411 /**
21412  * The node_announcement features of the node at this hop. For the last hop, these may be
21413  * amended to match the features present in the invoice this node generated.
21414  */
21415 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21416
21417 /**
21418  * The node_announcement features of the node at this hop. For the last hop, these may be
21419  * amended to match the features present in the invoice this node generated.
21420  */
21421 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21422
21423 /**
21424  * The channel that should be used from the previous hop to reach this node.
21425  */
21426 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21427
21428 /**
21429  * The channel that should be used from the previous hop to reach this node.
21430  */
21431 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
21432
21433 /**
21434  * The channel_announcement features of the channel that should be used from the previous hop
21435  * to reach this node.
21436  */
21437 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21438
21439 /**
21440  * The channel_announcement features of the channel that should be used from the previous hop
21441  * to reach this node.
21442  */
21443 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21444
21445 /**
21446  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
21447  * For the last hop, this should be the full value of the payment (might be more than
21448  * requested if we had to match htlc_minimum_msat).
21449  */
21450 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21451
21452 /**
21453  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
21454  * For the last hop, this should be the full value of the payment (might be more than
21455  * requested if we had to match htlc_minimum_msat).
21456  */
21457 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
21458
21459 /**
21460  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
21461  * expected at the destination, in excess of the current block height.
21462  */
21463 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21464
21465 /**
21466  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
21467  * expected at the destination, in excess of the current block height.
21468  */
21469 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
21470
21471 /**
21472  * Constructs a new RouteHop given each field
21473  */
21474 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);
21475
21476 /**
21477  * Creates a copy of the RouteHop
21478  */
21479 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
21480
21481 /**
21482  * Checks if two RouteHops contain equal inner contents.
21483  */
21484 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
21485
21486 /**
21487  * Checks if two RouteHops contain equal inner contents.
21488  * This ignores pointers and is_owned flags and looks at the values in fields.
21489  * Two objects with NULL inner values will be considered "equal" here.
21490  */
21491 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
21492
21493 /**
21494  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
21495  */
21496 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
21497
21498 /**
21499  * Read a RouteHop from a byte array, created by RouteHop_write
21500  */
21501 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
21502
21503 /**
21504  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
21505  */
21506 void Route_free(struct LDKRoute this_obj);
21507
21508 /**
21509  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
21510  * last RouteHop in each path must be the same.
21511  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
21512  * destination. Thus, this must always be at least length one. While the maximum length of any
21513  * given path is variable, keeping the length of any path to less than 20 should currently
21514  * ensure it is viable.
21515  */
21516 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
21517
21518 /**
21519  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
21520  * last RouteHop in each path must be the same.
21521  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
21522  * destination. Thus, this must always be at least length one. While the maximum length of any
21523  * given path is variable, keeping the length of any path to less than 20 should currently
21524  * ensure it is viable.
21525  */
21526 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
21527
21528 /**
21529  * The `payee` parameter passed to [`find_route`].
21530  * This is used by `ChannelManager` to track information which may be required for retries,
21531  * provided back to you via [`Event::PaymentPathFailed`].
21532  *
21533  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21534  *
21535  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21536  */
21537 struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
21538
21539 /**
21540  * The `payee` parameter passed to [`find_route`].
21541  * This is used by `ChannelManager` to track information which may be required for retries,
21542  * provided back to you via [`Event::PaymentPathFailed`].
21543  *
21544  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21545  *
21546  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21547  */
21548 void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
21549
21550 /**
21551  * Constructs a new Route given each field
21552  */
21553 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
21554
21555 /**
21556  * Creates a copy of the Route
21557  */
21558 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
21559
21560 /**
21561  * Checks if two Routes contain equal inner contents.
21562  */
21563 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
21564
21565 /**
21566  * Checks if two Routes contain equal inner contents.
21567  * This ignores pointers and is_owned flags and looks at the values in fields.
21568  * Two objects with NULL inner values will be considered "equal" here.
21569  */
21570 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
21571
21572 /**
21573  * Returns the total amount of fees paid on this [`Route`].
21574  *
21575  * This doesn't include any extra payment made to the recipient, which can happen in excess of
21576  * the amount passed to [`find_route`]'s `params.final_value_msat`.
21577  */
21578 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
21579
21580 /**
21581  * Returns the total amount paid on this [`Route`], excluding the fees.
21582  */
21583 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
21584
21585 /**
21586  * Serialize the Route object into a byte array which can be read by Route_read
21587  */
21588 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
21589
21590 /**
21591  * Read a Route from a byte array, created by Route_write
21592  */
21593 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
21594
21595 /**
21596  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
21597  */
21598 void RouteParameters_free(struct LDKRouteParameters this_obj);
21599
21600 /**
21601  * The recipient of the failed payment path.
21602  */
21603 struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21604
21605 /**
21606  * The recipient of the failed payment path.
21607  */
21608 void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
21609
21610 /**
21611  * The amount in msats sent on the failed payment path.
21612  */
21613 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21614
21615 /**
21616  * The amount in msats sent on the failed payment path.
21617  */
21618 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
21619
21620 /**
21621  * The CLTV on the final hop of the failed payment path.
21622  */
21623 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21624
21625 /**
21626  * The CLTV on the final hop of the failed payment path.
21627  */
21628 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
21629
21630 /**
21631  * Constructs a new RouteParameters given each field
21632  */
21633 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
21634
21635 /**
21636  * Creates a copy of the RouteParameters
21637  */
21638 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
21639
21640 /**
21641  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
21642  */
21643 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
21644
21645 /**
21646  * Read a RouteParameters from a byte array, created by RouteParameters_write
21647  */
21648 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
21649
21650 /**
21651  * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
21652  */
21653 void Payee_free(struct LDKPayee this_obj);
21654
21655 /**
21656  * The node id of the payee.
21657  */
21658 struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
21659
21660 /**
21661  * The node id of the payee.
21662  */
21663 void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21664
21665 /**
21666  * Features supported by the payee.
21667  *
21668  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
21669  * does not contain any features.
21670  *
21671  * [`for_keysend`]: Self::for_keysend
21672  *
21673  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21674  */
21675 struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
21676
21677 /**
21678  * Features supported by the payee.
21679  *
21680  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
21681  * does not contain any features.
21682  *
21683  * [`for_keysend`]: Self::for_keysend
21684  *
21685  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21686  */
21687 void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
21688
21689 /**
21690  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
21691  */
21692 struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
21693
21694 /**
21695  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
21696  */
21697 void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
21698
21699 /**
21700  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
21701  */
21702 struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
21703
21704 /**
21705  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
21706  */
21707 void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21708
21709 /**
21710  * Constructs a new Payee given each field
21711  */
21712 MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg);
21713
21714 /**
21715  * Creates a copy of the Payee
21716  */
21717 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
21718
21719 /**
21720  * Checks if two Payees contain equal inner contents.
21721  */
21722 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
21723
21724 /**
21725  * Checks if two Payees contain equal inner contents.
21726  * This ignores pointers and is_owned flags and looks at the values in fields.
21727  * Two objects with NULL inner values will be considered "equal" here.
21728  */
21729 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
21730
21731 /**
21732  * Serialize the Payee object into a byte array which can be read by Payee_read
21733  */
21734 struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
21735
21736 /**
21737  * Read a Payee from a byte array, created by Payee_write
21738  */
21739 struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
21740
21741 /**
21742  * Creates a payee with the node id of the given `pubkey`.
21743  */
21744 MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
21745
21746 /**
21747  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
21748  */
21749 MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
21750
21751 /**
21752  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
21753  */
21754 void RouteHint_free(struct LDKRouteHint this_obj);
21755
21756 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
21757
21758 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
21759
21760 /**
21761  * Constructs a new RouteHint given each field
21762  */
21763 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
21764
21765 /**
21766  * Creates a copy of the RouteHint
21767  */
21768 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
21769
21770 /**
21771  * Checks if two RouteHints contain equal inner contents.
21772  */
21773 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
21774
21775 /**
21776  * Checks if two RouteHints contain equal inner contents.
21777  * This ignores pointers and is_owned flags and looks at the values in fields.
21778  * Two objects with NULL inner values will be considered "equal" here.
21779  */
21780 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
21781
21782 /**
21783  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
21784  */
21785 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
21786
21787 /**
21788  * Read a RouteHint from a byte array, created by RouteHint_write
21789  */
21790 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
21791
21792 /**
21793  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
21794  */
21795 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
21796
21797 /**
21798  * The node_id of the non-target end of the route
21799  */
21800 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21801
21802 /**
21803  * The node_id of the non-target end of the route
21804  */
21805 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21806
21807 /**
21808  * The short_channel_id of this channel
21809  */
21810 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21811
21812 /**
21813  * The short_channel_id of this channel
21814  */
21815 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
21816
21817 /**
21818  * The fees which must be paid to use this channel
21819  */
21820 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21821
21822 /**
21823  * The fees which must be paid to use this channel
21824  */
21825 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
21826
21827 /**
21828  * The difference in CLTV values between this node and the next node.
21829  */
21830 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21831
21832 /**
21833  * The difference in CLTV values between this node and the next node.
21834  */
21835 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
21836
21837 /**
21838  * The minimum value, in msat, which must be relayed to the next hop.
21839  */
21840 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21841
21842 /**
21843  * The minimum value, in msat, which must be relayed to the next hop.
21844  */
21845 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21846
21847 /**
21848  * The maximum value in msat available for routing with a single HTLC.
21849  */
21850 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21851
21852 /**
21853  * The maximum value in msat available for routing with a single HTLC.
21854  */
21855 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21856
21857 /**
21858  * Constructs a new RouteHintHop given each field
21859  */
21860 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);
21861
21862 /**
21863  * Creates a copy of the RouteHintHop
21864  */
21865 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
21866
21867 /**
21868  * Checks if two RouteHintHops contain equal inner contents.
21869  */
21870 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
21871
21872 /**
21873  * Checks if two RouteHintHops contain equal inner contents.
21874  * This ignores pointers and is_owned flags and looks at the values in fields.
21875  * Two objects with NULL inner values will be considered "equal" here.
21876  */
21877 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
21878
21879 /**
21880  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
21881  */
21882 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
21883
21884 /**
21885  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
21886  */
21887 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
21888
21889 /**
21890  * Finds a route from us (payer) to the given target node (payee).
21891  *
21892  * If the payee provided features in their invoice, they should be provided via `params.payee`.
21893  * Without this, MPP will only be used if the payee's features are available in the network graph.
21894  *
21895  * Private routing paths between a public node and the target may be included in `params.payee`.
21896  *
21897  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
21898  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
21899  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
21900  *
21901  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
21902  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
21903  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
21904  *
21905  * # Note
21906  *
21907  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
21908  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
21909  * function.
21910  *
21911  * # Panics
21912  *
21913  * Panics if first_hops contains channels without short_channel_ids;
21914  * [`ChannelManager::list_usable_channels`] will never include such channels.
21915  *
21916  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
21917  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21918  *
21919  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
21920  */
21921 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
21922
21923 /**
21924  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
21925  */
21926 void Scorer_free(struct LDKScorer this_obj);
21927
21928 /**
21929  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
21930  */
21931 void ScoringParameters_free(struct LDKScoringParameters this_obj);
21932
21933 /**
21934  * A fixed penalty in msats to apply to each channel.
21935  */
21936 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21937
21938 /**
21939  * A fixed penalty in msats to apply to each channel.
21940  */
21941 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21942
21943 /**
21944  * A penalty in msats to apply to a channel upon failing to relay a payment.
21945  *
21946  * This accumulates for each failure but may be reduced over time based on
21947  * [`failure_penalty_half_life`].
21948  *
21949  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
21950  */
21951 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21952
21953 /**
21954  * A penalty in msats to apply to a channel upon failing to relay a payment.
21955  *
21956  * This accumulates for each failure but may be reduced over time based on
21957  * [`failure_penalty_half_life`].
21958  *
21959  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
21960  */
21961 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21962
21963 /**
21964  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
21965  * cut in half.
21966  *
21967  * # Note
21968  *
21969  * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
21970  * elapse. Therefore, this penalty will never decay.
21971  *
21972  * [`failure_penalty_msat`]: Self::failure_penalty_msat
21973  */
21974 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21975
21976 /**
21977  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
21978  * cut in half.
21979  *
21980  * # Note
21981  *
21982  * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
21983  * elapse. Therefore, this penalty will never decay.
21984  *
21985  * [`failure_penalty_msat`]: Self::failure_penalty_msat
21986  */
21987 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21988
21989 /**
21990  * Constructs a new ScoringParameters given each field
21991  */
21992 MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint64_t failure_penalty_half_life_arg);
21993
21994 /**
21995  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
21996  */
21997 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
21998
21999 /**
22000  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
22001  */
22002 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
22003
22004 /**
22005  * Creates a new scorer using the given scoring parameters.
22006  */
22007 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
22008
22009 /**
22010  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
22011  */
22012 MUST_USE_RES struct LDKScorer Scorer_default(void);
22013
22014 /**
22015  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
22016  */
22017 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
22018
22019 /**
22020  * Constructs a new Score which calls the relevant methods on this_arg.
22021  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
22022  */
22023 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
22024
22025 /**
22026  * Serialize the Scorer object into a byte array which can be read by Scorer_read
22027  */
22028 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
22029
22030 /**
22031  * Read a Scorer from a byte array, created by Scorer_write
22032  */
22033 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
22034
22035 /**
22036  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
22037  */
22038 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
22039
22040 /**
22041  * Initialize a new FilesystemPersister and set the path to the individual channels'
22042  * files.
22043  */
22044 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
22045
22046 /**
22047  * Get the directory which was provided when this persister was initialized.
22048  */
22049 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
22050
22051 /**
22052  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
22053  * initialization, within a file called \"manager\".
22054  */
22055 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
22056
22057 /**
22058  * Read `ChannelMonitor`s from disk.
22059  */
22060 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
22061
22062 /**
22063  * Constructs a new Persist which calls the relevant methods on this_arg.
22064  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
22065  */
22066 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
22067
22068 /**
22069  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
22070  */
22071 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
22072
22073 /**
22074  * Calls the free function if one is set
22075  */
22076 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
22077
22078 /**
22079  * Start a background thread that takes care of responsibilities enumerated in the [top-level
22080  * documentation].
22081  *
22082  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
22083  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
22084  * either [`join`] or [`stop`].
22085  *
22086  * # Data Persistence
22087  *
22088  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
22089  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
22090  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
22091  * provided implementation.
22092  *
22093  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
22094  * error or call [`join`] and handle any error that may arise. For the latter case,
22095  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
22096  *
22097  * # Event Handling
22098  *
22099  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
22100  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
22101  * functionality implemented by other handlers.
22102  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
22103  *
22104  * [top-level documentation]: Self
22105  * [`join`]: Self::join
22106  * [`stop`]: Self::stop
22107  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
22108  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
22109  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
22110  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
22111  *
22112  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
22113  */
22114 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
22115
22116 /**
22117  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
22118  * [`ChannelManager`].
22119  *
22120  * # Panics
22121  *
22122  * This function panics if the background thread has panicked such as while persisting or
22123  * handling events.
22124  *
22125  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
22126  */
22127 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
22128
22129 /**
22130  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
22131  * [`ChannelManager`].
22132  *
22133  * # Panics
22134  *
22135  * This function panics if the background thread has panicked such as while persisting or
22136  * handling events.
22137  *
22138  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
22139  */
22140 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
22141
22142 /**
22143  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
22144  *
22145  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
22146  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
22147  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
22148  * since this check is fast we recommend to do it anyway.
22149  *
22150  * If this function fails this is considered a bug. Please open an issue describing your
22151  * platform and stating your current system time.
22152  *
22153  * # Panics
22154  * If the check fails this function panics. By calling this function on startup you ensure that
22155  * this wont happen at an arbitrary later point in time.
22156  */
22157 void check_platform(void);
22158
22159 /**
22160  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
22161  */
22162 void Invoice_free(struct LDKInvoice this_obj);
22163
22164 /**
22165  * Checks if two Invoices contain equal inner contents.
22166  * This ignores pointers and is_owned flags and looks at the values in fields.
22167  * Two objects with NULL inner values will be considered "equal" here.
22168  */
22169 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
22170
22171 /**
22172  * Creates a copy of the Invoice
22173  */
22174 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
22175
22176 /**
22177  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
22178  */
22179 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
22180
22181 /**
22182  * Checks if two SignedRawInvoices contain equal inner contents.
22183  * This ignores pointers and is_owned flags and looks at the values in fields.
22184  * Two objects with NULL inner values will be considered "equal" here.
22185  */
22186 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
22187
22188 /**
22189  * Creates a copy of the SignedRawInvoice
22190  */
22191 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
22192
22193 /**
22194  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
22195  */
22196 void RawInvoice_free(struct LDKRawInvoice this_obj);
22197
22198 /**
22199  * data part
22200  */
22201 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
22202
22203 /**
22204  * data part
22205  */
22206 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
22207
22208 /**
22209  * Checks if two RawInvoices contain equal inner contents.
22210  * This ignores pointers and is_owned flags and looks at the values in fields.
22211  * Two objects with NULL inner values will be considered "equal" here.
22212  */
22213 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
22214
22215 /**
22216  * Creates a copy of the RawInvoice
22217  */
22218 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
22219
22220 /**
22221  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
22222  */
22223 void RawDataPart_free(struct LDKRawDataPart this_obj);
22224
22225 /**
22226  * generation time of the invoice
22227  */
22228 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
22229
22230 /**
22231  * generation time of the invoice
22232  */
22233 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
22234
22235 /**
22236  * Checks if two RawDataParts contain equal inner contents.
22237  * This ignores pointers and is_owned flags and looks at the values in fields.
22238  * Two objects with NULL inner values will be considered "equal" here.
22239  */
22240 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
22241
22242 /**
22243  * Creates a copy of the RawDataPart
22244  */
22245 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
22246
22247 /**
22248  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
22249  */
22250 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
22251
22252 /**
22253  * Checks if two PositiveTimestamps contain equal inner contents.
22254  * This ignores pointers and is_owned flags and looks at the values in fields.
22255  * Two objects with NULL inner values will be considered "equal" here.
22256  */
22257 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
22258
22259 /**
22260  * Creates a copy of the PositiveTimestamp
22261  */
22262 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
22263
22264 /**
22265  * Creates a copy of the SiPrefix
22266  */
22267 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
22268
22269 /**
22270  * Utility method to constructs a new Milli-variant SiPrefix
22271  */
22272 enum LDKSiPrefix SiPrefix_milli(void);
22273
22274 /**
22275  * Utility method to constructs a new Micro-variant SiPrefix
22276  */
22277 enum LDKSiPrefix SiPrefix_micro(void);
22278
22279 /**
22280  * Utility method to constructs a new Nano-variant SiPrefix
22281  */
22282 enum LDKSiPrefix SiPrefix_nano(void);
22283
22284 /**
22285  * Utility method to constructs a new Pico-variant SiPrefix
22286  */
22287 enum LDKSiPrefix SiPrefix_pico(void);
22288
22289 /**
22290  * Checks if two SiPrefixs contain equal inner contents.
22291  * This ignores pointers and is_owned flags and looks at the values in fields.
22292  */
22293 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
22294
22295 /**
22296  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
22297  * This is effectively 10^12 * the prefix multiplier
22298  */
22299 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
22300
22301 /**
22302  * Creates a copy of the Currency
22303  */
22304 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
22305
22306 /**
22307  * Utility method to constructs a new Bitcoin-variant Currency
22308  */
22309 enum LDKCurrency Currency_bitcoin(void);
22310
22311 /**
22312  * Utility method to constructs a new BitcoinTestnet-variant Currency
22313  */
22314 enum LDKCurrency Currency_bitcoin_testnet(void);
22315
22316 /**
22317  * Utility method to constructs a new Regtest-variant Currency
22318  */
22319 enum LDKCurrency Currency_regtest(void);
22320
22321 /**
22322  * Utility method to constructs a new Simnet-variant Currency
22323  */
22324 enum LDKCurrency Currency_simnet(void);
22325
22326 /**
22327  * Utility method to constructs a new Signet-variant Currency
22328  */
22329 enum LDKCurrency Currency_signet(void);
22330
22331 /**
22332  * Checks if two Currencys contain equal inner contents.
22333  */
22334 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
22335
22336 /**
22337  * Checks if two Currencys contain equal inner contents.
22338  * This ignores pointers and is_owned flags and looks at the values in fields.
22339  */
22340 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
22341
22342 /**
22343  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
22344  */
22345 void Sha256_free(struct LDKSha256 this_obj);
22346
22347 /**
22348  * Creates a copy of the Sha256
22349  */
22350 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
22351
22352 /**
22353  * Checks if two Sha256s contain equal inner contents.
22354  */
22355 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
22356
22357 /**
22358  * Checks if two Sha256s contain equal inner contents.
22359  * This ignores pointers and is_owned flags and looks at the values in fields.
22360  * Two objects with NULL inner values will be considered "equal" here.
22361  */
22362 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
22363
22364 /**
22365  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
22366  */
22367 void Description_free(struct LDKDescription this_obj);
22368
22369 /**
22370  * Creates a copy of the Description
22371  */
22372 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
22373
22374 /**
22375  * Checks if two Descriptions contain equal inner contents.
22376  */
22377 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
22378
22379 /**
22380  * Checks if two Descriptions contain equal inner contents.
22381  * This ignores pointers and is_owned flags and looks at the values in fields.
22382  * Two objects with NULL inner values will be considered "equal" here.
22383  */
22384 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
22385
22386 /**
22387  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
22388  */
22389 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
22390
22391 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
22392
22393 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22394
22395 /**
22396  * Constructs a new PayeePubKey given each field
22397  */
22398 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
22399
22400 /**
22401  * Creates a copy of the PayeePubKey
22402  */
22403 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
22404
22405 /**
22406  * Checks if two PayeePubKeys contain equal inner contents.
22407  */
22408 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
22409
22410 /**
22411  * Checks if two PayeePubKeys contain equal inner contents.
22412  * This ignores pointers and is_owned flags and looks at the values in fields.
22413  * Two objects with NULL inner values will be considered "equal" here.
22414  */
22415 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
22416
22417 /**
22418  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
22419  */
22420 void ExpiryTime_free(struct LDKExpiryTime this_obj);
22421
22422 /**
22423  * Creates a copy of the ExpiryTime
22424  */
22425 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
22426
22427 /**
22428  * Checks if two ExpiryTimes contain equal inner contents.
22429  */
22430 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
22431
22432 /**
22433  * Checks if two ExpiryTimes contain equal inner contents.
22434  * This ignores pointers and is_owned flags and looks at the values in fields.
22435  * Two objects with NULL inner values will be considered "equal" here.
22436  */
22437 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
22438
22439 /**
22440  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
22441  */
22442 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
22443
22444 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
22445
22446 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
22447
22448 /**
22449  * Constructs a new MinFinalCltvExpiry given each field
22450  */
22451 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
22452
22453 /**
22454  * Creates a copy of the MinFinalCltvExpiry
22455  */
22456 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
22457
22458 /**
22459  * Checks if two MinFinalCltvExpirys contain equal inner contents.
22460  */
22461 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
22462
22463 /**
22464  * Checks if two MinFinalCltvExpirys contain equal inner contents.
22465  * This ignores pointers and is_owned flags and looks at the values in fields.
22466  * Two objects with NULL inner values will be considered "equal" here.
22467  */
22468 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
22469
22470 /**
22471  * Frees any resources used by the Fallback
22472  */
22473 void Fallback_free(struct LDKFallback this_ptr);
22474
22475 /**
22476  * Creates a copy of the Fallback
22477  */
22478 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
22479
22480 /**
22481  * Utility method to constructs a new SegWitProgram-variant Fallback
22482  */
22483 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
22484
22485 /**
22486  * Utility method to constructs a new PubKeyHash-variant Fallback
22487  */
22488 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
22489
22490 /**
22491  * Utility method to constructs a new ScriptHash-variant Fallback
22492  */
22493 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
22494
22495 /**
22496  * Checks if two Fallbacks contain equal inner contents.
22497  */
22498 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
22499
22500 /**
22501  * Checks if two Fallbacks contain equal inner contents.
22502  * This ignores pointers and is_owned flags and looks at the values in fields.
22503  */
22504 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
22505
22506 /**
22507  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
22508  */
22509 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
22510
22511 /**
22512  * Creates a copy of the InvoiceSignature
22513  */
22514 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
22515
22516 /**
22517  * Checks if two InvoiceSignatures contain equal inner contents.
22518  * This ignores pointers and is_owned flags and looks at the values in fields.
22519  * Two objects with NULL inner values will be considered "equal" here.
22520  */
22521 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
22522
22523 /**
22524  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
22525  */
22526 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
22527
22528 /**
22529  * Creates a copy of the PrivateRoute
22530  */
22531 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
22532
22533 /**
22534  * Checks if two PrivateRoutes contain equal inner contents.
22535  */
22536 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
22537
22538 /**
22539  * Checks if two PrivateRoutes contain equal inner contents.
22540  * This ignores pointers and is_owned flags and looks at the values in fields.
22541  * Two objects with NULL inner values will be considered "equal" here.
22542  */
22543 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
22544
22545 /**
22546  * Disassembles the `SignedRawInvoice` into its three parts:
22547  *  1. raw invoice
22548  *  2. hash of the raw invoice
22549  *  3. signature
22550  */
22551 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
22552
22553 /**
22554  * The `RawInvoice` which was signed.
22555  */
22556 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22557
22558 /**
22559  * The hash of the `RawInvoice` that was signed.
22560  */
22561 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
22562
22563 /**
22564  * InvoiceSignature for the invoice.
22565  */
22566 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22567
22568 /**
22569  * Recovers the public key used for signing the invoice from the recoverable signature.
22570  */
22571 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22572
22573 /**
22574  * Checks if the signature is valid for the included payee public key or if none exists if it's
22575  * valid for the recovered signature (which should always be true?).
22576  */
22577 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22578
22579 /**
22580  * Calculate the hash of the encoded `RawInvoice`
22581  */
22582 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22583
22584 /**
22585  *
22586  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22587  */
22588 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22589
22590 /**
22591  *
22592  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22593  */
22594 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22595
22596 /**
22597  *
22598  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22599  */
22600 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22601
22602 /**
22603  *
22604  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22605  */
22606 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22607
22608 /**
22609  *
22610  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22611  */
22612 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22613
22614 /**
22615  *
22616  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22617  */
22618 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22619
22620 /**
22621  *
22622  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22623  */
22624 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22625
22626 /**
22627  *
22628  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22629  */
22630 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22631
22632 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22633
22634 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22635
22636 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22637
22638 /**
22639  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
22640  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
22641  * `CreationError::TimestampOutOfBounds`.
22642  */
22643 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
22644
22645 /**
22646  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
22647  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
22648  * `CreationError::TimestampOutOfBounds`.
22649  */
22650 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
22651
22652 /**
22653  * Returns the UNIX timestamp representing the stored time
22654  */
22655 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
22656
22657 /**
22658  * Returns a reference to the internal `SystemTime` time representation
22659  */
22660 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
22661
22662 /**
22663  * Transform the `Invoice` into it's unchecked version
22664  */
22665 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
22666
22667 /**
22668  * Check that the invoice is signed correctly and that key recovery works
22669  */
22670 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
22671
22672 /**
22673  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
22674  * ```
22675  * use lightning_invoice::*;
22676  *
22677  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
22678  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
22679  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
22680  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
22681  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
22682  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
22683  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
22684  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
22685  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
22686  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
22687  * j5r6drg6k6zcqj0fcwg\";
22688  *
22689  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
22690  *
22691  * assert!(Invoice::from_signed(signed).is_ok());
22692  * ```
22693  */
22694 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
22695
22696 /**
22697  * Returns the `Invoice`'s timestamp (should equal it's creation time)
22698  */
22699 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
22700
22701 /**
22702  * Returns the hash to which we will receive the preimage on completion of the payment
22703  */
22704 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
22705
22706 /**
22707  * Get the payee's public key if one was included in the invoice
22708  *
22709  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22710  */
22711 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
22712
22713 /**
22714  * Get the payment secret if one was included in the invoice
22715  */
22716 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
22717
22718 /**
22719  * Get the invoice features if they were included in the invoice
22720  *
22721  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22722  */
22723 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
22724
22725 /**
22726  * Recover the payee's public key (only to be used if none was included in the invoice)
22727  */
22728 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
22729
22730 /**
22731  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
22732  */
22733 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
22734
22735 /**
22736  * Returns whether the invoice has expired.
22737  */
22738 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
22739
22740 /**
22741  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
22742  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
22743  */
22744 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
22745
22746 /**
22747  * Returns a list of all routes included in the invoice
22748  */
22749 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
22750
22751 /**
22752  * Returns a list of all routes included in the invoice as the underlying hints
22753  */
22754 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
22755
22756 /**
22757  * Returns the currency for which the invoice was issued
22758  */
22759 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
22760
22761 /**
22762  * Returns the amount if specified in the invoice as millisatoshis.
22763  */
22764 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
22765
22766 /**
22767  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
22768  * returns `CreationError::DescriptionTooLong` otherwise
22769  *
22770  * Please note that single characters may use more than one byte due to UTF8 encoding.
22771  */
22772 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
22773
22774 /**
22775  * Returns the underlying description `String`
22776  */
22777 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
22778
22779 /**
22780  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
22781  * overflow on adding the `EpiryTime` to it then this function will return a
22782  * `CreationError::ExpiryTimeOutOfBounds`.
22783  */
22784 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
22785
22786 /**
22787  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
22788  * would overflow on adding the `EpiryTime` to it then this function will return a
22789  * `CreationError::ExpiryTimeOutOfBounds`.
22790  */
22791 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
22792
22793 /**
22794  * Returns the expiry time in seconds
22795  */
22796 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
22797
22798 /**
22799  * Returns a reference to the underlying `Duration` (=expiry time)
22800  */
22801 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
22802
22803 /**
22804  * Creates a new (partial) route from a list of hops
22805  */
22806 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
22807
22808 /**
22809  * Returns the underlying list of hops
22810  */
22811 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
22812
22813 /**
22814  * Creates a copy of the CreationError
22815  */
22816 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
22817
22818 /**
22819  * Utility method to constructs a new DescriptionTooLong-variant CreationError
22820  */
22821 enum LDKCreationError CreationError_description_too_long(void);
22822
22823 /**
22824  * Utility method to constructs a new RouteTooLong-variant CreationError
22825  */
22826 enum LDKCreationError CreationError_route_too_long(void);
22827
22828 /**
22829  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
22830  */
22831 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
22832
22833 /**
22834  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
22835  */
22836 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
22837
22838 /**
22839  * Checks if two CreationErrors contain equal inner contents.
22840  * This ignores pointers and is_owned flags and looks at the values in fields.
22841  */
22842 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
22843
22844 /**
22845  * Get the string representation of a CreationError object
22846  */
22847 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
22848
22849 /**
22850  * Creates a copy of the SemanticError
22851  */
22852 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
22853
22854 /**
22855  * Utility method to constructs a new NoPaymentHash-variant SemanticError
22856  */
22857 enum LDKSemanticError SemanticError_no_payment_hash(void);
22858
22859 /**
22860  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
22861  */
22862 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
22863
22864 /**
22865  * Utility method to constructs a new NoDescription-variant SemanticError
22866  */
22867 enum LDKSemanticError SemanticError_no_description(void);
22868
22869 /**
22870  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
22871  */
22872 enum LDKSemanticError SemanticError_multiple_descriptions(void);
22873
22874 /**
22875  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
22876  */
22877 enum LDKSemanticError SemanticError_no_payment_secret(void);
22878
22879 /**
22880  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
22881  */
22882 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
22883
22884 /**
22885  * Utility method to constructs a new InvalidFeatures-variant SemanticError
22886  */
22887 enum LDKSemanticError SemanticError_invalid_features(void);
22888
22889 /**
22890  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
22891  */
22892 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
22893
22894 /**
22895  * Utility method to constructs a new InvalidSignature-variant SemanticError
22896  */
22897 enum LDKSemanticError SemanticError_invalid_signature(void);
22898
22899 /**
22900  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
22901  */
22902 enum LDKSemanticError SemanticError_imprecise_amount(void);
22903
22904 /**
22905  * Checks if two SemanticErrors contain equal inner contents.
22906  * This ignores pointers and is_owned flags and looks at the values in fields.
22907  */
22908 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
22909
22910 /**
22911  * Get the string representation of a SemanticError object
22912  */
22913 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
22914
22915 /**
22916  * Frees any resources used by the SignOrCreationError
22917  */
22918 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
22919
22920 /**
22921  * Creates a copy of the SignOrCreationError
22922  */
22923 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
22924
22925 /**
22926  * Utility method to constructs a new SignError-variant SignOrCreationError
22927  */
22928 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
22929
22930 /**
22931  * Utility method to constructs a new CreationError-variant SignOrCreationError
22932  */
22933 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
22934
22935 /**
22936  * Checks if two SignOrCreationErrors contain equal inner contents.
22937  * This ignores pointers and is_owned flags and looks at the values in fields.
22938  */
22939 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
22940
22941 /**
22942  * Get the string representation of a SignOrCreationError object
22943  */
22944 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
22945
22946 /**
22947  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
22948  */
22949 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
22950
22951 /**
22952  * Calls the free function if one is set
22953  */
22954 void Payer_free(struct LDKPayer this_ptr);
22955
22956 /**
22957  * Calls the free function if one is set
22958  */
22959 void Router_free(struct LDKRouter this_ptr);
22960
22961 /**
22962  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
22963  */
22964 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
22965
22966 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
22967
22968 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
22969
22970 /**
22971  * Constructs a new RetryAttempts given each field
22972  */
22973 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
22974
22975 /**
22976  * Creates a copy of the RetryAttempts
22977  */
22978 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
22979
22980 /**
22981  * Checks if two RetryAttemptss contain equal inner contents.
22982  * This ignores pointers and is_owned flags and looks at the values in fields.
22983  * Two objects with NULL inner values will be considered "equal" here.
22984  */
22985 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
22986
22987 /**
22988  * Checks if two RetryAttemptss contain equal inner contents.
22989  */
22990 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
22991
22992 /**
22993  * Frees any resources used by the PaymentError
22994  */
22995 void PaymentError_free(struct LDKPaymentError this_ptr);
22996
22997 /**
22998  * Creates a copy of the PaymentError
22999  */
23000 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
23001
23002 /**
23003  * Utility method to constructs a new Invoice-variant PaymentError
23004  */
23005 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
23006
23007 /**
23008  * Utility method to constructs a new Routing-variant PaymentError
23009  */
23010 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
23011
23012 /**
23013  * Utility method to constructs a new Sending-variant PaymentError
23014  */
23015 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
23016
23017 /**
23018  * Creates an invoice payer that retries failed payment paths.
23019  *
23020  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
23021  * `retry_attempts` has been exceeded for a given [`Invoice`].
23022  */
23023 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
23024
23025 /**
23026  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
23027  *
23028  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
23029  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
23030  * for you.
23031  */
23032 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
23033
23034 /**
23035  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
23036  * case a retry is needed.
23037  *
23038  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
23039  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
23040  * for you.
23041  */
23042 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats);
23043
23044 /**
23045  * Removes the payment cached by the given payment hash.
23046  *
23047  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
23048  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
23049  */
23050 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
23051
23052 /**
23053  * Constructs a new EventHandler which calls the relevant methods on this_arg.
23054  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
23055  */
23056 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
23057
23058 /**
23059  * Utility to construct an invoice. Generally, unless you want to do something like a custom
23060  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
23061  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
23062  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
23063  * that the payment secret is valid when the invoice is paid.
23064  */
23065 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);
23066
23067 /**
23068  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
23069  */
23070 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
23071
23072 /**
23073  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
23074  */
23075 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
23076
23077 /**
23078  * Constructs a new Router which calls the relevant methods on this_arg.
23079  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
23080  */
23081 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
23082
23083 /**
23084  * Constructs a new Payer which calls the relevant methods on this_arg.
23085  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
23086  */
23087 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
23088
23089 /**
23090  * Read a SiPrefix object from a string
23091  */
23092 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
23093
23094 /**
23095  * Read a Invoice object from a string
23096  */
23097 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
23098
23099 /**
23100  * Read a SignedRawInvoice object from a string
23101  */
23102 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
23103
23104 /**
23105  * Get the string representation of a Invoice object
23106  */
23107 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
23108
23109 /**
23110  * Get the string representation of a SignedRawInvoice object
23111  */
23112 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
23113
23114 /**
23115  * Get the string representation of a Currency object
23116  */
23117 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
23118
23119 /**
23120  * Get the string representation of a SiPrefix object
23121  */
23122 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
23123
23124 #endif /* LDK_C_BINDINGS_H */
23125
23126 #include "ldk_ver.h"