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  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3403  */
3404 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3405    /**
3406     * A pointer to the contents in the success state.
3407     * Reading from this pointer when `result_ok` is not set is undefined.
3408     */
3409    struct LDKDelayedPaymentOutputDescriptor *result;
3410    /**
3411     * A pointer to the contents in the error state.
3412     * Reading from this pointer when `result_ok` is set is undefined.
3413     */
3414    struct LDKDecodeError *err;
3415 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
3416
3417 /**
3418  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3419  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3420  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3421  */
3422 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3423    /**
3424     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3425     * `err` or `result` depending on the state of `result_ok`.
3426     */
3427    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
3428    /**
3429     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3430     */
3431    bool result_ok;
3432 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
3433
3434 /**
3435  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3436  */
3437 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3438    /**
3439     * A pointer to the contents in the success state.
3440     * Reading from this pointer when `result_ok` is not set is undefined.
3441     */
3442    struct LDKStaticPaymentOutputDescriptor *result;
3443    /**
3444     * A pointer to the contents in the error state.
3445     * Reading from this pointer when `result_ok` is set is undefined.
3446     */
3447    struct LDKDecodeError *err;
3448 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
3449
3450 /**
3451  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3452  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3453  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3454  */
3455 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3456    /**
3457     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3458     * `err` or `result` depending on the state of `result_ok`.
3459     */
3460    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
3461    /**
3462     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3463     */
3464    bool result_ok;
3465 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3466
3467 /**
3468  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3469  */
3470 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3471    /**
3472     * A pointer to the contents in the success state.
3473     * Reading from this pointer when `result_ok` is not set is undefined.
3474     */
3475    struct LDKSpendableOutputDescriptor *result;
3476    /**
3477     * A pointer to the contents in the error state.
3478     * Reading from this pointer when `result_ok` is set is undefined.
3479     */
3480    struct LDKDecodeError *err;
3481 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3482
3483 /**
3484  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3485  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3486  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3487  */
3488 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3489    /**
3490     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3491     * `err` or `result` depending on the state of `result_ok`.
3492     */
3493    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3494    /**
3495     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3496     */
3497    bool result_ok;
3498 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3499
3500 /**
3501  * The contents of CResult_NoneNoneZ
3502  */
3503 typedef union LDKCResult_NoneNoneZPtr {
3504    /**
3505     * Note that this value is always NULL, as there are no contents in the OK variant
3506     */
3507    void *result;
3508    /**
3509     * Note that this value is always NULL, as there are no contents in the Err variant
3510     */
3511    void *err;
3512 } LDKCResult_NoneNoneZPtr;
3513
3514 /**
3515  * A CResult_NoneNoneZ represents the result of a fallible operation,
3516  * containing a () on success and a () on failure.
3517  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3518  */
3519 typedef struct LDKCResult_NoneNoneZ {
3520    /**
3521     * The contents of this CResult_NoneNoneZ, accessible via either
3522     * `err` or `result` depending on the state of `result_ok`.
3523     */
3524    union LDKCResult_NoneNoneZPtr contents;
3525    /**
3526     * Whether this CResult_NoneNoneZ represents a success state.
3527     */
3528    bool result_ok;
3529 } LDKCResult_NoneNoneZ;
3530
3531 /**
3532  * A tuple of 2 elements. See the individual fields for the types contained.
3533  */
3534 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3535    /**
3536     * The element at position 0
3537     */
3538    struct LDKSignature a;
3539    /**
3540     * The element at position 1
3541     */
3542    struct LDKCVec_SignatureZ b;
3543 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3544
3545 /**
3546  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3547  */
3548 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3549    /**
3550     * A pointer to the contents in the success state.
3551     * Reading from this pointer when `result_ok` is not set is undefined.
3552     */
3553    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3554    /**
3555     * Note that this value is always NULL, as there are no contents in the Err variant
3556     */
3557    void *err;
3558 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3559
3560 /**
3561  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3562  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3563  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3564  */
3565 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3566    /**
3567     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3568     * `err` or `result` depending on the state of `result_ok`.
3569     */
3570    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3571    /**
3572     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3573     */
3574    bool result_ok;
3575 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3576
3577 /**
3578  * The contents of CResult_SignatureNoneZ
3579  */
3580 typedef union LDKCResult_SignatureNoneZPtr {
3581    /**
3582     * A pointer to the contents in the success state.
3583     * Reading from this pointer when `result_ok` is not set is undefined.
3584     */
3585    struct LDKSignature *result;
3586    /**
3587     * Note that this value is always NULL, as there are no contents in the Err variant
3588     */
3589    void *err;
3590 } LDKCResult_SignatureNoneZPtr;
3591
3592 /**
3593  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3594  * containing a crate::c_types::Signature on success and a () on failure.
3595  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3596  */
3597 typedef struct LDKCResult_SignatureNoneZ {
3598    /**
3599     * The contents of this CResult_SignatureNoneZ, accessible via either
3600     * `err` or `result` depending on the state of `result_ok`.
3601     */
3602    union LDKCResult_SignatureNoneZPtr contents;
3603    /**
3604     * Whether this CResult_SignatureNoneZ represents a success state.
3605     */
3606    bool result_ok;
3607 } LDKCResult_SignatureNoneZ;
3608
3609
3610
3611 /**
3612  * This class tracks the per-transaction information needed to build a closing transaction and will
3613  * actually build it and sign.
3614  *
3615  * This class can be used inside a signer implementation to generate a signature given the relevant
3616  * secret key.
3617  */
3618 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
3619    /**
3620     * A pointer to the opaque Rust object.
3621     * Nearly everywhere, inner must be non-null, however in places where
3622     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3623     */
3624    LDKnativeClosingTransaction *inner;
3625    /**
3626     * Indicates that this is the only struct which contains the same pointer.
3627     * Rust functions which take ownership of an object provided via an argument require
3628     * this to be true and invalidate the object pointed to by inner.
3629     */
3630    bool is_owned;
3631 } LDKClosingTransaction;
3632
3633
3634
3635 /**
3636  * The unsigned part of a channel_announcement
3637  */
3638 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3639    /**
3640     * A pointer to the opaque Rust object.
3641     * Nearly everywhere, inner must be non-null, however in places where
3642     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3643     */
3644    LDKnativeUnsignedChannelAnnouncement *inner;
3645    /**
3646     * Indicates that this is the only struct which contains the same pointer.
3647     * Rust functions which take ownership of an object provided via an argument require
3648     * this to be true and invalidate the object pointed to by inner.
3649     */
3650    bool is_owned;
3651 } LDKUnsignedChannelAnnouncement;
3652
3653 /**
3654  * A trait to sign lightning channel transactions as described in BOLT 3.
3655  *
3656  * Signing services could be implemented on a hardware wallet. In this case,
3657  * the current Sign would be a front-end on top of a communication
3658  * channel connected to your secure device and lightning key material wouldn't
3659  * reside on a hot server. Nevertheless, a this deployment would still need
3660  * to trust the ChannelManager to avoid loss of funds as this latest component
3661  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3662  *
3663  * A more secure iteration would be to use hashlock (or payment points) to pair
3664  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3665  * at the price of more state and computation on the hardware wallet side. In the future,
3666  * we are looking forward to design such interface.
3667  *
3668  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3669  * to act, as liveness and breach reply correctness are always going to be hard requirements
3670  * of LN security model, orthogonal of key management issues.
3671  */
3672 typedef struct LDKBaseSign {
3673    /**
3674     * An opaque pointer which is passed to your function implementations as an argument.
3675     * This has no meaning in the LDK, and can be NULL or any other value.
3676     */
3677    void *this_arg;
3678    /**
3679     * Gets the per-commitment point for a specific commitment number
3680     *
3681     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3682     */
3683    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3684    /**
3685     * Gets the commitment secret for a specific commitment number as part of the revocation process
3686     *
3687     * An external signer implementation should error here if the commitment was already signed
3688     * and should refuse to sign it in the future.
3689     *
3690     * May be called more than once for the same index.
3691     *
3692     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3693     */
3694    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3695    /**
3696     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
3697     *
3698     * This is required in order for the signer to make sure that releasing a commitment
3699     * secret won't leave us without a broadcastable holder transaction.
3700     * Policy checks should be implemented in this function, including checking the amount
3701     * sent to us and checking the HTLCs.
3702     */
3703    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
3704    /**
3705     * Gets the holder's channel public keys and basepoints
3706     */
3707    struct LDKChannelPublicKeys pubkeys;
3708    /**
3709     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3710     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3711     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3712     */
3713    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3714    /**
3715     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3716     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3717     * Sign object uniquely and lookup or re-derive its keys.
3718     */
3719    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3720    /**
3721     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3722     *
3723     * Note that if signing fails or is rejected, the channel will be force-closed.
3724     *
3725     * Policy checks should be implemented in this function, including checking the amount
3726     * sent to us and checking the HTLCs.
3727     */
3728    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3729    /**
3730     * Validate the counterparty's revocation.
3731     *
3732     * This is required in order for the signer to make sure that the state has moved
3733     * forward and it is safe to sign the next counterparty commitment.
3734     */
3735    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
3736    /**
3737     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3738     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3739     * latest commitment_tx when we initiate a force-close.
3740     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3741     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3742     * the latest.
3743     * This may be called multiple times for the same transaction.
3744     *
3745     * An external signer implementation should check that the commitment has not been revoked.
3746     *
3747     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3748     */
3749    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3750    /**
3751     * Create a signature for the given input in a transaction spending an HTLC transaction output
3752     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3753     *
3754     * A justice transaction may claim multiple outputs at the same time if timelocks are
3755     * similar, but only a signature for the input at index `input` should be signed for here.
3756     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3757     * to an upcoming timelock expiration.
3758     *
3759     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3760     *
3761     * per_commitment_key is revocation secret which was provided by our counterparty when they
3762     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3763     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3764     * so).
3765     */
3766    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]);
3767    /**
3768     * Create a signature for the given input in a transaction spending a commitment transaction
3769     * HTLC output when our counterparty broadcasts an old state.
3770     *
3771     * A justice transaction may claim multiple outputs at the same time if timelocks are
3772     * similar, but only a signature for the input at index `input` should be signed for here.
3773     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3774     * to an upcoming timelock expiration.
3775     *
3776     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3777     *
3778     * per_commitment_key is revocation secret which was provided by our counterparty when they
3779     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3780     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3781     * so).
3782     *
3783     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3784     * (which is committed to in the BIP 143 signatures).
3785     */
3786    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);
3787    /**
3788     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3789     * transaction, either offered or received.
3790     *
3791     * Such a transaction may claim multiples offered outputs at same time if we know the
3792     * preimage for each when we create it, but only the input at index `input` should be
3793     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3794     * needed with regards to an upcoming timelock expiration.
3795     *
3796     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3797     * outputs.
3798     *
3799     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3800     *
3801     * Per_commitment_point is the dynamic point corresponding to the channel state
3802     * detected onchain. It has been generated by our counterparty and is used to derive
3803     * channel state keys, which are then included in the witness script and committed to in the
3804     * BIP 143 signature.
3805     */
3806    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);
3807    /**
3808     * Create a signature for a (proposed) closing transaction.
3809     *
3810     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3811     * chosen to forgo their output as dust.
3812     */
3813    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
3814    /**
3815     * Signs a channel announcement message with our funding key, proving it comes from one
3816     * of the channel participants.
3817     *
3818     * Note that if this fails or is rejected, the channel will not be publicly announced and
3819     * our counterparty may (though likely will not) close the channel on us for violating the
3820     * protocol.
3821     */
3822    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3823    /**
3824     * Set the counterparty static channel data, including basepoints,
3825     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3826     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3827     * they MUST NOT be allowed to change to different values once set.
3828     *
3829     * channel_parameters.is_populated() MUST be true.
3830     *
3831     * We bind holder_selected_contest_delay late here for API convenience.
3832     *
3833     * Will be called before any signatures are applied.
3834     */
3835    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3836    /**
3837     * Frees any resources associated with this object given its this_arg pointer.
3838     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3839     */
3840    void (*free)(void *this_arg);
3841 } LDKBaseSign;
3842
3843 /**
3844  * A cloneable signer.
3845  *
3846  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3847  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3848  * which implies Sized, into this derived trait.
3849  */
3850 typedef struct LDKSign {
3851    /**
3852     * An opaque pointer which is passed to your function implementations as an argument.
3853     * This has no meaning in the LDK, and can be NULL or any other value.
3854     */
3855    void *this_arg;
3856    /**
3857     * Implementation of BaseSign for this object.
3858     */
3859    struct LDKBaseSign BaseSign;
3860    /**
3861     * Serialize the object into a byte array
3862     */
3863    struct LDKCVec_u8Z (*write)(const void *this_arg);
3864    /**
3865     * Called, if set, after this Sign has been cloned into a duplicate object.
3866     * The new Sign is provided, and should be mutated as needed to perform a
3867     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3868     */
3869    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
3870    /**
3871     * Frees any resources associated with this object given its this_arg pointer.
3872     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3873     */
3874    void (*free)(void *this_arg);
3875 } LDKSign;
3876
3877 /**
3878  * The contents of CResult_SignDecodeErrorZ
3879  */
3880 typedef union LDKCResult_SignDecodeErrorZPtr {
3881    /**
3882     * A pointer to the contents in the success state.
3883     * Reading from this pointer when `result_ok` is not set is undefined.
3884     */
3885    struct LDKSign *result;
3886    /**
3887     * A pointer to the contents in the error state.
3888     * Reading from this pointer when `result_ok` is set is undefined.
3889     */
3890    struct LDKDecodeError *err;
3891 } LDKCResult_SignDecodeErrorZPtr;
3892
3893 /**
3894  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3895  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3896  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3897  */
3898 typedef struct LDKCResult_SignDecodeErrorZ {
3899    /**
3900     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3901     * `err` or `result` depending on the state of `result_ok`.
3902     */
3903    union LDKCResult_SignDecodeErrorZPtr contents;
3904    /**
3905     * Whether this CResult_SignDecodeErrorZ represents a success state.
3906     */
3907    bool result_ok;
3908 } LDKCResult_SignDecodeErrorZ;
3909
3910 /**
3911  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3912  * allows recovering the exact public key which created the signature given the message.
3913  */
3914 typedef struct LDKRecoverableSignature {
3915    /**
3916     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3917     * recovery.
3918     */
3919    uint8_t serialized_form[68];
3920 } LDKRecoverableSignature;
3921
3922 /**
3923  * The contents of CResult_RecoverableSignatureNoneZ
3924  */
3925 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3926    /**
3927     * A pointer to the contents in the success state.
3928     * Reading from this pointer when `result_ok` is not set is undefined.
3929     */
3930    struct LDKRecoverableSignature *result;
3931    /**
3932     * Note that this value is always NULL, as there are no contents in the Err variant
3933     */
3934    void *err;
3935 } LDKCResult_RecoverableSignatureNoneZPtr;
3936
3937 /**
3938  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3939  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3941  */
3942 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3943    /**
3944     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3945     * `err` or `result` depending on the state of `result_ok`.
3946     */
3947    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3948    /**
3949     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3950     */
3951    bool result_ok;
3952 } LDKCResult_RecoverableSignatureNoneZ;
3953
3954 /**
3955  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3956  * This corresponds to std::vector in C++
3957  */
3958 typedef struct LDKCVec_CVec_u8ZZ {
3959    /**
3960     * The elements in the array.
3961     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3962     */
3963    struct LDKCVec_u8Z *data;
3964    /**
3965     * The number of elements pointed to by `data`.
3966     */
3967    uintptr_t datalen;
3968 } LDKCVec_CVec_u8ZZ;
3969
3970 /**
3971  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3972  */
3973 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3974    /**
3975     * A pointer to the contents in the success state.
3976     * Reading from this pointer when `result_ok` is not set is undefined.
3977     */
3978    struct LDKCVec_CVec_u8ZZ *result;
3979    /**
3980     * Note that this value is always NULL, as there are no contents in the Err variant
3981     */
3982    void *err;
3983 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3984
3985 /**
3986  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3987  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3988  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3989  */
3990 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3991    /**
3992     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3993     * `err` or `result` depending on the state of `result_ok`.
3994     */
3995    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3996    /**
3997     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3998     */
3999    bool result_ok;
4000 } LDKCResult_CVec_CVec_u8ZZNoneZ;
4001
4002
4003
4004 /**
4005  * A simple implementation of Sign that just keeps the private keys in memory.
4006  *
4007  * This implementation performs no policy checks and is insufficient by itself as
4008  * a secure external signer.
4009  */
4010 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
4011    /**
4012     * A pointer to the opaque Rust object.
4013     * Nearly everywhere, inner must be non-null, however in places where
4014     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4015     */
4016    LDKnativeInMemorySigner *inner;
4017    /**
4018     * Indicates that this is the only struct which contains the same pointer.
4019     * Rust functions which take ownership of an object provided via an argument require
4020     * this to be true and invalidate the object pointed to by inner.
4021     */
4022    bool is_owned;
4023 } LDKInMemorySigner;
4024
4025 /**
4026  * The contents of CResult_InMemorySignerDecodeErrorZ
4027  */
4028 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
4029    /**
4030     * A pointer to the contents in the success state.
4031     * Reading from this pointer when `result_ok` is not set is undefined.
4032     */
4033    struct LDKInMemorySigner *result;
4034    /**
4035     * A pointer to the contents in the error state.
4036     * Reading from this pointer when `result_ok` is set is undefined.
4037     */
4038    struct LDKDecodeError *err;
4039 } LDKCResult_InMemorySignerDecodeErrorZPtr;
4040
4041 /**
4042  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4043  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4044  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4045  */
4046 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
4047    /**
4048     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4049     * `err` or `result` depending on the state of `result_ok`.
4050     */
4051    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
4052    /**
4053     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4054     */
4055    bool result_ok;
4056 } LDKCResult_InMemorySignerDecodeErrorZ;
4057
4058 /**
4059  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4060  * This corresponds to std::vector in C++
4061  */
4062 typedef struct LDKCVec_TxOutZ {
4063    /**
4064     * The elements in the array.
4065     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4066     */
4067    struct LDKTxOut *data;
4068    /**
4069     * The number of elements pointed to by `data`.
4070     */
4071    uintptr_t datalen;
4072 } LDKCVec_TxOutZ;
4073
4074 /**
4075  * The contents of CResult_TransactionNoneZ
4076  */
4077 typedef union LDKCResult_TransactionNoneZPtr {
4078    /**
4079     * A pointer to the contents in the success state.
4080     * Reading from this pointer when `result_ok` is not set is undefined.
4081     */
4082    struct LDKTransaction *result;
4083    /**
4084     * Note that this value is always NULL, as there are no contents in the Err variant
4085     */
4086    void *err;
4087 } LDKCResult_TransactionNoneZPtr;
4088
4089 /**
4090  * A CResult_TransactionNoneZ represents the result of a fallible operation,
4091  * containing a crate::c_types::Transaction on success and a () on failure.
4092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4093  */
4094 typedef struct LDKCResult_TransactionNoneZ {
4095    /**
4096     * The contents of this CResult_TransactionNoneZ, accessible via either
4097     * `err` or `result` depending on the state of `result_ok`.
4098     */
4099    union LDKCResult_TransactionNoneZPtr contents;
4100    /**
4101     * Whether this CResult_TransactionNoneZ represents a success state.
4102     */
4103    bool result_ok;
4104 } LDKCResult_TransactionNoneZ;
4105
4106
4107
4108 /**
4109  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
4110  * on-chain transactions to ensure no loss of funds occurs.
4111  *
4112  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
4113  * information and are actively monitoring the chain.
4114  *
4115  * Pending Events or updated HTLCs which have not yet been read out by
4116  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
4117  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
4118  * gotten are fully handled before re-serializing the new state.
4119  *
4120  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
4121  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4122  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
4123  * returned block hash and the the current chain and then reconnecting blocks to get to the
4124  * best chain) upon deserializing the object!
4125  */
4126 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
4127    /**
4128     * A pointer to the opaque Rust object.
4129     * Nearly everywhere, inner must be non-null, however in places where
4130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4131     */
4132    LDKnativeChannelMonitor *inner;
4133    /**
4134     * Indicates that this is the only struct which contains the same pointer.
4135     * Rust functions which take ownership of an object provided via an argument require
4136     * this to be true and invalidate the object pointed to by inner.
4137     */
4138    bool is_owned;
4139 } LDKChannelMonitor;
4140
4141 /**
4142  * A tuple of 2 elements. See the individual fields for the types contained.
4143  */
4144 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
4145    /**
4146     * The element at position 0
4147     */
4148    struct LDKThirtyTwoBytes a;
4149    /**
4150     * The element at position 1
4151     */
4152    struct LDKChannelMonitor b;
4153 } LDKC2Tuple_BlockHashChannelMonitorZ;
4154
4155 /**
4156  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4157  * This corresponds to std::vector in C++
4158  */
4159 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
4160    /**
4161     * The elements in the array.
4162     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4163     */
4164    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
4165    /**
4166     * The number of elements pointed to by `data`.
4167     */
4168    uintptr_t datalen;
4169 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
4170
4171 /**
4172  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4173  */
4174 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4175    /**
4176     * A pointer to the contents in the success state.
4177     * Reading from this pointer when `result_ok` is not set is undefined.
4178     */
4179    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
4180    /**
4181     * A pointer to the contents in the error state.
4182     * Reading from this pointer when `result_ok` is set is undefined.
4183     */
4184    enum LDKIOError *err;
4185 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
4186
4187 /**
4188  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4189  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4190  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4191  */
4192 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4193    /**
4194     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4195     * `err` or `result` depending on the state of `result_ok`.
4196     */
4197    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
4198    /**
4199     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4200     */
4201    bool result_ok;
4202 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
4203
4204 /**
4205  * An enum which can either contain a u16 or not
4206  */
4207 typedef enum LDKCOption_u16Z_Tag {
4208    /**
4209     * When we're in this state, this COption_u16Z contains a u16
4210     */
4211    LDKCOption_u16Z_Some,
4212    /**
4213     * When we're in this state, this COption_u16Z contains nothing
4214     */
4215    LDKCOption_u16Z_None,
4216    /**
4217     * Must be last for serialization purposes
4218     */
4219    LDKCOption_u16Z_Sentinel,
4220 } LDKCOption_u16Z_Tag;
4221
4222 typedef struct LDKCOption_u16Z {
4223    LDKCOption_u16Z_Tag tag;
4224    union {
4225       struct {
4226          uint16_t some;
4227       };
4228    };
4229 } LDKCOption_u16Z;
4230
4231 /**
4232  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
4233  * too-high values)
4234  */
4235 typedef enum LDKAPIError_Tag {
4236    /**
4237     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
4238     * are documented, but generally indicates some precondition of a function was violated.
4239     */
4240    LDKAPIError_APIMisuseError,
4241    /**
4242     * Due to a high feerate, we were unable to complete the request.
4243     * For example, this may be returned if the feerate implies we cannot open a channel at the
4244     * requested value, but opening a larger channel would succeed.
4245     */
4246    LDKAPIError_FeeRateTooHigh,
4247    /**
4248     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
4249     * too-many-hops, etc).
4250     */
4251    LDKAPIError_RouteError,
4252    /**
4253     * We were unable to complete the request as the Channel required to do so is unable to
4254     * complete the request (or was not found). This can take many forms, including disconnected
4255     * peer, channel at capacity, channel shutting down, etc.
4256     */
4257    LDKAPIError_ChannelUnavailable,
4258    /**
4259     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4260     * attempted action to fail.
4261     */
4262    LDKAPIError_MonitorUpdateFailed,
4263    /**
4264     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
4265     * with the channel counterparty as negotiated in [`InitFeatures`].
4266     *
4267     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
4268     * a channel or cooperatively close one with this peer (and will have to force-close instead).
4269     *
4270     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
4271     * [`InitFeatures`]: crate::ln::features::InitFeatures
4272     */
4273    LDKAPIError_IncompatibleShutdownScript,
4274    /**
4275     * Must be last for serialization purposes
4276     */
4277    LDKAPIError_Sentinel,
4278 } LDKAPIError_Tag;
4279
4280 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4281    /**
4282     * A human-readable error message
4283     */
4284    struct LDKStr err;
4285 } LDKAPIError_LDKAPIMisuseError_Body;
4286
4287 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4288    /**
4289     * A human-readable error message
4290     */
4291    struct LDKStr err;
4292    /**
4293     * The feerate which was too high.
4294     */
4295    uint32_t feerate;
4296 } LDKAPIError_LDKFeeRateTooHigh_Body;
4297
4298 typedef struct LDKAPIError_LDKRouteError_Body {
4299    /**
4300     * A human-readable error message
4301     */
4302    struct LDKStr err;
4303 } LDKAPIError_LDKRouteError_Body;
4304
4305 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4306    /**
4307     * A human-readable error message
4308     */
4309    struct LDKStr err;
4310 } LDKAPIError_LDKChannelUnavailable_Body;
4311
4312 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
4313    /**
4314     * The incompatible shutdown script.
4315     */
4316    struct LDKShutdownScript script;
4317 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
4318
4319 typedef struct MUST_USE_STRUCT LDKAPIError {
4320    LDKAPIError_Tag tag;
4321    union {
4322       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
4323       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
4324       LDKAPIError_LDKRouteError_Body route_error;
4325       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
4326       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
4327    };
4328 } LDKAPIError;
4329
4330 /**
4331  * The contents of CResult_NoneAPIErrorZ
4332  */
4333 typedef union LDKCResult_NoneAPIErrorZPtr {
4334    /**
4335     * Note that this value is always NULL, as there are no contents in the OK variant
4336     */
4337    void *result;
4338    /**
4339     * A pointer to the contents in the error state.
4340     * Reading from this pointer when `result_ok` is set is undefined.
4341     */
4342    struct LDKAPIError *err;
4343 } LDKCResult_NoneAPIErrorZPtr;
4344
4345 /**
4346  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4347  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
4348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4349  */
4350 typedef struct LDKCResult_NoneAPIErrorZ {
4351    /**
4352     * The contents of this CResult_NoneAPIErrorZ, accessible via either
4353     * `err` or `result` depending on the state of `result_ok`.
4354     */
4355    union LDKCResult_NoneAPIErrorZPtr contents;
4356    /**
4357     * Whether this CResult_NoneAPIErrorZ represents a success state.
4358     */
4359    bool result_ok;
4360 } LDKCResult_NoneAPIErrorZ;
4361
4362 /**
4363  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4364  * This corresponds to std::vector in C++
4365  */
4366 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
4367    /**
4368     * The elements in the array.
4369     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4370     */
4371    struct LDKCResult_NoneAPIErrorZ *data;
4372    /**
4373     * The number of elements pointed to by `data`.
4374     */
4375    uintptr_t datalen;
4376 } LDKCVec_CResult_NoneAPIErrorZZ;
4377
4378 /**
4379  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4380  * This corresponds to std::vector in C++
4381  */
4382 typedef struct LDKCVec_APIErrorZ {
4383    /**
4384     * The elements in the array.
4385     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4386     */
4387    struct LDKAPIError *data;
4388    /**
4389     * The number of elements pointed to by `data`.
4390     */
4391    uintptr_t datalen;
4392 } LDKCVec_APIErrorZ;
4393
4394 /**
4395  * The contents of CResult__u832APIErrorZ
4396  */
4397 typedef union LDKCResult__u832APIErrorZPtr {
4398    /**
4399     * A pointer to the contents in the success state.
4400     * Reading from this pointer when `result_ok` is not set is undefined.
4401     */
4402    struct LDKThirtyTwoBytes *result;
4403    /**
4404     * A pointer to the contents in the error state.
4405     * Reading from this pointer when `result_ok` is set is undefined.
4406     */
4407    struct LDKAPIError *err;
4408 } LDKCResult__u832APIErrorZPtr;
4409
4410 /**
4411  * A CResult__u832APIErrorZ represents the result of a fallible operation,
4412  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4413  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4414  */
4415 typedef struct LDKCResult__u832APIErrorZ {
4416    /**
4417     * The contents of this CResult__u832APIErrorZ, accessible via either
4418     * `err` or `result` depending on the state of `result_ok`.
4419     */
4420    union LDKCResult__u832APIErrorZPtr contents;
4421    /**
4422     * Whether this CResult__u832APIErrorZ represents a success state.
4423     */
4424    bool result_ok;
4425 } LDKCResult__u832APIErrorZ;
4426
4427 /**
4428  * If a payment fails to send, it can be in one of several states. This enum is returned as the
4429  * Err() type describing which state the payment is in, see the description of individual enum
4430  * states for more.
4431  */
4432 typedef enum LDKPaymentSendFailure_Tag {
4433    /**
4434     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
4435     * send the payment at all. No channel state has been changed or messages sent to peers, and
4436     * once you've changed the parameter at error, you can freely retry the payment in full.
4437     */
4438    LDKPaymentSendFailure_ParameterError,
4439    /**
4440     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4441     * from attempting to send the payment at all. No channel state has been changed or messages
4442     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4443     * payment in full.
4444     *
4445     * The results here are ordered the same as the paths in the route object which was passed to
4446     * send_payment.
4447     */
4448    LDKPaymentSendFailure_PathParameterError,
4449    /**
4450     * All paths which were attempted failed to send, with no channel state change taking place.
4451     * You can freely retry the payment in full (though you probably want to do so over different
4452     * paths than the ones selected).
4453     */
4454    LDKPaymentSendFailure_AllFailedRetrySafe,
4455    /**
4456     * Some paths which were attempted failed to send, though possibly not all. At least some
4457     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4458     * in over-/re-payment.
4459     *
4460     * The results here are ordered the same as the paths in the route object which was passed to
4461     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4462     * retried (though there is currently no API with which to do so).
4463     *
4464     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4465     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4466     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4467     * with the latest update_id.
4468     */
4469    LDKPaymentSendFailure_PartialFailure,
4470    /**
4471     * Must be last for serialization purposes
4472     */
4473    LDKPaymentSendFailure_Sentinel,
4474 } LDKPaymentSendFailure_Tag;
4475
4476 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
4477    /**
4478     * The errors themselves, in the same order as the route hops.
4479     */
4480    struct LDKCVec_CResult_NoneAPIErrorZZ results;
4481    /**
4482     * If some paths failed without irrevocably committing to the new HTLC(s), this will
4483     * contain a [`RouteParameters`] object which can be used to calculate a new route that
4484     * will pay all remaining unpaid balance.
4485     *
4486     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4487     */
4488    struct LDKRouteParameters failed_paths_retry;
4489    /**
4490     * The payment id for the payment, which is now at least partially pending.
4491     */
4492    struct LDKThirtyTwoBytes payment_id;
4493 } LDKPaymentSendFailure_LDKPartialFailure_Body;
4494
4495 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4496    LDKPaymentSendFailure_Tag tag;
4497    union {
4498       struct {
4499          struct LDKAPIError parameter_error;
4500       };
4501       struct {
4502          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4503       };
4504       struct {
4505          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4506       };
4507       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
4508    };
4509 } LDKPaymentSendFailure;
4510
4511 /**
4512  * The contents of CResult_PaymentIdPaymentSendFailureZ
4513  */
4514 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
4515    /**
4516     * A pointer to the contents in the success state.
4517     * Reading from this pointer when `result_ok` is not set is undefined.
4518     */
4519    struct LDKThirtyTwoBytes *result;
4520    /**
4521     * A pointer to the contents in the error state.
4522     * Reading from this pointer when `result_ok` is set is undefined.
4523     */
4524    struct LDKPaymentSendFailure *err;
4525 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
4526
4527 /**
4528  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4529  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4530  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4531  */
4532 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
4533    /**
4534     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4535     * `err` or `result` depending on the state of `result_ok`.
4536     */
4537    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
4538    /**
4539     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4540     */
4541    bool result_ok;
4542 } LDKCResult_PaymentIdPaymentSendFailureZ;
4543
4544 /**
4545  * The contents of CResult_NonePaymentSendFailureZ
4546  */
4547 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4548    /**
4549     * Note that this value is always NULL, as there are no contents in the OK variant
4550     */
4551    void *result;
4552    /**
4553     * A pointer to the contents in the error state.
4554     * Reading from this pointer when `result_ok` is set is undefined.
4555     */
4556    struct LDKPaymentSendFailure *err;
4557 } LDKCResult_NonePaymentSendFailureZPtr;
4558
4559 /**
4560  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4561  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4562  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4563  */
4564 typedef struct LDKCResult_NonePaymentSendFailureZ {
4565    /**
4566     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4567     * `err` or `result` depending on the state of `result_ok`.
4568     */
4569    union LDKCResult_NonePaymentSendFailureZPtr contents;
4570    /**
4571     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4572     */
4573    bool result_ok;
4574 } LDKCResult_NonePaymentSendFailureZ;
4575
4576 /**
4577  * A tuple of 2 elements. See the individual fields for the types contained.
4578  */
4579 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
4580    /**
4581     * The element at position 0
4582     */
4583    struct LDKThirtyTwoBytes a;
4584    /**
4585     * The element at position 1
4586     */
4587    struct LDKThirtyTwoBytes b;
4588 } LDKC2Tuple_PaymentHashPaymentIdZ;
4589
4590 /**
4591  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
4592  */
4593 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4594    /**
4595     * A pointer to the contents in the success state.
4596     * Reading from this pointer when `result_ok` is not set is undefined.
4597     */
4598    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
4599    /**
4600     * A pointer to the contents in the error state.
4601     * Reading from this pointer when `result_ok` is set is undefined.
4602     */
4603    struct LDKPaymentSendFailure *err;
4604 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
4605
4606 /**
4607  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
4608  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4609  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4610  */
4611 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4612    /**
4613     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
4614     * `err` or `result` depending on the state of `result_ok`.
4615     */
4616    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
4617    /**
4618     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
4619     */
4620    bool result_ok;
4621 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
4622
4623 /**
4624  * A 4-byte byte array.
4625  */
4626 typedef struct LDKFourBytes {
4627    /**
4628     * The four bytes
4629     */
4630    uint8_t data[4];
4631 } LDKFourBytes;
4632
4633 /**
4634  * A 16-byte byte array.
4635  */
4636 typedef struct LDKSixteenBytes {
4637    /**
4638     * The sixteen bytes
4639     */
4640    uint8_t data[16];
4641 } LDKSixteenBytes;
4642
4643 /**
4644  * A 10-byte byte array.
4645  */
4646 typedef struct LDKTenBytes {
4647    /**
4648     * The ten bytes
4649     */
4650    uint8_t data[10];
4651 } LDKTenBytes;
4652
4653 /**
4654  * An address which can be used to connect to a remote peer
4655  */
4656 typedef enum LDKNetAddress_Tag {
4657    /**
4658     * An IPv4 address/port on which the peer is listening.
4659     */
4660    LDKNetAddress_IPv4,
4661    /**
4662     * An IPv6 address/port on which the peer is listening.
4663     */
4664    LDKNetAddress_IPv6,
4665    /**
4666     * An old-style Tor onion address/port on which the peer is listening.
4667     */
4668    LDKNetAddress_OnionV2,
4669    /**
4670     * A new-style Tor onion address/port on which the peer is listening.
4671     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4672     * wrap as base32 and append \".onion\".
4673     */
4674    LDKNetAddress_OnionV3,
4675    /**
4676     * Must be last for serialization purposes
4677     */
4678    LDKNetAddress_Sentinel,
4679 } LDKNetAddress_Tag;
4680
4681 typedef struct LDKNetAddress_LDKIPv4_Body {
4682    /**
4683     * The 4-byte IPv4 address
4684     */
4685    struct LDKFourBytes addr;
4686    /**
4687     * The port on which the node is listening
4688     */
4689    uint16_t port;
4690 } LDKNetAddress_LDKIPv4_Body;
4691
4692 typedef struct LDKNetAddress_LDKIPv6_Body {
4693    /**
4694     * The 16-byte IPv6 address
4695     */
4696    struct LDKSixteenBytes addr;
4697    /**
4698     * The port on which the node is listening
4699     */
4700    uint16_t port;
4701 } LDKNetAddress_LDKIPv6_Body;
4702
4703 typedef struct LDKNetAddress_LDKOnionV2_Body {
4704    /**
4705     * The bytes (usually encoded in base32 with \".onion\" appended)
4706     */
4707    struct LDKTenBytes addr;
4708    /**
4709     * The port on which the node is listening
4710     */
4711    uint16_t port;
4712 } LDKNetAddress_LDKOnionV2_Body;
4713
4714 typedef struct LDKNetAddress_LDKOnionV3_Body {
4715    /**
4716     * The ed25519 long-term public key of the peer
4717     */
4718    struct LDKThirtyTwoBytes ed25519_pubkey;
4719    /**
4720     * The checksum of the pubkey and version, as included in the onion address
4721     */
4722    uint16_t checksum;
4723    /**
4724     * The version byte, as defined by the Tor Onion v3 spec.
4725     */
4726    uint8_t version;
4727    /**
4728     * The port on which the node is listening
4729     */
4730    uint16_t port;
4731 } LDKNetAddress_LDKOnionV3_Body;
4732
4733 typedef struct MUST_USE_STRUCT LDKNetAddress {
4734    LDKNetAddress_Tag tag;
4735    union {
4736       LDKNetAddress_LDKIPv4_Body i_pv4;
4737       LDKNetAddress_LDKIPv6_Body i_pv6;
4738       LDKNetAddress_LDKOnionV2_Body onion_v2;
4739       LDKNetAddress_LDKOnionV3_Body onion_v3;
4740    };
4741 } LDKNetAddress;
4742
4743 /**
4744  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4745  * This corresponds to std::vector in C++
4746  */
4747 typedef struct LDKCVec_NetAddressZ {
4748    /**
4749     * The elements in the array.
4750     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4751     */
4752    struct LDKNetAddress *data;
4753    /**
4754     * The number of elements pointed to by `data`.
4755     */
4756    uintptr_t datalen;
4757 } LDKCVec_NetAddressZ;
4758
4759 /**
4760  * A tuple of 2 elements. See the individual fields for the types contained.
4761  */
4762 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4763    /**
4764     * The element at position 0
4765     */
4766    struct LDKThirtyTwoBytes a;
4767    /**
4768     * The element at position 1
4769     */
4770    struct LDKThirtyTwoBytes b;
4771 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4772
4773 /**
4774  * The contents of CResult_PaymentSecretAPIErrorZ
4775  */
4776 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4777    /**
4778     * A pointer to the contents in the success state.
4779     * Reading from this pointer when `result_ok` is not set is undefined.
4780     */
4781    struct LDKThirtyTwoBytes *result;
4782    /**
4783     * A pointer to the contents in the error state.
4784     * Reading from this pointer when `result_ok` is set is undefined.
4785     */
4786    struct LDKAPIError *err;
4787 } LDKCResult_PaymentSecretAPIErrorZPtr;
4788
4789 /**
4790  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4791  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4793  */
4794 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4795    /**
4796     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4797     * `err` or `result` depending on the state of `result_ok`.
4798     */
4799    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4800    /**
4801     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4802     */
4803    bool result_ok;
4804 } LDKCResult_PaymentSecretAPIErrorZ;
4805
4806 /**
4807  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4808  * This corresponds to std::vector in C++
4809  */
4810 typedef struct LDKCVec_ChannelMonitorZ {
4811    /**
4812     * The elements in the array.
4813     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4814     */
4815    struct LDKChannelMonitor *data;
4816    /**
4817     * The number of elements pointed to by `data`.
4818     */
4819    uintptr_t datalen;
4820 } LDKCVec_ChannelMonitorZ;
4821
4822
4823
4824 /**
4825  * An update generated by the underlying Channel itself which contains some new information the
4826  * ChannelMonitor should be made aware of.
4827  */
4828 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4829    /**
4830     * A pointer to the opaque Rust object.
4831     * Nearly everywhere, inner must be non-null, however in places where
4832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4833     */
4834    LDKnativeChannelMonitorUpdate *inner;
4835    /**
4836     * Indicates that this is the only struct which contains the same pointer.
4837     * Rust functions which take ownership of an object provided via an argument require
4838     * this to be true and invalidate the object pointed to by inner.
4839     */
4840    bool is_owned;
4841 } LDKChannelMonitorUpdate;
4842
4843 /**
4844  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4845  * blocks are connected and disconnected.
4846  *
4847  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4848  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4849  * channel state changes and HTLCs are resolved. See method documentation for specific
4850  * requirements.
4851  *
4852  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4853  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4854  * without taking any further action such as persisting the current state.
4855  *
4856  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4857  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4858  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4859  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4860  * multiple instances.
4861  *
4862  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
4863  */
4864 typedef struct LDKWatch {
4865    /**
4866     * An opaque pointer which is passed to your function implementations as an argument.
4867     * This has no meaning in the LDK, and can be NULL or any other value.
4868     */
4869    void *this_arg;
4870    /**
4871     * Watches a channel identified by `funding_txo` using `monitor`.
4872     *
4873     * Implementations are responsible for watching the chain for the funding transaction along
4874     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4875     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4876     *
4877     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
4878     * the given `funding_txo` has previously been registered via `watch_channel`.
4879     *
4880     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4881     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4882     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4883     */
4884    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4885    /**
4886     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4887     *
4888     * Implementations must call [`update_monitor`] with the given update. See
4889     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4890     *
4891     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4892     */
4893    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4894    /**
4895     * Returns any monitor events since the last call. Subsequent calls must only return new
4896     * events.
4897     *
4898     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
4899     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
4900     * to disk.
4901     *
4902     * For details on asynchronous [`ChannelMonitor`] updating and returning
4903     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
4904     */
4905    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4906    /**
4907     * Frees any resources associated with this object given its this_arg pointer.
4908     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4909     */
4910    void (*free)(void *this_arg);
4911 } LDKWatch;
4912
4913 /**
4914  * An interface to send a transaction to the Bitcoin network.
4915  */
4916 typedef struct LDKBroadcasterInterface {
4917    /**
4918     * An opaque pointer which is passed to your function implementations as an argument.
4919     * This has no meaning in the LDK, and can be NULL or any other value.
4920     */
4921    void *this_arg;
4922    /**
4923     * Sends a transaction out to (hopefully) be mined.
4924     */
4925    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4926    /**
4927     * Frees any resources associated with this object given its this_arg pointer.
4928     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4929     */
4930    void (*free)(void *this_arg);
4931 } LDKBroadcasterInterface;
4932
4933 /**
4934  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4935  * own the memory pointed to by data.
4936  */
4937 typedef struct LDKu8slice {
4938    /**
4939     * A pointer to the byte buffer
4940     */
4941    const uint8_t *data;
4942    /**
4943     * The number of bytes pointed to by `data`.
4944     */
4945    uintptr_t datalen;
4946 } LDKu8slice;
4947
4948 /**
4949  * A trait to describe an object which can get user secrets and key material.
4950  */
4951 typedef struct LDKKeysInterface {
4952    /**
4953     * An opaque pointer which is passed to your function implementations as an argument.
4954     * This has no meaning in the LDK, and can be NULL or any other value.
4955     */
4956    void *this_arg;
4957    /**
4958     * Get node secret key (aka node_id or network_key).
4959     *
4960     * This method must return the same value each time it is called.
4961     */
4962    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4963    /**
4964     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4965     *
4966     * This method should return a different value each time it is called, to avoid linking
4967     * on-chain funds across channels as controlled to the same user.
4968     */
4969    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4970    /**
4971     * Get a script pubkey which we will send funds to when closing a channel.
4972     *
4973     * This method should return a different value each time it is called, to avoid linking
4974     * on-chain funds across channels as controlled to the same user.
4975     */
4976    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
4977    /**
4978     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4979     * restarted with some stale data!
4980     *
4981     * This method must return a different value each time it is called.
4982     */
4983    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4984    /**
4985     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4986     * onion packets and for temporary channel IDs. There is no requirement that these be
4987     * persisted anywhere, though they must be unique across restarts.
4988     *
4989     * This method must return a different value each time it is called.
4990     */
4991    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4992    /**
4993     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4994     * This is only called during deserialization of other objects which contain
4995     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4996     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4997     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4998     * you've read all of the provided bytes to ensure no corruption occurred.
4999     */
5000    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
5001    /**
5002     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
5003     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
5004     * this trait to parse the invoice and make sure they're signing what they expect, rather than
5005     * blindly signing the hash.
5006     */
5007    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
5008    /**
5009     * Frees any resources associated with this object given its this_arg pointer.
5010     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5011     */
5012    void (*free)(void *this_arg);
5013 } LDKKeysInterface;
5014
5015 /**
5016  * A trait which should be implemented to provide feerate information on a number of time
5017  * horizons.
5018  *
5019  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
5020  * called from inside the library in response to chain events, P2P events, or timer events).
5021  */
5022 typedef struct LDKFeeEstimator {
5023    /**
5024     * An opaque pointer which is passed to your function implementations as an argument.
5025     * This has no meaning in the LDK, and can be NULL or any other value.
5026     */
5027    void *this_arg;
5028    /**
5029     * Gets estimated satoshis of fee required per 1000 Weight-Units.
5030     *
5031     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
5032     * don't put us below 1 satoshi-per-byte).
5033     *
5034     * This translates to:
5035     *  * satoshis-per-byte * 250
5036     *  * ceil(satoshis-per-kbyte / 4)
5037     */
5038    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
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 } LDKFeeEstimator;
5045
5046 /**
5047  * A trait encapsulating the operations required of a logger
5048  */
5049 typedef struct LDKLogger {
5050    /**
5051     * An opaque pointer which is passed to your function implementations as an argument.
5052     * This has no meaning in the LDK, and can be NULL or any other value.
5053     */
5054    void *this_arg;
5055    /**
5056     * Logs the `Record`
5057     */
5058    void (*log)(const void *this_arg, const char *record);
5059    /**
5060     * Frees any resources associated with this object given its this_arg pointer.
5061     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5062     */
5063    void (*free)(void *this_arg);
5064 } LDKLogger;
5065
5066
5067
5068 /**
5069  * Manager which keeps track of a number of channels and sends messages to the appropriate
5070  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
5071  *
5072  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
5073  * to individual Channels.
5074  *
5075  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
5076  * all peers during write/read (though does not modify this instance, only the instance being
5077  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
5078  * called funding_transaction_generated for outbound channels).
5079  *
5080  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
5081  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
5082  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
5083  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
5084  * the serialization process). If the deserialized version is out-of-date compared to the
5085  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
5086  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
5087  *
5088  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
5089  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5090  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
5091  * block_connected() to step towards your best block) upon deserialization before using the
5092  * object!
5093  *
5094  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
5095  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
5096  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
5097  * offline for a full minute. In order to track this, you must call
5098  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
5099  *
5100  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
5101  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
5102  * essentially you should default to using a SimpleRefChannelManager, and use a
5103  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
5104  * you're using lightning-net-tokio.
5105  */
5106 typedef struct MUST_USE_STRUCT LDKChannelManager {
5107    /**
5108     * A pointer to the opaque Rust object.
5109     * Nearly everywhere, inner must be non-null, however in places where
5110     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5111     */
5112    LDKnativeChannelManager *inner;
5113    /**
5114     * Indicates that this is the only struct which contains the same pointer.
5115     * Rust functions which take ownership of an object provided via an argument require
5116     * this to be true and invalidate the object pointed to by inner.
5117     */
5118    bool is_owned;
5119 } LDKChannelManager;
5120
5121 /**
5122  * A tuple of 2 elements. See the individual fields for the types contained.
5123  */
5124 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
5125    /**
5126     * The element at position 0
5127     */
5128    struct LDKThirtyTwoBytes a;
5129    /**
5130     * The element at position 1
5131     */
5132    struct LDKChannelManager b;
5133 } LDKC2Tuple_BlockHashChannelManagerZ;
5134
5135 /**
5136  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5137  */
5138 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5139    /**
5140     * A pointer to the contents in the success state.
5141     * Reading from this pointer when `result_ok` is not set is undefined.
5142     */
5143    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
5144    /**
5145     * A pointer to the contents in the error state.
5146     * Reading from this pointer when `result_ok` is set is undefined.
5147     */
5148    struct LDKDecodeError *err;
5149 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
5150
5151 /**
5152  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5153  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5155  */
5156 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5157    /**
5158     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5159     * `err` or `result` depending on the state of `result_ok`.
5160     */
5161    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
5162    /**
5163     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5164     */
5165    bool result_ok;
5166 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
5167
5168
5169
5170 /**
5171  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
5172  * with our counterparty.
5173  */
5174 typedef struct MUST_USE_STRUCT LDKChannelConfig {
5175    /**
5176     * A pointer to the opaque Rust object.
5177     * Nearly everywhere, inner must be non-null, however in places where
5178     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5179     */
5180    LDKnativeChannelConfig *inner;
5181    /**
5182     * Indicates that this is the only struct which contains the same pointer.
5183     * Rust functions which take ownership of an object provided via an argument require
5184     * this to be true and invalidate the object pointed to by inner.
5185     */
5186    bool is_owned;
5187 } LDKChannelConfig;
5188
5189 /**
5190  * The contents of CResult_ChannelConfigDecodeErrorZ
5191  */
5192 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
5193    /**
5194     * A pointer to the contents in the success state.
5195     * Reading from this pointer when `result_ok` is not set is undefined.
5196     */
5197    struct LDKChannelConfig *result;
5198    /**
5199     * A pointer to the contents in the error state.
5200     * Reading from this pointer when `result_ok` is set is undefined.
5201     */
5202    struct LDKDecodeError *err;
5203 } LDKCResult_ChannelConfigDecodeErrorZPtr;
5204
5205 /**
5206  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5207  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5208  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5209  */
5210 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
5211    /**
5212     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5213     * `err` or `result` depending on the state of `result_ok`.
5214     */
5215    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
5216    /**
5217     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5218     */
5219    bool result_ok;
5220 } LDKCResult_ChannelConfigDecodeErrorZ;
5221
5222 /**
5223  * The contents of CResult_OutPointDecodeErrorZ
5224  */
5225 typedef union LDKCResult_OutPointDecodeErrorZPtr {
5226    /**
5227     * A pointer to the contents in the success state.
5228     * Reading from this pointer when `result_ok` is not set is undefined.
5229     */
5230    struct LDKOutPoint *result;
5231    /**
5232     * A pointer to the contents in the error state.
5233     * Reading from this pointer when `result_ok` is set is undefined.
5234     */
5235    struct LDKDecodeError *err;
5236 } LDKCResult_OutPointDecodeErrorZPtr;
5237
5238 /**
5239  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5240  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5241  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5242  */
5243 typedef struct LDKCResult_OutPointDecodeErrorZ {
5244    /**
5245     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5246     * `err` or `result` depending on the state of `result_ok`.
5247     */
5248    union LDKCResult_OutPointDecodeErrorZPtr contents;
5249    /**
5250     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
5251     */
5252    bool result_ok;
5253 } LDKCResult_OutPointDecodeErrorZ;
5254
5255 /**
5256  * Defines a type identifier for sending messages over the wire.
5257  *
5258  * Messages implementing this trait specify a type and must be [`Writeable`].
5259  */
5260 typedef struct LDKType {
5261    /**
5262     * An opaque pointer which is passed to your function implementations as an argument.
5263     * This has no meaning in the LDK, and can be NULL or any other value.
5264     */
5265    void *this_arg;
5266    /**
5267     * Returns the type identifying the message payload.
5268     */
5269    uint16_t (*type_id)(const void *this_arg);
5270    /**
5271     * Return a human-readable "debug" string describing this object
5272     */
5273    struct LDKStr (*debug_str)(const void *this_arg);
5274    /**
5275     * Serialize the object into a byte array
5276     */
5277    struct LDKCVec_u8Z (*write)(const void *this_arg);
5278    /**
5279     * Frees any resources associated with this object given its this_arg pointer.
5280     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5281     */
5282    void (*free)(void *this_arg);
5283 } LDKType;
5284
5285 /**
5286  * An enum which can either contain a crate::lightning::ln::wire::Type or not
5287  */
5288 typedef enum LDKCOption_TypeZ_Tag {
5289    /**
5290     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5291     */
5292    LDKCOption_TypeZ_Some,
5293    /**
5294     * When we're in this state, this COption_TypeZ contains nothing
5295     */
5296    LDKCOption_TypeZ_None,
5297    /**
5298     * Must be last for serialization purposes
5299     */
5300    LDKCOption_TypeZ_Sentinel,
5301 } LDKCOption_TypeZ_Tag;
5302
5303 typedef struct LDKCOption_TypeZ {
5304    LDKCOption_TypeZ_Tag tag;
5305    union {
5306       struct {
5307          struct LDKType some;
5308       };
5309    };
5310 } LDKCOption_TypeZ;
5311
5312 /**
5313  * The contents of CResult_COption_TypeZDecodeErrorZ
5314  */
5315 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
5316    /**
5317     * A pointer to the contents in the success state.
5318     * Reading from this pointer when `result_ok` is not set is undefined.
5319     */
5320    struct LDKCOption_TypeZ *result;
5321    /**
5322     * A pointer to the contents in the error state.
5323     * Reading from this pointer when `result_ok` is set is undefined.
5324     */
5325    struct LDKDecodeError *err;
5326 } LDKCResult_COption_TypeZDecodeErrorZPtr;
5327
5328 /**
5329  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5330  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5331  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5332  */
5333 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
5334    /**
5335     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5336     * `err` or `result` depending on the state of `result_ok`.
5337     */
5338    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
5339    /**
5340     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5341     */
5342    bool result_ok;
5343 } LDKCResult_COption_TypeZDecodeErrorZ;
5344
5345 /**
5346  * An error that may occur when making a payment.
5347  */
5348 typedef enum LDKPaymentError_Tag {
5349    /**
5350     * An error resulting from the provided [`Invoice`] or payment hash.
5351     */
5352    LDKPaymentError_Invoice,
5353    /**
5354     * An error occurring when finding a route.
5355     */
5356    LDKPaymentError_Routing,
5357    /**
5358     * An error occurring when sending a payment.
5359     */
5360    LDKPaymentError_Sending,
5361    /**
5362     * Must be last for serialization purposes
5363     */
5364    LDKPaymentError_Sentinel,
5365 } LDKPaymentError_Tag;
5366
5367 typedef struct MUST_USE_STRUCT LDKPaymentError {
5368    LDKPaymentError_Tag tag;
5369    union {
5370       struct {
5371          struct LDKStr invoice;
5372       };
5373       struct {
5374          struct LDKLightningError routing;
5375       };
5376       struct {
5377          struct LDKPaymentSendFailure sending;
5378       };
5379    };
5380 } LDKPaymentError;
5381
5382 /**
5383  * The contents of CResult_PaymentIdPaymentErrorZ
5384  */
5385 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
5386    /**
5387     * A pointer to the contents in the success state.
5388     * Reading from this pointer when `result_ok` is not set is undefined.
5389     */
5390    struct LDKThirtyTwoBytes *result;
5391    /**
5392     * A pointer to the contents in the error state.
5393     * Reading from this pointer when `result_ok` is set is undefined.
5394     */
5395    struct LDKPaymentError *err;
5396 } LDKCResult_PaymentIdPaymentErrorZPtr;
5397
5398 /**
5399  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5400  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5401  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5402  */
5403 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
5404    /**
5405     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5406     * `err` or `result` depending on the state of `result_ok`.
5407     */
5408    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
5409    /**
5410     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5411     */
5412    bool result_ok;
5413 } LDKCResult_PaymentIdPaymentErrorZ;
5414
5415 /**
5416  * The contents of CResult_SiPrefixNoneZ
5417  */
5418 typedef union LDKCResult_SiPrefixNoneZPtr {
5419    /**
5420     * A pointer to the contents in the success state.
5421     * Reading from this pointer when `result_ok` is not set is undefined.
5422     */
5423    enum LDKSiPrefix *result;
5424    /**
5425     * Note that this value is always NULL, as there are no contents in the Err variant
5426     */
5427    void *err;
5428 } LDKCResult_SiPrefixNoneZPtr;
5429
5430 /**
5431  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5432  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5433  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5434  */
5435 typedef struct LDKCResult_SiPrefixNoneZ {
5436    /**
5437     * The contents of this CResult_SiPrefixNoneZ, accessible via either
5438     * `err` or `result` depending on the state of `result_ok`.
5439     */
5440    union LDKCResult_SiPrefixNoneZPtr contents;
5441    /**
5442     * Whether this CResult_SiPrefixNoneZ represents a success state.
5443     */
5444    bool result_ok;
5445 } LDKCResult_SiPrefixNoneZ;
5446
5447
5448
5449 /**
5450  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
5451  *
5452  * There are three ways to construct an `Invoice`:
5453  *  1. using `InvoiceBuilder`
5454  *  2. using `Invoice::from_signed(SignedRawInvoice)`
5455  *  3. using `str::parse::<Invoice>(&str)`
5456  */
5457 typedef struct MUST_USE_STRUCT LDKInvoice {
5458    /**
5459     * A pointer to the opaque Rust object.
5460     * Nearly everywhere, inner must be non-null, however in places where
5461     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5462     */
5463    LDKnativeInvoice *inner;
5464    /**
5465     * Indicates that this is the only struct which contains the same pointer.
5466     * Rust functions which take ownership of an object provided via an argument require
5467     * this to be true and invalidate the object pointed to by inner.
5468     */
5469    bool is_owned;
5470 } LDKInvoice;
5471
5472 /**
5473  * The contents of CResult_InvoiceNoneZ
5474  */
5475 typedef union LDKCResult_InvoiceNoneZPtr {
5476    /**
5477     * A pointer to the contents in the success state.
5478     * Reading from this pointer when `result_ok` is not set is undefined.
5479     */
5480    struct LDKInvoice *result;
5481    /**
5482     * Note that this value is always NULL, as there are no contents in the Err variant
5483     */
5484    void *err;
5485 } LDKCResult_InvoiceNoneZPtr;
5486
5487 /**
5488  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
5489  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
5490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5491  */
5492 typedef struct LDKCResult_InvoiceNoneZ {
5493    /**
5494     * The contents of this CResult_InvoiceNoneZ, accessible via either
5495     * `err` or `result` depending on the state of `result_ok`.
5496     */
5497    union LDKCResult_InvoiceNoneZPtr contents;
5498    /**
5499     * Whether this CResult_InvoiceNoneZ represents a success state.
5500     */
5501    bool result_ok;
5502 } LDKCResult_InvoiceNoneZ;
5503
5504
5505
5506 /**
5507  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
5508  * invalid.
5509  *
5510  * # Invariants
5511  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
5512  */
5513 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
5514    /**
5515     * A pointer to the opaque Rust object.
5516     * Nearly everywhere, inner must be non-null, however in places where
5517     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5518     */
5519    LDKnativeSignedRawInvoice *inner;
5520    /**
5521     * Indicates that this is the only struct which contains the same pointer.
5522     * Rust functions which take ownership of an object provided via an argument require
5523     * this to be true and invalidate the object pointed to by inner.
5524     */
5525    bool is_owned;
5526 } LDKSignedRawInvoice;
5527
5528 /**
5529  * The contents of CResult_SignedRawInvoiceNoneZ
5530  */
5531 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
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    struct LDKSignedRawInvoice *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_SignedRawInvoiceNoneZPtr;
5542
5543 /**
5544  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5545  * containing a crate::lightning_invoice::SignedRawInvoice 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_SignedRawInvoiceNoneZ {
5549    /**
5550     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5551     * `err` or `result` depending on the state of `result_ok`.
5552     */
5553    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
5554    /**
5555     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5556     */
5557    bool result_ok;
5558 } LDKCResult_SignedRawInvoiceNoneZ;
5559
5560
5561
5562 /**
5563  * Represents an syntactically correct Invoice for a payment on the lightning network,
5564  * but without the signature information.
5565  * De- and encoding should not lead to information loss but may lead to different hashes.
5566  *
5567  * For methods without docs see the corresponding methods in `Invoice`.
5568  */
5569 typedef struct MUST_USE_STRUCT LDKRawInvoice {
5570    /**
5571     * A pointer to the opaque Rust object.
5572     * Nearly everywhere, inner must be non-null, however in places where
5573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5574     */
5575    LDKnativeRawInvoice *inner;
5576    /**
5577     * Indicates that this is the only struct which contains the same pointer.
5578     * Rust functions which take ownership of an object provided via an argument require
5579     * this to be true and invalidate the object pointed to by inner.
5580     */
5581    bool is_owned;
5582 } LDKRawInvoice;
5583
5584
5585
5586 /**
5587  * Recoverable signature
5588  */
5589 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
5590    /**
5591     * A pointer to the opaque Rust object.
5592     * Nearly everywhere, inner must be non-null, however in places where
5593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5594     */
5595    LDKnativeInvoiceSignature *inner;
5596    /**
5597     * Indicates that this is the only struct which contains the same pointer.
5598     * Rust functions which take ownership of an object provided via an argument require
5599     * this to be true and invalidate the object pointed to by inner.
5600     */
5601    bool is_owned;
5602 } LDKInvoiceSignature;
5603
5604 /**
5605  * A tuple of 3 elements. See the individual fields for the types contained.
5606  */
5607 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
5608    /**
5609     * The element at position 0
5610     */
5611    struct LDKRawInvoice a;
5612    /**
5613     * The element at position 1
5614     */
5615    struct LDKThirtyTwoBytes b;
5616    /**
5617     * The element at position 2
5618     */
5619    struct LDKInvoiceSignature c;
5620 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
5621
5622
5623
5624 /**
5625  * Payee public key
5626  */
5627 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
5628    /**
5629     * A pointer to the opaque Rust object.
5630     * Nearly everywhere, inner must be non-null, however in places where
5631     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5632     */
5633    LDKnativePayeePubKey *inner;
5634    /**
5635     * Indicates that this is the only struct which contains the same pointer.
5636     * Rust functions which take ownership of an object provided via an argument require
5637     * this to be true and invalidate the object pointed to by inner.
5638     */
5639    bool is_owned;
5640 } LDKPayeePubKey;
5641
5642 /**
5643  * The contents of CResult_PayeePubKeyErrorZ
5644  */
5645 typedef union LDKCResult_PayeePubKeyErrorZPtr {
5646    /**
5647     * A pointer to the contents in the success state.
5648     * Reading from this pointer when `result_ok` is not set is undefined.
5649     */
5650    struct LDKPayeePubKey *result;
5651    /**
5652     * A pointer to the contents in the error state.
5653     * Reading from this pointer when `result_ok` is set is undefined.
5654     */
5655    enum LDKSecp256k1Error *err;
5656 } LDKCResult_PayeePubKeyErrorZPtr;
5657
5658 /**
5659  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5660  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5661  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5662  */
5663 typedef struct LDKCResult_PayeePubKeyErrorZ {
5664    /**
5665     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5666     * `err` or `result` depending on the state of `result_ok`.
5667     */
5668    union LDKCResult_PayeePubKeyErrorZPtr contents;
5669    /**
5670     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
5671     */
5672    bool result_ok;
5673 } LDKCResult_PayeePubKeyErrorZ;
5674
5675
5676
5677 /**
5678  * Private routing information
5679  *
5680  * # Invariants
5681  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
5682  *
5683  */
5684 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
5685    /**
5686     * A pointer to the opaque Rust object.
5687     * Nearly everywhere, inner must be non-null, however in places where
5688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5689     */
5690    LDKnativePrivateRoute *inner;
5691    /**
5692     * Indicates that this is the only struct which contains the same pointer.
5693     * Rust functions which take ownership of an object provided via an argument require
5694     * this to be true and invalidate the object pointed to by inner.
5695     */
5696    bool is_owned;
5697 } LDKPrivateRoute;
5698
5699 /**
5700  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5701  * This corresponds to std::vector in C++
5702  */
5703 typedef struct LDKCVec_PrivateRouteZ {
5704    /**
5705     * The elements in the array.
5706     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5707     */
5708    struct LDKPrivateRoute *data;
5709    /**
5710     * The number of elements pointed to by `data`.
5711     */
5712    uintptr_t datalen;
5713 } LDKCVec_PrivateRouteZ;
5714
5715
5716
5717 /**
5718  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
5719  * timestamp is positive.
5720  *
5721  * # Invariants
5722  * The UNIX timestamp representing the stored time has to be positive and small enough so that
5723  * a `EpiryTime` can be added to it without an overflow.
5724  */
5725 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
5726    /**
5727     * A pointer to the opaque Rust object.
5728     * Nearly everywhere, inner must be non-null, however in places where
5729     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5730     */
5731    LDKnativePositiveTimestamp *inner;
5732    /**
5733     * Indicates that this is the only struct which contains the same pointer.
5734     * Rust functions which take ownership of an object provided via an argument require
5735     * this to be true and invalidate the object pointed to by inner.
5736     */
5737    bool is_owned;
5738 } LDKPositiveTimestamp;
5739
5740 /**
5741  * The contents of CResult_PositiveTimestampCreationErrorZ
5742  */
5743 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
5744    /**
5745     * A pointer to the contents in the success state.
5746     * Reading from this pointer when `result_ok` is not set is undefined.
5747     */
5748    struct LDKPositiveTimestamp *result;
5749    /**
5750     * A pointer to the contents in the error state.
5751     * Reading from this pointer when `result_ok` is set is undefined.
5752     */
5753    enum LDKCreationError *err;
5754 } LDKCResult_PositiveTimestampCreationErrorZPtr;
5755
5756 /**
5757  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5758  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5759  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760  */
5761 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
5762    /**
5763     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5764     * `err` or `result` depending on the state of `result_ok`.
5765     */
5766    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
5767    /**
5768     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5769     */
5770    bool result_ok;
5771 } LDKCResult_PositiveTimestampCreationErrorZ;
5772
5773 /**
5774  * The contents of CResult_NoneSemanticErrorZ
5775  */
5776 typedef union LDKCResult_NoneSemanticErrorZPtr {
5777    /**
5778     * Note that this value is always NULL, as there are no contents in the OK variant
5779     */
5780    void *result;
5781    /**
5782     * A pointer to the contents in the error state.
5783     * Reading from this pointer when `result_ok` is set is undefined.
5784     */
5785    enum LDKSemanticError *err;
5786 } LDKCResult_NoneSemanticErrorZPtr;
5787
5788 /**
5789  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5790  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5791  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5792  */
5793 typedef struct LDKCResult_NoneSemanticErrorZ {
5794    /**
5795     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
5796     * `err` or `result` depending on the state of `result_ok`.
5797     */
5798    union LDKCResult_NoneSemanticErrorZPtr contents;
5799    /**
5800     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5801     */
5802    bool result_ok;
5803 } LDKCResult_NoneSemanticErrorZ;
5804
5805 /**
5806  * The contents of CResult_InvoiceSemanticErrorZ
5807  */
5808 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5809    /**
5810     * A pointer to the contents in the success state.
5811     * Reading from this pointer when `result_ok` is not set is undefined.
5812     */
5813    struct LDKInvoice *result;
5814    /**
5815     * A pointer to the contents in the error state.
5816     * Reading from this pointer when `result_ok` is set is undefined.
5817     */
5818    enum LDKSemanticError *err;
5819 } LDKCResult_InvoiceSemanticErrorZPtr;
5820
5821 /**
5822  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5823  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5824  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5825  */
5826 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5827    /**
5828     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5829     * `err` or `result` depending on the state of `result_ok`.
5830     */
5831    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5832    /**
5833     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5834     */
5835    bool result_ok;
5836 } LDKCResult_InvoiceSemanticErrorZ;
5837
5838
5839
5840 /**
5841  * Description string
5842  *
5843  * # Invariants
5844  * The description can be at most 639 __bytes__ long
5845  */
5846 typedef struct MUST_USE_STRUCT LDKDescription {
5847    /**
5848     * A pointer to the opaque Rust object.
5849     * Nearly everywhere, inner must be non-null, however in places where
5850     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5851     */
5852    LDKnativeDescription *inner;
5853    /**
5854     * Indicates that this is the only struct which contains the same pointer.
5855     * Rust functions which take ownership of an object provided via an argument require
5856     * this to be true and invalidate the object pointed to by inner.
5857     */
5858    bool is_owned;
5859 } LDKDescription;
5860
5861 /**
5862  * The contents of CResult_DescriptionCreationErrorZ
5863  */
5864 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5865    /**
5866     * A pointer to the contents in the success state.
5867     * Reading from this pointer when `result_ok` is not set is undefined.
5868     */
5869    struct LDKDescription *result;
5870    /**
5871     * A pointer to the contents in the error state.
5872     * Reading from this pointer when `result_ok` is set is undefined.
5873     */
5874    enum LDKCreationError *err;
5875 } LDKCResult_DescriptionCreationErrorZPtr;
5876
5877 /**
5878  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5879  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5880  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5881  */
5882 typedef struct LDKCResult_DescriptionCreationErrorZ {
5883    /**
5884     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5885     * `err` or `result` depending on the state of `result_ok`.
5886     */
5887    union LDKCResult_DescriptionCreationErrorZPtr contents;
5888    /**
5889     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5890     */
5891    bool result_ok;
5892 } LDKCResult_DescriptionCreationErrorZ;
5893
5894
5895
5896 /**
5897  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5898  * expires
5899  *
5900  * # Invariants
5901  * The number of seconds this expiry time represents has to be in the range
5902  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5903  * timestamp
5904  */
5905 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5906    /**
5907     * A pointer to the opaque Rust object.
5908     * Nearly everywhere, inner must be non-null, however in places where
5909     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5910     */
5911    LDKnativeExpiryTime *inner;
5912    /**
5913     * Indicates that this is the only struct which contains the same pointer.
5914     * Rust functions which take ownership of an object provided via an argument require
5915     * this to be true and invalidate the object pointed to by inner.
5916     */
5917    bool is_owned;
5918 } LDKExpiryTime;
5919
5920 /**
5921  * The contents of CResult_ExpiryTimeCreationErrorZ
5922  */
5923 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5924    /**
5925     * A pointer to the contents in the success state.
5926     * Reading from this pointer when `result_ok` is not set is undefined.
5927     */
5928    struct LDKExpiryTime *result;
5929    /**
5930     * A pointer to the contents in the error state.
5931     * Reading from this pointer when `result_ok` is set is undefined.
5932     */
5933    enum LDKCreationError *err;
5934 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5935
5936 /**
5937  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5938  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5940  */
5941 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5942    /**
5943     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5944     * `err` or `result` depending on the state of `result_ok`.
5945     */
5946    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5947    /**
5948     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5949     */
5950    bool result_ok;
5951 } LDKCResult_ExpiryTimeCreationErrorZ;
5952
5953 /**
5954  * The contents of CResult_PrivateRouteCreationErrorZ
5955  */
5956 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5957    /**
5958     * A pointer to the contents in the success state.
5959     * Reading from this pointer when `result_ok` is not set is undefined.
5960     */
5961    struct LDKPrivateRoute *result;
5962    /**
5963     * A pointer to the contents in the error state.
5964     * Reading from this pointer when `result_ok` is set is undefined.
5965     */
5966    enum LDKCreationError *err;
5967 } LDKCResult_PrivateRouteCreationErrorZPtr;
5968
5969 /**
5970  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5971  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5972  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5973  */
5974 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5975    /**
5976     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5977     * `err` or `result` depending on the state of `result_ok`.
5978     */
5979    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5980    /**
5981     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5982     */
5983    bool result_ok;
5984 } LDKCResult_PrivateRouteCreationErrorZ;
5985
5986 /**
5987  * The contents of CResult_StringErrorZ
5988  */
5989 typedef union LDKCResult_StringErrorZPtr {
5990    /**
5991     * A pointer to the contents in the success state.
5992     * Reading from this pointer when `result_ok` is not set is undefined.
5993     */
5994    struct LDKStr *result;
5995    /**
5996     * A pointer to the contents in the error state.
5997     * Reading from this pointer when `result_ok` is set is undefined.
5998     */
5999    enum LDKSecp256k1Error *err;
6000 } LDKCResult_StringErrorZPtr;
6001
6002 /**
6003  * A CResult_StringErrorZ represents the result of a fallible operation,
6004  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6006  */
6007 typedef struct LDKCResult_StringErrorZ {
6008    /**
6009     * The contents of this CResult_StringErrorZ, accessible via either
6010     * `err` or `result` depending on the state of `result_ok`.
6011     */
6012    union LDKCResult_StringErrorZPtr contents;
6013    /**
6014     * Whether this CResult_StringErrorZ represents a success state.
6015     */
6016    bool result_ok;
6017 } LDKCResult_StringErrorZ;
6018
6019 /**
6020  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6021  */
6022 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
6023    /**
6024     * A pointer to the contents in the success state.
6025     * Reading from this pointer when `result_ok` is not set is undefined.
6026     */
6027    struct LDKChannelMonitorUpdate *result;
6028    /**
6029     * A pointer to the contents in the error state.
6030     * Reading from this pointer when `result_ok` is set is undefined.
6031     */
6032    struct LDKDecodeError *err;
6033 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
6034
6035 /**
6036  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6037  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6038  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6039  */
6040 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
6041    /**
6042     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6043     * `err` or `result` depending on the state of `result_ok`.
6044     */
6045    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
6046    /**
6047     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6048     */
6049    bool result_ok;
6050 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
6051
6052 /**
6053  * The contents of CResult_HTLCUpdateDecodeErrorZ
6054  */
6055 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
6056    /**
6057     * A pointer to the contents in the success state.
6058     * Reading from this pointer when `result_ok` is not set is undefined.
6059     */
6060    struct LDKHTLCUpdate *result;
6061    /**
6062     * A pointer to the contents in the error state.
6063     * Reading from this pointer when `result_ok` is set is undefined.
6064     */
6065    struct LDKDecodeError *err;
6066 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
6067
6068 /**
6069  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6070  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6071  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6072  */
6073 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
6074    /**
6075     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6076     * `err` or `result` depending on the state of `result_ok`.
6077     */
6078    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
6079    /**
6080     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6081     */
6082    bool result_ok;
6083 } LDKCResult_HTLCUpdateDecodeErrorZ;
6084
6085
6086
6087 /**
6088  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
6089  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
6090  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
6091  * corrupted.
6092  * Contains a developer-readable error message.
6093  */
6094 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
6095    /**
6096     * A pointer to the opaque Rust object.
6097     * Nearly everywhere, inner must be non-null, however in places where
6098     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6099     */
6100    LDKnativeMonitorUpdateError *inner;
6101    /**
6102     * Indicates that this is the only struct which contains the same pointer.
6103     * Rust functions which take ownership of an object provided via an argument require
6104     * this to be true and invalidate the object pointed to by inner.
6105     */
6106    bool is_owned;
6107 } LDKMonitorUpdateError;
6108
6109 /**
6110  * The contents of CResult_NoneMonitorUpdateErrorZ
6111  */
6112 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
6113    /**
6114     * Note that this value is always NULL, as there are no contents in the OK variant
6115     */
6116    void *result;
6117    /**
6118     * A pointer to the contents in the error state.
6119     * Reading from this pointer when `result_ok` is set is undefined.
6120     */
6121    struct LDKMonitorUpdateError *err;
6122 } LDKCResult_NoneMonitorUpdateErrorZPtr;
6123
6124 /**
6125  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6126  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6127  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6128  */
6129 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
6130    /**
6131     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6132     * `err` or `result` depending on the state of `result_ok`.
6133     */
6134    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
6135    /**
6136     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6137     */
6138    bool result_ok;
6139 } LDKCResult_NoneMonitorUpdateErrorZ;
6140
6141 /**
6142  * A tuple of 2 elements. See the individual fields for the types contained.
6143  */
6144 typedef struct LDKC2Tuple_OutPointScriptZ {
6145    /**
6146     * The element at position 0
6147     */
6148    struct LDKOutPoint a;
6149    /**
6150     * The element at position 1
6151     */
6152    struct LDKCVec_u8Z b;
6153 } LDKC2Tuple_OutPointScriptZ;
6154
6155 /**
6156  * A tuple of 2 elements. See the individual fields for the types contained.
6157  */
6158 typedef struct LDKC2Tuple_u32ScriptZ {
6159    /**
6160     * The element at position 0
6161     */
6162    uint32_t a;
6163    /**
6164     * The element at position 1
6165     */
6166    struct LDKCVec_u8Z b;
6167 } LDKC2Tuple_u32ScriptZ;
6168
6169 /**
6170  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6171  * This corresponds to std::vector in C++
6172  */
6173 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
6174    /**
6175     * The elements in the array.
6176     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6177     */
6178    struct LDKC2Tuple_u32ScriptZ *data;
6179    /**
6180     * The number of elements pointed to by `data`.
6181     */
6182    uintptr_t datalen;
6183 } LDKCVec_C2Tuple_u32ScriptZZ;
6184
6185 /**
6186  * A tuple of 2 elements. See the individual fields for the types contained.
6187  */
6188 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6189    /**
6190     * The element at position 0
6191     */
6192    struct LDKThirtyTwoBytes a;
6193    /**
6194     * The element at position 1
6195     */
6196    struct LDKCVec_C2Tuple_u32ScriptZZ b;
6197 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
6198
6199 /**
6200  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6201  * This corresponds to std::vector in C++
6202  */
6203 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6204    /**
6205     * The elements in the array.
6206     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6207     */
6208    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
6209    /**
6210     * The number of elements pointed to by `data`.
6211     */
6212    uintptr_t datalen;
6213 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
6214
6215 /**
6216  * Some information provided on receipt of payment depends on whether the payment received is a
6217  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
6218  */
6219 typedef enum LDKPaymentPurpose_Tag {
6220    /**
6221     * Information for receiving a payment that we generated an invoice for.
6222     */
6223    LDKPaymentPurpose_InvoicePayment,
6224    /**
6225     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
6226     * (the payee) providing a preimage.
6227     */
6228    LDKPaymentPurpose_SpontaneousPayment,
6229    /**
6230     * Must be last for serialization purposes
6231     */
6232    LDKPaymentPurpose_Sentinel,
6233 } LDKPaymentPurpose_Tag;
6234
6235 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
6236    /**
6237     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
6238     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
6239     * [`ChannelManager::claim_funds`].
6240     *
6241     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6242     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
6243     *
6244     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6245     */
6246    struct LDKThirtyTwoBytes payment_preimage;
6247    /**
6248     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
6249     * number of deanonymization attacks during the routing process.
6250     * It is provided here for your reference, however its accuracy is enforced directly by
6251     * [`ChannelManager`] using the values you previously provided to
6252     * [`ChannelManager::create_inbound_payment`] or
6253     * [`ChannelManager::create_inbound_payment_for_hash`].
6254     *
6255     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
6256     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6257     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
6258     */
6259    struct LDKThirtyTwoBytes payment_secret;
6260    /**
6261     * This is the `user_payment_id` which was provided to
6262     * [`ChannelManager::create_inbound_payment_for_hash`] or
6263     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
6264     * simply copied here. It may be used to correlate PaymentReceived events with invoice
6265     * metadata stored elsewhere.
6266     *
6267     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
6268     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
6269     */
6270    uint64_t user_payment_id;
6271 } LDKPaymentPurpose_LDKInvoicePayment_Body;
6272
6273 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
6274    LDKPaymentPurpose_Tag tag;
6275    union {
6276       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
6277       struct {
6278          struct LDKThirtyTwoBytes spontaneous_payment;
6279       };
6280    };
6281 } LDKPaymentPurpose;
6282
6283 /**
6284  * The reason the channel was closed. See individual variants more details.
6285  */
6286 typedef enum LDKClosureReason_Tag {
6287    /**
6288     * Closure generated from receiving a peer error message.
6289     *
6290     * Our counterparty may have broadcasted their latest commitment state, and we have
6291     * as well.
6292     */
6293    LDKClosureReason_CounterpartyForceClosed,
6294    /**
6295     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
6296     *
6297     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
6298     */
6299    LDKClosureReason_HolderForceClosed,
6300    /**
6301     * The channel was closed after negotiating a cooperative close and we've now broadcasted
6302     * the cooperative close transaction. Note the shutdown may have been initiated by us.
6303     */
6304    LDKClosureReason_CooperativeClosure,
6305    /**
6306     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
6307     * commitment transaction came from our counterparty, but it may also have come from
6308     * a copy of our own `ChannelMonitor`.
6309     */
6310    LDKClosureReason_CommitmentTxConfirmed,
6311    /**
6312     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
6313     */
6314    LDKClosureReason_ProcessingError,
6315    /**
6316     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
6317     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
6318     * peer again in the future or if the peer disconnected before we finished negotiating
6319     * the channel open. The first case may be caused by incompatible features which our
6320     * counterparty, or we, require.
6321     */
6322    LDKClosureReason_DisconnectedPeer,
6323    /**
6324     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
6325     * the ChannelManager deserialized.
6326     */
6327    LDKClosureReason_OutdatedChannelManager,
6328    /**
6329     * Must be last for serialization purposes
6330     */
6331    LDKClosureReason_Sentinel,
6332 } LDKClosureReason_Tag;
6333
6334 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
6335    /**
6336     * The error which the peer sent us.
6337     *
6338     * The string should be sanitized before it is used (e.g emitted to logs
6339     * or printed to stdout). Otherwise, a well crafted error message may exploit
6340     * a security vulnerability in the terminal emulator or the logging subsystem.
6341     */
6342    struct LDKStr peer_msg;
6343 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
6344
6345 typedef struct LDKClosureReason_LDKProcessingError_Body {
6346    /**
6347     * A developer-readable error message which we generated.
6348     */
6349    struct LDKStr err;
6350 } LDKClosureReason_LDKProcessingError_Body;
6351
6352 typedef struct MUST_USE_STRUCT LDKClosureReason {
6353    LDKClosureReason_Tag tag;
6354    union {
6355       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
6356       LDKClosureReason_LDKProcessingError_Body processing_error;
6357    };
6358 } LDKClosureReason;
6359
6360 /**
6361  * An Event which you should probably take some action in response to.
6362  *
6363  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
6364  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
6365  * written as it makes no sense to respond to it after reconnecting to peers).
6366  */
6367 typedef enum LDKEvent_Tag {
6368    /**
6369     * Used to indicate that the client should generate a funding transaction with the given
6370     * parameters and then call ChannelManager::funding_transaction_generated.
6371     * Generated in ChannelManager message handling.
6372     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
6373     * counterparty can steal your funds!
6374     */
6375    LDKEvent_FundingGenerationReady,
6376    /**
6377     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
6378     * [`ChannelManager::claim_funds`] to get it....
6379     * Note that if the preimage is not known, you should call
6380     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
6381     * network congestion.
6382     * If you fail to call either [`ChannelManager::claim_funds`] or
6383     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
6384     * automatically failed.
6385     *
6386     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
6387     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
6388     */
6389    LDKEvent_PaymentReceived,
6390    /**
6391     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
6392     * and we got back the payment preimage for it).
6393     *
6394     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
6395     * event. In this situation, you SHOULD treat this payment as having succeeded.
6396     */
6397    LDKEvent_PaymentSent,
6398    /**
6399     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
6400     * something. You may wish to retry with a different route.
6401     */
6402    LDKEvent_PaymentPathFailed,
6403    /**
6404     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
6405     * time in the future.
6406     */
6407    LDKEvent_PendingHTLCsForwardable,
6408    /**
6409     * Used to indicate that an output which you should know how to spend was confirmed on chain
6410     * and is now spendable.
6411     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
6412     * counterparty spending them due to some kind of timeout. Thus, you need to store them
6413     * somewhere and spend them when you create on-chain transactions.
6414     */
6415    LDKEvent_SpendableOutputs,
6416    /**
6417     * This event is generated when a payment has been successfully forwarded through us and a
6418     * forwarding fee earned.
6419     */
6420    LDKEvent_PaymentForwarded,
6421    /**
6422     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
6423     */
6424    LDKEvent_ChannelClosed,
6425    /**
6426     * Used to indicate to the user that they can abandon the funding transaction and recycle the
6427     * inputs for another purpose.
6428     */
6429    LDKEvent_DiscardFunding,
6430    /**
6431     * Must be last for serialization purposes
6432     */
6433    LDKEvent_Sentinel,
6434 } LDKEvent_Tag;
6435
6436 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
6437    /**
6438     * The random channel_id we picked which you'll need to pass into
6439     * ChannelManager::funding_transaction_generated.
6440     */
6441    struct LDKThirtyTwoBytes temporary_channel_id;
6442    /**
6443     * The value, in satoshis, that the output should have.
6444     */
6445    uint64_t channel_value_satoshis;
6446    /**
6447     * The script which should be used in the transaction output.
6448     */
6449    struct LDKCVec_u8Z output_script;
6450    /**
6451     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6452     * an inbound channel.
6453     *
6454     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6455     */
6456    uint64_t user_channel_id;
6457 } LDKEvent_LDKFundingGenerationReady_Body;
6458
6459 typedef struct LDKEvent_LDKPaymentReceived_Body {
6460    /**
6461     * The hash for which the preimage should be handed to the ChannelManager.
6462     */
6463    struct LDKThirtyTwoBytes payment_hash;
6464    /**
6465     * The value, in thousandths of a satoshi, that this payment is for.
6466     */
6467    uint64_t amt;
6468    /**
6469     * Information for claiming this received payment, based on whether the purpose of the
6470     * payment is to pay an invoice or to send a spontaneous payment.
6471     */
6472    struct LDKPaymentPurpose purpose;
6473 } LDKEvent_LDKPaymentReceived_Body;
6474
6475 typedef struct LDKEvent_LDKPaymentSent_Body {
6476    /**
6477     * The id returned by [`ChannelManager::send_payment`] and used with
6478     * [`ChannelManager::retry_payment`].
6479     *
6480     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6481     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
6482     *
6483     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6484     */
6485    struct LDKThirtyTwoBytes payment_id;
6486    /**
6487     * The preimage to the hash given to ChannelManager::send_payment.
6488     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
6489     * store it somehow!
6490     */
6491    struct LDKThirtyTwoBytes payment_preimage;
6492    /**
6493     * The hash which was given to [`ChannelManager::send_payment`].
6494     *
6495     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6496     */
6497    struct LDKThirtyTwoBytes payment_hash;
6498    /**
6499     * The total fee which was spent at intermediate hops in this payment, across all paths.
6500     *
6501     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
6502     * overpayment to the recipient node.
6503     *
6504     * If the recipient or an intermediate node misbehaves and gives us free money, this may
6505     * overstate the amount paid, though this is unlikely.
6506     *
6507     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
6508     */
6509    struct LDKCOption_u64Z fee_paid_msat;
6510 } LDKEvent_LDKPaymentSent_Body;
6511
6512 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
6513    /**
6514     * The id returned by [`ChannelManager::send_payment`] and used with
6515     * [`ChannelManager::retry_payment`].
6516     *
6517     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
6518     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
6519     *
6520     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6521     */
6522    struct LDKThirtyTwoBytes payment_id;
6523    /**
6524     * The hash which was given to ChannelManager::send_payment.
6525     */
6526    struct LDKThirtyTwoBytes payment_hash;
6527    /**
6528     * Indicates the payment was rejected for some reason by the recipient. This implies that
6529     * the payment has failed, not just the route in question. If this is not set, you may
6530     * retry the payment via a different route.
6531     */
6532    bool rejected_by_dest;
6533    /**
6534     * Any failure information conveyed via the Onion return packet by a node along the failed
6535     * payment route.
6536     *
6537     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
6538     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
6539     *
6540     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
6541     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
6542     */
6543    struct LDKCOption_NetworkUpdateZ network_update;
6544    /**
6545     * For both single-path and multi-path payments, this is set if all paths of the payment have
6546     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
6547     * larger MPP payment were still in flight when this event was generated.
6548     */
6549    bool all_paths_failed;
6550    /**
6551     * The payment path that failed.
6552     */
6553    struct LDKCVec_RouteHopZ path;
6554    /**
6555     * The channel responsible for the failed payment path.
6556     *
6557     * If this is `Some`, then the corresponding channel should be avoided when the payment is
6558     * retried. May be `None` for older [`Event`] serializations.
6559     */
6560    struct LDKCOption_u64Z short_channel_id;
6561    /**
6562     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
6563     *
6564     * See [`find_route`] for details.
6565     *
6566     * [`Route`]: crate::routing::router::Route
6567     * [`find_route`]: crate::routing::router::find_route
6568     *
6569     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6570     */
6571    struct LDKRouteParameters retry;
6572 } LDKEvent_LDKPaymentPathFailed_Body;
6573
6574 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
6575    /**
6576     * The minimum amount of time that should be waited prior to calling
6577     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
6578     * you should wait a random amount of time in roughly the range (now + time_forwardable,
6579     * now + 5*time_forwardable).
6580     */
6581    uint64_t time_forwardable;
6582 } LDKEvent_LDKPendingHTLCsForwardable_Body;
6583
6584 typedef struct LDKEvent_LDKSpendableOutputs_Body {
6585    /**
6586     * The outputs which you should store as spendable by you.
6587     */
6588    struct LDKCVec_SpendableOutputDescriptorZ outputs;
6589 } LDKEvent_LDKSpendableOutputs_Body;
6590
6591 typedef struct LDKEvent_LDKPaymentForwarded_Body {
6592    /**
6593     * The fee, in milli-satoshis, which was earned as a result of the payment.
6594     *
6595     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
6596     * was pending, the amount the next hop claimed will have been rounded down to the nearest
6597     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
6598     * claimed the full value in millisatoshis from the source. In this case,
6599     * `claim_from_onchain_tx` will be set.
6600     *
6601     * If the channel which sent us the payment has been force-closed, we will claim the funds
6602     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
6603     * fees which we will spend and will instead set this to `None`. It is possible duplicate
6604     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
6605     * `None`.
6606     */
6607    struct LDKCOption_u64Z fee_earned_msat;
6608    /**
6609     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
6610     * transaction.
6611     */
6612    bool claim_from_onchain_tx;
6613 } LDKEvent_LDKPaymentForwarded_Body;
6614
6615 typedef struct LDKEvent_LDKChannelClosed_Body {
6616    /**
6617     * The channel_id of the channel which has been closed. Note that on-chain transactions
6618     * resolving the channel are likely still awaiting confirmation.
6619     */
6620    struct LDKThirtyTwoBytes channel_id;
6621    /**
6622     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
6623     * an inbound channel. This will always be zero for objects serialized with LDK versions
6624     * prior to 0.0.102.
6625     *
6626     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
6627     */
6628    uint64_t user_channel_id;
6629    /**
6630     * The reason the channel was closed.
6631     */
6632    struct LDKClosureReason reason;
6633 } LDKEvent_LDKChannelClosed_Body;
6634
6635 typedef struct LDKEvent_LDKDiscardFunding_Body {
6636    /**
6637     * The channel_id of the channel which has been closed.
6638     */
6639    struct LDKThirtyTwoBytes channel_id;
6640    /**
6641     * The full transaction received from the user
6642     */
6643    struct LDKTransaction transaction;
6644 } LDKEvent_LDKDiscardFunding_Body;
6645
6646 typedef struct MUST_USE_STRUCT LDKEvent {
6647    LDKEvent_Tag tag;
6648    union {
6649       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
6650       LDKEvent_LDKPaymentReceived_Body payment_received;
6651       LDKEvent_LDKPaymentSent_Body payment_sent;
6652       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
6653       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
6654       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
6655       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
6656       LDKEvent_LDKChannelClosed_Body channel_closed;
6657       LDKEvent_LDKDiscardFunding_Body discard_funding;
6658    };
6659 } LDKEvent;
6660
6661 /**
6662  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6663  * This corresponds to std::vector in C++
6664  */
6665 typedef struct LDKCVec_EventZ {
6666    /**
6667     * The elements in the array.
6668     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6669     */
6670    struct LDKEvent *data;
6671    /**
6672     * The number of elements pointed to by `data`.
6673     */
6674    uintptr_t datalen;
6675 } LDKCVec_EventZ;
6676
6677 /**
6678  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6679  * This corresponds to std::vector in C++
6680  */
6681 typedef struct LDKCVec_TransactionZ {
6682    /**
6683     * The elements in the array.
6684     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6685     */
6686    struct LDKTransaction *data;
6687    /**
6688     * The number of elements pointed to by `data`.
6689     */
6690    uintptr_t datalen;
6691 } LDKCVec_TransactionZ;
6692
6693 /**
6694  * A tuple of 2 elements. See the individual fields for the types contained.
6695  */
6696 typedef struct LDKC2Tuple_u32TxOutZ {
6697    /**
6698     * The element at position 0
6699     */
6700    uint32_t a;
6701    /**
6702     * The element at position 1
6703     */
6704    struct LDKTxOut b;
6705 } LDKC2Tuple_u32TxOutZ;
6706
6707 /**
6708  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6709  * This corresponds to std::vector in C++
6710  */
6711 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
6712    /**
6713     * The elements in the array.
6714     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6715     */
6716    struct LDKC2Tuple_u32TxOutZ *data;
6717    /**
6718     * The number of elements pointed to by `data`.
6719     */
6720    uintptr_t datalen;
6721 } LDKCVec_C2Tuple_u32TxOutZZ;
6722
6723 /**
6724  * A tuple of 2 elements. See the individual fields for the types contained.
6725  */
6726 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6727    /**
6728     * The element at position 0
6729     */
6730    struct LDKThirtyTwoBytes a;
6731    /**
6732     * The element at position 1
6733     */
6734    struct LDKCVec_C2Tuple_u32TxOutZZ b;
6735 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
6736
6737 /**
6738  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6739  * This corresponds to std::vector in C++
6740  */
6741 typedef struct LDKCVec_TransactionOutputsZ {
6742    /**
6743     * The elements in the array.
6744     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6745     */
6746    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
6747    /**
6748     * The number of elements pointed to by `data`.
6749     */
6750    uintptr_t datalen;
6751 } LDKCVec_TransactionOutputsZ;
6752
6753 /**
6754  * Details about the balance(s) available for spending once the channel appears on chain.
6755  *
6756  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
6757  * be provided.
6758  */
6759 typedef enum LDKBalance_Tag {
6760    /**
6761     * The channel is not yet closed (or the commitment or closing transaction has not yet
6762     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
6763     * force-closed now.
6764     */
6765    LDKBalance_ClaimableOnChannelClose,
6766    /**
6767     * The channel has been closed, and the given balance is ours but awaiting confirmations until
6768     * we consider it spendable.
6769     */
6770    LDKBalance_ClaimableAwaitingConfirmations,
6771    /**
6772     * The channel has been closed, and the given balance should be ours but awaiting spending
6773     * transaction confirmation. If the spending transaction does not confirm in time, it is
6774     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
6775     *
6776     * Once the spending transaction confirms, before it has reached enough confirmations to be
6777     * considered safe from chain reorganizations, the balance will instead be provided via
6778     * [`Balance::ClaimableAwaitingConfirmations`].
6779     */
6780    LDKBalance_ContentiousClaimable,
6781    /**
6782     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
6783     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
6784     * likely to be claimed by our counterparty before we do.
6785     */
6786    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
6787    /**
6788     * Must be last for serialization purposes
6789     */
6790    LDKBalance_Sentinel,
6791 } LDKBalance_Tag;
6792
6793 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
6794    /**
6795     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6796     * required to do so.
6797     */
6798    uint64_t claimable_amount_satoshis;
6799 } LDKBalance_LDKClaimableOnChannelClose_Body;
6800
6801 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
6802    /**
6803     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
6804     * were spent in broadcasting the transaction.
6805     */
6806    uint64_t claimable_amount_satoshis;
6807    /**
6808     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
6809     * amount.
6810     */
6811    uint32_t confirmation_height;
6812 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
6813
6814 typedef struct LDKBalance_LDKContentiousClaimable_Body {
6815    /**
6816     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6817     * required to do so.
6818     */
6819    uint64_t claimable_amount_satoshis;
6820    /**
6821     * The height at which the counterparty may be able to claim the balance if we have not
6822     * done so.
6823     */
6824    uint32_t timeout_height;
6825 } LDKBalance_LDKContentiousClaimable_Body;
6826
6827 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
6828    /**
6829     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
6830     * required to do so.
6831     */
6832    uint64_t claimable_amount_satoshis;
6833    /**
6834     * The height at which we will be able to claim the balance if our counterparty has not
6835     * done so.
6836     */
6837    uint32_t claimable_height;
6838 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
6839
6840 typedef struct MUST_USE_STRUCT LDKBalance {
6841    LDKBalance_Tag tag;
6842    union {
6843       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
6844       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
6845       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
6846       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
6847    };
6848 } LDKBalance;
6849
6850 /**
6851  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6852  * This corresponds to std::vector in C++
6853  */
6854 typedef struct LDKCVec_BalanceZ {
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 LDKBalance *data;
6860    /**
6861     * The number of elements pointed to by `data`.
6862     */
6863    uintptr_t datalen;
6864 } LDKCVec_BalanceZ;
6865
6866 /**
6867  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6868  */
6869 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6870    /**
6871     * A pointer to the contents in the success state.
6872     * Reading from this pointer when `result_ok` is not set is undefined.
6873     */
6874    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
6875    /**
6876     * A pointer to the contents in the error state.
6877     * Reading from this pointer when `result_ok` is set is undefined.
6878     */
6879    struct LDKDecodeError *err;
6880 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
6881
6882 /**
6883  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6884  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6886  */
6887 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6888    /**
6889     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6890     * `err` or `result` depending on the state of `result_ok`.
6891     */
6892    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
6893    /**
6894     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6895     */
6896    bool result_ok;
6897 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
6898
6899 /**
6900  * The contents of CResult_NoneLightningErrorZ
6901  */
6902 typedef union LDKCResult_NoneLightningErrorZPtr {
6903    /**
6904     * Note that this value is always NULL, as there are no contents in the OK variant
6905     */
6906    void *result;
6907    /**
6908     * A pointer to the contents in the error state.
6909     * Reading from this pointer when `result_ok` is set is undefined.
6910     */
6911    struct LDKLightningError *err;
6912 } LDKCResult_NoneLightningErrorZPtr;
6913
6914 /**
6915  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6916  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6917  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6918  */
6919 typedef struct LDKCResult_NoneLightningErrorZ {
6920    /**
6921     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6922     * `err` or `result` depending on the state of `result_ok`.
6923     */
6924    union LDKCResult_NoneLightningErrorZPtr contents;
6925    /**
6926     * Whether this CResult_NoneLightningErrorZ represents a success state.
6927     */
6928    bool result_ok;
6929 } LDKCResult_NoneLightningErrorZ;
6930
6931 /**
6932  * A tuple of 2 elements. See the individual fields for the types contained.
6933  */
6934 typedef struct LDKC2Tuple_PublicKeyTypeZ {
6935    /**
6936     * The element at position 0
6937     */
6938    struct LDKPublicKey a;
6939    /**
6940     * The element at position 1
6941     */
6942    struct LDKType b;
6943 } LDKC2Tuple_PublicKeyTypeZ;
6944
6945 /**
6946  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
6947  * This corresponds to std::vector in C++
6948  */
6949 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
6950    /**
6951     * The elements in the array.
6952     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6953     */
6954    struct LDKC2Tuple_PublicKeyTypeZ *data;
6955    /**
6956     * The number of elements pointed to by `data`.
6957     */
6958    uintptr_t datalen;
6959 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
6960
6961 /**
6962  * The contents of CResult_boolLightningErrorZ
6963  */
6964 typedef union LDKCResult_boolLightningErrorZPtr {
6965    /**
6966     * A pointer to the contents in the success state.
6967     * Reading from this pointer when `result_ok` is not set is undefined.
6968     */
6969    bool *result;
6970    /**
6971     * A pointer to the contents in the error state.
6972     * Reading from this pointer when `result_ok` is set is undefined.
6973     */
6974    struct LDKLightningError *err;
6975 } LDKCResult_boolLightningErrorZPtr;
6976
6977 /**
6978  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
6979  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6981  */
6982 typedef struct LDKCResult_boolLightningErrorZ {
6983    /**
6984     * The contents of this CResult_boolLightningErrorZ, accessible via either
6985     * `err` or `result` depending on the state of `result_ok`.
6986     */
6987    union LDKCResult_boolLightningErrorZPtr contents;
6988    /**
6989     * Whether this CResult_boolLightningErrorZ represents a success state.
6990     */
6991    bool result_ok;
6992 } LDKCResult_boolLightningErrorZ;
6993
6994 /**
6995  * A tuple of 3 elements. See the individual fields for the types contained.
6996  */
6997 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6998    /**
6999     * The element at position 0
7000     */
7001    struct LDKChannelAnnouncement a;
7002    /**
7003     * The element at position 1
7004     */
7005    struct LDKChannelUpdate b;
7006    /**
7007     * The element at position 2
7008     */
7009    struct LDKChannelUpdate c;
7010 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
7011
7012 /**
7013  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7014  * This corresponds to std::vector in C++
7015  */
7016 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7017    /**
7018     * The elements in the array.
7019     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7020     */
7021    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
7022    /**
7023     * The number of elements pointed to by `data`.
7024     */
7025    uintptr_t datalen;
7026 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
7027
7028 /**
7029  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7030  * This corresponds to std::vector in C++
7031  */
7032 typedef struct LDKCVec_NodeAnnouncementZ {
7033    /**
7034     * The elements in the array.
7035     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7036     */
7037    struct LDKNodeAnnouncement *data;
7038    /**
7039     * The number of elements pointed to by `data`.
7040     */
7041    uintptr_t datalen;
7042 } LDKCVec_NodeAnnouncementZ;
7043
7044 /**
7045  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7046  * This corresponds to std::vector in C++
7047  */
7048 typedef struct LDKCVec_PublicKeyZ {
7049    /**
7050     * The elements in the array.
7051     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7052     */
7053    struct LDKPublicKey *data;
7054    /**
7055     * The number of elements pointed to by `data`.
7056     */
7057    uintptr_t datalen;
7058 } LDKCVec_PublicKeyZ;
7059
7060
7061
7062 /**
7063  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
7064  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
7065  * descriptor.
7066  */
7067 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
7068    /**
7069     * A pointer to the opaque Rust object.
7070     * Nearly everywhere, inner must be non-null, however in places where
7071     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7072     */
7073    LDKnativePeerHandleError *inner;
7074    /**
7075     * Indicates that this is the only struct which contains the same pointer.
7076     * Rust functions which take ownership of an object provided via an argument require
7077     * this to be true and invalidate the object pointed to by inner.
7078     */
7079    bool is_owned;
7080 } LDKPeerHandleError;
7081
7082 /**
7083  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
7084  */
7085 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
7086    /**
7087     * A pointer to the contents in the success state.
7088     * Reading from this pointer when `result_ok` is not set is undefined.
7089     */
7090    struct LDKCVec_u8Z *result;
7091    /**
7092     * A pointer to the contents in the error state.
7093     * Reading from this pointer when `result_ok` is set is undefined.
7094     */
7095    struct LDKPeerHandleError *err;
7096 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
7097
7098 /**
7099  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7100  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7102  */
7103 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
7104    /**
7105     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7106     * `err` or `result` depending on the state of `result_ok`.
7107     */
7108    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
7109    /**
7110     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7111     */
7112    bool result_ok;
7113 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
7114
7115 /**
7116  * The contents of CResult_NonePeerHandleErrorZ
7117  */
7118 typedef union LDKCResult_NonePeerHandleErrorZPtr {
7119    /**
7120     * Note that this value is always NULL, as there are no contents in the OK variant
7121     */
7122    void *result;
7123    /**
7124     * A pointer to the contents in the error state.
7125     * Reading from this pointer when `result_ok` is set is undefined.
7126     */
7127    struct LDKPeerHandleError *err;
7128 } LDKCResult_NonePeerHandleErrorZPtr;
7129
7130 /**
7131  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7132  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7133  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7134  */
7135 typedef struct LDKCResult_NonePeerHandleErrorZ {
7136    /**
7137     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7138     * `err` or `result` depending on the state of `result_ok`.
7139     */
7140    union LDKCResult_NonePeerHandleErrorZPtr contents;
7141    /**
7142     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
7143     */
7144    bool result_ok;
7145 } LDKCResult_NonePeerHandleErrorZ;
7146
7147 /**
7148  * The contents of CResult_boolPeerHandleErrorZ
7149  */
7150 typedef union LDKCResult_boolPeerHandleErrorZPtr {
7151    /**
7152     * A pointer to the contents in the success state.
7153     * Reading from this pointer when `result_ok` is not set is undefined.
7154     */
7155    bool *result;
7156    /**
7157     * A pointer to the contents in the error state.
7158     * Reading from this pointer when `result_ok` is set is undefined.
7159     */
7160    struct LDKPeerHandleError *err;
7161 } LDKCResult_boolPeerHandleErrorZPtr;
7162
7163 /**
7164  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7165  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7166  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7167  */
7168 typedef struct LDKCResult_boolPeerHandleErrorZ {
7169    /**
7170     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7171     * `err` or `result` depending on the state of `result_ok`.
7172     */
7173    union LDKCResult_boolPeerHandleErrorZPtr contents;
7174    /**
7175     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
7176     */
7177    bool result_ok;
7178 } LDKCResult_boolPeerHandleErrorZ;
7179
7180
7181
7182 /**
7183  * Represents the compressed public key of a node
7184  */
7185 typedef struct MUST_USE_STRUCT LDKNodeId {
7186    /**
7187     * A pointer to the opaque Rust object.
7188     * Nearly everywhere, inner must be non-null, however in places where
7189     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7190     */
7191    LDKnativeNodeId *inner;
7192    /**
7193     * Indicates that this is the only struct which contains the same pointer.
7194     * Rust functions which take ownership of an object provided via an argument require
7195     * this to be true and invalidate the object pointed to by inner.
7196     */
7197    bool is_owned;
7198 } LDKNodeId;
7199
7200 /**
7201  * The contents of CResult_NodeIdDecodeErrorZ
7202  */
7203 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
7204    /**
7205     * A pointer to the contents in the success state.
7206     * Reading from this pointer when `result_ok` is not set is undefined.
7207     */
7208    struct LDKNodeId *result;
7209    /**
7210     * A pointer to the contents in the error state.
7211     * Reading from this pointer when `result_ok` is set is undefined.
7212     */
7213    struct LDKDecodeError *err;
7214 } LDKCResult_NodeIdDecodeErrorZPtr;
7215
7216 /**
7217  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7218  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7219  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7220  */
7221 typedef struct LDKCResult_NodeIdDecodeErrorZ {
7222    /**
7223     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7224     * `err` or `result` depending on the state of `result_ok`.
7225     */
7226    union LDKCResult_NodeIdDecodeErrorZPtr contents;
7227    /**
7228     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7229     */
7230    bool result_ok;
7231 } LDKCResult_NodeIdDecodeErrorZ;
7232
7233 /**
7234  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7235  * UTXOs.
7236  */
7237 typedef struct LDKAccess {
7238    /**
7239     * An opaque pointer which is passed to your function implementations as an argument.
7240     * This has no meaning in the LDK, and can be NULL or any other value.
7241     */
7242    void *this_arg;
7243    /**
7244     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7245     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7246     * is unknown.
7247     *
7248     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7249     */
7250    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7251    /**
7252     * Frees any resources associated with this object given its this_arg pointer.
7253     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7254     */
7255    void (*free)(void *this_arg);
7256 } LDKAccess;
7257
7258 /**
7259  * An enum which can either contain a crate::lightning::chain::Access or not
7260  */
7261 typedef enum LDKCOption_AccessZ_Tag {
7262    /**
7263     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7264     */
7265    LDKCOption_AccessZ_Some,
7266    /**
7267     * When we're in this state, this COption_AccessZ contains nothing
7268     */
7269    LDKCOption_AccessZ_None,
7270    /**
7271     * Must be last for serialization purposes
7272     */
7273    LDKCOption_AccessZ_Sentinel,
7274 } LDKCOption_AccessZ_Tag;
7275
7276 typedef struct LDKCOption_AccessZ {
7277    LDKCOption_AccessZ_Tag tag;
7278    union {
7279       struct {
7280          struct LDKAccess some;
7281       };
7282    };
7283 } LDKCOption_AccessZ;
7284
7285
7286
7287 /**
7288  * Details about one direction of a channel. Received
7289  * within a channel update.
7290  */
7291 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
7292    /**
7293     * A pointer to the opaque Rust object.
7294     * Nearly everywhere, inner must be non-null, however in places where
7295     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7296     */
7297    LDKnativeDirectionalChannelInfo *inner;
7298    /**
7299     * Indicates that this is the only struct which contains the same pointer.
7300     * Rust functions which take ownership of an object provided via an argument require
7301     * this to be true and invalidate the object pointed to by inner.
7302     */
7303    bool is_owned;
7304 } LDKDirectionalChannelInfo;
7305
7306 /**
7307  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7308  */
7309 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
7310    /**
7311     * A pointer to the contents in the success state.
7312     * Reading from this pointer when `result_ok` is not set is undefined.
7313     */
7314    struct LDKDirectionalChannelInfo *result;
7315    /**
7316     * A pointer to the contents in the error state.
7317     * Reading from this pointer when `result_ok` is set is undefined.
7318     */
7319    struct LDKDecodeError *err;
7320 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
7321
7322 /**
7323  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7324  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7325  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7326  */
7327 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
7328    /**
7329     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7330     * `err` or `result` depending on the state of `result_ok`.
7331     */
7332    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
7333    /**
7334     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7335     */
7336    bool result_ok;
7337 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
7338
7339
7340
7341 /**
7342  * Details about a channel (both directions).
7343  * Received within a channel announcement.
7344  */
7345 typedef struct MUST_USE_STRUCT LDKChannelInfo {
7346    /**
7347     * A pointer to the opaque Rust object.
7348     * Nearly everywhere, inner must be non-null, however in places where
7349     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7350     */
7351    LDKnativeChannelInfo *inner;
7352    /**
7353     * Indicates that this is the only struct which contains the same pointer.
7354     * Rust functions which take ownership of an object provided via an argument require
7355     * this to be true and invalidate the object pointed to by inner.
7356     */
7357    bool is_owned;
7358 } LDKChannelInfo;
7359
7360 /**
7361  * The contents of CResult_ChannelInfoDecodeErrorZ
7362  */
7363 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
7364    /**
7365     * A pointer to the contents in the success state.
7366     * Reading from this pointer when `result_ok` is not set is undefined.
7367     */
7368    struct LDKChannelInfo *result;
7369    /**
7370     * A pointer to the contents in the error state.
7371     * Reading from this pointer when `result_ok` is set is undefined.
7372     */
7373    struct LDKDecodeError *err;
7374 } LDKCResult_ChannelInfoDecodeErrorZPtr;
7375
7376 /**
7377  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7378  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7379  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7380  */
7381 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
7382    /**
7383     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7384     * `err` or `result` depending on the state of `result_ok`.
7385     */
7386    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7387    /**
7388     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7389     */
7390    bool result_ok;
7391 } LDKCResult_ChannelInfoDecodeErrorZ;
7392
7393
7394
7395 /**
7396  * Fees for routing via a given channel or a node
7397  */
7398 typedef struct MUST_USE_STRUCT LDKRoutingFees {
7399    /**
7400     * A pointer to the opaque Rust object.
7401     * Nearly everywhere, inner must be non-null, however in places where
7402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7403     */
7404    LDKnativeRoutingFees *inner;
7405    /**
7406     * Indicates that this is the only struct which contains the same pointer.
7407     * Rust functions which take ownership of an object provided via an argument require
7408     * this to be true and invalidate the object pointed to by inner.
7409     */
7410    bool is_owned;
7411 } LDKRoutingFees;
7412
7413 /**
7414  * The contents of CResult_RoutingFeesDecodeErrorZ
7415  */
7416 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
7417    /**
7418     * A pointer to the contents in the success state.
7419     * Reading from this pointer when `result_ok` is not set is undefined.
7420     */
7421    struct LDKRoutingFees *result;
7422    /**
7423     * A pointer to the contents in the error state.
7424     * Reading from this pointer when `result_ok` is set is undefined.
7425     */
7426    struct LDKDecodeError *err;
7427 } LDKCResult_RoutingFeesDecodeErrorZPtr;
7428
7429 /**
7430  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7431  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7432  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7433  */
7434 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
7435    /**
7436     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7437     * `err` or `result` depending on the state of `result_ok`.
7438     */
7439    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
7440    /**
7441     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7442     */
7443    bool result_ok;
7444 } LDKCResult_RoutingFeesDecodeErrorZ;
7445
7446
7447
7448 /**
7449  * Information received in the latest node_announcement from this node.
7450  */
7451 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7452    /**
7453     * A pointer to the opaque Rust object.
7454     * Nearly everywhere, inner must be non-null, however in places where
7455     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7456     */
7457    LDKnativeNodeAnnouncementInfo *inner;
7458    /**
7459     * Indicates that this is the only struct which contains the same pointer.
7460     * Rust functions which take ownership of an object provided via an argument require
7461     * this to be true and invalidate the object pointed to by inner.
7462     */
7463    bool is_owned;
7464 } LDKNodeAnnouncementInfo;
7465
7466 /**
7467  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7468  */
7469 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7470    /**
7471     * A pointer to the contents in the success state.
7472     * Reading from this pointer when `result_ok` is not set is undefined.
7473     */
7474    struct LDKNodeAnnouncementInfo *result;
7475    /**
7476     * A pointer to the contents in the error state.
7477     * Reading from this pointer when `result_ok` is set is undefined.
7478     */
7479    struct LDKDecodeError *err;
7480 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7481
7482 /**
7483  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7484  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7485  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7486  */
7487 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7488    /**
7489     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7490     * `err` or `result` depending on the state of `result_ok`.
7491     */
7492    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7493    /**
7494     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7495     */
7496    bool result_ok;
7497 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7498
7499 /**
7500  * A dynamically-allocated array of u64s of arbitrary size.
7501  * This corresponds to std::vector in C++
7502  */
7503 typedef struct LDKCVec_u64Z {
7504    /**
7505     * The elements in the array.
7506     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7507     */
7508    uint64_t *data;
7509    /**
7510     * The number of elements pointed to by `data`.
7511     */
7512    uintptr_t datalen;
7513 } LDKCVec_u64Z;
7514
7515
7516
7517 /**
7518  * Details about a node in the network, known from the network announcement.
7519  */
7520 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7521    /**
7522     * A pointer to the opaque Rust object.
7523     * Nearly everywhere, inner must be non-null, however in places where
7524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7525     */
7526    LDKnativeNodeInfo *inner;
7527    /**
7528     * Indicates that this is the only struct which contains the same pointer.
7529     * Rust functions which take ownership of an object provided via an argument require
7530     * this to be true and invalidate the object pointed to by inner.
7531     */
7532    bool is_owned;
7533 } LDKNodeInfo;
7534
7535 /**
7536  * The contents of CResult_NodeInfoDecodeErrorZ
7537  */
7538 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7539    /**
7540     * A pointer to the contents in the success state.
7541     * Reading from this pointer when `result_ok` is not set is undefined.
7542     */
7543    struct LDKNodeInfo *result;
7544    /**
7545     * A pointer to the contents in the error state.
7546     * Reading from this pointer when `result_ok` is set is undefined.
7547     */
7548    struct LDKDecodeError *err;
7549 } LDKCResult_NodeInfoDecodeErrorZPtr;
7550
7551 /**
7552  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7553  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7555  */
7556 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7557    /**
7558     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7559     * `err` or `result` depending on the state of `result_ok`.
7560     */
7561    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7562    /**
7563     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7564     */
7565    bool result_ok;
7566 } LDKCResult_NodeInfoDecodeErrorZ;
7567
7568
7569
7570 /**
7571  * Represents the network as nodes and channels between them
7572  */
7573 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
7574    /**
7575     * A pointer to the opaque Rust object.
7576     * Nearly everywhere, inner must be non-null, however in places where
7577     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7578     */
7579    LDKnativeNetworkGraph *inner;
7580    /**
7581     * Indicates that this is the only struct which contains the same pointer.
7582     * Rust functions which take ownership of an object provided via an argument require
7583     * this to be true and invalidate the object pointed to by inner.
7584     */
7585    bool is_owned;
7586 } LDKNetworkGraph;
7587
7588 /**
7589  * The contents of CResult_NetworkGraphDecodeErrorZ
7590  */
7591 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7592    /**
7593     * A pointer to the contents in the success state.
7594     * Reading from this pointer when `result_ok` is not set is undefined.
7595     */
7596    struct LDKNetworkGraph *result;
7597    /**
7598     * A pointer to the contents in the error state.
7599     * Reading from this pointer when `result_ok` is set is undefined.
7600     */
7601    struct LDKDecodeError *err;
7602 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7603
7604 /**
7605  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7606  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7607  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7608  */
7609 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7610    /**
7611     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7612     * `err` or `result` depending on the state of `result_ok`.
7613     */
7614    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7615    /**
7616     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7617     */
7618    bool result_ok;
7619 } LDKCResult_NetworkGraphDecodeErrorZ;
7620
7621 /**
7622  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7623  */
7624 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7625    /**
7626     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7627     */
7628    LDKCOption_CVec_NetAddressZZ_Some,
7629    /**
7630     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7631     */
7632    LDKCOption_CVec_NetAddressZZ_None,
7633    /**
7634     * Must be last for serialization purposes
7635     */
7636    LDKCOption_CVec_NetAddressZZ_Sentinel,
7637 } LDKCOption_CVec_NetAddressZZ_Tag;
7638
7639 typedef struct LDKCOption_CVec_NetAddressZZ {
7640    LDKCOption_CVec_NetAddressZZ_Tag tag;
7641    union {
7642       struct {
7643          struct LDKCVec_NetAddressZ some;
7644       };
7645    };
7646 } LDKCOption_CVec_NetAddressZZ;
7647
7648 /**
7649  * The contents of CResult_NetAddressDecodeErrorZ
7650  */
7651 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
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 LDKNetAddress *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_NetAddressDecodeErrorZPtr;
7663
7664 /**
7665  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7666  * containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressDecodeErrorZ {
7670    /**
7671     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7672     * `err` or `result` depending on the state of `result_ok`.
7673     */
7674    union LDKCResult_NetAddressDecodeErrorZPtr contents;
7675    /**
7676     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7677     */
7678    bool result_ok;
7679 } LDKCResult_NetAddressDecodeErrorZ;
7680
7681
7682
7683 /**
7684  * An update_add_htlc message to be sent or received from a peer
7685  */
7686 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
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    LDKnativeUpdateAddHTLC *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 } LDKUpdateAddHTLC;
7700
7701 /**
7702  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7703  * This corresponds to std::vector in C++
7704  */
7705 typedef struct LDKCVec_UpdateAddHTLCZ {
7706    /**
7707     * The elements in the array.
7708     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7709     */
7710    struct LDKUpdateAddHTLC *data;
7711    /**
7712     * The number of elements pointed to by `data`.
7713     */
7714    uintptr_t datalen;
7715 } LDKCVec_UpdateAddHTLCZ;
7716
7717
7718
7719 /**
7720  * An update_fulfill_htlc message to be sent or received from a peer
7721  */
7722 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
7723    /**
7724     * A pointer to the opaque Rust object.
7725     * Nearly everywhere, inner must be non-null, however in places where
7726     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7727     */
7728    LDKnativeUpdateFulfillHTLC *inner;
7729    /**
7730     * Indicates that this is the only struct which contains the same pointer.
7731     * Rust functions which take ownership of an object provided via an argument require
7732     * this to be true and invalidate the object pointed to by inner.
7733     */
7734    bool is_owned;
7735 } LDKUpdateFulfillHTLC;
7736
7737 /**
7738  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7739  * This corresponds to std::vector in C++
7740  */
7741 typedef struct LDKCVec_UpdateFulfillHTLCZ {
7742    /**
7743     * The elements in the array.
7744     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7745     */
7746    struct LDKUpdateFulfillHTLC *data;
7747    /**
7748     * The number of elements pointed to by `data`.
7749     */
7750    uintptr_t datalen;
7751 } LDKCVec_UpdateFulfillHTLCZ;
7752
7753
7754
7755 /**
7756  * An update_fail_htlc message to be sent or received from a peer
7757  */
7758 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
7759    /**
7760     * A pointer to the opaque Rust object.
7761     * Nearly everywhere, inner must be non-null, however in places where
7762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7763     */
7764    LDKnativeUpdateFailHTLC *inner;
7765    /**
7766     * Indicates that this is the only struct which contains the same pointer.
7767     * Rust functions which take ownership of an object provided via an argument require
7768     * this to be true and invalidate the object pointed to by inner.
7769     */
7770    bool is_owned;
7771 } LDKUpdateFailHTLC;
7772
7773 /**
7774  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
7775  * This corresponds to std::vector in C++
7776  */
7777 typedef struct LDKCVec_UpdateFailHTLCZ {
7778    /**
7779     * The elements in the array.
7780     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7781     */
7782    struct LDKUpdateFailHTLC *data;
7783    /**
7784     * The number of elements pointed to by `data`.
7785     */
7786    uintptr_t datalen;
7787 } LDKCVec_UpdateFailHTLCZ;
7788
7789
7790
7791 /**
7792  * An update_fail_malformed_htlc message to be sent or received from a peer
7793  */
7794 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
7795    /**
7796     * A pointer to the opaque Rust object.
7797     * Nearly everywhere, inner must be non-null, however in places where
7798     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7799     */
7800    LDKnativeUpdateFailMalformedHTLC *inner;
7801    /**
7802     * Indicates that this is the only struct which contains the same pointer.
7803     * Rust functions which take ownership of an object provided via an argument require
7804     * this to be true and invalidate the object pointed to by inner.
7805     */
7806    bool is_owned;
7807 } LDKUpdateFailMalformedHTLC;
7808
7809 /**
7810  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
7811  * This corresponds to std::vector in C++
7812  */
7813 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
7814    /**
7815     * The elements in the array.
7816     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7817     */
7818    struct LDKUpdateFailMalformedHTLC *data;
7819    /**
7820     * The number of elements pointed to by `data`.
7821     */
7822    uintptr_t datalen;
7823 } LDKCVec_UpdateFailMalformedHTLCZ;
7824
7825 /**
7826  * The contents of CResult_AcceptChannelDecodeErrorZ
7827  */
7828 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
7829    /**
7830     * A pointer to the contents in the success state.
7831     * Reading from this pointer when `result_ok` is not set is undefined.
7832     */
7833    struct LDKAcceptChannel *result;
7834    /**
7835     * A pointer to the contents in the error state.
7836     * Reading from this pointer when `result_ok` is set is undefined.
7837     */
7838    struct LDKDecodeError *err;
7839 } LDKCResult_AcceptChannelDecodeErrorZPtr;
7840
7841 /**
7842  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
7843  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7844  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7845  */
7846 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
7847    /**
7848     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
7849     * `err` or `result` depending on the state of `result_ok`.
7850     */
7851    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
7852    /**
7853     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
7854     */
7855    bool result_ok;
7856 } LDKCResult_AcceptChannelDecodeErrorZ;
7857
7858 /**
7859  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
7860  */
7861 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
7862    /**
7863     * A pointer to the contents in the success state.
7864     * Reading from this pointer when `result_ok` is not set is undefined.
7865     */
7866    struct LDKAnnouncementSignatures *result;
7867    /**
7868     * A pointer to the contents in the error state.
7869     * Reading from this pointer when `result_ok` is set is undefined.
7870     */
7871    struct LDKDecodeError *err;
7872 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
7873
7874 /**
7875  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
7876  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
7877  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878  */
7879 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
7880    /**
7881     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
7882     * `err` or `result` depending on the state of `result_ok`.
7883     */
7884    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
7885    /**
7886     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
7887     */
7888    bool result_ok;
7889 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
7890
7891 /**
7892  * The contents of CResult_ChannelReestablishDecodeErrorZ
7893  */
7894 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
7895    /**
7896     * A pointer to the contents in the success state.
7897     * Reading from this pointer when `result_ok` is not set is undefined.
7898     */
7899    struct LDKChannelReestablish *result;
7900    /**
7901     * A pointer to the contents in the error state.
7902     * Reading from this pointer when `result_ok` is set is undefined.
7903     */
7904    struct LDKDecodeError *err;
7905 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
7906
7907 /**
7908  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
7909  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
7910  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7911  */
7912 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
7913    /**
7914     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
7915     * `err` or `result` depending on the state of `result_ok`.
7916     */
7917    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
7918    /**
7919     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
7920     */
7921    bool result_ok;
7922 } LDKCResult_ChannelReestablishDecodeErrorZ;
7923
7924 /**
7925  * The contents of CResult_ClosingSignedDecodeErrorZ
7926  */
7927 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
7928    /**
7929     * A pointer to the contents in the success state.
7930     * Reading from this pointer when `result_ok` is not set is undefined.
7931     */
7932    struct LDKClosingSigned *result;
7933    /**
7934     * A pointer to the contents in the error state.
7935     * Reading from this pointer when `result_ok` is set is undefined.
7936     */
7937    struct LDKDecodeError *err;
7938 } LDKCResult_ClosingSignedDecodeErrorZPtr;
7939
7940 /**
7941  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
7942  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7944  */
7945 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
7946    /**
7947     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
7948     * `err` or `result` depending on the state of `result_ok`.
7949     */
7950    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
7951    /**
7952     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
7953     */
7954    bool result_ok;
7955 } LDKCResult_ClosingSignedDecodeErrorZ;
7956
7957
7958
7959 /**
7960  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
7961  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
7962  * to use.
7963  */
7964 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
7965    /**
7966     * A pointer to the opaque Rust object.
7967     * Nearly everywhere, inner must be non-null, however in places where
7968     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7969     */
7970    LDKnativeClosingSignedFeeRange *inner;
7971    /**
7972     * Indicates that this is the only struct which contains the same pointer.
7973     * Rust functions which take ownership of an object provided via an argument require
7974     * this to be true and invalidate the object pointed to by inner.
7975     */
7976    bool is_owned;
7977 } LDKClosingSignedFeeRange;
7978
7979 /**
7980  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
7981  */
7982 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
7983    /**
7984     * A pointer to the contents in the success state.
7985     * Reading from this pointer when `result_ok` is not set is undefined.
7986     */
7987    struct LDKClosingSignedFeeRange *result;
7988    /**
7989     * A pointer to the contents in the error state.
7990     * Reading from this pointer when `result_ok` is set is undefined.
7991     */
7992    struct LDKDecodeError *err;
7993 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
7994
7995 /**
7996  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
7997  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7999  */
8000 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
8001    /**
8002     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8003     * `err` or `result` depending on the state of `result_ok`.
8004     */
8005    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
8006    /**
8007     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8008     */
8009    bool result_ok;
8010 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
8011
8012
8013
8014 /**
8015  * A commitment_signed message to be sent or received from a peer
8016  */
8017 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
8018    /**
8019     * A pointer to the opaque Rust object.
8020     * Nearly everywhere, inner must be non-null, however in places where
8021     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8022     */
8023    LDKnativeCommitmentSigned *inner;
8024    /**
8025     * Indicates that this is the only struct which contains the same pointer.
8026     * Rust functions which take ownership of an object provided via an argument require
8027     * this to be true and invalidate the object pointed to by inner.
8028     */
8029    bool is_owned;
8030 } LDKCommitmentSigned;
8031
8032 /**
8033  * The contents of CResult_CommitmentSignedDecodeErrorZ
8034  */
8035 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
8036    /**
8037     * A pointer to the contents in the success state.
8038     * Reading from this pointer when `result_ok` is not set is undefined.
8039     */
8040    struct LDKCommitmentSigned *result;
8041    /**
8042     * A pointer to the contents in the error state.
8043     * Reading from this pointer when `result_ok` is set is undefined.
8044     */
8045    struct LDKDecodeError *err;
8046 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
8047
8048 /**
8049  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8050  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8051  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8052  */
8053 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
8054    /**
8055     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8056     * `err` or `result` depending on the state of `result_ok`.
8057     */
8058    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
8059    /**
8060     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8061     */
8062    bool result_ok;
8063 } LDKCResult_CommitmentSignedDecodeErrorZ;
8064
8065 /**
8066  * The contents of CResult_FundingCreatedDecodeErrorZ
8067  */
8068 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
8069    /**
8070     * A pointer to the contents in the success state.
8071     * Reading from this pointer when `result_ok` is not set is undefined.
8072     */
8073    struct LDKFundingCreated *result;
8074    /**
8075     * A pointer to the contents in the error state.
8076     * Reading from this pointer when `result_ok` is set is undefined.
8077     */
8078    struct LDKDecodeError *err;
8079 } LDKCResult_FundingCreatedDecodeErrorZPtr;
8080
8081 /**
8082  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8083  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8085  */
8086 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
8087    /**
8088     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8089     * `err` or `result` depending on the state of `result_ok`.
8090     */
8091    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
8092    /**
8093     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8094     */
8095    bool result_ok;
8096 } LDKCResult_FundingCreatedDecodeErrorZ;
8097
8098 /**
8099  * The contents of CResult_FundingSignedDecodeErrorZ
8100  */
8101 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
8102    /**
8103     * A pointer to the contents in the success state.
8104     * Reading from this pointer when `result_ok` is not set is undefined.
8105     */
8106    struct LDKFundingSigned *result;
8107    /**
8108     * A pointer to the contents in the error state.
8109     * Reading from this pointer when `result_ok` is set is undefined.
8110     */
8111    struct LDKDecodeError *err;
8112 } LDKCResult_FundingSignedDecodeErrorZPtr;
8113
8114 /**
8115  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8116  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8117  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8118  */
8119 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
8120    /**
8121     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8122     * `err` or `result` depending on the state of `result_ok`.
8123     */
8124    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
8125    /**
8126     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8127     */
8128    bool result_ok;
8129 } LDKCResult_FundingSignedDecodeErrorZ;
8130
8131 /**
8132  * The contents of CResult_FundingLockedDecodeErrorZ
8133  */
8134 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
8135    /**
8136     * A pointer to the contents in the success state.
8137     * Reading from this pointer when `result_ok` is not set is undefined.
8138     */
8139    struct LDKFundingLocked *result;
8140    /**
8141     * A pointer to the contents in the error state.
8142     * Reading from this pointer when `result_ok` is set is undefined.
8143     */
8144    struct LDKDecodeError *err;
8145 } LDKCResult_FundingLockedDecodeErrorZPtr;
8146
8147 /**
8148  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8149  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8150  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8151  */
8152 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
8153    /**
8154     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8155     * `err` or `result` depending on the state of `result_ok`.
8156     */
8157    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
8158    /**
8159     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8160     */
8161    bool result_ok;
8162 } LDKCResult_FundingLockedDecodeErrorZ;
8163
8164
8165
8166 /**
8167  * An init message to be sent or received from a peer
8168  */
8169 typedef struct MUST_USE_STRUCT LDKInit {
8170    /**
8171     * A pointer to the opaque Rust object.
8172     * Nearly everywhere, inner must be non-null, however in places where
8173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8174     */
8175    LDKnativeInit *inner;
8176    /**
8177     * Indicates that this is the only struct which contains the same pointer.
8178     * Rust functions which take ownership of an object provided via an argument require
8179     * this to be true and invalidate the object pointed to by inner.
8180     */
8181    bool is_owned;
8182 } LDKInit;
8183
8184 /**
8185  * The contents of CResult_InitDecodeErrorZ
8186  */
8187 typedef union LDKCResult_InitDecodeErrorZPtr {
8188    /**
8189     * A pointer to the contents in the success state.
8190     * Reading from this pointer when `result_ok` is not set is undefined.
8191     */
8192    struct LDKInit *result;
8193    /**
8194     * A pointer to the contents in the error state.
8195     * Reading from this pointer when `result_ok` is set is undefined.
8196     */
8197    struct LDKDecodeError *err;
8198 } LDKCResult_InitDecodeErrorZPtr;
8199
8200 /**
8201  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8202  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8204  */
8205 typedef struct LDKCResult_InitDecodeErrorZ {
8206    /**
8207     * The contents of this CResult_InitDecodeErrorZ, accessible via either
8208     * `err` or `result` depending on the state of `result_ok`.
8209     */
8210    union LDKCResult_InitDecodeErrorZPtr contents;
8211    /**
8212     * Whether this CResult_InitDecodeErrorZ represents a success state.
8213     */
8214    bool result_ok;
8215 } LDKCResult_InitDecodeErrorZ;
8216
8217 /**
8218  * The contents of CResult_OpenChannelDecodeErrorZ
8219  */
8220 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
8221    /**
8222     * A pointer to the contents in the success state.
8223     * Reading from this pointer when `result_ok` is not set is undefined.
8224     */
8225    struct LDKOpenChannel *result;
8226    /**
8227     * A pointer to the contents in the error state.
8228     * Reading from this pointer when `result_ok` is set is undefined.
8229     */
8230    struct LDKDecodeError *err;
8231 } LDKCResult_OpenChannelDecodeErrorZPtr;
8232
8233 /**
8234  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8235  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8237  */
8238 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
8239    /**
8240     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8241     * `err` or `result` depending on the state of `result_ok`.
8242     */
8243    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
8244    /**
8245     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8246     */
8247    bool result_ok;
8248 } LDKCResult_OpenChannelDecodeErrorZ;
8249
8250 /**
8251  * The contents of CResult_RevokeAndACKDecodeErrorZ
8252  */
8253 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
8254    /**
8255     * A pointer to the contents in the success state.
8256     * Reading from this pointer when `result_ok` is not set is undefined.
8257     */
8258    struct LDKRevokeAndACK *result;
8259    /**
8260     * A pointer to the contents in the error state.
8261     * Reading from this pointer when `result_ok` is set is undefined.
8262     */
8263    struct LDKDecodeError *err;
8264 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
8265
8266 /**
8267  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
8268  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
8269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8270  */
8271 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
8272    /**
8273     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
8274     * `err` or `result` depending on the state of `result_ok`.
8275     */
8276    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
8277    /**
8278     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
8279     */
8280    bool result_ok;
8281 } LDKCResult_RevokeAndACKDecodeErrorZ;
8282
8283 /**
8284  * The contents of CResult_ShutdownDecodeErrorZ
8285  */
8286 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
8287    /**
8288     * A pointer to the contents in the success state.
8289     * Reading from this pointer when `result_ok` is not set is undefined.
8290     */
8291    struct LDKShutdown *result;
8292    /**
8293     * A pointer to the contents in the error state.
8294     * Reading from this pointer when `result_ok` is set is undefined.
8295     */
8296    struct LDKDecodeError *err;
8297 } LDKCResult_ShutdownDecodeErrorZPtr;
8298
8299 /**
8300  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
8301  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
8302  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8303  */
8304 typedef struct LDKCResult_ShutdownDecodeErrorZ {
8305    /**
8306     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
8307     * `err` or `result` depending on the state of `result_ok`.
8308     */
8309    union LDKCResult_ShutdownDecodeErrorZPtr contents;
8310    /**
8311     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
8312     */
8313    bool result_ok;
8314 } LDKCResult_ShutdownDecodeErrorZ;
8315
8316 /**
8317  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
8318  */
8319 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
8320    /**
8321     * A pointer to the contents in the success state.
8322     * Reading from this pointer when `result_ok` is not set is undefined.
8323     */
8324    struct LDKUpdateFailHTLC *result;
8325    /**
8326     * A pointer to the contents in the error state.
8327     * Reading from this pointer when `result_ok` is set is undefined.
8328     */
8329    struct LDKDecodeError *err;
8330 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
8331
8332 /**
8333  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
8334  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8336  */
8337 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
8338    /**
8339     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
8340     * `err` or `result` depending on the state of `result_ok`.
8341     */
8342    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
8343    /**
8344     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
8345     */
8346    bool result_ok;
8347 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
8348
8349 /**
8350  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
8351  */
8352 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
8353    /**
8354     * A pointer to the contents in the success state.
8355     * Reading from this pointer when `result_ok` is not set is undefined.
8356     */
8357    struct LDKUpdateFailMalformedHTLC *result;
8358    /**
8359     * A pointer to the contents in the error state.
8360     * Reading from this pointer when `result_ok` is set is undefined.
8361     */
8362    struct LDKDecodeError *err;
8363 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
8364
8365 /**
8366  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
8367  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8368  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8369  */
8370 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
8371    /**
8372     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
8373     * `err` or `result` depending on the state of `result_ok`.
8374     */
8375    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
8376    /**
8377     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
8378     */
8379    bool result_ok;
8380 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
8381
8382
8383
8384 /**
8385  * An update_fee message to be sent or received from a peer
8386  */
8387 typedef struct MUST_USE_STRUCT LDKUpdateFee {
8388    /**
8389     * A pointer to the opaque Rust object.
8390     * Nearly everywhere, inner must be non-null, however in places where
8391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8392     */
8393    LDKnativeUpdateFee *inner;
8394    /**
8395     * Indicates that this is the only struct which contains the same pointer.
8396     * Rust functions which take ownership of an object provided via an argument require
8397     * this to be true and invalidate the object pointed to by inner.
8398     */
8399    bool is_owned;
8400 } LDKUpdateFee;
8401
8402 /**
8403  * The contents of CResult_UpdateFeeDecodeErrorZ
8404  */
8405 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
8406    /**
8407     * A pointer to the contents in the success state.
8408     * Reading from this pointer when `result_ok` is not set is undefined.
8409     */
8410    struct LDKUpdateFee *result;
8411    /**
8412     * A pointer to the contents in the error state.
8413     * Reading from this pointer when `result_ok` is set is undefined.
8414     */
8415    struct LDKDecodeError *err;
8416 } LDKCResult_UpdateFeeDecodeErrorZPtr;
8417
8418 /**
8419  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
8420  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
8421  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8422  */
8423 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
8424    /**
8425     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
8426     * `err` or `result` depending on the state of `result_ok`.
8427     */
8428    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
8429    /**
8430     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
8431     */
8432    bool result_ok;
8433 } LDKCResult_UpdateFeeDecodeErrorZ;
8434
8435 /**
8436  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
8437  */
8438 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
8439    /**
8440     * A pointer to the contents in the success state.
8441     * Reading from this pointer when `result_ok` is not set is undefined.
8442     */
8443    struct LDKUpdateFulfillHTLC *result;
8444    /**
8445     * A pointer to the contents in the error state.
8446     * Reading from this pointer when `result_ok` is set is undefined.
8447     */
8448    struct LDKDecodeError *err;
8449 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
8450
8451 /**
8452  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
8453  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8454  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8455  */
8456 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
8457    /**
8458     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
8459     * `err` or `result` depending on the state of `result_ok`.
8460     */
8461    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
8462    /**
8463     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
8464     */
8465    bool result_ok;
8466 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
8467
8468 /**
8469  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
8470  */
8471 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
8472    /**
8473     * A pointer to the contents in the success state.
8474     * Reading from this pointer when `result_ok` is not set is undefined.
8475     */
8476    struct LDKUpdateAddHTLC *result;
8477    /**
8478     * A pointer to the contents in the error state.
8479     * Reading from this pointer when `result_ok` is set is undefined.
8480     */
8481    struct LDKDecodeError *err;
8482 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
8483
8484 /**
8485  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
8486  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8488  */
8489 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
8490    /**
8491     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
8492     * `err` or `result` depending on the state of `result_ok`.
8493     */
8494    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
8495    /**
8496     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
8497     */
8498    bool result_ok;
8499 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
8500
8501
8502
8503 /**
8504  * A ping message to be sent or received from a peer
8505  */
8506 typedef struct MUST_USE_STRUCT LDKPing {
8507    /**
8508     * A pointer to the opaque Rust object.
8509     * Nearly everywhere, inner must be non-null, however in places where
8510     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8511     */
8512    LDKnativePing *inner;
8513    /**
8514     * Indicates that this is the only struct which contains the same pointer.
8515     * Rust functions which take ownership of an object provided via an argument require
8516     * this to be true and invalidate the object pointed to by inner.
8517     */
8518    bool is_owned;
8519 } LDKPing;
8520
8521 /**
8522  * The contents of CResult_PingDecodeErrorZ
8523  */
8524 typedef union LDKCResult_PingDecodeErrorZPtr {
8525    /**
8526     * A pointer to the contents in the success state.
8527     * Reading from this pointer when `result_ok` is not set is undefined.
8528     */
8529    struct LDKPing *result;
8530    /**
8531     * A pointer to the contents in the error state.
8532     * Reading from this pointer when `result_ok` is set is undefined.
8533     */
8534    struct LDKDecodeError *err;
8535 } LDKCResult_PingDecodeErrorZPtr;
8536
8537 /**
8538  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
8539  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
8540  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8541  */
8542 typedef struct LDKCResult_PingDecodeErrorZ {
8543    /**
8544     * The contents of this CResult_PingDecodeErrorZ, accessible via either
8545     * `err` or `result` depending on the state of `result_ok`.
8546     */
8547    union LDKCResult_PingDecodeErrorZPtr contents;
8548    /**
8549     * Whether this CResult_PingDecodeErrorZ represents a success state.
8550     */
8551    bool result_ok;
8552 } LDKCResult_PingDecodeErrorZ;
8553
8554
8555
8556 /**
8557  * A pong message to be sent or received from a peer
8558  */
8559 typedef struct MUST_USE_STRUCT LDKPong {
8560    /**
8561     * A pointer to the opaque Rust object.
8562     * Nearly everywhere, inner must be non-null, however in places where
8563     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8564     */
8565    LDKnativePong *inner;
8566    /**
8567     * Indicates that this is the only struct which contains the same pointer.
8568     * Rust functions which take ownership of an object provided via an argument require
8569     * this to be true and invalidate the object pointed to by inner.
8570     */
8571    bool is_owned;
8572 } LDKPong;
8573
8574 /**
8575  * The contents of CResult_PongDecodeErrorZ
8576  */
8577 typedef union LDKCResult_PongDecodeErrorZPtr {
8578    /**
8579     * A pointer to the contents in the success state.
8580     * Reading from this pointer when `result_ok` is not set is undefined.
8581     */
8582    struct LDKPong *result;
8583    /**
8584     * A pointer to the contents in the error state.
8585     * Reading from this pointer when `result_ok` is set is undefined.
8586     */
8587    struct LDKDecodeError *err;
8588 } LDKCResult_PongDecodeErrorZPtr;
8589
8590 /**
8591  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
8592  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
8593  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8594  */
8595 typedef struct LDKCResult_PongDecodeErrorZ {
8596    /**
8597     * The contents of this CResult_PongDecodeErrorZ, accessible via either
8598     * `err` or `result` depending on the state of `result_ok`.
8599     */
8600    union LDKCResult_PongDecodeErrorZPtr contents;
8601    /**
8602     * Whether this CResult_PongDecodeErrorZ represents a success state.
8603     */
8604    bool result_ok;
8605 } LDKCResult_PongDecodeErrorZ;
8606
8607 /**
8608  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
8609  */
8610 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8611    /**
8612     * A pointer to the contents in the success state.
8613     * Reading from this pointer when `result_ok` is not set is undefined.
8614     */
8615    struct LDKUnsignedChannelAnnouncement *result;
8616    /**
8617     * A pointer to the contents in the error state.
8618     * Reading from this pointer when `result_ok` is set is undefined.
8619     */
8620    struct LDKDecodeError *err;
8621 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
8622
8623 /**
8624  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8625  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8626  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8627  */
8628 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
8629    /**
8630     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
8631     * `err` or `result` depending on the state of `result_ok`.
8632     */
8633    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
8634    /**
8635     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
8636     */
8637    bool result_ok;
8638 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
8639
8640 /**
8641  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
8642  */
8643 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
8644    /**
8645     * A pointer to the contents in the success state.
8646     * Reading from this pointer when `result_ok` is not set is undefined.
8647     */
8648    struct LDKChannelAnnouncement *result;
8649    /**
8650     * A pointer to the contents in the error state.
8651     * Reading from this pointer when `result_ok` is set is undefined.
8652     */
8653    struct LDKDecodeError *err;
8654 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
8655
8656 /**
8657  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8658  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8660  */
8661 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
8662    /**
8663     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8664     * `err` or `result` depending on the state of `result_ok`.
8665     */
8666    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
8667    /**
8668     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8669     */
8670    bool result_ok;
8671 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
8672
8673
8674
8675 /**
8676  * The unsigned part of a channel_update
8677  */
8678 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8679    /**
8680     * A pointer to the opaque Rust object.
8681     * Nearly everywhere, inner must be non-null, however in places where
8682     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8683     */
8684    LDKnativeUnsignedChannelUpdate *inner;
8685    /**
8686     * Indicates that this is the only struct which contains the same pointer.
8687     * Rust functions which take ownership of an object provided via an argument require
8688     * this to be true and invalidate the object pointed to by inner.
8689     */
8690    bool is_owned;
8691 } LDKUnsignedChannelUpdate;
8692
8693 /**
8694  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8695  */
8696 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
8697    /**
8698     * A pointer to the contents in the success state.
8699     * Reading from this pointer when `result_ok` is not set is undefined.
8700     */
8701    struct LDKUnsignedChannelUpdate *result;
8702    /**
8703     * A pointer to the contents in the error state.
8704     * Reading from this pointer when `result_ok` is set is undefined.
8705     */
8706    struct LDKDecodeError *err;
8707 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
8708
8709 /**
8710  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8711  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8713  */
8714 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
8715    /**
8716     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8717     * `err` or `result` depending on the state of `result_ok`.
8718     */
8719    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
8720    /**
8721     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8722     */
8723    bool result_ok;
8724 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
8725
8726 /**
8727  * The contents of CResult_ChannelUpdateDecodeErrorZ
8728  */
8729 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
8730    /**
8731     * A pointer to the contents in the success state.
8732     * Reading from this pointer when `result_ok` is not set is undefined.
8733     */
8734    struct LDKChannelUpdate *result;
8735    /**
8736     * A pointer to the contents in the error state.
8737     * Reading from this pointer when `result_ok` is set is undefined.
8738     */
8739    struct LDKDecodeError *err;
8740 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
8741
8742 /**
8743  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8744  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8745  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8746  */
8747 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
8748    /**
8749     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8750     * `err` or `result` depending on the state of `result_ok`.
8751     */
8752    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
8753    /**
8754     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8755     */
8756    bool result_ok;
8757 } LDKCResult_ChannelUpdateDecodeErrorZ;
8758
8759 /**
8760  * The contents of CResult_ErrorMessageDecodeErrorZ
8761  */
8762 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
8763    /**
8764     * A pointer to the contents in the success state.
8765     * Reading from this pointer when `result_ok` is not set is undefined.
8766     */
8767    struct LDKErrorMessage *result;
8768    /**
8769     * A pointer to the contents in the error state.
8770     * Reading from this pointer when `result_ok` is set is undefined.
8771     */
8772    struct LDKDecodeError *err;
8773 } LDKCResult_ErrorMessageDecodeErrorZPtr;
8774
8775 /**
8776  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8777  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8779  */
8780 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
8781    /**
8782     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8783     * `err` or `result` depending on the state of `result_ok`.
8784     */
8785    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
8786    /**
8787     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8788     */
8789    bool result_ok;
8790 } LDKCResult_ErrorMessageDecodeErrorZ;
8791
8792
8793
8794 /**
8795  * The unsigned part of a node_announcement
8796  */
8797 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8798    /**
8799     * A pointer to the opaque Rust object.
8800     * Nearly everywhere, inner must be non-null, however in places where
8801     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8802     */
8803    LDKnativeUnsignedNodeAnnouncement *inner;
8804    /**
8805     * Indicates that this is the only struct which contains the same pointer.
8806     * Rust functions which take ownership of an object provided via an argument require
8807     * this to be true and invalidate the object pointed to by inner.
8808     */
8809    bool is_owned;
8810 } LDKUnsignedNodeAnnouncement;
8811
8812 /**
8813  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8814  */
8815 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8816    /**
8817     * A pointer to the contents in the success state.
8818     * Reading from this pointer when `result_ok` is not set is undefined.
8819     */
8820    struct LDKUnsignedNodeAnnouncement *result;
8821    /**
8822     * A pointer to the contents in the error state.
8823     * Reading from this pointer when `result_ok` is set is undefined.
8824     */
8825    struct LDKDecodeError *err;
8826 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
8827
8828 /**
8829  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8830  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8831  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8832  */
8833 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
8834    /**
8835     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8836     * `err` or `result` depending on the state of `result_ok`.
8837     */
8838    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
8839    /**
8840     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8841     */
8842    bool result_ok;
8843 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
8844
8845 /**
8846  * The contents of CResult_NodeAnnouncementDecodeErrorZ
8847  */
8848 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
8849    /**
8850     * A pointer to the contents in the success state.
8851     * Reading from this pointer when `result_ok` is not set is undefined.
8852     */
8853    struct LDKNodeAnnouncement *result;
8854    /**
8855     * A pointer to the contents in the error state.
8856     * Reading from this pointer when `result_ok` is set is undefined.
8857     */
8858    struct LDKDecodeError *err;
8859 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
8860
8861 /**
8862  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8863  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8864  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8865  */
8866 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
8867    /**
8868     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8869     * `err` or `result` depending on the state of `result_ok`.
8870     */
8871    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
8872    /**
8873     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8874     */
8875    bool result_ok;
8876 } LDKCResult_NodeAnnouncementDecodeErrorZ;
8877
8878 /**
8879  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8880  */
8881 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
8882    /**
8883     * A pointer to the contents in the success state.
8884     * Reading from this pointer when `result_ok` is not set is undefined.
8885     */
8886    struct LDKQueryShortChannelIds *result;
8887    /**
8888     * A pointer to the contents in the error state.
8889     * Reading from this pointer when `result_ok` is set is undefined.
8890     */
8891    struct LDKDecodeError *err;
8892 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
8893
8894 /**
8895  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8896  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8897  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8898  */
8899 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
8900    /**
8901     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8902     * `err` or `result` depending on the state of `result_ok`.
8903     */
8904    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
8905    /**
8906     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8907     */
8908    bool result_ok;
8909 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
8910
8911
8912
8913 /**
8914  * A reply_short_channel_ids_end message is sent as a reply to a
8915  * query_short_channel_ids message. The query recipient makes a best
8916  * effort to respond based on their local network view which may not be
8917  * a perfect view of the network.
8918  */
8919 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
8920    /**
8921     * A pointer to the opaque Rust object.
8922     * Nearly everywhere, inner must be non-null, however in places where
8923     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8924     */
8925    LDKnativeReplyShortChannelIdsEnd *inner;
8926    /**
8927     * Indicates that this is the only struct which contains the same pointer.
8928     * Rust functions which take ownership of an object provided via an argument require
8929     * this to be true and invalidate the object pointed to by inner.
8930     */
8931    bool is_owned;
8932 } LDKReplyShortChannelIdsEnd;
8933
8934 /**
8935  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8936  */
8937 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8938    /**
8939     * A pointer to the contents in the success state.
8940     * Reading from this pointer when `result_ok` is not set is undefined.
8941     */
8942    struct LDKReplyShortChannelIdsEnd *result;
8943    /**
8944     * A pointer to the contents in the error state.
8945     * Reading from this pointer when `result_ok` is set is undefined.
8946     */
8947    struct LDKDecodeError *err;
8948 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
8949
8950 /**
8951  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8952  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8954  */
8955 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
8956    /**
8957     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8958     * `err` or `result` depending on the state of `result_ok`.
8959     */
8960    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
8961    /**
8962     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8963     */
8964    bool result_ok;
8965 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
8966
8967 /**
8968  * The contents of CResult_QueryChannelRangeDecodeErrorZ
8969  */
8970 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
8971    /**
8972     * A pointer to the contents in the success state.
8973     * Reading from this pointer when `result_ok` is not set is undefined.
8974     */
8975    struct LDKQueryChannelRange *result;
8976    /**
8977     * A pointer to the contents in the error state.
8978     * Reading from this pointer when `result_ok` is set is undefined.
8979     */
8980    struct LDKDecodeError *err;
8981 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
8982
8983 /**
8984  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8985  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8986  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8987  */
8988 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
8989    /**
8990     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8991     * `err` or `result` depending on the state of `result_ok`.
8992     */
8993    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
8994    /**
8995     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8996     */
8997    bool result_ok;
8998 } LDKCResult_QueryChannelRangeDecodeErrorZ;
8999
9000 /**
9001  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
9002  */
9003 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
9004    /**
9005     * A pointer to the contents in the success state.
9006     * Reading from this pointer when `result_ok` is not set is undefined.
9007     */
9008    struct LDKReplyChannelRange *result;
9009    /**
9010     * A pointer to the contents in the error state.
9011     * Reading from this pointer when `result_ok` is set is undefined.
9012     */
9013    struct LDKDecodeError *err;
9014 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
9015
9016 /**
9017  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
9018  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9019  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9020  */
9021 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
9022    /**
9023     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
9024     * `err` or `result` depending on the state of `result_ok`.
9025     */
9026    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
9027    /**
9028     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
9029     */
9030    bool result_ok;
9031 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
9032
9033
9034
9035 /**
9036  * A gossip_timestamp_filter message is used by a node to request
9037  * gossip relay for messages in the requested time range when the
9038  * gossip_queries feature has been negotiated.
9039  */
9040 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
9041    /**
9042     * A pointer to the opaque Rust object.
9043     * Nearly everywhere, inner must be non-null, however in places where
9044     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9045     */
9046    LDKnativeGossipTimestampFilter *inner;
9047    /**
9048     * Indicates that this is the only struct which contains the same pointer.
9049     * Rust functions which take ownership of an object provided via an argument require
9050     * this to be true and invalidate the object pointed to by inner.
9051     */
9052    bool is_owned;
9053 } LDKGossipTimestampFilter;
9054
9055 /**
9056  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
9057  */
9058 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
9059    /**
9060     * A pointer to the contents in the success state.
9061     * Reading from this pointer when `result_ok` is not set is undefined.
9062     */
9063    struct LDKGossipTimestampFilter *result;
9064    /**
9065     * A pointer to the contents in the error state.
9066     * Reading from this pointer when `result_ok` is set is undefined.
9067     */
9068    struct LDKDecodeError *err;
9069 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
9070
9071 /**
9072  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
9073  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
9074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9075  */
9076 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
9077    /**
9078     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
9079     * `err` or `result` depending on the state of `result_ok`.
9080     */
9081    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
9082    /**
9083     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
9084     */
9085    bool result_ok;
9086 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
9087
9088 /**
9089  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
9090  * may occur.
9091  */
9092 typedef enum LDKSignOrCreationError_Tag {
9093    /**
9094     * An error occurred during signing
9095     */
9096    LDKSignOrCreationError_SignError,
9097    /**
9098     * An error occurred while building the transaction
9099     */
9100    LDKSignOrCreationError_CreationError,
9101    /**
9102     * Must be last for serialization purposes
9103     */
9104    LDKSignOrCreationError_Sentinel,
9105 } LDKSignOrCreationError_Tag;
9106
9107 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
9108    LDKSignOrCreationError_Tag tag;
9109    union {
9110       struct {
9111          enum LDKCreationError creation_error;
9112       };
9113    };
9114 } LDKSignOrCreationError;
9115
9116 /**
9117  * The contents of CResult_InvoiceSignOrCreationErrorZ
9118  */
9119 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
9120    /**
9121     * A pointer to the contents in the success state.
9122     * Reading from this pointer when `result_ok` is not set is undefined.
9123     */
9124    struct LDKInvoice *result;
9125    /**
9126     * A pointer to the contents in the error state.
9127     * Reading from this pointer when `result_ok` is set is undefined.
9128     */
9129    struct LDKSignOrCreationError *err;
9130 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
9131
9132 /**
9133  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9134  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9135  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9136  */
9137 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
9138    /**
9139     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9140     * `err` or `result` depending on the state of `result_ok`.
9141     */
9142    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
9143    /**
9144     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9145     */
9146    bool result_ok;
9147 } LDKCResult_InvoiceSignOrCreationErrorZ;
9148
9149
9150
9151 /**
9152  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
9153  *
9154  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
9155  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
9156  * the return value of [`Filter::register_output`].
9157  *
9158  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
9159  * may have been spent there. See [`Filter::register_output`] for details.
9160  *
9161  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
9162  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
9163  */
9164 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
9165    /**
9166     * A pointer to the opaque Rust object.
9167     * Nearly everywhere, inner must be non-null, however in places where
9168     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9169     */
9170    LDKnativeWatchedOutput *inner;
9171    /**
9172     * Indicates that this is the only struct which contains the same pointer.
9173     * Rust functions which take ownership of an object provided via an argument require
9174     * this to be true and invalidate the object pointed to by inner.
9175     */
9176    bool is_owned;
9177 } LDKWatchedOutput;
9178
9179 /**
9180  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
9181  * channels.
9182  *
9183  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
9184  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
9185  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
9186  * receiving full blocks from a chain source, any further filtering is unnecessary.
9187  *
9188  * After an output has been registered, subsequent block retrievals from the chain source must not
9189  * exclude any transactions matching the new criteria nor any in-block descendants of such
9190  * transactions.
9191  *
9192  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
9193  * should not block on I/O. Implementations should instead queue the newly monitored data to be
9194  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
9195  * invocation that has called the `Filter` must return [`TemporaryFailure`].
9196  *
9197  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
9198  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
9199  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
9200  */
9201 typedef struct LDKFilter {
9202    /**
9203     * An opaque pointer which is passed to your function implementations as an argument.
9204     * This has no meaning in the LDK, and can be NULL or any other value.
9205     */
9206    void *this_arg;
9207    /**
9208     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
9209     * a spending condition.
9210     */
9211    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
9212    /**
9213     * Registers interest in spends of a transaction output.
9214     *
9215     * Optionally, when `output.block_hash` is set, should return any transaction spending the
9216     * output that is found in the corresponding block along with its index.
9217     *
9218     * This return value is useful for Electrum clients in order to supply in-block descendant
9219     * transactions which otherwise were not included. This is not necessary for other clients if
9220     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
9221     * full block).
9222     */
9223    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
9224    /**
9225     * Frees any resources associated with this object given its this_arg pointer.
9226     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9227     */
9228    void (*free)(void *this_arg);
9229 } LDKFilter;
9230
9231 /**
9232  * An enum which can either contain a crate::lightning::chain::Filter or not
9233  */
9234 typedef enum LDKCOption_FilterZ_Tag {
9235    /**
9236     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
9237     */
9238    LDKCOption_FilterZ_Some,
9239    /**
9240     * When we're in this state, this COption_FilterZ contains nothing
9241     */
9242    LDKCOption_FilterZ_None,
9243    /**
9244     * Must be last for serialization purposes
9245     */
9246    LDKCOption_FilterZ_Sentinel,
9247 } LDKCOption_FilterZ_Tag;
9248
9249 typedef struct LDKCOption_FilterZ {
9250    LDKCOption_FilterZ_Tag tag;
9251    union {
9252       struct {
9253          struct LDKFilter some;
9254       };
9255    };
9256 } LDKCOption_FilterZ;
9257
9258
9259
9260 /**
9261  * A read-only reference to a current ChannelMonitor.
9262  *
9263  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
9264  * released.
9265  */
9266 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
9267    /**
9268     * A pointer to the opaque Rust object.
9269     * Nearly everywhere, inner must be non-null, however in places where
9270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9271     */
9272    LDKnativeLockedChannelMonitor *inner;
9273    /**
9274     * Indicates that this is the only struct which contains the same pointer.
9275     * Rust functions which take ownership of an object provided via an argument require
9276     * this to be true and invalidate the object pointed to by inner.
9277     */
9278    bool is_owned;
9279 } LDKLockedChannelMonitor;
9280
9281 /**
9282  * The contents of CResult_LockedChannelMonitorNoneZ
9283  */
9284 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
9285    /**
9286     * A pointer to the contents in the success state.
9287     * Reading from this pointer when `result_ok` is not set is undefined.
9288     */
9289    struct LDKLockedChannelMonitor *result;
9290    /**
9291     * Note that this value is always NULL, as there are no contents in the Err variant
9292     */
9293    void *err;
9294 } LDKCResult_LockedChannelMonitorNoneZPtr;
9295
9296 /**
9297  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
9298  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
9299  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9300  */
9301 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
9302    /**
9303     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
9304     * `err` or `result` depending on the state of `result_ok`.
9305     */
9306    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
9307    /**
9308     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
9309     */
9310    bool result_ok;
9311 } LDKCResult_LockedChannelMonitorNoneZ;
9312
9313 /**
9314  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
9315  * This corresponds to std::vector in C++
9316  */
9317 typedef struct LDKCVec_OutPointZ {
9318    /**
9319     * The elements in the array.
9320     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9321     */
9322    struct LDKOutPoint *data;
9323    /**
9324     * The number of elements pointed to by `data`.
9325     */
9326    uintptr_t datalen;
9327 } LDKCVec_OutPointZ;
9328
9329 /**
9330  * A trait indicating an object may generate message send events
9331  */
9332 typedef struct LDKMessageSendEventsProvider {
9333    /**
9334     * An opaque pointer which is passed to your function implementations as an argument.
9335     * This has no meaning in the LDK, and can be NULL or any other value.
9336     */
9337    void *this_arg;
9338    /**
9339     * Gets the list of pending events which were generated by previous actions, clearing the list
9340     * in the process.
9341     */
9342    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
9343    /**
9344     * Frees any resources associated with this object given its this_arg pointer.
9345     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9346     */
9347    void (*free)(void *this_arg);
9348 } LDKMessageSendEventsProvider;
9349
9350 /**
9351  * A trait implemented for objects handling events from [`EventsProvider`].
9352  */
9353 typedef struct LDKEventHandler {
9354    /**
9355     * An opaque pointer which is passed to your function implementations as an argument.
9356     * This has no meaning in the LDK, and can be NULL or any other value.
9357     */
9358    void *this_arg;
9359    /**
9360     * Handles the given [`Event`].
9361     *
9362     * See [`EventsProvider`] for details that must be considered when implementing this method.
9363     */
9364    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
9365    /**
9366     * Frees any resources associated with this object given its this_arg pointer.
9367     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9368     */
9369    void (*free)(void *this_arg);
9370 } LDKEventHandler;
9371
9372 /**
9373  * A trait indicating an object may generate events.
9374  *
9375  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
9376  *
9377  * # Requirements
9378  *
9379  * See [`process_pending_events`] for requirements around event processing.
9380  *
9381  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
9382  * event since the last invocation. The handler must either act upon the event immediately
9383  * or preserve it for later handling.
9384  *
9385  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
9386  * consult the provider's documentation on the implication of processing events and how a handler
9387  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
9388  * [`ChainMonitor::process_pending_events`]).
9389  *
9390  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
9391  * own type(s).
9392  *
9393  * [`process_pending_events`]: Self::process_pending_events
9394  * [`handle_event`]: EventHandler::handle_event
9395  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
9396  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
9397  */
9398 typedef struct LDKEventsProvider {
9399    /**
9400     * An opaque pointer which is passed to your function implementations as an argument.
9401     * This has no meaning in the LDK, and can be NULL or any other value.
9402     */
9403    void *this_arg;
9404    /**
9405     * Processes any events generated since the last call using the given event handler.
9406     *
9407     * Subsequent calls must only process new events. However, handlers must be capable of handling
9408     * duplicate events across process restarts. This may occur if the provider was recovered from
9409     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
9410     */
9411    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
9412    /**
9413     * Frees any resources associated with this object given its this_arg pointer.
9414     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9415     */
9416    void (*free)(void *this_arg);
9417 } LDKEventsProvider;
9418
9419
9420
9421 /**
9422  * Configuration we set when applicable.
9423  *
9424  * Default::default() provides sane defaults.
9425  */
9426 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
9427    /**
9428     * A pointer to the opaque Rust object.
9429     * Nearly everywhere, inner must be non-null, however in places where
9430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9431     */
9432    LDKnativeChannelHandshakeConfig *inner;
9433    /**
9434     * Indicates that this is the only struct which contains the same pointer.
9435     * Rust functions which take ownership of an object provided via an argument require
9436     * this to be true and invalidate the object pointed to by inner.
9437     */
9438    bool is_owned;
9439 } LDKChannelHandshakeConfig;
9440
9441
9442
9443 /**
9444  * Optional channel limits which are applied during channel creation.
9445  *
9446  * These limits are only applied to our counterparty's limits, not our own.
9447  *
9448  * Use 0/<type>::max_value() as appropriate to skip checking.
9449  *
9450  * Provides sane defaults for most configurations.
9451  *
9452  * Most additional limits are disabled except those with which specify a default in individual
9453  * field documentation. Note that this may result in barely-usable channels, but since they
9454  * are applied mostly only to incoming channels that's not much of a problem.
9455  */
9456 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
9457    /**
9458     * A pointer to the opaque Rust object.
9459     * Nearly everywhere, inner must be non-null, however in places where
9460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9461     */
9462    LDKnativeChannelHandshakeLimits *inner;
9463    /**
9464     * Indicates that this is the only struct which contains the same pointer.
9465     * Rust functions which take ownership of an object provided via an argument require
9466     * this to be true and invalidate the object pointed to by inner.
9467     */
9468    bool is_owned;
9469 } LDKChannelHandshakeLimits;
9470
9471
9472
9473 /**
9474  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
9475  *
9476  * Default::default() provides sane defaults for most configurations
9477  * (but currently with 0 relay fees!)
9478  */
9479 typedef struct MUST_USE_STRUCT LDKUserConfig {
9480    /**
9481     * A pointer to the opaque Rust object.
9482     * Nearly everywhere, inner must be non-null, however in places where
9483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9484     */
9485    LDKnativeUserConfig *inner;
9486    /**
9487     * Indicates that this is the only struct which contains the same pointer.
9488     * Rust functions which take ownership of an object provided via an argument require
9489     * this to be true and invalidate the object pointed to by inner.
9490     */
9491    bool is_owned;
9492 } LDKUserConfig;
9493
9494
9495
9496 /**
9497  * The best known block as identified by its hash and height.
9498  */
9499 typedef struct MUST_USE_STRUCT LDKBestBlock {
9500    /**
9501     * A pointer to the opaque Rust object.
9502     * Nearly everywhere, inner must be non-null, however in places where
9503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9504     */
9505    LDKnativeBestBlock *inner;
9506    /**
9507     * Indicates that this is the only struct which contains the same pointer.
9508     * Rust functions which take ownership of an object provided via an argument require
9509     * this to be true and invalidate the object pointed to by inner.
9510     */
9511    bool is_owned;
9512 } LDKBestBlock;
9513
9514 /**
9515  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
9516  * chain.
9517  *
9518  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
9519  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
9520  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
9521  * when needed.
9522  */
9523 typedef struct LDKListen {
9524    /**
9525     * An opaque pointer which is passed to your function implementations as an argument.
9526     * This has no meaning in the LDK, and can be NULL or any other value.
9527     */
9528    void *this_arg;
9529    /**
9530     * Notifies the listener that a block was added at the given height.
9531     */
9532    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
9533    /**
9534     * Notifies the listener that a block was removed at the given height.
9535     */
9536    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9537    /**
9538     * Frees any resources associated with this object given its this_arg pointer.
9539     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9540     */
9541    void (*free)(void *this_arg);
9542 } LDKListen;
9543
9544 /**
9545  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
9546  * unconfirmed during a chain reorganization.
9547  *
9548  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
9549  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
9550  * related to registered transactions and outputs. Upon notification, it would pass along the
9551  * matching transactions using this interface.
9552  *
9553  * # Use
9554  *
9555  * The intended use is as follows:
9556  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
9557  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
9558  *   that has been reorganized out of the chain.
9559  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
9560  *
9561  * # Order
9562  *
9563  * Clients must call these methods in chain order. Specifically:
9564  * - Transactions confirmed in a block must be given before transactions confirmed in a later
9565  *   block.
9566  * - Dependent transactions within the same block must be given in topological order, possibly in
9567  *   separate calls.
9568  * - Unconfirmed transactions must be given after the original confirmations and before any
9569  *   reconfirmation.
9570  *
9571  * See individual method documentation for further details.
9572  *
9573  * [`transactions_confirmed`]: Self::transactions_confirmed
9574  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9575  * [`best_block_updated`]: Self::best_block_updated
9576  * [`get_relevant_txids`]: Self::get_relevant_txids
9577  */
9578 typedef struct LDKConfirm {
9579    /**
9580     * An opaque pointer which is passed to your function implementations as an argument.
9581     * This has no meaning in the LDK, and can be NULL or any other value.
9582     */
9583    void *this_arg;
9584    /**
9585     * Processes transactions confirmed in a block with a given header and height.
9586     *
9587     * Should be called for any transactions registered by [`Filter::register_tx`] or any
9588     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
9589     * appearing in the same block do not need to be included in the same call; instead, multiple
9590     * calls with additional transactions may be made so long as they are made in [chain order].
9591     *
9592     * May be called before or after [`best_block_updated`] for the corresponding block. However,
9593     * in the event of a chain reorganization, it must not be called with a `header` that is no
9594     * longer in the chain as of the last call to [`best_block_updated`].
9595     *
9596     * [chain order]: Confirm#Order
9597     * [`best_block_updated`]: Self::best_block_updated
9598     */
9599    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
9600    /**
9601     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
9602     *
9603     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
9604     * reorganized out of the best chain. Once called, the given transaction should not be returned
9605     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
9606     *
9607     * [`get_relevant_txids`]: Self::get_relevant_txids
9608     * [`transactions_confirmed`]: Self::transactions_confirmed
9609     */
9610    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
9611    /**
9612     * Processes an update to the best header connected at the given height.
9613     *
9614     * Should be called when a new header is available but may be skipped for intermediary blocks
9615     * if they become available at the same time.
9616     */
9617    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9618    /**
9619     * Returns transactions that should be monitored for reorganization out of the chain.
9620     *
9621     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
9622     * confirmations to be safe from a chain reorganization. Should not include any transactions
9623     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
9624     *
9625     * May be called to determine the subset of transactions that must still be monitored for
9626     * reorganization. Will be idempotent between calls but may change as a result of calls to the
9627     * other interface methods. Thus, this is useful to determine which transactions may need to be
9628     * given to [`transaction_unconfirmed`].
9629     *
9630     * [`transactions_confirmed`]: Self::transactions_confirmed
9631     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9632     */
9633    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
9634    /**
9635     * Frees any resources associated with this object given its this_arg pointer.
9636     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9637     */
9638    void (*free)(void *this_arg);
9639 } LDKConfirm;
9640
9641
9642
9643 /**
9644  * An opaque identifier describing a specific [`Persist`] method call.
9645  */
9646 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
9647    /**
9648     * A pointer to the opaque Rust object.
9649     * Nearly everywhere, inner must be non-null, however in places where
9650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9651     */
9652    LDKnativeMonitorUpdateId *inner;
9653    /**
9654     * Indicates that this is the only struct which contains the same pointer.
9655     * Rust functions which take ownership of an object provided via an argument require
9656     * this to be true and invalidate the object pointed to by inner.
9657     */
9658    bool is_owned;
9659 } LDKMonitorUpdateId;
9660
9661 /**
9662  * `Persist` defines behavior for persisting channel monitors: this could mean
9663  * writing once to disk, and/or uploading to one or more backup services.
9664  *
9665  * Each method can return three possible values:
9666  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
9667  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
9668  *  * If persistence happens asynchronously, implementations should first ensure the
9669  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
9670  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
9671  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
9672  *    called with the corresponding [`MonitorUpdateId`].
9673  *
9674  *    Note that unlike the direct [`chain::Watch`] interface,
9675  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
9676  *
9677  *  * If persistence fails for some reason, implementations should return
9678  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
9679  *    closed without broadcasting the latest state. See
9680  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
9681  */
9682 typedef struct LDKPersist {
9683    /**
9684     * An opaque pointer which is passed to your function implementations as an argument.
9685     * This has no meaning in the LDK, and can be NULL or any other value.
9686     */
9687    void *this_arg;
9688    /**
9689     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
9690     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
9691     *
9692     * The data can be stored any way you want, but the identifier provided by LDK is the
9693     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
9694     * and the stored channel data). Note that you **must** persist every new monitor to disk.
9695     *
9696     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
9697     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
9698     *
9699     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
9700     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9701     *
9702     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9703     * [`Writeable::write`]: crate::util::ser::Writeable::write
9704     */
9705    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
9706    /**
9707     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
9708     * update.
9709     *
9710     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
9711     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
9712     * details.
9713     *
9714     * During blockchain synchronization operations, this may be called with no
9715     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
9716     * Note that after the full [`ChannelMonitor`] is persisted any previous
9717     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
9718     * applied to the persisted [`ChannelMonitor`] as they were already applied.
9719     *
9720     * If an implementer chooses to persist the updates only, they need to make
9721     * sure that all the updates are applied to the `ChannelMonitors` *before*
9722     * the set of channel monitors is given to the `ChannelManager`
9723     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
9724     * applying a monitor update to a monitor. If full `ChannelMonitors` are
9725     * persisted, then there is no need to persist individual updates.
9726     *
9727     * Note that there could be a performance tradeoff between persisting complete
9728     * channel monitors on every update vs. persisting only updates and applying
9729     * them in batches. The size of each monitor grows `O(number of state updates)`
9730     * whereas updates are small and `O(1)`.
9731     *
9732     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
9733     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
9734     *
9735     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
9736     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
9737     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
9738     *
9739     * [`Writeable::write`]: crate::util::ser::Writeable::write
9740     *
9741     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
9742     */
9743    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);
9744    /**
9745     * Frees any resources associated with this object given its this_arg pointer.
9746     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9747     */
9748    void (*free)(void *this_arg);
9749 } LDKPersist;
9750
9751
9752
9753 /**
9754  * An implementation of [`chain::Watch`] for monitoring channels.
9755  *
9756  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
9757  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
9758  * or used independently to monitor channels remotely. See the [module-level documentation] for
9759  * details.
9760  *
9761  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9762  * [module-level documentation]: crate::chain::chainmonitor
9763  */
9764 typedef struct MUST_USE_STRUCT LDKChainMonitor {
9765    /**
9766     * A pointer to the opaque Rust object.
9767     * Nearly everywhere, inner must be non-null, however in places where
9768     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9769     */
9770    LDKnativeChainMonitor *inner;
9771    /**
9772     * Indicates that this is the only struct which contains the same pointer.
9773     * Rust functions which take ownership of an object provided via an argument require
9774     * this to be true and invalidate the object pointed to by inner.
9775     */
9776    bool is_owned;
9777 } LDKChainMonitor;
9778
9779
9780
9781 /**
9782  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
9783  * and derives keys from that.
9784  *
9785  * Your node_id is seed/0'
9786  * ChannelMonitor closes may use seed/1'
9787  * Cooperative closes may use seed/2'
9788  * The two close keys may be needed to claim on-chain funds!
9789  */
9790 typedef struct MUST_USE_STRUCT LDKKeysManager {
9791    /**
9792     * A pointer to the opaque Rust object.
9793     * Nearly everywhere, inner must be non-null, however in places where
9794     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9795     */
9796    LDKnativeKeysManager *inner;
9797    /**
9798     * Indicates that this is the only struct which contains the same pointer.
9799     * Rust functions which take ownership of an object provided via an argument require
9800     * this to be true and invalidate the object pointed to by inner.
9801     */
9802    bool is_owned;
9803 } LDKKeysManager;
9804
9805
9806
9807 /**
9808  * Chain-related parameters used to construct a new `ChannelManager`.
9809  *
9810  * Typically, the block-specific parameters are derived from the best block hash for the network,
9811  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
9812  * are not needed when deserializing a previously constructed `ChannelManager`.
9813  */
9814 typedef struct MUST_USE_STRUCT LDKChainParameters {
9815    /**
9816     * A pointer to the opaque Rust object.
9817     * Nearly everywhere, inner must be non-null, however in places where
9818     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9819     */
9820    LDKnativeChainParameters *inner;
9821    /**
9822     * Indicates that this is the only struct which contains the same pointer.
9823     * Rust functions which take ownership of an object provided via an argument require
9824     * this to be true and invalidate the object pointed to by inner.
9825     */
9826    bool is_owned;
9827 } LDKChainParameters;
9828
9829
9830
9831 /**
9832  * Information needed for constructing an invoice route hint for this channel.
9833  */
9834 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
9835    /**
9836     * A pointer to the opaque Rust object.
9837     * Nearly everywhere, inner must be non-null, however in places where
9838     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9839     */
9840    LDKnativeCounterpartyForwardingInfo *inner;
9841    /**
9842     * Indicates that this is the only struct which contains the same pointer.
9843     * Rust functions which take ownership of an object provided via an argument require
9844     * this to be true and invalidate the object pointed to by inner.
9845     */
9846    bool is_owned;
9847 } LDKCounterpartyForwardingInfo;
9848
9849
9850
9851 /**
9852  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
9853  * to better separate parameters.
9854  */
9855 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
9856    /**
9857     * A pointer to the opaque Rust object.
9858     * Nearly everywhere, inner must be non-null, however in places where
9859     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9860     */
9861    LDKnativeChannelCounterparty *inner;
9862    /**
9863     * Indicates that this is the only struct which contains the same pointer.
9864     * Rust functions which take ownership of an object provided via an argument require
9865     * this to be true and invalidate the object pointed to by inner.
9866     */
9867    bool is_owned;
9868 } LDKChannelCounterparty;
9869
9870 /**
9871  * A 3-byte byte array.
9872  */
9873 typedef struct LDKThreeBytes {
9874    /**
9875     * The three bytes
9876     */
9877    uint8_t data[3];
9878 } LDKThreeBytes;
9879
9880 /**
9881  * A trait to describe an object which can receive channel messages.
9882  *
9883  * Messages MAY be called in parallel when they originate from different their_node_ids, however
9884  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
9885  */
9886 typedef struct LDKChannelMessageHandler {
9887    /**
9888     * An opaque pointer which is passed to your function implementations as an argument.
9889     * This has no meaning in the LDK, and can be NULL or any other value.
9890     */
9891    void *this_arg;
9892    /**
9893     * Handle an incoming open_channel message from the given peer.
9894     */
9895    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
9896    /**
9897     * Handle an incoming accept_channel message from the given peer.
9898     */
9899    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
9900    /**
9901     * Handle an incoming funding_created message from the given peer.
9902     */
9903    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
9904    /**
9905     * Handle an incoming funding_signed message from the given peer.
9906     */
9907    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
9908    /**
9909     * Handle an incoming funding_locked message from the given peer.
9910     */
9911    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
9912    /**
9913     * Handle an incoming shutdown message from the given peer.
9914     */
9915    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);
9916    /**
9917     * Handle an incoming closing_signed message from the given peer.
9918     */
9919    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
9920    /**
9921     * Handle an incoming update_add_htlc message from the given peer.
9922     */
9923    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
9924    /**
9925     * Handle an incoming update_fulfill_htlc message from the given peer.
9926     */
9927    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
9928    /**
9929     * Handle an incoming update_fail_htlc message from the given peer.
9930     */
9931    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
9932    /**
9933     * Handle an incoming update_fail_malformed_htlc message from the given peer.
9934     */
9935    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
9936    /**
9937     * Handle an incoming commitment_signed message from the given peer.
9938     */
9939    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
9940    /**
9941     * Handle an incoming revoke_and_ack message from the given peer.
9942     */
9943    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
9944    /**
9945     * Handle an incoming update_fee message from the given peer.
9946     */
9947    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
9948    /**
9949     * Handle an incoming announcement_signatures message from the given peer.
9950     */
9951    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
9952    /**
9953     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
9954     * is believed to be possible in the future (eg they're sending us messages we don't
9955     * understand or indicate they require unknown feature bits), no_connection_possible is set
9956     * and any outstanding channels should be failed.
9957     */
9958    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
9959    /**
9960     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
9961     */
9962    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
9963    /**
9964     * Handle an incoming channel_reestablish message from the given peer.
9965     */
9966    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
9967    /**
9968     * Handle an incoming channel update from the given peer.
9969     */
9970    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
9971    /**
9972     * Handle an incoming error message from the given peer.
9973     */
9974    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
9975    /**
9976     * Implementation of MessageSendEventsProvider for this object.
9977     */
9978    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
9979    /**
9980     * Frees any resources associated with this object given its this_arg pointer.
9981     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9982     */
9983    void (*free)(void *this_arg);
9984 } LDKChannelMessageHandler;
9985
9986
9987
9988 /**
9989  * Arguments for the creation of a ChannelManager that are not deserialized.
9990  *
9991  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
9992  * is:
9993  * 1) Deserialize all stored [`ChannelMonitor`]s.
9994  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
9995  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
9996  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
9997  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
9998  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
9999  *    same way you would handle a [`chain::Filter`] call using
10000  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
10001  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
10002  * 5) Disconnect/connect blocks on the [`ChannelManager`].
10003  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
10004  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
10005  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
10006  *    the next step.
10007  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
10008  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
10009  *
10010  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
10011  * call any other methods on the newly-deserialized [`ChannelManager`].
10012  *
10013  * Note that because some channels may be closed during deserialization, it is critical that you
10014  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
10015  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
10016  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
10017  * not force-close the same channels but consider them live), you may end up revoking a state for
10018  * which you've already broadcasted the transaction.
10019  *
10020  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
10021  */
10022 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
10023    /**
10024     * A pointer to the opaque Rust object.
10025     * Nearly everywhere, inner must be non-null, however in places where
10026     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10027     */
10028    LDKnativeChannelManagerReadArgs *inner;
10029    /**
10030     * Indicates that this is the only struct which contains the same pointer.
10031     * Rust functions which take ownership of an object provided via an argument require
10032     * this to be true and invalidate the object pointed to by inner.
10033     */
10034    bool is_owned;
10035 } LDKChannelManagerReadArgs;
10036
10037
10038
10039 /**
10040  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
10041  * This is used to convince the recipient that the channel is at a certain commitment
10042  * number even if they lost that data due to a local failure.  Of course, the peer may lie
10043  * and even later commitments may have been revoked.
10044  */
10045 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
10046    /**
10047     * A pointer to the opaque Rust object.
10048     * Nearly everywhere, inner must be non-null, however in places where
10049     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10050     */
10051    LDKnativeDataLossProtect *inner;
10052    /**
10053     * Indicates that this is the only struct which contains the same pointer.
10054     * Rust functions which take ownership of an object provided via an argument require
10055     * this to be true and invalidate the object pointed to by inner.
10056     */
10057    bool is_owned;
10058 } LDKDataLossProtect;
10059
10060 /**
10061  * A trait to describe an object which can receive routing messages.
10062  *
10063  * # Implementor DoS Warnings
10064  *
10065  * For `gossip_queries` messages there are potential DoS vectors when handling
10066  * inbound queries. Implementors using an on-disk network graph should be aware of
10067  * repeated disk I/O for queries accessing different parts of the network graph.
10068  */
10069 typedef struct LDKRoutingMessageHandler {
10070    /**
10071     * An opaque pointer which is passed to your function implementations as an argument.
10072     * This has no meaning in the LDK, and can be NULL or any other value.
10073     */
10074    void *this_arg;
10075    /**
10076     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
10077     * false or returning an Err otherwise.
10078     */
10079    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
10080    /**
10081     * Handle a channel_announcement message, returning true if it should be forwarded on, false
10082     * or returning an Err otherwise.
10083     */
10084    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
10085    /**
10086     * Handle an incoming channel_update message, returning true if it should be forwarded on,
10087     * false or returning an Err otherwise.
10088     */
10089    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
10090    /**
10091     * Gets a subset of the channel announcements and updates required to dump our routing table
10092     * to a remote node, starting at the short_channel_id indicated by starting_point and
10093     * including the batch_amount entries immediately higher in numerical value than starting_point.
10094     */
10095    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
10096    /**
10097     * Gets a subset of the node announcements required to dump our routing table to a remote node,
10098     * starting at the node *after* the provided publickey and including batch_amount entries
10099     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
10100     * If None is provided for starting_point, we start at the first node.
10101     *
10102     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
10103     */
10104    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
10105    /**
10106     * Called when a connection is established with a peer. This can be used to
10107     * perform routing table synchronization using a strategy defined by the
10108     * implementor.
10109     */
10110    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
10111    /**
10112     * Handles the reply of a query we initiated to learn about channels
10113     * for a given range of blocks. We can expect to receive one or more
10114     * replies to a single query.
10115     */
10116    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
10117    /**
10118     * Handles the reply of a query we initiated asking for routing gossip
10119     * messages for a list of channels. We should receive this message when
10120     * a node has completed its best effort to send us the pertaining routing
10121     * gossip messages.
10122     */
10123    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
10124    /**
10125     * Handles when a peer asks us to send a list of short_channel_ids
10126     * for the requested range of blocks.
10127     */
10128    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
10129    /**
10130     * Handles when a peer asks us to send routing gossip messages for a
10131     * list of short_channel_ids.
10132     */
10133    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
10134    /**
10135     * Implementation of MessageSendEventsProvider for this object.
10136     */
10137    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10138    /**
10139     * Frees any resources associated with this object given its this_arg pointer.
10140     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10141     */
10142    void (*free)(void *this_arg);
10143 } LDKRoutingMessageHandler;
10144
10145 /**
10146  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
10147  * decoders.
10148  */
10149 typedef struct LDKCustomMessageReader {
10150    /**
10151     * An opaque pointer which is passed to your function implementations as an argument.
10152     * This has no meaning in the LDK, and can be NULL or any other value.
10153     */
10154    void *this_arg;
10155    /**
10156     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
10157     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
10158     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
10159     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
10160     */
10161    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
10162    /**
10163     * Frees any resources associated with this object given its this_arg pointer.
10164     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10165     */
10166    void (*free)(void *this_arg);
10167 } LDKCustomMessageReader;
10168
10169 /**
10170  * Handler for BOLT1-compliant messages.
10171  */
10172 typedef struct LDKCustomMessageHandler {
10173    /**
10174     * An opaque pointer which is passed to your function implementations as an argument.
10175     * This has no meaning in the LDK, and can be NULL or any other value.
10176     */
10177    void *this_arg;
10178    /**
10179     * Called with the message type that was received and the buffer to be read.
10180     * Can return a `MessageHandlingError` if the message could not be handled.
10181     */
10182    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
10183    /**
10184     * Gets the list of pending messages which were generated by the custom message
10185     * handler, clearing the list in the process. The first tuple element must
10186     * correspond to the intended recipients node ids. If no connection to one of the
10187     * specified node does not exist, the message is simply not sent to it.
10188     */
10189    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
10190    /**
10191     * Implementation of CustomMessageReader for this object.
10192     */
10193    struct LDKCustomMessageReader CustomMessageReader;
10194    /**
10195     * Frees any resources associated with this object given its this_arg pointer.
10196     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10197     */
10198    void (*free)(void *this_arg);
10199 } LDKCustomMessageHandler;
10200
10201
10202
10203 /**
10204  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
10205  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
10206  */
10207 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
10208    /**
10209     * A pointer to the opaque Rust object.
10210     * Nearly everywhere, inner must be non-null, however in places where
10211     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10212     */
10213    LDKnativeIgnoringMessageHandler *inner;
10214    /**
10215     * Indicates that this is the only struct which contains the same pointer.
10216     * Rust functions which take ownership of an object provided via an argument require
10217     * this to be true and invalidate the object pointed to by inner.
10218     */
10219    bool is_owned;
10220 } LDKIgnoringMessageHandler;
10221
10222
10223
10224 /**
10225  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
10226  * You can provide one of these as the route_handler in a MessageHandler.
10227  */
10228 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
10229    /**
10230     * A pointer to the opaque Rust object.
10231     * Nearly everywhere, inner must be non-null, however in places where
10232     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10233     */
10234    LDKnativeErroringMessageHandler *inner;
10235    /**
10236     * Indicates that this is the only struct which contains the same pointer.
10237     * Rust functions which take ownership of an object provided via an argument require
10238     * this to be true and invalidate the object pointed to by inner.
10239     */
10240    bool is_owned;
10241 } LDKErroringMessageHandler;
10242
10243
10244
10245 /**
10246  * Provides references to trait impls which handle different types of messages.
10247  */
10248 typedef struct MUST_USE_STRUCT LDKMessageHandler {
10249    /**
10250     * A pointer to the opaque Rust object.
10251     * Nearly everywhere, inner must be non-null, however in places where
10252     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10253     */
10254    LDKnativeMessageHandler *inner;
10255    /**
10256     * Indicates that this is the only struct which contains the same pointer.
10257     * Rust functions which take ownership of an object provided via an argument require
10258     * this to be true and invalidate the object pointed to by inner.
10259     */
10260    bool is_owned;
10261 } LDKMessageHandler;
10262
10263 /**
10264  * Provides an object which can be used to send data to and which uniquely identifies a connection
10265  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
10266  * implement Hash to meet the PeerManager API.
10267  *
10268  * For efficiency, Clone should be relatively cheap for this type.
10269  *
10270  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
10271  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
10272  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
10273  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
10274  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
10275  * to simply use another value which is guaranteed to be globally unique instead.
10276  */
10277 typedef struct LDKSocketDescriptor {
10278    /**
10279     * An opaque pointer which is passed to your function implementations as an argument.
10280     * This has no meaning in the LDK, and can be NULL or any other value.
10281     */
10282    void *this_arg;
10283    /**
10284     * Attempts to send some data from the given slice to the peer.
10285     *
10286     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
10287     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
10288     * called and further write attempts may occur until that time.
10289     *
10290     * If the returned size is smaller than `data.len()`, a
10291     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
10292     * written. Additionally, until a `send_data` event completes fully, no further
10293     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
10294     * prevent denial-of-service issues, you should not read or buffer any data from the socket
10295     * until then.
10296     *
10297     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
10298     * (indicating that read events should be paused to prevent DoS in the send buffer),
10299     * `resume_read` may be set indicating that read events on this descriptor should resume. A
10300     * `resume_read` of false carries no meaning, and should not cause any action.
10301     */
10302    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
10303    /**
10304     * Disconnect the socket pointed to by this SocketDescriptor.
10305     *
10306     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
10307     * call (doing so is a noop).
10308     */
10309    void (*disconnect_socket)(void *this_arg);
10310    /**
10311     * Checks if two objects are equal given this object's this_arg pointer and another object.
10312     */
10313    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
10314    /**
10315     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
10316     * This is used, for example, for inclusion of this object in a hash map.
10317     */
10318    uint64_t (*hash)(const void *this_arg);
10319    /**
10320     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
10321     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
10322     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
10323     */
10324    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
10325    /**
10326     * Frees any resources associated with this object given its this_arg pointer.
10327     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10328     */
10329    void (*free)(void *this_arg);
10330 } LDKSocketDescriptor;
10331
10332
10333
10334 /**
10335  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
10336  * socket events into messages which it passes on to its [`MessageHandler`].
10337  *
10338  * Locks are taken internally, so you must never assume that reentrancy from a
10339  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
10340  *
10341  * Calls to [`read_event`] will decode relevant messages and pass them to the
10342  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
10343  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
10344  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
10345  * calls only after previous ones have returned.
10346  *
10347  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
10348  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
10349  * essentially you should default to using a SimpleRefPeerManager, and use a
10350  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
10351  * you're using lightning-net-tokio.
10352  *
10353  * [`read_event`]: PeerManager::read_event
10354  */
10355 typedef struct MUST_USE_STRUCT LDKPeerManager {
10356    /**
10357     * A pointer to the opaque Rust object.
10358     * Nearly everywhere, inner must be non-null, however in places where
10359     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10360     */
10361    LDKnativePeerManager *inner;
10362    /**
10363     * Indicates that this is the only struct which contains the same pointer.
10364     * Rust functions which take ownership of an object provided via an argument require
10365     * this to be true and invalidate the object pointed to by inner.
10366     */
10367    bool is_owned;
10368 } LDKPeerManager;
10369
10370
10371
10372 /**
10373  * Static channel fields used to build transactions given per-commitment fields, organized by
10374  * broadcaster/countersignatory.
10375  *
10376  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
10377  * as_holder_broadcastable and as_counterparty_broadcastable functions.
10378  */
10379 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
10380    /**
10381     * A pointer to the opaque Rust object.
10382     * Nearly everywhere, inner must be non-null, however in places where
10383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10384     */
10385    LDKnativeDirectedChannelTransactionParameters *inner;
10386    /**
10387     * Indicates that this is the only struct which contains the same pointer.
10388     * Rust functions which take ownership of an object provided via an argument require
10389     * this to be true and invalidate the object pointed to by inner.
10390     */
10391    bool is_owned;
10392 } LDKDirectedChannelTransactionParameters;
10393
10394 /**
10395  * An interface used to score payment channels for path finding.
10396  *
10397  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
10398  */
10399 typedef struct LDKScore {
10400    /**
10401     * An opaque pointer which is passed to your function implementations as an argument.
10402     * This has no meaning in the LDK, and can be NULL or any other value.
10403     */
10404    void *this_arg;
10405    /**
10406     * Returns the fee in msats willing to be paid to avoid routing through the given channel
10407     * in the direction from `source` to `target`.
10408     */
10409    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);
10410    /**
10411     * Handles updating channel penalties after failing to route through a channel.
10412     */
10413    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
10414    /**
10415     * Frees any resources associated with this object given its this_arg pointer.
10416     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10417     */
10418    void (*free)(void *this_arg);
10419 } LDKScore;
10420
10421
10422
10423 /**
10424  * A scorer that is accessed under a lock.
10425  *
10426  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
10427  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
10428  * implementations. Internal locking would be detrimental to route finding performance and could
10429  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
10430  *
10431  * [`find_route`]: crate::routing::router::find_route
10432  */
10433 typedef struct MUST_USE_STRUCT LDKLockableScore {
10434    /**
10435     * A pointer to the opaque Rust object.
10436     * Nearly everywhere, inner must be non-null, however in places where
10437     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10438     */
10439    LDKnativeLockableScore *inner;
10440    /**
10441     * Indicates that this is the only struct which contains the same pointer.
10442     * Rust functions which take ownership of an object provided via an argument require
10443     * this to be true and invalidate the object pointed to by inner.
10444     */
10445    bool is_owned;
10446 } LDKLockableScore;
10447
10448
10449
10450 /**
10451  * A read-only view of [`NetworkGraph`].
10452  */
10453 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
10454    /**
10455     * A pointer to the opaque Rust object.
10456     * Nearly everywhere, inner must be non-null, however in places where
10457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10458     */
10459    LDKnativeReadOnlyNetworkGraph *inner;
10460    /**
10461     * Indicates that this is the only struct which contains the same pointer.
10462     * Rust functions which take ownership of an object provided via an argument require
10463     * this to be true and invalidate the object pointed to by inner.
10464     */
10465    bool is_owned;
10466 } LDKReadOnlyNetworkGraph;
10467
10468
10469
10470 /**
10471  * Receives and validates network updates from peers,
10472  * stores authentic and relevant data as a network graph.
10473  * This network graph is then used for routing payments.
10474  * Provides interface to help with initial routing sync by
10475  * serving historical announcements.
10476  *
10477  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
10478  * [`NetworkGraph`].
10479  */
10480 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
10481    /**
10482     * A pointer to the opaque Rust object.
10483     * Nearly everywhere, inner must be non-null, however in places where
10484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10485     */
10486    LDKnativeNetGraphMsgHandler *inner;
10487    /**
10488     * Indicates that this is the only struct which contains the same pointer.
10489     * Rust functions which take ownership of an object provided via an argument require
10490     * this to be true and invalidate the object pointed to by inner.
10491     */
10492    bool is_owned;
10493 } LDKNetGraphMsgHandler;
10494
10495
10496
10497 /**
10498  * [`routing::Score`] implementation that provides reasonable default behavior.
10499  *
10500  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
10501  * slightly higher fees are available. May also further penalize failed channels.
10502  *
10503  * See [module-level documentation] for usage.
10504  *
10505  * [module-level documentation]: crate::routing::scorer
10506  */
10507 typedef struct MUST_USE_STRUCT LDKScorer {
10508    /**
10509     * A pointer to the opaque Rust object.
10510     * Nearly everywhere, inner must be non-null, however in places where
10511     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10512     */
10513    LDKnativeScorer *inner;
10514    /**
10515     * Indicates that this is the only struct which contains the same pointer.
10516     * Rust functions which take ownership of an object provided via an argument require
10517     * this to be true and invalidate the object pointed to by inner.
10518     */
10519    bool is_owned;
10520 } LDKScorer;
10521
10522
10523
10524 /**
10525  * Parameters for configuring [`Scorer`].
10526  */
10527 typedef struct MUST_USE_STRUCT LDKScoringParameters {
10528    /**
10529     * A pointer to the opaque Rust object.
10530     * Nearly everywhere, inner must be non-null, however in places where
10531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10532     */
10533    LDKnativeScoringParameters *inner;
10534    /**
10535     * Indicates that this is the only struct which contains the same pointer.
10536     * Rust functions which take ownership of an object provided via an argument require
10537     * this to be true and invalidate the object pointed to by inner.
10538     */
10539    bool is_owned;
10540 } LDKScoringParameters;
10541
10542
10543
10544 /**
10545  * FilesystemPersister persists channel data on disk, where each channel's
10546  * data is stored in a file named after its funding outpoint.
10547  *
10548  * Warning: this module does the best it can with calls to persist data, but it
10549  * can only guarantee that the data is passed to the drive. It is up to the
10550  * drive manufacturers to do the actual persistence properly, which they often
10551  * don't (especially on consumer-grade hardware). Therefore, it is up to the
10552  * user to validate their entire storage stack, to ensure the writes are
10553  * persistent.
10554  * Corollary: especially when dealing with larger amounts of money, it is best
10555  * practice to have multiple channel data backups and not rely only on one
10556  * FilesystemPersister.
10557  */
10558 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
10559    /**
10560     * A pointer to the opaque Rust object.
10561     * Nearly everywhere, inner must be non-null, however in places where
10562     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10563     */
10564    LDKnativeFilesystemPersister *inner;
10565    /**
10566     * Indicates that this is the only struct which contains the same pointer.
10567     * Rust functions which take ownership of an object provided via an argument require
10568     * this to be true and invalidate the object pointed to by inner.
10569     */
10570    bool is_owned;
10571 } LDKFilesystemPersister;
10572
10573
10574
10575 /**
10576  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
10577  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
10578  * responsibilities are:
10579  * * Processing [`Event`]s with a user-provided [`EventHandler`].
10580  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
10581  *   writing it to disk/backups by invoking the callback given to it at startup.
10582  *   [`ChannelManager`] persistence should be done in the background.
10583  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
10584  *   at the appropriate intervals.
10585  *
10586  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
10587  * upon as doing so may result in high latency.
10588  *
10589  * # Note
10590  *
10591  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
10592  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
10593  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
10594  * unilateral chain closure fees are at risk.
10595  *
10596  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
10597  * [`Event`]: lightning::util::events::Event
10598  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
10599  */
10600 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
10601    /**
10602     * A pointer to the opaque Rust object.
10603     * Nearly everywhere, inner must be non-null, however in places where
10604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10605     */
10606    LDKnativeBackgroundProcessor *inner;
10607    /**
10608     * Indicates that this is the only struct which contains the same pointer.
10609     * Rust functions which take ownership of an object provided via an argument require
10610     * this to be true and invalidate the object pointed to by inner.
10611     */
10612    bool is_owned;
10613 } LDKBackgroundProcessor;
10614
10615 /**
10616  * Trait which handles persisting a [`ChannelManager`] to disk.
10617  *
10618  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10619  */
10620 typedef struct LDKChannelManagerPersister {
10621    /**
10622     * An opaque pointer which is passed to your function implementations as an argument.
10623     * This has no meaning in the LDK, and can be NULL or any other value.
10624     */
10625    void *this_arg;
10626    /**
10627     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
10628     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
10629     *
10630     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10631     */
10632    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
10633    /**
10634     * Frees any resources associated with this object given its this_arg pointer.
10635     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10636     */
10637    void (*free)(void *this_arg);
10638 } LDKChannelManagerPersister;
10639
10640
10641
10642 /**
10643  * Data of the `RawInvoice` that is encoded in the data part
10644  */
10645 typedef struct MUST_USE_STRUCT LDKRawDataPart {
10646    /**
10647     * A pointer to the opaque Rust object.
10648     * Nearly everywhere, inner must be non-null, however in places where
10649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10650     */
10651    LDKnativeRawDataPart *inner;
10652    /**
10653     * Indicates that this is the only struct which contains the same pointer.
10654     * Rust functions which take ownership of an object provided via an argument require
10655     * this to be true and invalidate the object pointed to by inner.
10656     */
10657    bool is_owned;
10658 } LDKRawDataPart;
10659
10660
10661
10662 /**
10663  * SHA-256 hash
10664  */
10665 typedef struct MUST_USE_STRUCT LDKSha256 {
10666    /**
10667     * A pointer to the opaque Rust object.
10668     * Nearly everywhere, inner must be non-null, however in places where
10669     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10670     */
10671    LDKnativeSha256 *inner;
10672    /**
10673     * Indicates that this is the only struct which contains the same pointer.
10674     * Rust functions which take ownership of an object provided via an argument require
10675     * this to be true and invalidate the object pointed to by inner.
10676     */
10677    bool is_owned;
10678 } LDKSha256;
10679
10680
10681
10682 /**
10683  * `min_final_cltv_expiry` to use for the last HTLC in the route
10684  */
10685 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
10686    /**
10687     * A pointer to the opaque Rust object.
10688     * Nearly everywhere, inner must be non-null, however in places where
10689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10690     */
10691    LDKnativeMinFinalCltvExpiry *inner;
10692    /**
10693     * Indicates that this is the only struct which contains the same pointer.
10694     * Rust functions which take ownership of an object provided via an argument require
10695     * this to be true and invalidate the object pointed to by inner.
10696     */
10697    bool is_owned;
10698 } LDKMinFinalCltvExpiry;
10699
10700 /**
10701  * Integer in the range `0..32`
10702  */
10703 typedef struct LDKu5 {
10704    uint8_t _0;
10705 } LDKu5;
10706
10707 /**
10708  * A 20-byte byte array.
10709  */
10710 typedef struct LDKTwentyBytes {
10711    /**
10712     * The twenty bytes
10713     */
10714    uint8_t data[20];
10715 } LDKTwentyBytes;
10716
10717 /**
10718  * Fallback address in case no LN payment is possible
10719  */
10720 typedef enum LDKFallback_Tag {
10721    LDKFallback_SegWitProgram,
10722    LDKFallback_PubKeyHash,
10723    LDKFallback_ScriptHash,
10724    /**
10725     * Must be last for serialization purposes
10726     */
10727    LDKFallback_Sentinel,
10728 } LDKFallback_Tag;
10729
10730 typedef struct LDKFallback_LDKSegWitProgram_Body {
10731    struct LDKu5 version;
10732    struct LDKCVec_u8Z program;
10733 } LDKFallback_LDKSegWitProgram_Body;
10734
10735 typedef struct MUST_USE_STRUCT LDKFallback {
10736    LDKFallback_Tag tag;
10737    union {
10738       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
10739       struct {
10740          struct LDKTwentyBytes pub_key_hash;
10741       };
10742       struct {
10743          struct LDKTwentyBytes script_hash;
10744       };
10745    };
10746 } LDKFallback;
10747
10748 /**
10749  * A trait defining behavior of an [`Invoice`] payer.
10750  */
10751 typedef struct LDKPayer {
10752    /**
10753     * An opaque pointer which is passed to your function implementations as an argument.
10754     * This has no meaning in the LDK, and can be NULL or any other value.
10755     */
10756    void *this_arg;
10757    /**
10758     * Returns the payer's node id.
10759     */
10760    struct LDKPublicKey (*node_id)(const void *this_arg);
10761    /**
10762     * Returns the payer's channels.
10763     */
10764    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
10765    /**
10766     * Sends a payment over the Lightning Network using the given [`Route`].
10767     *
10768     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
10769     */
10770    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
10771    /**
10772     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
10773     */
10774    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
10775    /**
10776     * Frees any resources associated with this object given its this_arg pointer.
10777     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10778     */
10779    void (*free)(void *this_arg);
10780 } LDKPayer;
10781
10782 /**
10783  * A trait defining behavior for routing an [`Invoice`] payment.
10784  */
10785 typedef struct LDKRouter {
10786    /**
10787     * An opaque pointer which is passed to your function implementations as an argument.
10788     * This has no meaning in the LDK, and can be NULL or any other value.
10789     */
10790    void *this_arg;
10791    /**
10792     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
10793     *
10794     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
10795     */
10796    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);
10797    /**
10798     * Frees any resources associated with this object given its this_arg pointer.
10799     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10800     */
10801    void (*free)(void *this_arg);
10802 } LDKRouter;
10803
10804
10805
10806 /**
10807  * A utility for paying [`Invoice]`s.
10808  */
10809 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
10810    /**
10811     * A pointer to the opaque Rust object.
10812     * Nearly everywhere, inner must be non-null, however in places where
10813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10814     */
10815    LDKnativeInvoicePayer *inner;
10816    /**
10817     * Indicates that this is the only struct which contains the same pointer.
10818     * Rust functions which take ownership of an object provided via an argument require
10819     * this to be true and invalidate the object pointed to by inner.
10820     */
10821    bool is_owned;
10822 } LDKInvoicePayer;
10823
10824
10825
10826 /**
10827  * Number of attempts to retry payment path failures for an [`Invoice`].
10828  *
10829  * Note that this is the number of *path* failures, not full payment retries. For multi-path
10830  * payments, if this is less than the total number of paths, we will never even retry all of the
10831  * payment's paths.
10832  */
10833 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
10834    /**
10835     * A pointer to the opaque Rust object.
10836     * Nearly everywhere, inner must be non-null, however in places where
10837     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10838     */
10839    LDKnativeRetryAttempts *inner;
10840    /**
10841     * Indicates that this is the only struct which contains the same pointer.
10842     * Rust functions which take ownership of an object provided via an argument require
10843     * this to be true and invalidate the object pointed to by inner.
10844     */
10845    bool is_owned;
10846 } LDKRetryAttempts;
10847
10848
10849
10850 /**
10851  * A [`Router`] implemented using [`find_route`].
10852  */
10853 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
10854    /**
10855     * A pointer to the opaque Rust object.
10856     * Nearly everywhere, inner must be non-null, however in places where
10857     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10858     */
10859    LDKnativeDefaultRouter *inner;
10860    /**
10861     * Indicates that this is the only struct which contains the same pointer.
10862     * Rust functions which take ownership of an object provided via an argument require
10863     * this to be true and invalidate the object pointed to by inner.
10864     */
10865    bool is_owned;
10866 } LDKDefaultRouter;
10867
10868 extern const uintptr_t MAX_BUF_SIZE;
10869
10870 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
10871
10872 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
10873
10874 extern const uint32_t ANTI_REORG_DELAY;
10875
10876 extern const uint16_t BREAKDOWN_TIMEOUT;
10877
10878 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
10879
10880 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
10881
10882 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
10883
10884 extern const uint64_t DEFAULT_EXPIRY_TIME;
10885
10886 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
10887
10888 extern const uint8_t TAG_PAYMENT_HASH;
10889
10890 extern const uint8_t TAG_DESCRIPTION;
10891
10892 extern const uint8_t TAG_PAYEE_PUB_KEY;
10893
10894 extern const uint8_t TAG_DESCRIPTION_HASH;
10895
10896 extern const uint8_t TAG_EXPIRY_TIME;
10897
10898 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
10899
10900 extern const uint8_t TAG_FALLBACK;
10901
10902 extern const uint8_t TAG_PRIVATE_ROUTE;
10903
10904 extern const uint8_t TAG_PAYMENT_SECRET;
10905
10906 extern const uint8_t TAG_FEATURES;
10907
10908 struct LDKStr _ldk_get_compiled_version(void);
10909
10910 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
10911
10912 /**
10913  * Frees the data buffer, if data_is_owned is set and datalen > 0.
10914  */
10915 void Transaction_free(struct LDKTransaction _res);
10916
10917 /**
10918  * Convenience function for constructing a new TxOut
10919  */
10920 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
10921
10922 /**
10923  * Frees the data pointed to by script_pubkey.
10924  */
10925 void TxOut_free(struct LDKTxOut _res);
10926
10927 /**
10928  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
10929  */
10930 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
10931
10932 /**
10933  * Frees the data buffer, if chars_is_owned is set and len > 0.
10934  */
10935 void Str_free(struct LDKStr _res);
10936
10937 /**
10938  * Creates a new CResult_SecretKeyErrorZ in the success state.
10939  */
10940 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
10941
10942 /**
10943  * Creates a new CResult_SecretKeyErrorZ in the error state.
10944  */
10945 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
10946
10947 /**
10948  * Frees any resources used by the CResult_SecretKeyErrorZ.
10949  */
10950 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
10951
10952 /**
10953  * Creates a new CResult_PublicKeyErrorZ in the success state.
10954  */
10955 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
10956
10957 /**
10958  * Creates a new CResult_PublicKeyErrorZ in the error state.
10959  */
10960 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
10961
10962 /**
10963  * Frees any resources used by the CResult_PublicKeyErrorZ.
10964  */
10965 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
10966
10967 /**
10968  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10969  * but with all dynamically-allocated buffers duplicated in new buffers.
10970  */
10971 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
10972
10973 /**
10974  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
10975  */
10976 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
10977
10978 /**
10979  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
10980  */
10981 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
10982
10983 /**
10984  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
10985  */
10986 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
10987
10988 /**
10989  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
10990  * but with all dynamically-allocated buffers duplicated in new buffers.
10991  */
10992 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
10993
10994 /**
10995  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
10996  */
10997 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
10998
10999 /**
11000  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
11001  */
11002 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
11003
11004 /**
11005  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
11006  */
11007 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
11008
11009 /**
11010  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
11011  * but with all dynamically-allocated buffers duplicated in new buffers.
11012  */
11013 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
11014
11015 /**
11016  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
11017  */
11018 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
11019
11020 /**
11021  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
11022  */
11023 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
11024
11025 /**
11026  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
11027  */
11028 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
11029
11030 /**
11031  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
11032  * but with all dynamically-allocated buffers duplicated in new buffers.
11033  */
11034 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
11035
11036 /**
11037  * Constructs a new COption_u32Z containing a u32
11038  */
11039 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
11040
11041 /**
11042  * Constructs a new COption_u32Z containing nothing
11043  */
11044 struct LDKCOption_u32Z COption_u32Z_none(void);
11045
11046 /**
11047  * Frees any resources associated with the u32, if we are in the Some state
11048  */
11049 void COption_u32Z_free(struct LDKCOption_u32Z _res);
11050
11051 /**
11052  * Creates a new COption_u32Z which has the same data as `orig`
11053  * but with all dynamically-allocated buffers duplicated in new buffers.
11054  */
11055 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
11056
11057 /**
11058  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
11059  */
11060 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
11061
11062 /**
11063  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
11064  */
11065 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
11066
11067 /**
11068  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
11069  */
11070 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
11071
11072 /**
11073  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
11074  * but with all dynamically-allocated buffers duplicated in new buffers.
11075  */
11076 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
11077
11078 /**
11079  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
11080  */
11081 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
11082
11083 /**
11084  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
11085  */
11086 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11087
11088 /**
11089  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
11090  */
11091 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
11092
11093 /**
11094  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11095  * but with all dynamically-allocated buffers duplicated in new buffers.
11096  */
11097 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11098
11099 /**
11100  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
11101  */
11102 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
11103
11104 /**
11105  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
11106  */
11107 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11108
11109 /**
11110  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
11111  */
11112 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
11113
11114 /**
11115  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11116  * but with all dynamically-allocated buffers duplicated in new buffers.
11117  */
11118 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11119
11120 /**
11121  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11122  */
11123 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
11124
11125 /**
11126  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
11127  */
11128 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
11129
11130 /**
11131  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
11132  */
11133 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11134
11135 /**
11136  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
11137  */
11138 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
11139
11140 /**
11141  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11142  * but with all dynamically-allocated buffers duplicated in new buffers.
11143  */
11144 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11145
11146 /**
11147  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
11148  */
11149 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
11150
11151 /**
11152  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
11153  */
11154 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11155
11156 /**
11157  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
11158  */
11159 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
11160
11161 /**
11162  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11163  * but with all dynamically-allocated buffers duplicated in new buffers.
11164  */
11165 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11166
11167 /**
11168  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
11169  */
11170 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
11171
11172 /**
11173  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
11174  */
11175 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
11176
11177 /**
11178  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
11179  */
11180 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
11181
11182 /**
11183  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
11184  */
11185 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
11186
11187 /**
11188  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
11189  */
11190 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11191
11192 /**
11193  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
11194  */
11195 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
11196
11197 /**
11198  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
11199  * but with all dynamically-allocated buffers duplicated in new buffers.
11200  */
11201 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11202
11203 /**
11204  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
11205  */
11206 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
11207
11208 /**
11209  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
11210  */
11211 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
11212
11213 /**
11214  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
11215  */
11216 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
11217
11218 /**
11219  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
11220  */
11221 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
11222
11223 /**
11224  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
11225  */
11226 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
11227
11228 /**
11229  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
11230  */
11231 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
11232
11233 /**
11234  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
11235  * but with all dynamically-allocated buffers duplicated in new buffers.
11236  */
11237 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
11238
11239 /**
11240  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
11241  */
11242 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
11243
11244 /**
11245  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
11246  */
11247 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
11248
11249 /**
11250  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
11251  */
11252 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
11253
11254 /**
11255  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
11256  * but with all dynamically-allocated buffers duplicated in new buffers.
11257  */
11258 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
11259
11260 /**
11261  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
11262  */
11263 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
11264
11265 /**
11266  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
11267  */
11268 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
11269
11270 /**
11271  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
11272  */
11273 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
11274
11275 /**
11276  * Creates a new CResult_NoneErrorZ in the success state.
11277  */
11278 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11279
11280 /**
11281  * Creates a new CResult_NoneErrorZ in the error state.
11282  */
11283 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
11284
11285 /**
11286  * Frees any resources used by the CResult_NoneErrorZ.
11287  */
11288 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
11289
11290 /**
11291  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
11292  * but with all dynamically-allocated buffers duplicated in new buffers.
11293  */
11294 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
11295
11296 /**
11297  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
11298  */
11299 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
11300
11301 /**
11302  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
11303  */
11304 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
11305
11306 /**
11307  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
11308  */
11309 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
11310
11311 /**
11312  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
11313  * but with all dynamically-allocated buffers duplicated in new buffers.
11314  */
11315 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
11316
11317 /**
11318  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11319  */
11320 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
11321
11322 /**
11323  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11324  */
11325 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
11326
11327 /**
11328  * Creates a new CResult_RouteDecodeErrorZ in the success state.
11329  */
11330 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
11331
11332 /**
11333  * Creates a new CResult_RouteDecodeErrorZ in the error state.
11334  */
11335 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
11336
11337 /**
11338  * Frees any resources used by the CResult_RouteDecodeErrorZ.
11339  */
11340 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
11341
11342 /**
11343  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
11344  * but with all dynamically-allocated buffers duplicated in new buffers.
11345  */
11346 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
11347
11348 /**
11349  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
11350  */
11351 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
11352
11353 /**
11354  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
11355  */
11356 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
11357
11358 /**
11359  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
11360  */
11361 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
11362
11363 /**
11364  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
11365  * but with all dynamically-allocated buffers duplicated in new buffers.
11366  */
11367 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
11368
11369 /**
11370  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11371  */
11372 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
11373
11374 /**
11375  * Constructs a new COption_u64Z containing a u64
11376  */
11377 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
11378
11379 /**
11380  * Constructs a new COption_u64Z containing nothing
11381  */
11382 struct LDKCOption_u64Z COption_u64Z_none(void);
11383
11384 /**
11385  * Frees any resources associated with the u64, if we are in the Some state
11386  */
11387 void COption_u64Z_free(struct LDKCOption_u64Z _res);
11388
11389 /**
11390  * Creates a new COption_u64Z which has the same data as `orig`
11391  * but with all dynamically-allocated buffers duplicated in new buffers.
11392  */
11393 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
11394
11395 /**
11396  * Creates a new CResult_PayeeDecodeErrorZ in the success state.
11397  */
11398 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
11399
11400 /**
11401  * Creates a new CResult_PayeeDecodeErrorZ in the error state.
11402  */
11403 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
11404
11405 /**
11406  * Frees any resources used by the CResult_PayeeDecodeErrorZ.
11407  */
11408 void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
11409
11410 /**
11411  * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
11412  * but with all dynamically-allocated buffers duplicated in new buffers.
11413  */
11414 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
11415
11416 /**
11417  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11418  */
11419 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
11420
11421 /**
11422  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
11423  */
11424 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
11425
11426 /**
11427  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
11428  */
11429 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
11430
11431 /**
11432  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
11433  */
11434 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
11435
11436 /**
11437  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
11438  * but with all dynamically-allocated buffers duplicated in new buffers.
11439  */
11440 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
11441
11442 /**
11443  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
11444  */
11445 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
11446
11447 /**
11448  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
11449  */
11450 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
11451
11452 /**
11453  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
11454  */
11455 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
11456
11457 /**
11458  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
11459  * but with all dynamically-allocated buffers duplicated in new buffers.
11460  */
11461 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
11462
11463 /**
11464  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11465  */
11466 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
11467
11468 /**
11469  * Creates a new CResult_RouteLightningErrorZ in the success state.
11470  */
11471 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
11472
11473 /**
11474  * Creates a new CResult_RouteLightningErrorZ in the error state.
11475  */
11476 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
11477
11478 /**
11479  * Frees any resources used by the CResult_RouteLightningErrorZ.
11480  */
11481 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
11482
11483 /**
11484  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
11485  * but with all dynamically-allocated buffers duplicated in new buffers.
11486  */
11487 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
11488
11489 /**
11490  * Creates a new CResult_TxOutAccessErrorZ in the success state.
11491  */
11492 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
11493
11494 /**
11495  * Creates a new CResult_TxOutAccessErrorZ in the error state.
11496  */
11497 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
11498
11499 /**
11500  * Frees any resources used by the CResult_TxOutAccessErrorZ.
11501  */
11502 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
11503
11504 /**
11505  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
11506  * but with all dynamically-allocated buffers duplicated in new buffers.
11507  */
11508 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
11509
11510 /**
11511  * Creates a new tuple which has the same data as `orig`
11512  * but with all dynamically-allocated buffers duplicated in new buffers.
11513  */
11514 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
11515
11516 /**
11517  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
11518  */
11519 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
11520
11521 /**
11522  * Frees any resources used by the C2Tuple_usizeTransactionZ.
11523  */
11524 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
11525
11526 /**
11527  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11528  */
11529 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
11530
11531 /**
11532  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11533  */
11534 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
11535
11536 /**
11537  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
11538  */
11539 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
11540
11541 /**
11542  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
11543  */
11544 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
11545
11546 /**
11547  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
11548  */
11549 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
11550
11551 /**
11552  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
11553  * but with all dynamically-allocated buffers duplicated in new buffers.
11554  */
11555 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
11556
11557 /**
11558  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11559  */
11560 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
11561
11562 /**
11563  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
11564  */
11565 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
11566
11567 /**
11568  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
11569  */
11570 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
11571
11572 /**
11573  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
11574  */
11575 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
11576
11577 /**
11578  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
11579  * but with all dynamically-allocated buffers duplicated in new buffers.
11580  */
11581 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
11582
11583 /**
11584  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
11585  */
11586 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
11587
11588 /**
11589  * Constructs a new COption_NetworkUpdateZ containing nothing
11590  */
11591 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
11592
11593 /**
11594  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
11595  */
11596 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
11597
11598 /**
11599  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
11600  * but with all dynamically-allocated buffers duplicated in new buffers.
11601  */
11602 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
11603
11604 /**
11605  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11606  */
11607 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
11608
11609 /**
11610  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11611  */
11612 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
11613
11614 /**
11615  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
11616  */
11617 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
11618
11619 /**
11620  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
11621  */
11622 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11623
11624 /**
11625  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
11626  */
11627 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
11628
11629 /**
11630  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
11631  */
11632 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
11633
11634 /**
11635  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
11636  */
11637 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11638
11639 /**
11640  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
11641  */
11642 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
11643
11644 /**
11645  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
11646  */
11647 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
11648
11649 /**
11650  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
11651  */
11652 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11653
11654 /**
11655  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
11656  */
11657 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
11658
11659 /**
11660  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
11661  */
11662 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
11663
11664 /**
11665  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
11666  */
11667 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
11668
11669 /**
11670  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
11671  */
11672 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
11673
11674 /**
11675  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
11676  */
11677 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
11678
11679 /**
11680  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
11681  */
11682 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11683
11684 /**
11685  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
11686  */
11687 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
11688
11689 /**
11690  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11691  * but with all dynamically-allocated buffers duplicated in new buffers.
11692  */
11693 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11694
11695 /**
11696  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
11697  */
11698 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
11699
11700 /**
11701  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
11702  */
11703 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11704
11705 /**
11706  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
11707  */
11708 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
11709
11710 /**
11711  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
11712  * but with all dynamically-allocated buffers duplicated in new buffers.
11713  */
11714 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11715
11716 /**
11717  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
11718  */
11719 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
11720
11721 /**
11722  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
11723  */
11724 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
11725
11726 /**
11727  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
11728  */
11729 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
11730
11731 /**
11732  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
11733  * but with all dynamically-allocated buffers duplicated in new buffers.
11734  */
11735 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
11736
11737 /**
11738  * Creates a new CResult_NoneNoneZ in the success state.
11739  */
11740 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
11741
11742 /**
11743  * Creates a new CResult_NoneNoneZ in the error state.
11744  */
11745 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
11746
11747 /**
11748  * Frees any resources used by the CResult_NoneNoneZ.
11749  */
11750 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
11751
11752 /**
11753  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
11754  * but with all dynamically-allocated buffers duplicated in new buffers.
11755  */
11756 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
11757
11758 /**
11759  * Creates a new tuple which has the same data as `orig`
11760  * but with all dynamically-allocated buffers duplicated in new buffers.
11761  */
11762 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
11763
11764 /**
11765  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
11766  */
11767 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
11768
11769 /**
11770  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
11771  */
11772 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
11773
11774 /**
11775  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
11776  */
11777 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
11778
11779 /**
11780  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
11781  */
11782 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
11783
11784 /**
11785  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
11786  */
11787 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
11788
11789 /**
11790  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
11791  * but with all dynamically-allocated buffers duplicated in new buffers.
11792  */
11793 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
11794
11795 /**
11796  * Creates a new CResult_SignatureNoneZ in the success state.
11797  */
11798 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
11799
11800 /**
11801  * Creates a new CResult_SignatureNoneZ in the error state.
11802  */
11803 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
11804
11805 /**
11806  * Frees any resources used by the CResult_SignatureNoneZ.
11807  */
11808 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
11809
11810 /**
11811  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
11812  * but with all dynamically-allocated buffers duplicated in new buffers.
11813  */
11814 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
11815
11816 /**
11817  * Creates a new CResult_SignDecodeErrorZ in the success state.
11818  */
11819 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
11820
11821 /**
11822  * Creates a new CResult_SignDecodeErrorZ in the error state.
11823  */
11824 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
11825
11826 /**
11827  * Frees any resources used by the CResult_SignDecodeErrorZ.
11828  */
11829 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
11830
11831 /**
11832  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
11833  * but with all dynamically-allocated buffers duplicated in new buffers.
11834  */
11835 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
11836
11837 /**
11838  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11839  */
11840 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
11841
11842 /**
11843  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
11844  */
11845 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
11846
11847 /**
11848  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
11849  */
11850 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
11851
11852 /**
11853  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
11854  */
11855 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
11856
11857 /**
11858  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
11859  * but with all dynamically-allocated buffers duplicated in new buffers.
11860  */
11861 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
11862
11863 /**
11864  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11865  */
11866 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
11867
11868 /**
11869  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
11870  */
11871 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
11872
11873 /**
11874  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
11875  */
11876 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
11877
11878 /**
11879  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
11880  */
11881 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
11882
11883 /**
11884  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
11885  * but with all dynamically-allocated buffers duplicated in new buffers.
11886  */
11887 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
11888
11889 /**
11890  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
11891  */
11892 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
11893
11894 /**
11895  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
11896  */
11897 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
11898
11899 /**
11900  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
11901  */
11902 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
11903
11904 /**
11905  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
11906  * but with all dynamically-allocated buffers duplicated in new buffers.
11907  */
11908 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
11909
11910 /**
11911  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11912  */
11913 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
11914
11915 /**
11916  * Creates a new CResult_TransactionNoneZ in the success state.
11917  */
11918 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
11919
11920 /**
11921  * Creates a new CResult_TransactionNoneZ in the error state.
11922  */
11923 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
11924
11925 /**
11926  * Frees any resources used by the CResult_TransactionNoneZ.
11927  */
11928 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
11929
11930 /**
11931  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
11932  * but with all dynamically-allocated buffers duplicated in new buffers.
11933  */
11934 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
11935
11936 /**
11937  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
11938  */
11939 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
11940
11941 /**
11942  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
11943  */
11944 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
11945
11946 /**
11947  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11948  */
11949 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
11950
11951 /**
11952  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
11953  */
11954 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
11955
11956 /**
11957  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
11958  */
11959 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
11960
11961 /**
11962  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
11963  */
11964 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
11965
11966 /**
11967  * Constructs a new COption_u16Z containing a u16
11968  */
11969 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
11970
11971 /**
11972  * Constructs a new COption_u16Z containing nothing
11973  */
11974 struct LDKCOption_u16Z COption_u16Z_none(void);
11975
11976 /**
11977  * Frees any resources associated with the u16, if we are in the Some state
11978  */
11979 void COption_u16Z_free(struct LDKCOption_u16Z _res);
11980
11981 /**
11982  * Creates a new COption_u16Z which has the same data as `orig`
11983  * but with all dynamically-allocated buffers duplicated in new buffers.
11984  */
11985 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
11986
11987 /**
11988  * Creates a new CResult_NoneAPIErrorZ in the success state.
11989  */
11990 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
11991
11992 /**
11993  * Creates a new CResult_NoneAPIErrorZ in the error state.
11994  */
11995 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
11996
11997 /**
11998  * Frees any resources used by the CResult_NoneAPIErrorZ.
11999  */
12000 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
12001
12002 /**
12003  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
12004  * but with all dynamically-allocated buffers duplicated in new buffers.
12005  */
12006 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
12007
12008 /**
12009  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12010  */
12011 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
12012
12013 /**
12014  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12015  */
12016 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
12017
12018 /**
12019  * Creates a new CResult__u832APIErrorZ in the success state.
12020  */
12021 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
12022
12023 /**
12024  * Creates a new CResult__u832APIErrorZ in the error state.
12025  */
12026 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
12027
12028 /**
12029  * Frees any resources used by the CResult__u832APIErrorZ.
12030  */
12031 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
12032
12033 /**
12034  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
12035  * but with all dynamically-allocated buffers duplicated in new buffers.
12036  */
12037 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
12038
12039 /**
12040  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
12041  */
12042 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
12043
12044 /**
12045  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
12046  */
12047 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12048
12049 /**
12050  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
12051  */
12052 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
12053
12054 /**
12055  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
12056  * but with all dynamically-allocated buffers duplicated in new buffers.
12057  */
12058 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
12059
12060 /**
12061  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
12062  */
12063 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
12064
12065 /**
12066  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
12067  */
12068 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12069
12070 /**
12071  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
12072  */
12073 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
12074
12075 /**
12076  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
12077  * but with all dynamically-allocated buffers duplicated in new buffers.
12078  */
12079 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
12080
12081 /**
12082  * Creates a new tuple which has the same data as `orig`
12083  * but with all dynamically-allocated buffers duplicated in new buffers.
12084  */
12085 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
12086
12087 /**
12088  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
12089  */
12090 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12091
12092 /**
12093  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
12094  */
12095 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
12096
12097 /**
12098  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
12099  */
12100 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
12101
12102 /**
12103  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
12104  */
12105 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12106
12107 /**
12108  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
12109  */
12110 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
12111
12112 /**
12113  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
12114  * but with all dynamically-allocated buffers duplicated in new buffers.
12115  */
12116 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
12117
12118 /**
12119  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12120  */
12121 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
12122
12123 /**
12124  * Creates a new tuple which has the same data as `orig`
12125  * but with all dynamically-allocated buffers duplicated in new buffers.
12126  */
12127 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
12128
12129 /**
12130  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
12131  */
12132 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12133
12134 /**
12135  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
12136  */
12137 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
12138
12139 /**
12140  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
12141  */
12142 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
12143
12144 /**
12145  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
12146  */
12147 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
12148
12149 /**
12150  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
12151  */
12152 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
12153
12154 /**
12155  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
12156  * but with all dynamically-allocated buffers duplicated in new buffers.
12157  */
12158 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
12159
12160 /**
12161  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12162  */
12163 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
12164
12165 /**
12166  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
12167  */
12168 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
12169
12170 /**
12171  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
12172  */
12173 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
12174
12175 /**
12176  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
12177  */
12178 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
12179
12180 /**
12181  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
12182  */
12183 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
12184
12185 /**
12186  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
12187  */
12188 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
12189
12190 /**
12191  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
12192  */
12193 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
12194
12195 /**
12196  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
12197  */
12198 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
12199
12200 /**
12201  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
12202  */
12203 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
12204
12205 /**
12206  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12207  * but with all dynamically-allocated buffers duplicated in new buffers.
12208  */
12209 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
12210
12211 /**
12212  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
12213  */
12214 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
12215
12216 /**
12217  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
12218  */
12219 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
12220
12221 /**
12222  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
12223  */
12224 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
12225
12226 /**
12227  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
12228  * but with all dynamically-allocated buffers duplicated in new buffers.
12229  */
12230 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
12231
12232 /**
12233  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
12234  */
12235 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
12236
12237 /**
12238  * Constructs a new COption_TypeZ containing nothing
12239  */
12240 struct LDKCOption_TypeZ COption_TypeZ_none(void);
12241
12242 /**
12243  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
12244  */
12245 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
12246
12247 /**
12248  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
12249  */
12250 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
12251
12252 /**
12253  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
12254  */
12255 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
12256
12257 /**
12258  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
12259  */
12260 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
12261
12262 /**
12263  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
12264  */
12265 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
12266
12267 /**
12268  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
12269  */
12270 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
12271
12272 /**
12273  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
12274  */
12275 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
12276
12277 /**
12278  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
12279  * but with all dynamically-allocated buffers duplicated in new buffers.
12280  */
12281 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
12282
12283 /**
12284  * Creates a new CResult_SiPrefixNoneZ in the success state.
12285  */
12286 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
12287
12288 /**
12289  * Creates a new CResult_SiPrefixNoneZ in the error state.
12290  */
12291 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
12292
12293 /**
12294  * Frees any resources used by the CResult_SiPrefixNoneZ.
12295  */
12296 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
12297
12298 /**
12299  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
12300  * but with all dynamically-allocated buffers duplicated in new buffers.
12301  */
12302 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
12303
12304 /**
12305  * Creates a new CResult_InvoiceNoneZ in the success state.
12306  */
12307 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
12308
12309 /**
12310  * Creates a new CResult_InvoiceNoneZ in the error state.
12311  */
12312 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
12313
12314 /**
12315  * Frees any resources used by the CResult_InvoiceNoneZ.
12316  */
12317 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
12318
12319 /**
12320  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
12321  * but with all dynamically-allocated buffers duplicated in new buffers.
12322  */
12323 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
12324
12325 /**
12326  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
12327  */
12328 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
12329
12330 /**
12331  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
12332  */
12333 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
12334
12335 /**
12336  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
12337  */
12338 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
12339
12340 /**
12341  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
12342  * but with all dynamically-allocated buffers duplicated in new buffers.
12343  */
12344 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
12345
12346 /**
12347  * Creates a new tuple which has the same data as `orig`
12348  * but with all dynamically-allocated buffers duplicated in new buffers.
12349  */
12350 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
12351
12352 /**
12353  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12354  */
12355 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
12356
12357 /**
12358  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12359  */
12360 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
12361
12362 /**
12363  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
12364  */
12365 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
12366
12367 /**
12368  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
12369  */
12370 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
12371
12372 /**
12373  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
12374  */
12375 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
12376
12377 /**
12378  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12379  * but with all dynamically-allocated buffers duplicated in new buffers.
12380  */
12381 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
12382
12383 /**
12384  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12385  */
12386 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
12387
12388 /**
12389  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12390  */
12391 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
12392
12393 /**
12394  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12395  */
12396 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
12397
12398 /**
12399  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12400  */
12401 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
12402
12403 /**
12404  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
12405  * but with all dynamically-allocated buffers duplicated in new buffers.
12406  */
12407 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
12408
12409 /**
12410  * Creates a new CResult_NoneSemanticErrorZ in the success state.
12411  */
12412 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
12413
12414 /**
12415  * Creates a new CResult_NoneSemanticErrorZ in the error state.
12416  */
12417 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
12418
12419 /**
12420  * Frees any resources used by the CResult_NoneSemanticErrorZ.
12421  */
12422 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
12423
12424 /**
12425  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
12426  * but with all dynamically-allocated buffers duplicated in new buffers.
12427  */
12428 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
12429
12430 /**
12431  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
12432  */
12433 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
12434
12435 /**
12436  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
12437  */
12438 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
12439
12440 /**
12441  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
12442  */
12443 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
12444
12445 /**
12446  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
12447  * but with all dynamically-allocated buffers duplicated in new buffers.
12448  */
12449 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
12450
12451 /**
12452  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
12453  */
12454 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
12455
12456 /**
12457  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
12458  */
12459 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
12460
12461 /**
12462  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
12463  */
12464 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
12465
12466 /**
12467  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
12468  * but with all dynamically-allocated buffers duplicated in new buffers.
12469  */
12470 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
12471
12472 /**
12473  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
12474  */
12475 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
12476
12477 /**
12478  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
12479  */
12480 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
12481
12482 /**
12483  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
12484  */
12485 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
12486
12487 /**
12488  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
12489  * but with all dynamically-allocated buffers duplicated in new buffers.
12490  */
12491 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
12492
12493 /**
12494  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
12495  */
12496 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
12497
12498 /**
12499  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
12500  */
12501 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
12502
12503 /**
12504  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
12505  */
12506 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
12507
12508 /**
12509  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
12510  * but with all dynamically-allocated buffers duplicated in new buffers.
12511  */
12512 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
12513
12514 /**
12515  * Creates a new CResult_StringErrorZ in the success state.
12516  */
12517 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
12518
12519 /**
12520  * Creates a new CResult_StringErrorZ in the error state.
12521  */
12522 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
12523
12524 /**
12525  * Frees any resources used by the CResult_StringErrorZ.
12526  */
12527 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
12528
12529 /**
12530  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12531  */
12532 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
12533
12534 /**
12535  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12536  */
12537 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12538
12539 /**
12540  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12541  */
12542 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
12543
12544 /**
12545  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12546  * but with all dynamically-allocated buffers duplicated in new buffers.
12547  */
12548 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
12549
12550 /**
12551  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12552  */
12553 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
12554
12555 /**
12556  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12557  */
12558 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
12559
12560 /**
12561  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12562  */
12563 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
12564
12565 /**
12566  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12567  * but with all dynamically-allocated buffers duplicated in new buffers.
12568  */
12569 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
12570
12571 /**
12572  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
12573  */
12574 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
12575
12576 /**
12577  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
12578  */
12579 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
12580
12581 /**
12582  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
12583  */
12584 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
12585
12586 /**
12587  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
12588  * but with all dynamically-allocated buffers duplicated in new buffers.
12589  */
12590 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
12591
12592 /**
12593  * Creates a new tuple which has the same data as `orig`
12594  * but with all dynamically-allocated buffers duplicated in new buffers.
12595  */
12596 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
12597
12598 /**
12599  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
12600  */
12601 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
12602
12603 /**
12604  * Frees any resources used by the C2Tuple_OutPointScriptZ.
12605  */
12606 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
12607
12608 /**
12609  * Creates a new tuple which has the same data as `orig`
12610  * but with all dynamically-allocated buffers duplicated in new buffers.
12611  */
12612 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
12613
12614 /**
12615  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
12616  */
12617 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
12618
12619 /**
12620  * Frees any resources used by the C2Tuple_u32ScriptZ.
12621  */
12622 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
12623
12624 /**
12625  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12626  */
12627 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
12628
12629 /**
12630  * Creates a new tuple which has the same data as `orig`
12631  * but with all dynamically-allocated buffers duplicated in new buffers.
12632  */
12633 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
12634
12635 /**
12636  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
12637  */
12638 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
12639
12640 /**
12641  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
12642  */
12643 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
12644
12645 /**
12646  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12647  */
12648 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
12649
12650 /**
12651  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12652  */
12653 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
12654
12655 /**
12656  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12657  */
12658 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
12659
12660 /**
12661  * Creates a new tuple which has the same data as `orig`
12662  * but with all dynamically-allocated buffers duplicated in new buffers.
12663  */
12664 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
12665
12666 /**
12667  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
12668  */
12669 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
12670
12671 /**
12672  * Frees any resources used by the C2Tuple_u32TxOutZ.
12673  */
12674 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
12675
12676 /**
12677  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12678  */
12679 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
12680
12681 /**
12682  * Creates a new tuple which has the same data as `orig`
12683  * but with all dynamically-allocated buffers duplicated in new buffers.
12684  */
12685 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
12686
12687 /**
12688  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12689  */
12690 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
12691
12692 /**
12693  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12694  */
12695 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
12696
12697 /**
12698  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12699  */
12700 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
12701
12702 /**
12703  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12704  */
12705 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
12706
12707 /**
12708  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12709  */
12710 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
12711
12712 /**
12713  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12714  */
12715 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
12716
12717 /**
12718  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12719  */
12720 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
12721
12722 /**
12723  * Creates a new CResult_NoneLightningErrorZ in the success state.
12724  */
12725 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
12726
12727 /**
12728  * Creates a new CResult_NoneLightningErrorZ in the error state.
12729  */
12730 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
12731
12732 /**
12733  * Frees any resources used by the CResult_NoneLightningErrorZ.
12734  */
12735 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
12736
12737 /**
12738  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
12739  * but with all dynamically-allocated buffers duplicated in new buffers.
12740  */
12741 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
12742
12743 /**
12744  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12745  */
12746 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
12747
12748 /**
12749  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12750  */
12751 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
12752
12753 /**
12754  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12755  */
12756 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
12757
12758 /**
12759  * Creates a new CResult_boolLightningErrorZ in the success state.
12760  */
12761 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
12762
12763 /**
12764  * Creates a new CResult_boolLightningErrorZ in the error state.
12765  */
12766 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
12767
12768 /**
12769  * Frees any resources used by the CResult_boolLightningErrorZ.
12770  */
12771 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
12772
12773 /**
12774  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
12775  * but with all dynamically-allocated buffers duplicated in new buffers.
12776  */
12777 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
12778
12779 /**
12780  * Creates a new tuple which has the same data as `orig`
12781  * but with all dynamically-allocated buffers duplicated in new buffers.
12782  */
12783 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
12784
12785 /**
12786  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
12787  */
12788 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
12789
12790 /**
12791  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
12792  */
12793 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
12794
12795 /**
12796  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12797  */
12798 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
12799
12800 /**
12801  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12802  */
12803 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
12804
12805 /**
12806  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12807  */
12808 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
12809
12810 /**
12811  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12812  */
12813 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
12814
12815 /**
12816  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12817  */
12818 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12819
12820 /**
12821  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12822  */
12823 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
12824
12825 /**
12826  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12827  * but with all dynamically-allocated buffers duplicated in new buffers.
12828  */
12829 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
12830
12831 /**
12832  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
12833  */
12834 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
12835
12836 /**
12837  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
12838  */
12839 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
12840
12841 /**
12842  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
12843  */
12844 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
12845
12846 /**
12847  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12848  * but with all dynamically-allocated buffers duplicated in new buffers.
12849  */
12850 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
12851
12852 /**
12853  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
12854  */
12855 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
12856
12857 /**
12858  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
12859  */
12860 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
12861
12862 /**
12863  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
12864  */
12865 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
12866
12867 /**
12868  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12869  * but with all dynamically-allocated buffers duplicated in new buffers.
12870  */
12871 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
12872
12873 /**
12874  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
12875  */
12876 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
12877
12878 /**
12879  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
12880  */
12881 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
12882
12883 /**
12884  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
12885  */
12886 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
12887
12888 /**
12889  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
12890  * but with all dynamically-allocated buffers duplicated in new buffers.
12891  */
12892 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
12893
12894 /**
12895  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
12896  */
12897 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
12898
12899 /**
12900  * Constructs a new COption_AccessZ containing nothing
12901  */
12902 struct LDKCOption_AccessZ COption_AccessZ_none(void);
12903
12904 /**
12905  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
12906  */
12907 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
12908
12909 /**
12910  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
12911  */
12912 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
12913
12914 /**
12915  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
12916  */
12917 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
12918
12919 /**
12920  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
12921  */
12922 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
12923
12924 /**
12925  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
12926  * but with all dynamically-allocated buffers duplicated in new buffers.
12927  */
12928 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
12929
12930 /**
12931  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
12932  */
12933 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
12934
12935 /**
12936  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
12937  */
12938 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
12939
12940 /**
12941  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
12942  */
12943 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
12944
12945 /**
12946  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
12947  * but with all dynamically-allocated buffers duplicated in new buffers.
12948  */
12949 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
12950
12951 /**
12952  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
12953  */
12954 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
12955
12956 /**
12957  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
12958  */
12959 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
12960
12961 /**
12962  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
12963  */
12964 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
12965
12966 /**
12967  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
12968  * but with all dynamically-allocated buffers duplicated in new buffers.
12969  */
12970 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
12971
12972 /**
12973  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
12974  */
12975 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
12976
12977 /**
12978  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
12979  */
12980 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
12981
12982 /**
12983  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
12984  */
12985 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
12986
12987 /**
12988  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
12989  * but with all dynamically-allocated buffers duplicated in new buffers.
12990  */
12991 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
12992
12993 /**
12994  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12995  */
12996 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
12997
12998 /**
12999  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
13000  */
13001 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
13002
13003 /**
13004  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
13005  */
13006 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
13007
13008 /**
13009  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
13010  */
13011 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
13012
13013 /**
13014  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
13015  * but with all dynamically-allocated buffers duplicated in new buffers.
13016  */
13017 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
13018
13019 /**
13020  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
13021  */
13022 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
13023
13024 /**
13025  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
13026  */
13027 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
13028
13029 /**
13030  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
13031  */
13032 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
13033
13034 /**
13035  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
13036  * but with all dynamically-allocated buffers duplicated in new buffers.
13037  */
13038 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
13039
13040 /**
13041  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
13042  */
13043 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
13044
13045 /**
13046  * Constructs a new COption_CVec_NetAddressZZ containing nothing
13047  */
13048 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
13049
13050 /**
13051  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
13052  */
13053 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
13054
13055 /**
13056  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
13057  * but with all dynamically-allocated buffers duplicated in new buffers.
13058  */
13059 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
13060
13061 /**
13062  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13063  */
13064 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
13065
13066 /**
13067  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13068  */
13069 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
13070
13071 /**
13072  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13073  */
13074 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
13075
13076 /**
13077  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13078  * but with all dynamically-allocated buffers duplicated in new buffers.
13079  */
13080 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
13081
13082 /**
13083  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13084  */
13085 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
13086
13087 /**
13088  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13089  */
13090 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
13091
13092 /**
13093  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13094  */
13095 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
13096
13097 /**
13098  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13099  */
13100 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
13101
13102 /**
13103  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13104  */
13105 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
13106
13107 /**
13108  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13109  */
13110 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
13111
13112 /**
13113  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13114  */
13115 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
13116
13117 /**
13118  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13119  * but with all dynamically-allocated buffers duplicated in new buffers.
13120  */
13121 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
13122
13123 /**
13124  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13125  */
13126 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
13127
13128 /**
13129  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13130  */
13131 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
13132
13133 /**
13134  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13135  */
13136 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
13137
13138 /**
13139  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13140  * but with all dynamically-allocated buffers duplicated in new buffers.
13141  */
13142 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
13143
13144 /**
13145  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13146  */
13147 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
13148
13149 /**
13150  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13151  */
13152 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
13153
13154 /**
13155  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13156  */
13157 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
13158
13159 /**
13160  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13161  * but with all dynamically-allocated buffers duplicated in new buffers.
13162  */
13163 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
13164
13165 /**
13166  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13167  */
13168 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
13169
13170 /**
13171  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13172  */
13173 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
13174
13175 /**
13176  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13177  */
13178 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
13179
13180 /**
13181  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13182  * but with all dynamically-allocated buffers duplicated in new buffers.
13183  */
13184 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
13185
13186 /**
13187  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13188  */
13189 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
13190
13191 /**
13192  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13193  */
13194 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
13195
13196 /**
13197  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13198  */
13199 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
13200
13201 /**
13202  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13203  * but with all dynamically-allocated buffers duplicated in new buffers.
13204  */
13205 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
13206
13207 /**
13208  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13209  */
13210 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
13211
13212 /**
13213  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13214  */
13215 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
13216
13217 /**
13218  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13219  */
13220 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
13221
13222 /**
13223  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13224  * but with all dynamically-allocated buffers duplicated in new buffers.
13225  */
13226 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
13227
13228 /**
13229  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13230  */
13231 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
13232
13233 /**
13234  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13235  */
13236 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
13237
13238 /**
13239  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13240  */
13241 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
13242
13243 /**
13244  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13245  * but with all dynamically-allocated buffers duplicated in new buffers.
13246  */
13247 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
13248
13249 /**
13250  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13251  */
13252 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
13253
13254 /**
13255  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13256  */
13257 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
13258
13259 /**
13260  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13261  */
13262 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
13263
13264 /**
13265  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13266  * but with all dynamically-allocated buffers duplicated in new buffers.
13267  */
13268 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
13269
13270 /**
13271  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
13272  */
13273 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
13274
13275 /**
13276  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
13277  */
13278 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
13279
13280 /**
13281  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
13282  */
13283 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
13284
13285 /**
13286  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
13287  * but with all dynamically-allocated buffers duplicated in new buffers.
13288  */
13289 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
13290
13291 /**
13292  * Creates a new CResult_InitDecodeErrorZ in the success state.
13293  */
13294 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
13295
13296 /**
13297  * Creates a new CResult_InitDecodeErrorZ in the error state.
13298  */
13299 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
13300
13301 /**
13302  * Frees any resources used by the CResult_InitDecodeErrorZ.
13303  */
13304 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
13305
13306 /**
13307  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13308  * but with all dynamically-allocated buffers duplicated in new buffers.
13309  */
13310 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
13311
13312 /**
13313  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13314  */
13315 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
13316
13317 /**
13318  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13319  */
13320 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
13321
13322 /**
13323  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13324  */
13325 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
13326
13327 /**
13328  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13329  * but with all dynamically-allocated buffers duplicated in new buffers.
13330  */
13331 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
13332
13333 /**
13334  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13335  */
13336 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
13337
13338 /**
13339  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13340  */
13341 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
13342
13343 /**
13344  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13345  */
13346 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
13347
13348 /**
13349  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13350  * but with all dynamically-allocated buffers duplicated in new buffers.
13351  */
13352 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
13353
13354 /**
13355  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13356  */
13357 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
13358
13359 /**
13360  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13361  */
13362 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
13363
13364 /**
13365  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13366  */
13367 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
13368
13369 /**
13370  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13371  * but with all dynamically-allocated buffers duplicated in new buffers.
13372  */
13373 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
13374
13375 /**
13376  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13377  */
13378 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
13379
13380 /**
13381  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13382  */
13383 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13384
13385 /**
13386  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13387  */
13388 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
13389
13390 /**
13391  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13392  * but with all dynamically-allocated buffers duplicated in new buffers.
13393  */
13394 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
13395
13396 /**
13397  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13398  */
13399 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
13400
13401 /**
13402  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13403  */
13404 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13405
13406 /**
13407  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13408  */
13409 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
13410
13411 /**
13412  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13413  * but with all dynamically-allocated buffers duplicated in new buffers.
13414  */
13415 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
13416
13417 /**
13418  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13419  */
13420 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
13421
13422 /**
13423  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13424  */
13425 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
13426
13427 /**
13428  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13429  */
13430 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
13431
13432 /**
13433  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13434  * but with all dynamically-allocated buffers duplicated in new buffers.
13435  */
13436 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
13437
13438 /**
13439  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13440  */
13441 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
13442
13443 /**
13444  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13445  */
13446 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13447
13448 /**
13449  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13450  */
13451 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
13452
13453 /**
13454  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13455  * but with all dynamically-allocated buffers duplicated in new buffers.
13456  */
13457 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
13458
13459 /**
13460  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13461  */
13462 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
13463
13464 /**
13465  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13466  */
13467 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
13468
13469 /**
13470  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13471  */
13472 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
13473
13474 /**
13475  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13476  * but with all dynamically-allocated buffers duplicated in new buffers.
13477  */
13478 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
13479
13480 /**
13481  * Creates a new CResult_PingDecodeErrorZ in the success state.
13482  */
13483 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
13484
13485 /**
13486  * Creates a new CResult_PingDecodeErrorZ in the error state.
13487  */
13488 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
13489
13490 /**
13491  * Frees any resources used by the CResult_PingDecodeErrorZ.
13492  */
13493 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
13494
13495 /**
13496  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13497  * but with all dynamically-allocated buffers duplicated in new buffers.
13498  */
13499 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
13500
13501 /**
13502  * Creates a new CResult_PongDecodeErrorZ in the success state.
13503  */
13504 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
13505
13506 /**
13507  * Creates a new CResult_PongDecodeErrorZ in the error state.
13508  */
13509 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
13510
13511 /**
13512  * Frees any resources used by the CResult_PongDecodeErrorZ.
13513  */
13514 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
13515
13516 /**
13517  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13518  * but with all dynamically-allocated buffers duplicated in new buffers.
13519  */
13520 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
13521
13522 /**
13523  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13524  */
13525 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
13526
13527 /**
13528  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13529  */
13530 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13531
13532 /**
13533  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13534  */
13535 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
13536
13537 /**
13538  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13539  * but with all dynamically-allocated buffers duplicated in new buffers.
13540  */
13541 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13542
13543 /**
13544  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13545  */
13546 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
13547
13548 /**
13549  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13550  */
13551 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13552
13553 /**
13554  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13555  */
13556 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
13557
13558 /**
13559  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13560  * but with all dynamically-allocated buffers duplicated in new buffers.
13561  */
13562 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13563
13564 /**
13565  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13566  */
13567 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
13568
13569 /**
13570  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13571  */
13572 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13573
13574 /**
13575  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13576  */
13577 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
13578
13579 /**
13580  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13581  * but with all dynamically-allocated buffers duplicated in new buffers.
13582  */
13583 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13584
13585 /**
13586  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13587  */
13588 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
13589
13590 /**
13591  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13592  */
13593 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13594
13595 /**
13596  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13597  */
13598 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
13599
13600 /**
13601  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13602  * but with all dynamically-allocated buffers duplicated in new buffers.
13603  */
13604 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
13605
13606 /**
13607  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13608  */
13609 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
13610
13611 /**
13612  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13613  */
13614 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
13615
13616 /**
13617  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13618  */
13619 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
13620
13621 /**
13622  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13623  * but with all dynamically-allocated buffers duplicated in new buffers.
13624  */
13625 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
13626
13627 /**
13628  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13629  */
13630 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
13631
13632 /**
13633  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13634  */
13635 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13636
13637 /**
13638  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13639  */
13640 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
13641
13642 /**
13643  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13644  * but with all dynamically-allocated buffers duplicated in new buffers.
13645  */
13646 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13647
13648 /**
13649  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13650  */
13651 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
13652
13653 /**
13654  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13655  */
13656 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
13657
13658 /**
13659  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13660  */
13661 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
13662
13663 /**
13664  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13665  * but with all dynamically-allocated buffers duplicated in new buffers.
13666  */
13667 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
13668
13669 /**
13670  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13671  */
13672 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
13673
13674 /**
13675  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13676  */
13677 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
13678
13679 /**
13680  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13681  */
13682 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
13683
13684 /**
13685  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13686  * but with all dynamically-allocated buffers duplicated in new buffers.
13687  */
13688 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
13689
13690 /**
13691  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13692  */
13693 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
13694
13695 /**
13696  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13697  */
13698 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
13699
13700 /**
13701  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13702  */
13703 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
13704
13705 /**
13706  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13707  * but with all dynamically-allocated buffers duplicated in new buffers.
13708  */
13709 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
13710
13711 /**
13712  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13713  */
13714 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
13715
13716 /**
13717  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13718  */
13719 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13720
13721 /**
13722  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13723  */
13724 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
13725
13726 /**
13727  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13728  * but with all dynamically-allocated buffers duplicated in new buffers.
13729  */
13730 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13731
13732 /**
13733  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13734  */
13735 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
13736
13737 /**
13738  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13739  */
13740 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
13741
13742 /**
13743  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13744  */
13745 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
13746
13747 /**
13748  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13749  * but with all dynamically-allocated buffers duplicated in new buffers.
13750  */
13751 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
13752
13753 /**
13754  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
13755  */
13756 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
13757
13758 /**
13759  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
13760  */
13761 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
13762
13763 /**
13764  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
13765  */
13766 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
13767
13768 /**
13769  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
13770  * but with all dynamically-allocated buffers duplicated in new buffers.
13771  */
13772 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
13773
13774 /**
13775  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
13776  */
13777 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
13778
13779 /**
13780  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
13781  */
13782 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
13783
13784 /**
13785  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
13786  */
13787 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
13788
13789 /**
13790  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
13791  * but with all dynamically-allocated buffers duplicated in new buffers.
13792  */
13793 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
13794
13795 /**
13796  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
13797  */
13798 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
13799
13800 /**
13801  * Constructs a new COption_FilterZ containing nothing
13802  */
13803 struct LDKCOption_FilterZ COption_FilterZ_none(void);
13804
13805 /**
13806  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
13807  */
13808 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
13809
13810 /**
13811  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
13812  */
13813 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
13814
13815 /**
13816  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
13817  */
13818 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
13819
13820 /**
13821  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
13822  */
13823 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
13824
13825 /**
13826  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13827  */
13828 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
13829
13830 /**
13831  * Frees any resources used by the PaymentPurpose
13832  */
13833 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
13834
13835 /**
13836  * Creates a copy of the PaymentPurpose
13837  */
13838 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
13839
13840 /**
13841  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
13842  */
13843 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
13844
13845 /**
13846  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
13847  */
13848 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
13849
13850 /**
13851  * Frees any resources used by the ClosureReason
13852  */
13853 void ClosureReason_free(struct LDKClosureReason this_ptr);
13854
13855 /**
13856  * Creates a copy of the ClosureReason
13857  */
13858 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
13859
13860 /**
13861  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
13862  */
13863 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
13864
13865 /**
13866  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
13867  */
13868 struct LDKClosureReason ClosureReason_holder_force_closed(void);
13869
13870 /**
13871  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
13872  */
13873 struct LDKClosureReason ClosureReason_cooperative_closure(void);
13874
13875 /**
13876  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
13877  */
13878 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
13879
13880 /**
13881  * Utility method to constructs a new ProcessingError-variant ClosureReason
13882  */
13883 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
13884
13885 /**
13886  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
13887  */
13888 struct LDKClosureReason ClosureReason_disconnected_peer(void);
13889
13890 /**
13891  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
13892  */
13893 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
13894
13895 /**
13896  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
13897  */
13898 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
13899
13900 /**
13901  * Frees any resources used by the Event
13902  */
13903 void Event_free(struct LDKEvent this_ptr);
13904
13905 /**
13906  * Creates a copy of the Event
13907  */
13908 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
13909
13910 /**
13911  * Utility method to constructs a new FundingGenerationReady-variant Event
13912  */
13913 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);
13914
13915 /**
13916  * Utility method to constructs a new PaymentReceived-variant Event
13917  */
13918 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
13919
13920 /**
13921  * Utility method to constructs a new PaymentSent-variant Event
13922  */
13923 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
13924
13925 /**
13926  * Utility method to constructs a new PaymentPathFailed-variant Event
13927  */
13928 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);
13929
13930 /**
13931  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
13932  */
13933 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
13934
13935 /**
13936  * Utility method to constructs a new SpendableOutputs-variant Event
13937  */
13938 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
13939
13940 /**
13941  * Utility method to constructs a new PaymentForwarded-variant Event
13942  */
13943 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
13944
13945 /**
13946  * Utility method to constructs a new ChannelClosed-variant Event
13947  */
13948 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
13949
13950 /**
13951  * Utility method to constructs a new DiscardFunding-variant Event
13952  */
13953 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
13954
13955 /**
13956  * Serialize the Event object into a byte array which can be read by Event_read
13957  */
13958 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
13959
13960 /**
13961  * Frees any resources used by the MessageSendEvent
13962  */
13963 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
13964
13965 /**
13966  * Creates a copy of the MessageSendEvent
13967  */
13968 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
13969
13970 /**
13971  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
13972  */
13973 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
13974
13975 /**
13976  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
13977  */
13978 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
13979
13980 /**
13981  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
13982  */
13983 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
13984
13985 /**
13986  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
13987  */
13988 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
13989
13990 /**
13991  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
13992  */
13993 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
13994
13995 /**
13996  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
13997  */
13998 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
13999
14000 /**
14001  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
14002  */
14003 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
14004
14005 /**
14006  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
14007  */
14008 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
14009
14010 /**
14011  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
14012  */
14013 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
14014
14015 /**
14016  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
14017  */
14018 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
14019
14020 /**
14021  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
14022  */
14023 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
14024
14025 /**
14026  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
14027  */
14028 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
14029
14030 /**
14031  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
14032  */
14033 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
14034
14035 /**
14036  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
14037  */
14038 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
14039
14040 /**
14041  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
14042  */
14043 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
14044
14045 /**
14046  * Utility method to constructs a new HandleError-variant MessageSendEvent
14047  */
14048 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
14049
14050 /**
14051  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
14052  */
14053 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
14054
14055 /**
14056  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
14057  */
14058 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
14059
14060 /**
14061  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
14062  */
14063 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
14064
14065 /**
14066  * Calls the free function if one is set
14067  */
14068 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
14069
14070 /**
14071  * Calls the free function if one is set
14072  */
14073 void EventsProvider_free(struct LDKEventsProvider this_ptr);
14074
14075 /**
14076  * Calls the free function if one is set
14077  */
14078 void EventHandler_free(struct LDKEventHandler this_ptr);
14079
14080 /**
14081  * Frees any resources used by the APIError
14082  */
14083 void APIError_free(struct LDKAPIError this_ptr);
14084
14085 /**
14086  * Creates a copy of the APIError
14087  */
14088 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
14089
14090 /**
14091  * Utility method to constructs a new APIMisuseError-variant APIError
14092  */
14093 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
14094
14095 /**
14096  * Utility method to constructs a new FeeRateTooHigh-variant APIError
14097  */
14098 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
14099
14100 /**
14101  * Utility method to constructs a new RouteError-variant APIError
14102  */
14103 struct LDKAPIError APIError_route_error(struct LDKStr err);
14104
14105 /**
14106  * Utility method to constructs a new ChannelUnavailable-variant APIError
14107  */
14108 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
14109
14110 /**
14111  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
14112  */
14113 struct LDKAPIError APIError_monitor_update_failed(void);
14114
14115 /**
14116  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
14117  */
14118 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
14119
14120 /**
14121  * Creates a digital signature of a message given a SecretKey, like the node's secret.
14122  * 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.
14123  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
14124  */
14125 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
14126
14127 /**
14128  * Recovers the PublicKey of the signer of the message given the message and the signature.
14129  */
14130 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
14131
14132 /**
14133  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
14134  * and the PublicKey.
14135  */
14136 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
14137
14138 /**
14139  * Creates a copy of the Level
14140  */
14141 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
14142
14143 /**
14144  * Utility method to constructs a new Trace-variant Level
14145  */
14146 enum LDKLevel Level_trace(void);
14147
14148 /**
14149  * Utility method to constructs a new Debug-variant Level
14150  */
14151 enum LDKLevel Level_debug(void);
14152
14153 /**
14154  * Utility method to constructs a new Info-variant Level
14155  */
14156 enum LDKLevel Level_info(void);
14157
14158 /**
14159  * Utility method to constructs a new Warn-variant Level
14160  */
14161 enum LDKLevel Level_warn(void);
14162
14163 /**
14164  * Utility method to constructs a new Error-variant Level
14165  */
14166 enum LDKLevel Level_error(void);
14167
14168 /**
14169  * Checks if two Levels contain equal inner contents.
14170  * This ignores pointers and is_owned flags and looks at the values in fields.
14171  */
14172 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
14173
14174 /**
14175  * Checks if two Levels contain equal inner contents.
14176  */
14177 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
14178
14179 /**
14180  * Returns the most verbose logging level.
14181  */
14182 MUST_USE_RES enum LDKLevel Level_max(void);
14183
14184 /**
14185  * Calls the free function if one is set
14186  */
14187 void Logger_free(struct LDKLogger this_ptr);
14188
14189 /**
14190  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
14191  */
14192 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
14193
14194 /**
14195  * Confirmations we will wait for before considering the channel locked in.
14196  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
14197  * equivalent limit applied to outbound channels).
14198  *
14199  * Default value: 6.
14200  */
14201 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14202
14203 /**
14204  * Confirmations we will wait for before considering the channel locked in.
14205  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
14206  * equivalent limit applied to outbound channels).
14207  *
14208  * Default value: 6.
14209  */
14210 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
14211
14212 /**
14213  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
14214  * the number of blocks we have to punish our counterparty if they broadcast a revoked
14215  * transaction).
14216  *
14217  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
14218  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
14219  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
14220  * possibly with time in between to RBF the spending transaction).
14221  *
14222  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
14223  * case of an honest unilateral channel close, which implicitly decrease the economic value of
14224  * our channel.
14225  *
14226  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
14227  * can tweak config to ask for more security, not less.
14228  */
14229 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14230
14231 /**
14232  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
14233  * the number of blocks we have to punish our counterparty if they broadcast a revoked
14234  * transaction).
14235  *
14236  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
14237  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
14238  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
14239  * possibly with time in between to RBF the spending transaction).
14240  *
14241  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
14242  * case of an honest unilateral channel close, which implicitly decrease the economic value of
14243  * our channel.
14244  *
14245  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
14246  * can tweak config to ask for more security, not less.
14247  */
14248 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
14249
14250 /**
14251  * Set to the smallest value HTLC we will accept to process.
14252  *
14253  * This value is sent to our counterparty on channel-open and we close the channel any time
14254  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
14255  *
14256  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
14257  * by the protocol.
14258  */
14259 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
14260
14261 /**
14262  * Set to the smallest value HTLC we will accept to process.
14263  *
14264  * This value is sent to our counterparty on channel-open and we close the channel any time
14265  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
14266  *
14267  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
14268  * by the protocol.
14269  */
14270 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
14271
14272 /**
14273  * Constructs a new ChannelHandshakeConfig given each field
14274  */
14275 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);
14276
14277 /**
14278  * Creates a copy of the ChannelHandshakeConfig
14279  */
14280 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
14281
14282 /**
14283  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
14284  */
14285 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
14286
14287 /**
14288  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
14289  */
14290 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
14291
14292 /**
14293  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
14294  * only applies to inbound channels.
14295  *
14296  * Default value: 0.
14297  */
14298 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14299
14300 /**
14301  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
14302  * only applies to inbound channels.
14303  *
14304  * Default value: 0.
14305  */
14306 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14307
14308 /**
14309  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
14310  * you to limit the maximum minimum-size they can require.
14311  *
14312  * Default value: u64::max_value.
14313  */
14314 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14315
14316 /**
14317  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
14318  * you to limit the maximum minimum-size they can require.
14319  *
14320  * Default value: u64::max_value.
14321  */
14322 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14323
14324 /**
14325  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
14326  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
14327  *
14328  * Default value: 0.
14329  */
14330 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14331
14332 /**
14333  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
14334  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
14335  *
14336  * Default value: 0.
14337  */
14338 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14339
14340 /**
14341  * The remote node will require we keep a certain amount in direct payment to ourselves at all
14342  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
14343  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
14344  *
14345  * Default value: u64::max_value.
14346  */
14347 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14348
14349 /**
14350  * The remote node will require we keep a certain amount in direct payment to ourselves at all
14351  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
14352  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
14353  *
14354  * Default value: u64::max_value.
14355  */
14356 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
14357
14358 /**
14359  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
14360  * time. This allows you to set a minimum such value.
14361  *
14362  * Default value: 0.
14363  */
14364 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14365
14366 /**
14367  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
14368  * time. This allows you to set a minimum such value.
14369  *
14370  * Default value: 0.
14371  */
14372 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
14373
14374 /**
14375  * Before a channel is usable the funding transaction will need to be confirmed by at least a
14376  * certain number of blocks, specified by the node which is not the funder (as the funder can
14377  * assume they aren't going to double-spend themselves).
14378  * This config allows you to set a limit on the maximum amount of time to wait.
14379  *
14380  * Default value: 144, or roughly one day and only applies to outbound channels.
14381  */
14382 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14383
14384 /**
14385  * Before a channel is usable the funding transaction will need to be confirmed by at least a
14386  * certain number of blocks, specified by the node which is not the funder (as the funder can
14387  * assume they aren't going to double-spend themselves).
14388  * This config allows you to set a limit on the maximum amount of time to wait.
14389  *
14390  * Default value: 144, or roughly one day and only applies to outbound channels.
14391  */
14392 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
14393
14394 /**
14395  * Set to force an incoming channel to match our announced channel preference in
14396  * [`ChannelConfig::announced_channel`].
14397  *
14398  * For a node which is not online reliably, this should be set to true and
14399  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
14400  * channels will ever be opened.
14401  *
14402  * Default value: true.
14403  */
14404 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14405
14406 /**
14407  * Set to force an incoming channel to match our announced channel preference in
14408  * [`ChannelConfig::announced_channel`].
14409  *
14410  * For a node which is not online reliably, this should be set to true and
14411  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
14412  * channels will ever be opened.
14413  *
14414  * Default value: true.
14415  */
14416 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
14417
14418 /**
14419  * Set to the amount of time we're willing to wait to claim money back to us.
14420  *
14421  * Not checking this value would be a security issue, as our peer would be able to set it to
14422  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
14423  *
14424  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
14425  * reduce the loss of having useless locked funds (if your peer accepts)
14426  */
14427 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
14428
14429 /**
14430  * Set to the amount of time we're willing to wait to claim money back to us.
14431  *
14432  * Not checking this value would be a security issue, as our peer would be able to set it to
14433  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
14434  *
14435  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
14436  * reduce the loss of having useless locked funds (if your peer accepts)
14437  */
14438 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
14439
14440 /**
14441  * Constructs a new ChannelHandshakeLimits given each field
14442  */
14443 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);
14444
14445 /**
14446  * Creates a copy of the ChannelHandshakeLimits
14447  */
14448 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
14449
14450 /**
14451  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
14452  */
14453 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
14454
14455 /**
14456  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
14457  */
14458 void ChannelConfig_free(struct LDKChannelConfig this_obj);
14459
14460 /**
14461  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
14462  * over the channel.
14463  * This may be allowed to change at runtime in a later update, however doing so must result in
14464  * update messages sent to notify all nodes of our updated relay fee.
14465  *
14466  * Default value: 0.
14467  */
14468 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14469
14470 /**
14471  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
14472  * over the channel.
14473  * This may be allowed to change at runtime in a later update, however doing so must result in
14474  * update messages sent to notify all nodes of our updated relay fee.
14475  *
14476  * Default value: 0.
14477  */
14478 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
14479
14480 /**
14481  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
14482  * excess of [`forwarding_fee_proportional_millionths`].
14483  * This may be allowed to change at runtime in a later update, however doing so must result in
14484  * update messages sent to notify all nodes of our updated relay fee.
14485  *
14486  * The default value of a single satoshi roughly matches the market rate on many routing nodes
14487  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
14488  * this node.
14489  *
14490  * Default value: 1000.
14491  *
14492  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
14493  */
14494 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14495
14496 /**
14497  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
14498  * excess of [`forwarding_fee_proportional_millionths`].
14499  * This may be allowed to change at runtime in a later update, however doing so must result in
14500  * update messages sent to notify all nodes of our updated relay fee.
14501  *
14502  * The default value of a single satoshi roughly matches the market rate on many routing nodes
14503  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
14504  * this node.
14505  *
14506  * Default value: 1000.
14507  *
14508  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
14509  */
14510 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
14511
14512 /**
14513  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
14514  * the channel this config applies to.
14515  *
14516  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
14517  * HTLC balance when a channel appears on-chain whereas
14518  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14519  * (non-HTLC-encumbered) balance.
14520  *
14521  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14522  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14523  * commitment transaction at least once per this many blocks (minus some margin to allow us
14524  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14525  * the spending transaction).
14526  *
14527  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14528  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14529  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14530  *
14531  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14532  */
14533 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14534
14535 /**
14536  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
14537  * the channel this config applies to.
14538  *
14539  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
14540  * HTLC balance when a channel appears on-chain whereas
14541  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
14542  * (non-HTLC-encumbered) balance.
14543  *
14544  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
14545  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
14546  * commitment transaction at least once per this many blocks (minus some margin to allow us
14547  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
14548  * the spending transaction).
14549  *
14550  * Default value: 72 (12 hours at an average of 6 blocks/hour).
14551  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
14552  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
14553  *
14554  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
14555  */
14556 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
14557
14558 /**
14559  * Set to announce the channel publicly and notify all nodes that they can route via this
14560  * channel.
14561  *
14562  * This should only be set to true for nodes which expect to be online reliably.
14563  *
14564  * As the node which funds a channel picks this value this will only apply for new outbound
14565  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14566  *
14567  * This cannot be changed after the initial channel handshake.
14568  *
14569  * Default value: false.
14570  */
14571 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14572
14573 /**
14574  * Set to announce the channel publicly and notify all nodes that they can route via this
14575  * channel.
14576  *
14577  * This should only be set to true for nodes which expect to be online reliably.
14578  *
14579  * As the node which funds a channel picks this value this will only apply for new outbound
14580  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
14581  *
14582  * This cannot be changed after the initial channel handshake.
14583  *
14584  * Default value: false.
14585  */
14586 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14587
14588 /**
14589  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14590  * supports it, they will then enforce the mutual-close output to us matches what we provided
14591  * at intialization, preventing us from closing to an alternate pubkey.
14592  *
14593  * This is set to true by default to provide a slight increase in security, though ultimately
14594  * any attacker who is able to take control of a channel can just as easily send the funds via
14595  * lightning payments, so we never require that our counterparties support this option.
14596  *
14597  * This cannot be changed after a channel has been initialized.
14598  *
14599  * Default value: true.
14600  */
14601 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14602
14603 /**
14604  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
14605  * supports it, they will then enforce the mutual-close output to us matches what we provided
14606  * at intialization, preventing us from closing to an alternate pubkey.
14607  *
14608  * This is set to true by default to provide a slight increase in security, though ultimately
14609  * any attacker who is able to take control of a channel can just as easily send the funds via
14610  * lightning payments, so we never require that our counterparties support this option.
14611  *
14612  * This cannot be changed after a channel has been initialized.
14613  *
14614  * Default value: true.
14615  */
14616 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
14617
14618 /**
14619  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14620  * small to claim on-chain.
14621  *
14622  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14623  * not be claimable on-chain, instead being turned into additional miner fees if either
14624  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14625  * to such payments may be sustantial if there are many dust HTLCs present when the
14626  * channel is force-closed.
14627  *
14628  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14629  * exposure across all three types per-channel. Setting this too low may prevent the
14630  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14631  * important to prevent stealing of dust HTLCs by miners.
14632  *
14633  * Default value: 5_000_000 msat.
14634  */
14635 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14636
14637 /**
14638  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
14639  * small to claim on-chain.
14640  *
14641  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
14642  * not be claimable on-chain, instead being turned into additional miner fees if either
14643  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
14644  * to such payments may be sustantial if there are many dust HTLCs present when the
14645  * channel is force-closed.
14646  *
14647  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
14648  * exposure across all three types per-channel. Setting this too low may prevent the
14649  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
14650  * important to prevent stealing of dust HTLCs by miners.
14651  *
14652  * Default value: 5_000_000 msat.
14653  */
14654 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14655
14656 /**
14657  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14658  * `to_self_delay` to reclaim funds.
14659  *
14660  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14661  * closing transaction which both sides find acceptable, ultimately paid by the channel
14662  * funder/initiator.
14663  *
14664  * When we are the funder, because we have to pay the channel closing fee, we bound the
14665  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14666  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14667  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14668  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14669  * funds.
14670  *
14671  * When we are not the funder, we require the closing transaction fee pay at least our
14672  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14673  * Thus, this value is ignored when we are not the funder.
14674  *
14675  * Default value: 1000 satoshis.
14676  *
14677  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14678  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14679  */
14680 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
14681
14682 /**
14683  * The additional fee we're willing to pay to avoid waiting for the counterparty's
14684  * `to_self_delay` to reclaim funds.
14685  *
14686  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
14687  * closing transaction which both sides find acceptable, ultimately paid by the channel
14688  * funder/initiator.
14689  *
14690  * When we are the funder, because we have to pay the channel closing fee, we bound the
14691  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
14692  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
14693  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
14694  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
14695  * funds.
14696  *
14697  * When we are not the funder, we require the closing transaction fee pay at least our
14698  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
14699  * Thus, this value is ignored when we are not the funder.
14700  *
14701  * Default value: 1000 satoshis.
14702  *
14703  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14704  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14705  */
14706 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
14707
14708 /**
14709  * Constructs a new ChannelConfig given each field
14710  */
14711 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);
14712
14713 /**
14714  * Creates a copy of the ChannelConfig
14715  */
14716 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
14717
14718 /**
14719  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
14720  */
14721 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
14722
14723 /**
14724  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
14725  */
14726 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
14727
14728 /**
14729  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
14730  */
14731 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
14732
14733 /**
14734  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
14735  */
14736 void UserConfig_free(struct LDKUserConfig this_obj);
14737
14738 /**
14739  * Channel config that we propose to our counterparty.
14740  */
14741 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14742
14743 /**
14744  * Channel config that we propose to our counterparty.
14745  */
14746 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
14747
14748 /**
14749  * Limits applied to our counterparty's proposed channel config settings.
14750  */
14751 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14752
14753 /**
14754  * Limits applied to our counterparty's proposed channel config settings.
14755  */
14756 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
14757
14758 /**
14759  * Channel config which affects behavior during channel lifetime.
14760  */
14761 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14762
14763 /**
14764  * Channel config which affects behavior during channel lifetime.
14765  */
14766 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
14767
14768 /**
14769  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14770  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14771  * node which is not online reliably.
14772  *
14773  * For nodes which are not online reliably, you should set all channels to *not* be announced
14774  * (using [`ChannelConfig::announced_channel`] and
14775  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14776  * ensure you are not exposed to any forwarding risk.
14777  *
14778  * Note that because you cannot change a channel's announced state after creation, there is no
14779  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14780  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14781  * all your channels and open new ones. For privacy, you should also change your node_id
14782  * (swapping all private and public key material for new ones) at that time.
14783  *
14784  * Default value: false.
14785  */
14786 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
14787
14788 /**
14789  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
14790  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
14791  * node which is not online reliably.
14792  *
14793  * For nodes which are not online reliably, you should set all channels to *not* be announced
14794  * (using [`ChannelConfig::announced_channel`] and
14795  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
14796  * ensure you are not exposed to any forwarding risk.
14797  *
14798  * Note that because you cannot change a channel's announced state after creation, there is no
14799  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
14800  * from a publicly-announced forwarding node to a private non-forwarding node you must close
14801  * all your channels and open new ones. For privacy, you should also change your node_id
14802  * (swapping all private and public key material for new ones) at that time.
14803  *
14804  * Default value: false.
14805  */
14806 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
14807
14808 /**
14809  * Constructs a new UserConfig given each field
14810  */
14811 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);
14812
14813 /**
14814  * Creates a copy of the UserConfig
14815  */
14816 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
14817
14818 /**
14819  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
14820  */
14821 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
14822
14823 /**
14824  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
14825  */
14826 void BestBlock_free(struct LDKBestBlock this_obj);
14827
14828 /**
14829  * Creates a copy of the BestBlock
14830  */
14831 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
14832
14833 /**
14834  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
14835  * network.
14836  */
14837 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
14838
14839 /**
14840  * Returns a `BestBlock` as identified by the given block hash and height.
14841  */
14842 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
14843
14844 /**
14845  * Returns the best block hash.
14846  */
14847 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
14848
14849 /**
14850  * Returns the best block height.
14851  */
14852 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
14853
14854 /**
14855  * Creates a copy of the AccessError
14856  */
14857 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
14858
14859 /**
14860  * Utility method to constructs a new UnknownChain-variant AccessError
14861  */
14862 enum LDKAccessError AccessError_unknown_chain(void);
14863
14864 /**
14865  * Utility method to constructs a new UnknownTx-variant AccessError
14866  */
14867 enum LDKAccessError AccessError_unknown_tx(void);
14868
14869 /**
14870  * Calls the free function if one is set
14871  */
14872 void Access_free(struct LDKAccess this_ptr);
14873
14874 /**
14875  * Calls the free function if one is set
14876  */
14877 void Listen_free(struct LDKListen this_ptr);
14878
14879 /**
14880  * Calls the free function if one is set
14881  */
14882 void Confirm_free(struct LDKConfirm this_ptr);
14883
14884 /**
14885  * Creates a copy of the ChannelMonitorUpdateErr
14886  */
14887 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
14888
14889 /**
14890  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
14891  */
14892 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
14893
14894 /**
14895  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
14896  */
14897 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
14898
14899 /**
14900  * Calls the free function if one is set
14901  */
14902 void Watch_free(struct LDKWatch this_ptr);
14903
14904 /**
14905  * Calls the free function if one is set
14906  */
14907 void Filter_free(struct LDKFilter this_ptr);
14908
14909 /**
14910  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
14911  */
14912 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
14913
14914 /**
14915  * First block where the transaction output may have been spent.
14916  *
14917  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14918  */
14919 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14920
14921 /**
14922  * First block where the transaction output may have been spent.
14923  *
14924  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
14925  */
14926 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14927
14928 /**
14929  * Outpoint identifying the transaction output.
14930  */
14931 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14932
14933 /**
14934  * Outpoint identifying the transaction output.
14935  */
14936 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14937
14938 /**
14939  * Spending condition of the transaction output.
14940  */
14941 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
14942
14943 /**
14944  * Spending condition of the transaction output.
14945  */
14946 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14947
14948 /**
14949  * Constructs a new WatchedOutput given each field
14950  */
14951 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
14952
14953 /**
14954  * Creates a copy of the WatchedOutput
14955  */
14956 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
14957
14958 /**
14959  * Checks if two WatchedOutputs contain equal inner contents.
14960  */
14961 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
14962
14963 /**
14964  * Calls the free function if one is set
14965  */
14966 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
14967
14968 /**
14969  * Creates a copy of the ConfirmationTarget
14970  */
14971 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
14972
14973 /**
14974  * Utility method to constructs a new Background-variant ConfirmationTarget
14975  */
14976 enum LDKConfirmationTarget ConfirmationTarget_background(void);
14977
14978 /**
14979  * Utility method to constructs a new Normal-variant ConfirmationTarget
14980  */
14981 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
14982
14983 /**
14984  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
14985  */
14986 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
14987
14988 /**
14989  * Checks if two ConfirmationTargets contain equal inner contents.
14990  * This ignores pointers and is_owned flags and looks at the values in fields.
14991  */
14992 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
14993
14994 /**
14995  * Calls the free function if one is set
14996  */
14997 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
14998
14999 /**
15000  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
15001  */
15002 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
15003
15004 /**
15005  * Creates a copy of the MonitorUpdateId
15006  */
15007 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
15008
15009 /**
15010  * Checks if two MonitorUpdateIds contain equal inner contents.
15011  */
15012 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
15013
15014 /**
15015  * Checks if two MonitorUpdateIds contain equal inner contents.
15016  * This ignores pointers and is_owned flags and looks at the values in fields.
15017  * Two objects with NULL inner values will be considered "equal" here.
15018  */
15019 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
15020
15021 /**
15022  * Calls the free function if one is set
15023  */
15024 void Persist_free(struct LDKPersist this_ptr);
15025
15026 /**
15027  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
15028  */
15029 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
15030
15031 /**
15032  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
15033  */
15034 void ChainMonitor_free(struct LDKChainMonitor this_obj);
15035
15036 /**
15037  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
15038  *
15039  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
15040  * will call back to it indicating transactions and outputs of interest. This allows clients to
15041  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
15042  * always need to fetch full blocks absent another means for determining which blocks contain
15043  * transactions relevant to the watched channels.
15044  */
15045 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
15046
15047 /**
15048  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
15049  * claims which are awaiting confirmation.
15050  *
15051  * Includes the balances from each [`ChannelMonitor`] *except* those included in
15052  * `ignored_channels`, allowing you to filter out balances from channels which are still open
15053  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
15054  *
15055  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
15056  * inclusion in the return value.
15057  */
15058 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
15059
15060 /**
15061  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
15062  * such [`ChannelMonitor`] is currently being monitored for.
15063  *
15064  * Note that the result holds a mutex over our monitor set, and should not be held
15065  * indefinitely.
15066  */
15067 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
15068
15069 /**
15070  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
15071  *
15072  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
15073  * monitoring for on-chain state resolutions.
15074  */
15075 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15076
15077 /**
15078  * Indicates the persistence of a [`ChannelMonitor`] has completed after
15079  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
15080  *
15081  * Thus, the anticipated use is, at a high level:
15082  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
15083  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
15084  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
15085  *  2) once all remote copies are updated, you call this function with the
15086  *     `completed_update_id` that completed, and once all pending updates have completed the
15087  *     channel will be re-enabled.
15088  *
15089  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
15090  * registered [`ChannelMonitor`]s.
15091  */
15092 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);
15093
15094 /**
15095  * Constructs a new Listen which calls the relevant methods on this_arg.
15096  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
15097  */
15098 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15099
15100 /**
15101  * Constructs a new Confirm which calls the relevant methods on this_arg.
15102  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
15103  */
15104 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15105
15106 /**
15107  * Constructs a new Watch which calls the relevant methods on this_arg.
15108  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
15109  */
15110 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15111
15112 /**
15113  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
15114  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
15115  */
15116 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
15117
15118 /**
15119  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
15120  */
15121 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
15122
15123 /**
15124  * The sequence number of this update. Updates *must* be replayed in-order according to this
15125  * sequence number (and updates may panic if they are not). The update_id values are strictly
15126  * increasing and increase by one for each new update, with one exception specified below.
15127  *
15128  * This sequence number is also used to track up to which points updates which returned
15129  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
15130  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
15131  *
15132  * The only instance where update_id values are not strictly increasing is the case where we
15133  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
15134  * its docs for more details.
15135  */
15136 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
15137
15138 /**
15139  * The sequence number of this update. Updates *must* be replayed in-order according to this
15140  * sequence number (and updates may panic if they are not). The update_id values are strictly
15141  * increasing and increase by one for each new update, with one exception specified below.
15142  *
15143  * This sequence number is also used to track up to which points updates which returned
15144  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
15145  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
15146  *
15147  * The only instance where update_id values are not strictly increasing is the case where we
15148  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
15149  * its docs for more details.
15150  */
15151 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
15152
15153 /**
15154  * Creates a copy of the ChannelMonitorUpdate
15155  */
15156 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
15157
15158 /**
15159  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
15160  */
15161 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
15162
15163 /**
15164  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
15165  */
15166 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
15167
15168 /**
15169  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
15170  */
15171 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
15172
15173 struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr);
15174
15175 void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val);
15176
15177 /**
15178  * Constructs a new MonitorUpdateError given each field
15179  */
15180 MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg);
15181
15182 /**
15183  * Creates a copy of the MonitorUpdateError
15184  */
15185 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
15186
15187 /**
15188  * Frees any resources used by the MonitorEvent
15189  */
15190 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
15191
15192 /**
15193  * Creates a copy of the MonitorEvent
15194  */
15195 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
15196
15197 /**
15198  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
15199  */
15200 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
15201
15202 /**
15203  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
15204  */
15205 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
15206
15207 /**
15208  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
15209  */
15210 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
15211
15212 /**
15213  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
15214  */
15215 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
15216
15217 /**
15218  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
15219  */
15220 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
15221
15222 /**
15223  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
15224  */
15225 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
15226
15227 /**
15228  * Creates a copy of the HTLCUpdate
15229  */
15230 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
15231
15232 /**
15233  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
15234  */
15235 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
15236
15237 /**
15238  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
15239  */
15240 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
15241
15242 /**
15243  * Frees any resources used by the Balance
15244  */
15245 void Balance_free(struct LDKBalance this_ptr);
15246
15247 /**
15248  * Creates a copy of the Balance
15249  */
15250 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
15251
15252 /**
15253  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
15254  */
15255 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
15256
15257 /**
15258  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
15259  */
15260 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
15261
15262 /**
15263  * Utility method to constructs a new ContentiousClaimable-variant Balance
15264  */
15265 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
15266
15267 /**
15268  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
15269  */
15270 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
15271
15272 /**
15273  * Checks if two Balances contain equal inner contents.
15274  * This ignores pointers and is_owned flags and looks at the values in fields.
15275  */
15276 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
15277
15278 /**
15279  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
15280  */
15281 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
15282
15283 /**
15284  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
15285  */
15286 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
15287
15288 /**
15289  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
15290  * itself.
15291  *
15292  * panics if the given update is not the next update by update_id.
15293  */
15294 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);
15295
15296 /**
15297  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
15298  * ChannelMonitor.
15299  */
15300 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15301
15302 /**
15303  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
15304  */
15305 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15306
15307 /**
15308  * Gets a list of txids, with their output scripts (in the order they appear in the
15309  * transaction), which we must learn about spends of via block_connected().
15310  */
15311 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15312
15313 /**
15314  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
15315  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
15316  * have been registered.
15317  */
15318 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
15319
15320 /**
15321  * Get the list of HTLCs who's status has been updated on chain. This should be called by
15322  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
15323  */
15324 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15325
15326 /**
15327  * Gets the list of pending events which were generated by previous actions, clearing the list
15328  * in the process.
15329  *
15330  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
15331  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
15332  * no internal locking in ChannelMonitors.
15333  */
15334 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15335
15336 /**
15337  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
15338  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
15339  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
15340  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
15341  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
15342  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
15343  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
15344  * out-of-band the other node operator to coordinate with him if option is available to you.
15345  * In any-case, choice is up to the user.
15346  */
15347 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);
15348
15349 /**
15350  * Processes transactions in a newly connected block, which may result in any of the following:
15351  * - update the monitor's state against resolved HTLCs
15352  * - punish the counterparty in the case of seeing a revoked commitment transaction
15353  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
15354  * - detect settled outputs for later spending
15355  * - schedule and bump any in-flight claims
15356  *
15357  * Returns any new outputs to watch from `txdata`; after called, these are also included in
15358  * [`get_outputs_to_watch`].
15359  *
15360  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
15361  */
15362 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);
15363
15364 /**
15365  * Determines if the disconnected block contained any transactions of interest and updates
15366  * appropriately.
15367  */
15368 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);
15369
15370 /**
15371  * Processes transactions confirmed in a block with the given header and height, returning new
15372  * outputs to watch. See [`block_connected`] for details.
15373  *
15374  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
15375  * blocks. See [`chain::Confirm`] for calling expectations.
15376  *
15377  * [`block_connected`]: Self::block_connected
15378  */
15379 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);
15380
15381 /**
15382  * Processes a transaction that was reorganized out of the chain.
15383  *
15384  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
15385  * than blocks. See [`chain::Confirm`] for calling expectations.
15386  *
15387  * [`block_disconnected`]: Self::block_disconnected
15388  */
15389 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);
15390
15391 /**
15392  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
15393  * [`block_connected`] for details.
15394  *
15395  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
15396  * blocks. See [`chain::Confirm`] for calling expectations.
15397  *
15398  * [`block_connected`]: Self::block_connected
15399  */
15400 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);
15401
15402 /**
15403  * Returns the set of txids that should be monitored for re-organization out of the chain.
15404  */
15405 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15406
15407 /**
15408  * Gets the latest best block which was connected either via the [`chain::Listen`] or
15409  * [`chain::Confirm`] interfaces.
15410  */
15411 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15412
15413 /**
15414  * Gets the balances in this channel which are either claimable by us if we were to
15415  * force-close the channel now or which are claimable on-chain (possibly awaiting
15416  * confirmation).
15417  *
15418  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
15419  * included here until an [`Event::SpendableOutputs`] event has been generated for the
15420  * balance, or until our counterparty has claimed the balance and accrued several
15421  * confirmations on the claim transaction.
15422  *
15423  * Note that the balances available when you or your counterparty have broadcasted revoked
15424  * state(s) may not be fully captured here.
15425  *
15426  * See [`Balance`] for additional details on the types of claimable balances which
15427  * may be returned here and their meanings.
15428  */
15429 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
15430
15431 /**
15432  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
15433  */
15434 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
15435
15436 /**
15437  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
15438  */
15439 void OutPoint_free(struct LDKOutPoint this_obj);
15440
15441 /**
15442  * The referenced transaction's txid.
15443  */
15444 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
15445
15446 /**
15447  * The referenced transaction's txid.
15448  */
15449 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15450
15451 /**
15452  * The index of the referenced output in its transaction's vout.
15453  */
15454 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
15455
15456 /**
15457  * The index of the referenced output in its transaction's vout.
15458  */
15459 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
15460
15461 /**
15462  * Constructs a new OutPoint given each field
15463  */
15464 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
15465
15466 /**
15467  * Creates a copy of the OutPoint
15468  */
15469 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
15470
15471 /**
15472  * Checks if two OutPoints contain equal inner contents.
15473  * This ignores pointers and is_owned flags and looks at the values in fields.
15474  * Two objects with NULL inner values will be considered "equal" here.
15475  */
15476 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
15477
15478 /**
15479  * Checks if two OutPoints contain equal inner contents.
15480  */
15481 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
15482
15483 /**
15484  * Convert an `OutPoint` to a lightning channel id.
15485  */
15486 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
15487
15488 /**
15489  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
15490  */
15491 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
15492
15493 /**
15494  * Read a OutPoint from a byte array, created by OutPoint_write
15495  */
15496 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
15497
15498 /**
15499  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
15500  */
15501 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
15502
15503 /**
15504  * The outpoint which is spendable
15505  */
15506 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15507
15508 /**
15509  * The outpoint which is spendable
15510  */
15511 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15512
15513 /**
15514  * Per commitment point to derive delayed_payment_key by key holder
15515  */
15516 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15517
15518 /**
15519  * Per commitment point to derive delayed_payment_key by key holder
15520  */
15521 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15522
15523 /**
15524  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
15525  * the witness_script.
15526  */
15527 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15528
15529 /**
15530  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
15531  * the witness_script.
15532  */
15533 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
15534
15535 /**
15536  * The output which is referenced by the given outpoint
15537  */
15538 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
15539
15540 /**
15541  * The revocation point specific to the commitment transaction which was broadcast. Used to
15542  * derive the witnessScript for this output.
15543  */
15544 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15545
15546 /**
15547  * The revocation point specific to the commitment transaction which was broadcast. Used to
15548  * derive the witnessScript for this output.
15549  */
15550 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15551
15552 /**
15553  * Arbitrary identification information returned by a call to
15554  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15555  * the channel to spend the output.
15556  */
15557 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
15558
15559 /**
15560  * Arbitrary identification information returned by a call to
15561  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15562  * the channel to spend the output.
15563  */
15564 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15565
15566 /**
15567  * The value of the channel which this output originated from, possibly indirectly.
15568  */
15569 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15570
15571 /**
15572  * The value of the channel which this output originated from, possibly indirectly.
15573  */
15574 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
15575
15576 /**
15577  * Constructs a new DelayedPaymentOutputDescriptor given each field
15578  */
15579 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);
15580
15581 /**
15582  * Creates a copy of the DelayedPaymentOutputDescriptor
15583  */
15584 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
15585
15586 /**
15587  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
15588  */
15589 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
15590
15591 /**
15592  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
15593  */
15594 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
15595
15596 /**
15597  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
15598  */
15599 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
15600
15601 /**
15602  * The outpoint which is spendable
15603  */
15604 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15605
15606 /**
15607  * The outpoint which is spendable
15608  */
15609 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
15610
15611 /**
15612  * The output which is referenced by the given outpoint
15613  */
15614 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
15615
15616 /**
15617  * Arbitrary identification information returned by a call to
15618  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15619  * the channel to spend the output.
15620  */
15621 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
15622
15623 /**
15624  * Arbitrary identification information returned by a call to
15625  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
15626  * the channel to spend the output.
15627  */
15628 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15629
15630 /**
15631  * The value of the channel which this transactions spends.
15632  */
15633 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
15634
15635 /**
15636  * The value of the channel which this transactions spends.
15637  */
15638 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
15639
15640 /**
15641  * Constructs a new StaticPaymentOutputDescriptor given each field
15642  */
15643 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);
15644
15645 /**
15646  * Creates a copy of the StaticPaymentOutputDescriptor
15647  */
15648 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
15649
15650 /**
15651  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
15652  */
15653 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
15654
15655 /**
15656  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
15657  */
15658 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
15659
15660 /**
15661  * Frees any resources used by the SpendableOutputDescriptor
15662  */
15663 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
15664
15665 /**
15666  * Creates a copy of the SpendableOutputDescriptor
15667  */
15668 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
15669
15670 /**
15671  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
15672  */
15673 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
15674
15675 /**
15676  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
15677  */
15678 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
15679
15680 /**
15681  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
15682  */
15683 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
15684
15685 /**
15686  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
15687  */
15688 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
15689
15690 /**
15691  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
15692  */
15693 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
15694
15695 /**
15696  * Calls the free function if one is set
15697  */
15698 void BaseSign_free(struct LDKBaseSign this_ptr);
15699
15700 /**
15701  * Creates a copy of a Sign
15702  */
15703 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
15704
15705 /**
15706  * Calls the free function if one is set
15707  */
15708 void Sign_free(struct LDKSign this_ptr);
15709
15710 /**
15711  * Calls the free function if one is set
15712  */
15713 void KeysInterface_free(struct LDKKeysInterface this_ptr);
15714
15715 /**
15716  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
15717  */
15718 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
15719
15720 /**
15721  * Private key of anchor tx
15722  */
15723 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15724
15725 /**
15726  * Private key of anchor tx
15727  */
15728 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15729
15730 /**
15731  * Holder secret key for blinded revocation pubkey
15732  */
15733 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15734
15735 /**
15736  * Holder secret key for blinded revocation pubkey
15737  */
15738 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15739
15740 /**
15741  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15742  */
15743 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15744
15745 /**
15746  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
15747  */
15748 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15749
15750 /**
15751  * Holder secret key used in HTLC tx
15752  */
15753 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15754
15755 /**
15756  * Holder secret key used in HTLC tx
15757  */
15758 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15759
15760 /**
15761  * Holder htlc secret key used in commitment tx htlc outputs
15762  */
15763 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15764
15765 /**
15766  * Holder htlc secret key used in commitment tx htlc outputs
15767  */
15768 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
15769
15770 /**
15771  * Commitment seed
15772  */
15773 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
15774
15775 /**
15776  * Commitment seed
15777  */
15778 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15779
15780 /**
15781  * Creates a copy of the InMemorySigner
15782  */
15783 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
15784
15785 /**
15786  * Create a new InMemorySigner
15787  */
15788 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);
15789
15790 /**
15791  * Counterparty pubkeys.
15792  * Will panic if ready_channel wasn't called.
15793  */
15794 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15795
15796 /**
15797  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
15798  * transactions, ie the amount of time that we have to wait to recover our funds if we
15799  * broadcast a transaction.
15800  * Will panic if ready_channel wasn't called.
15801  */
15802 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15803
15804 /**
15805  * The contest_delay value specified by us and applied on transactions broadcastable
15806  * by our counterparty, ie the amount of time that they have to wait to recover their funds
15807  * if they broadcast a transaction.
15808  * Will panic if ready_channel wasn't called.
15809  */
15810 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15811
15812 /**
15813  * Whether the holder is the initiator
15814  * Will panic if ready_channel wasn't called.
15815  */
15816 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15817
15818 /**
15819  * Funding outpoint
15820  * Will panic if ready_channel wasn't called.
15821  */
15822 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15823
15824 /**
15825  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
15826  * building transactions.
15827  *
15828  * Will panic if ready_channel wasn't called.
15829  */
15830 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15831
15832 /**
15833  * Sign the single input of spend_tx at index `input_idx` which spends the output
15834  * described by descriptor, returning the witness stack for the input.
15835  *
15836  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15837  * or is not spending the outpoint described by `descriptor.outpoint`.
15838  */
15839 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);
15840
15841 /**
15842  * Sign the single input of spend_tx at index `input_idx` which spends the output
15843  * described by descriptor, returning the witness stack for the input.
15844  *
15845  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
15846  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
15847  * sequence set to `descriptor.to_self_delay`.
15848  */
15849 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);
15850
15851 /**
15852  * Constructs a new BaseSign which calls the relevant methods on this_arg.
15853  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
15854  */
15855 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15856
15857 /**
15858  * Constructs a new Sign which calls the relevant methods on this_arg.
15859  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
15860  */
15861 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
15862
15863 /**
15864  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
15865  */
15866 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
15867
15868 /**
15869  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
15870  */
15871 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
15872
15873 /**
15874  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
15875  */
15876 void KeysManager_free(struct LDKKeysManager this_obj);
15877
15878 /**
15879  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
15880  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
15881  * starting_time isn't strictly required to actually be a time, but it must absolutely,
15882  * without a doubt, be unique to this instance. ie if you start multiple times with the same
15883  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
15884  * simply use the current time (with very high precision).
15885  *
15886  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
15887  * obviously, starting_time should be unique every time you reload the library - it is only
15888  * used to generate new ephemeral key data (which will be stored by the individual channel if
15889  * necessary).
15890  *
15891  * Note that the seed is required to recover certain on-chain funds independent of
15892  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
15893  * channel, and some on-chain during-closing funds.
15894  *
15895  * Note that until the 0.1 release there is no guarantee of backward compatibility between
15896  * versions. Once the library is more fully supported, the docs will be updated to include a
15897  * detailed description of the guarantee.
15898  */
15899 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
15900
15901 /**
15902  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
15903  *
15904  * Key derivation parameters are accessible through a per-channel secrets
15905  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
15906  * onchain output detection for which a corresponding delayed_payment_key must be derived.
15907  */
15908 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]);
15909
15910 /**
15911  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
15912  * output to the given change destination (if sufficient change value remains). The
15913  * transaction will have a feerate, at least, of the given value.
15914  *
15915  * Returns `Err(())` if the output value is greater than the input value minus required fee or
15916  * if a descriptor was duplicated.
15917  *
15918  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
15919  *
15920  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
15921  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
15922  */
15923 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);
15924
15925 /**
15926  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
15927  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
15928  */
15929 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
15930
15931 /**
15932  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
15933  */
15934 void ChannelManager_free(struct LDKChannelManager this_obj);
15935
15936 /**
15937  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
15938  */
15939 void ChainParameters_free(struct LDKChainParameters this_obj);
15940
15941 /**
15942  * The network for determining the `chain_hash` in Lightning messages.
15943  */
15944 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
15945
15946 /**
15947  * The network for determining the `chain_hash` in Lightning messages.
15948  */
15949 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
15950
15951 /**
15952  * The hash and height of the latest block successfully connected.
15953  *
15954  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
15955  */
15956 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
15957
15958 /**
15959  * The hash and height of the latest block successfully connected.
15960  *
15961  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
15962  */
15963 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
15964
15965 /**
15966  * Constructs a new ChainParameters given each field
15967  */
15968 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
15969
15970 /**
15971  * Creates a copy of the ChainParameters
15972  */
15973 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
15974
15975 /**
15976  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
15977  */
15978 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
15979
15980 /**
15981  * Base routing fee in millisatoshis.
15982  */
15983 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
15984
15985 /**
15986  * Base routing fee in millisatoshis.
15987  */
15988 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
15989
15990 /**
15991  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
15992  */
15993 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
15994
15995 /**
15996  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
15997  */
15998 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
15999
16000 /**
16001  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
16002  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
16003  * `cltv_expiry_delta` for more details.
16004  */
16005 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
16006
16007 /**
16008  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
16009  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
16010  * `cltv_expiry_delta` for more details.
16011  */
16012 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
16013
16014 /**
16015  * Constructs a new CounterpartyForwardingInfo given each field
16016  */
16017 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);
16018
16019 /**
16020  * Creates a copy of the CounterpartyForwardingInfo
16021  */
16022 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
16023
16024 /**
16025  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
16026  */
16027 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
16028
16029 /**
16030  * The node_id of our counterparty
16031  */
16032 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16033
16034 /**
16035  * The node_id of our counterparty
16036  */
16037 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16038
16039 /**
16040  * The Features the channel counterparty provided upon last connection.
16041  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
16042  * many routing-relevant features are present in the init context.
16043  */
16044 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16045
16046 /**
16047  * The Features the channel counterparty provided upon last connection.
16048  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
16049  * many routing-relevant features are present in the init context.
16050  */
16051 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
16052
16053 /**
16054  * The value, in satoshis, that must always be held in the channel for our counterparty. This
16055  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
16056  * claiming at least this value on chain.
16057  *
16058  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
16059  *
16060  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
16061  */
16062 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16063
16064 /**
16065  * The value, in satoshis, that must always be held in the channel for our counterparty. This
16066  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
16067  * claiming at least this value on chain.
16068  *
16069  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
16070  *
16071  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
16072  */
16073 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
16074
16075 /**
16076  * Information on the fees and requirements that the counterparty requires when forwarding
16077  * payments to us through this channel.
16078  *
16079  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16080  */
16081 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
16082
16083 /**
16084  * Information on the fees and requirements that the counterparty requires when forwarding
16085  * payments to us through this channel.
16086  *
16087  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16088  */
16089 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
16090
16091 /**
16092  * Constructs a new ChannelCounterparty given each field
16093  */
16094 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);
16095
16096 /**
16097  * Creates a copy of the ChannelCounterparty
16098  */
16099 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
16100
16101 /**
16102  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
16103  */
16104 void ChannelDetails_free(struct LDKChannelDetails this_obj);
16105
16106 /**
16107  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
16108  * thereafter this is the txid of the funding transaction xor the funding transaction output).
16109  * Note that this means this value is *not* persistent - it can change once during the
16110  * lifetime of the channel.
16111  */
16112 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
16113
16114 /**
16115  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
16116  * thereafter this is the txid of the funding transaction xor the funding transaction output).
16117  * Note that this means this value is *not* persistent - it can change once during the
16118  * lifetime of the channel.
16119  */
16120 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16121
16122 /**
16123  * Parameters which apply to our counterparty. See individual fields for more information.
16124  */
16125 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16126
16127 /**
16128  * Parameters which apply to our counterparty. See individual fields for more information.
16129  */
16130 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
16131
16132 /**
16133  * The Channel's funding transaction output, if we've negotiated the funding transaction with
16134  * our counterparty already.
16135  *
16136  * Note that, if this has been set, `channel_id` will be equivalent to
16137  * `funding_txo.unwrap().to_channel_id()`.
16138  *
16139  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16140  */
16141 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16142
16143 /**
16144  * The Channel's funding transaction output, if we've negotiated the funding transaction with
16145  * our counterparty already.
16146  *
16147  * Note that, if this has been set, `channel_id` will be equivalent to
16148  * `funding_txo.unwrap().to_channel_id()`.
16149  *
16150  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16151  */
16152 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16153
16154 /**
16155  * The position of the funding transaction in the chain. None if the funding transaction has
16156  * not yet been confirmed and the channel fully opened.
16157  */
16158 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16159
16160 /**
16161  * The position of the funding transaction in the chain. None if the funding transaction has
16162  * not yet been confirmed and the channel fully opened.
16163  */
16164 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16165
16166 /**
16167  * The value, in satoshis, of this channel as appears in the funding output
16168  */
16169 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16170
16171 /**
16172  * The value, in satoshis, of this channel as appears in the funding output
16173  */
16174 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16175
16176 /**
16177  * The value, in satoshis, that must always be held in the channel for us. This value ensures
16178  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
16179  * this value on chain.
16180  *
16181  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
16182  *
16183  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16184  *
16185  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
16186  */
16187 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16188
16189 /**
16190  * The value, in satoshis, that must always be held in the channel for us. This value ensures
16191  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
16192  * this value on chain.
16193  *
16194  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
16195  *
16196  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16197  *
16198  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
16199  */
16200 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
16201
16202 /**
16203  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
16204  */
16205 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16206
16207 /**
16208  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
16209  */
16210 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16211
16212 /**
16213  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
16214  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16215  * available for inclusion in new outbound HTLCs). This further does not include any pending
16216  * outgoing HTLCs which are awaiting some other resolution to be sent.
16217  *
16218  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16219  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
16220  * should be able to spend nearly this amount.
16221  */
16222 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16223
16224 /**
16225  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
16226  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16227  * available for inclusion in new outbound HTLCs). This further does not include any pending
16228  * outgoing HTLCs which are awaiting some other resolution to be sent.
16229  *
16230  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16231  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
16232  * should be able to spend nearly this amount.
16233  */
16234 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16235
16236 /**
16237  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
16238  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16239  * available for inclusion in new inbound HTLCs).
16240  * Note that there are some corner cases not fully handled here, so the actual available
16241  * inbound capacity may be slightly higher than this.
16242  *
16243  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16244  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
16245  * However, our counterparty should be able to spend nearly this amount.
16246  */
16247 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16248
16249 /**
16250  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
16251  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
16252  * available for inclusion in new inbound HTLCs).
16253  * Note that there are some corner cases not fully handled here, so the actual available
16254  * inbound capacity may be slightly higher than this.
16255  *
16256  * This value is not exact. Due to various in-flight changes, feerate changes, and our
16257  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
16258  * However, our counterparty should be able to spend nearly this amount.
16259  */
16260 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
16261
16262 /**
16263  * The number of required confirmations on the funding transaction before the funding will be
16264  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
16265  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
16266  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
16267  * [`ChannelHandshakeLimits::max_minimum_depth`].
16268  *
16269  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16270  *
16271  * [`is_outbound`]: ChannelDetails::is_outbound
16272  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
16273  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
16274  */
16275 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16276
16277 /**
16278  * The number of required confirmations on the funding transaction before the funding will be
16279  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
16280  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
16281  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
16282  * [`ChannelHandshakeLimits::max_minimum_depth`].
16283  *
16284  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16285  *
16286  * [`is_outbound`]: ChannelDetails::is_outbound
16287  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
16288  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
16289  */
16290 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16291
16292 /**
16293  * The number of blocks (after our commitment transaction confirms) that we will need to wait
16294  * until we can claim our funds after we force-close the channel. During this time our
16295  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
16296  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
16297  * time to claim our non-HTLC-encumbered funds.
16298  *
16299  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16300  */
16301 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16302
16303 /**
16304  * The number of blocks (after our commitment transaction confirms) that we will need to wait
16305  * until we can claim our funds after we force-close the channel. During this time our
16306  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
16307  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
16308  * time to claim our non-HTLC-encumbered funds.
16309  *
16310  * This value will be `None` for outbound channels until the counterparty accepts the channel.
16311  */
16312 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
16313
16314 /**
16315  * True if the channel was initiated (and thus funded) by us.
16316  */
16317 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16318
16319 /**
16320  * True if the channel was initiated (and thus funded) by us.
16321  */
16322 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16323
16324 /**
16325  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
16326  * channel is not currently being shut down. `funding_locked` message exchange implies the
16327  * required confirmation count has been reached (and we were connected to the peer at some
16328  * point after the funding transaction received enough confirmations). The required
16329  * confirmation count is provided in [`confirmations_required`].
16330  *
16331  * [`confirmations_required`]: ChannelDetails::confirmations_required
16332  */
16333 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16334
16335 /**
16336  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
16337  * channel is not currently being shut down. `funding_locked` message exchange implies the
16338  * required confirmation count has been reached (and we were connected to the peer at some
16339  * point after the funding transaction received enough confirmations). The required
16340  * confirmation count is provided in [`confirmations_required`].
16341  *
16342  * [`confirmations_required`]: ChannelDetails::confirmations_required
16343  */
16344 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16345
16346 /**
16347  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
16348  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
16349  *
16350  * This is a strict superset of `is_funding_locked`.
16351  */
16352 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16353
16354 /**
16355  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
16356  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
16357  *
16358  * This is a strict superset of `is_funding_locked`.
16359  */
16360 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16361
16362 /**
16363  * True if this channel is (or will be) publicly-announced.
16364  */
16365 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
16366
16367 /**
16368  * True if this channel is (or will be) publicly-announced.
16369  */
16370 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
16371
16372 /**
16373  * Constructs a new ChannelDetails given each field
16374  */
16375 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);
16376
16377 /**
16378  * Creates a copy of the ChannelDetails
16379  */
16380 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
16381
16382 /**
16383  * Frees any resources used by the PaymentSendFailure
16384  */
16385 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
16386
16387 /**
16388  * Creates a copy of the PaymentSendFailure
16389  */
16390 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
16391
16392 /**
16393  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
16394  */
16395 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
16396
16397 /**
16398  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
16399  */
16400 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
16401
16402 /**
16403  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
16404  */
16405 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
16406
16407 /**
16408  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
16409  */
16410 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
16411
16412 /**
16413  * Constructs a new ChannelManager to hold several channels and route between them.
16414  *
16415  * This is the main \"logic hub\" for all channel-related actions, and implements
16416  * ChannelMessageHandler.
16417  *
16418  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
16419  *
16420  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
16421  *
16422  * Users need to notify the new ChannelManager when a new block is connected or
16423  * disconnected using its `block_connected` and `block_disconnected` methods, starting
16424  * from after `params.latest_hash`.
16425  */
16426 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);
16427
16428 /**
16429  * Gets the current configuration applied to all new channels,  as
16430  */
16431 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
16432
16433 /**
16434  * Creates a new outbound channel to the given remote node and with the given value.
16435  *
16436  * `user_channel_id` will be provided back as in
16437  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
16438  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
16439  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
16440  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
16441  * ignored.
16442  *
16443  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
16444  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
16445  *
16446  * Note that we do not check if you are currently connected to the given peer. If no
16447  * connection is available, the outbound `open_channel` message may fail to send, resulting in
16448  * the channel eventually being silently forgotten (dropped on reload).
16449  *
16450  * Returns the new Channel's temporary `channel_id`. This ID will appear as
16451  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
16452  * [`ChannelDetails::channel_id`] until after
16453  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
16454  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
16455  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
16456  *
16457  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
16458  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
16459  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
16460  *
16461  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
16462  */
16463 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);
16464
16465 /**
16466  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
16467  * more information.
16468  */
16469 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16470
16471 /**
16472  * Gets the list of usable channels, in random order. Useful as an argument to
16473  * get_route to ensure non-announced channels are used.
16474  *
16475  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
16476  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
16477  * are.
16478  */
16479 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16480
16481 /**
16482  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
16483  * will be accepted on the given channel, and after additional timeout/the closing of all
16484  * pending HTLCs, the channel will be closed on chain.
16485  *
16486  *  * If we are the channel initiator, we will pay between our [`Background`] and
16487  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
16488  *    estimate.
16489  *  * If our counterparty is the channel initiator, we will require a channel closing
16490  *    transaction feerate of at least our [`Background`] feerate or the feerate which
16491  *    would appear on a force-closure transaction, whichever is lower. We will allow our
16492  *    counterparty to pay as much fee as they'd like, however.
16493  *
16494  * May generate a SendShutdown message event on success, which should be relayed.
16495  *
16496  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
16497  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16498  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16499  */
16500 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
16501
16502 /**
16503  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
16504  * will be accepted on the given channel, and after additional timeout/the closing of all
16505  * pending HTLCs, the channel will be closed on chain.
16506  *
16507  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
16508  * the channel being closed or not:
16509  *  * If we are the channel initiator, we will pay at least this feerate on the closing
16510  *    transaction. The upper-bound is set by
16511  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
16512  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
16513  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
16514  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
16515  *    will appear on a force-closure transaction, whichever is lower).
16516  *
16517  * May generate a SendShutdown message event on success, which should be relayed.
16518  *
16519  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
16520  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
16521  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
16522  */
16523 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);
16524
16525 /**
16526  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
16527  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
16528  */
16529 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
16530
16531 /**
16532  * Force close all channels, immediately broadcasting the latest local commitment transaction
16533  * for each to the chain and rejecting new HTLCs on each.
16534  */
16535 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
16536
16537 /**
16538  * Sends a payment along a given route.
16539  *
16540  * Value parameters are provided via the last hop in route, see documentation for RouteHop
16541  * fields for more info.
16542  *
16543  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
16544  * payment), we don't do anything to stop you! We always try to ensure that if the provided
16545  * next hop knows the preimage to payment_hash they can claim an additional amount as
16546  * specified in the last hop in the route! Thus, you should probably do your own
16547  * payment_preimage tracking (which you should already be doing as they represent \"proof of
16548  * payment\") and prevent double-sends yourself.
16549  *
16550  * May generate SendHTLCs message(s) event on success, which should be relayed.
16551  *
16552  * Each path may have a different return value, and PaymentSendValue may return a Vec with
16553  * each entry matching the corresponding-index entry in the route paths, see
16554  * PaymentSendFailure for more info.
16555  *
16556  * In general, a path may raise:
16557  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
16558  *    node public key) is specified.
16559  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
16560  *    (including due to previous monitor update failure or new permanent monitor update
16561  *    failure).
16562  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
16563  *    relevant updates.
16564  *
16565  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
16566  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
16567  * different route unless you intend to pay twice!
16568  *
16569  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
16570  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
16571  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
16572  * must not contain multiple paths as multi-path payments require a recipient-provided
16573  * payment_secret.
16574  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
16575  * bit set (either as required or as available). If multiple paths are present in the Route,
16576  * we assume the invoice had the basic_mpp feature set.
16577  *
16578  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
16579  */
16580 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);
16581
16582 /**
16583  * Retries a payment along the given [`Route`].
16584  *
16585  * Errors returned are a superset of those returned from [`send_payment`], so see
16586  * [`send_payment`] documentation for more details on errors. This method will also error if the
16587  * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
16588  * for the given `payment_id` cannot be found (likely due to timeout or success).
16589  *
16590  * [`send_payment`]: [`ChannelManager::send_payment`]
16591  */
16592 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);
16593
16594 /**
16595  * Send a spontaneous payment, which is a payment that does not require the recipient to have
16596  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
16597  * the preimage, it must be a cryptographically secure random value that no intermediate node
16598  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
16599  * never reach the recipient.
16600  *
16601  * See [`send_payment`] documentation for more details on the return value of this function.
16602  *
16603  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
16604  * [`send_payment`] for more information about the risks of duplicate preimage usage.
16605  *
16606  * Note that `route` must have exactly one path.
16607  *
16608  * [`send_payment`]: Self::send_payment
16609  *
16610  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
16611  */
16612 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);
16613
16614 /**
16615  * Call this upon creation of a funding transaction for the given channel.
16616  *
16617  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
16618  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
16619  *
16620  * Panics if a funding transaction has already been provided for this channel.
16621  *
16622  * May panic if the output found in the funding transaction is duplicative with some other
16623  * channel (note that this should be trivially prevented by using unique funding transaction
16624  * keys per-channel).
16625  *
16626  * Do NOT broadcast the funding transaction yourself. When we have safely received our
16627  * counterparty's signature the funding transaction will automatically be broadcast via the
16628  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
16629  *
16630  * Note that this includes RBF or similar transaction replacement strategies - lightning does
16631  * not currently support replacing a funding transaction on an existing channel. Instead,
16632  * create a new channel with a conflicting funding transaction.
16633  *
16634  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
16635  */
16636 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);
16637
16638 /**
16639  * Regenerates channel_announcements and generates a signed node_announcement from the given
16640  * arguments, providing them in corresponding events via
16641  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
16642  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
16643  * announcement to ensure that the lightning P2P network is aware of the channels we have and
16644  * our network addresses.
16645  *
16646  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
16647  * node to humans. They carry no in-protocol meaning.
16648  *
16649  * `addresses` represent the set (possibly empty) of socket addresses on which this node
16650  * accepts incoming connections. These will be included in the node_announcement, publicly
16651  * tying these addresses together and to this node. If you wish to preserve user privacy,
16652  * addresses should likely contain only Tor Onion addresses.
16653  *
16654  * Panics if `addresses` is absurdly large (more than 500).
16655  *
16656  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
16657  */
16658 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
16659
16660 /**
16661  * Processes HTLCs which are pending waiting on random forward delay.
16662  *
16663  * Should only really ever be called in response to a PendingHTLCsForwardable event.
16664  * Will likely generate further events.
16665  */
16666 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
16667
16668 /**
16669  * Performs actions which should happen on startup and roughly once per minute thereafter.
16670  *
16671  * This currently includes:
16672  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
16673  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
16674  *    than a minute, informing the network that they should no longer attempt to route over
16675  *    the channel.
16676  *
16677  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
16678  * estimate fetches.
16679  */
16680 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
16681
16682 /**
16683  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
16684  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
16685  * along the path (including in our own channel on which we received it).
16686  * Returns false if no payment was found to fail backwards, true if the process of failing the
16687  * HTLC backwards has been started.
16688  */
16689 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
16690
16691 /**
16692  * Provides a payment preimage in response to a PaymentReceived event, returning true and
16693  * generating message events for the net layer to claim the payment, if possible. Thus, you
16694  * should probably kick the net layer to go send messages if this returns true!
16695  *
16696  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
16697  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
16698  * event matches your expectation. If you fail to do so and call this method, you may provide
16699  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
16700  *
16701  * May panic if called except in response to a PaymentReceived event.
16702  *
16703  * [`create_inbound_payment`]: Self::create_inbound_payment
16704  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16705  */
16706 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
16707
16708 /**
16709  * Gets the node_id held by this ChannelManager
16710  */
16711 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
16712
16713 /**
16714  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
16715  * to pay us.
16716  *
16717  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
16718  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
16719  *
16720  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
16721  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
16722  * passed directly to [`claim_funds`].
16723  *
16724  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
16725  *
16726  * [`claim_funds`]: Self::claim_funds
16727  * [`PaymentReceived`]: events::Event::PaymentReceived
16728  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
16729  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
16730  */
16731 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);
16732
16733 /**
16734  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
16735  * stored external to LDK.
16736  *
16737  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
16738  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
16739  * the `min_value_msat` provided here, if one is provided.
16740  *
16741  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
16742  * method may return an Err if another payment with the same payment_hash is still pending.
16743  *
16744  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
16745  * allow tracking of which events correspond with which calls to this and
16746  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
16747  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
16748  * with invoice metadata stored elsewhere.
16749  *
16750  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
16751  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
16752  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
16753  * sender \"proof-of-payment\" unless they have paid the required amount.
16754  *
16755  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
16756  * in excess of the current time. This should roughly match the expiry time set in the invoice.
16757  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
16758  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
16759  * invoices when no timeout is set.
16760  *
16761  * Note that we use block header time to time-out pending inbound payments (with some margin
16762  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
16763  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
16764  * If you need exact expiry semantics, you should enforce them upon receipt of
16765  * [`PaymentReceived`].
16766  *
16767  * Pending inbound payments are stored in memory and in serialized versions of this
16768  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
16769  * space is limited, you may wish to rate-limit inbound payment creation.
16770  *
16771  * May panic if `invoice_expiry_delta_secs` is greater than one year.
16772  *
16773  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
16774  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
16775  *
16776  * [`create_inbound_payment`]: Self::create_inbound_payment
16777  * [`PaymentReceived`]: events::Event::PaymentReceived
16778  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
16779  */
16780 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);
16781
16782 /**
16783  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16784  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16785  */
16786 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16787
16788 /**
16789  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
16790  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
16791  */
16792 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
16793
16794 /**
16795  * Constructs a new Listen which calls the relevant methods on this_arg.
16796  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
16797  */
16798 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
16799
16800 /**
16801  * Constructs a new Confirm which calls the relevant methods on this_arg.
16802  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
16803  */
16804 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
16805
16806 /**
16807  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
16808  * indicating whether persistence is necessary. Only one listener on
16809  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16810  * up.
16811  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
16812  */
16813 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
16814
16815 /**
16816  * Blocks until ChannelManager needs to be persisted. Only one listener on
16817  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
16818  * up.
16819  */
16820 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
16821
16822 /**
16823  * Gets the latest best block which was connected either via the [`chain::Listen`] or
16824  * [`chain::Confirm`] interfaces.
16825  */
16826 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
16827
16828 /**
16829  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
16830  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
16831  */
16832 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
16833
16834 /**
16835  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
16836  */
16837 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
16838
16839 /**
16840  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
16841  */
16842 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
16843
16844 /**
16845  * The keys provider which will give us relevant keys. Some keys will be loaded during
16846  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16847  * signing data.
16848  */
16849 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16850
16851 /**
16852  * The keys provider which will give us relevant keys. Some keys will be loaded during
16853  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
16854  * signing data.
16855  */
16856 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
16857
16858 /**
16859  * The fee_estimator for use in the ChannelManager in the future.
16860  *
16861  * No calls to the FeeEstimator will be made during deserialization.
16862  */
16863 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16864
16865 /**
16866  * The fee_estimator for use in the ChannelManager in the future.
16867  *
16868  * No calls to the FeeEstimator will be made during deserialization.
16869  */
16870 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
16871
16872 /**
16873  * The chain::Watch for use in the ChannelManager in the future.
16874  *
16875  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16876  * you have deserialized ChannelMonitors separately and will add them to your
16877  * chain::Watch after deserializing this ChannelManager.
16878  */
16879 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16880
16881 /**
16882  * The chain::Watch for use in the ChannelManager in the future.
16883  *
16884  * No calls to the chain::Watch will be made during deserialization. It is assumed that
16885  * you have deserialized ChannelMonitors separately and will add them to your
16886  * chain::Watch after deserializing this ChannelManager.
16887  */
16888 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
16889
16890 /**
16891  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16892  * used to broadcast the latest local commitment transactions of channels which must be
16893  * force-closed during deserialization.
16894  */
16895 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16896
16897 /**
16898  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
16899  * used to broadcast the latest local commitment transactions of channels which must be
16900  * force-closed during deserialization.
16901  */
16902 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
16903
16904 /**
16905  * The Logger for use in the ChannelManager and which may be used to log information during
16906  * deserialization.
16907  */
16908 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16909
16910 /**
16911  * The Logger for use in the ChannelManager and which may be used to log information during
16912  * deserialization.
16913  */
16914 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
16915
16916 /**
16917  * Default settings used for new channels. Any existing channels will continue to use the
16918  * runtime settings which were stored when the ChannelManager was serialized.
16919  */
16920 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
16921
16922 /**
16923  * Default settings used for new channels. Any existing channels will continue to use the
16924  * runtime settings which were stored when the ChannelManager was serialized.
16925  */
16926 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
16927
16928 /**
16929  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
16930  * HashMap for you. This is primarily useful for C bindings where it is not practical to
16931  * populate a HashMap directly from C.
16932  */
16933 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);
16934
16935 /**
16936  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
16937  */
16938 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
16939
16940 /**
16941  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
16942  */
16943 void DecodeError_free(struct LDKDecodeError this_obj);
16944
16945 /**
16946  * Creates a copy of the DecodeError
16947  */
16948 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
16949
16950 /**
16951  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
16952  */
16953 void Init_free(struct LDKInit this_obj);
16954
16955 /**
16956  * The relevant features which the sender supports
16957  */
16958 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
16959
16960 /**
16961  * The relevant features which the sender supports
16962  */
16963 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
16964
16965 /**
16966  * Constructs a new Init given each field
16967  */
16968 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
16969
16970 /**
16971  * Creates a copy of the Init
16972  */
16973 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
16974
16975 /**
16976  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
16977  */
16978 void ErrorMessage_free(struct LDKErrorMessage this_obj);
16979
16980 /**
16981  * The channel ID involved in the error
16982  */
16983 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
16984
16985 /**
16986  * The channel ID involved in the error
16987  */
16988 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16989
16990 /**
16991  * A possibly human-readable error description.
16992  * The string should be sanitized before it is used (e.g. emitted to logs
16993  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
16994  * vulnerability in the terminal emulator or the logging subsystem.
16995  */
16996 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
16997
16998 /**
16999  * A possibly human-readable error description.
17000  * The string should be sanitized before it is used (e.g. emitted to logs
17001  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
17002  * vulnerability in the terminal emulator or the logging subsystem.
17003  */
17004 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
17005
17006 /**
17007  * Constructs a new ErrorMessage given each field
17008  */
17009 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
17010
17011 /**
17012  * Creates a copy of the ErrorMessage
17013  */
17014 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
17015
17016 /**
17017  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
17018  */
17019 void Ping_free(struct LDKPing this_obj);
17020
17021 /**
17022  * The desired response length
17023  */
17024 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
17025
17026 /**
17027  * The desired response length
17028  */
17029 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
17030
17031 /**
17032  * The ping packet size.
17033  * This field is not sent on the wire. byteslen zeros are sent.
17034  */
17035 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
17036
17037 /**
17038  * The ping packet size.
17039  * This field is not sent on the wire. byteslen zeros are sent.
17040  */
17041 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
17042
17043 /**
17044  * Constructs a new Ping given each field
17045  */
17046 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
17047
17048 /**
17049  * Creates a copy of the Ping
17050  */
17051 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
17052
17053 /**
17054  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
17055  */
17056 void Pong_free(struct LDKPong this_obj);
17057
17058 /**
17059  * The pong packet size.
17060  * This field is not sent on the wire. byteslen zeros are sent.
17061  */
17062 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
17063
17064 /**
17065  * The pong packet size.
17066  * This field is not sent on the wire. byteslen zeros are sent.
17067  */
17068 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
17069
17070 /**
17071  * Constructs a new Pong given each field
17072  */
17073 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
17074
17075 /**
17076  * Creates a copy of the Pong
17077  */
17078 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
17079
17080 /**
17081  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
17082  */
17083 void OpenChannel_free(struct LDKOpenChannel this_obj);
17084
17085 /**
17086  * The genesis hash of the blockchain where the channel is to be opened
17087  */
17088 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
17089
17090 /**
17091  * The genesis hash of the blockchain where the channel is to be opened
17092  */
17093 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17094
17095 /**
17096  * A temporary channel ID, until the funding outpoint is announced
17097  */
17098 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
17099
17100 /**
17101  * A temporary channel ID, until the funding outpoint is announced
17102  */
17103 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17104
17105 /**
17106  * The channel value
17107  */
17108 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17109
17110 /**
17111  * The channel value
17112  */
17113 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17114
17115 /**
17116  * The amount to push to the counterparty as part of the open, in milli-satoshi
17117  */
17118 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17119
17120 /**
17121  * The amount to push to the counterparty as part of the open, in milli-satoshi
17122  */
17123 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17124
17125 /**
17126  * The threshold below which outputs on transactions broadcast by sender will be omitted
17127  */
17128 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17129
17130 /**
17131  * The threshold below which outputs on transactions broadcast by sender will be omitted
17132  */
17133 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17134
17135 /**
17136  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17137  */
17138 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17139
17140 /**
17141  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17142  */
17143 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17144
17145 /**
17146  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17147  */
17148 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17149
17150 /**
17151  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17152  */
17153 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17154
17155 /**
17156  * The minimum HTLC size incoming to sender, in milli-satoshi
17157  */
17158 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17159
17160 /**
17161  * The minimum HTLC size incoming to sender, in milli-satoshi
17162  */
17163 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
17164
17165 /**
17166  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
17167  */
17168 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17169
17170 /**
17171  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
17172  */
17173 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
17174
17175 /**
17176  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17177  */
17178 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17179
17180 /**
17181  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17182  */
17183 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
17184
17185 /**
17186  * The maximum number of inbound HTLCs towards sender
17187  */
17188 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17189
17190 /**
17191  * The maximum number of inbound HTLCs towards sender
17192  */
17193 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
17194
17195 /**
17196  * The sender's key controlling the funding transaction
17197  */
17198 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17199
17200 /**
17201  * The sender's key controlling the funding transaction
17202  */
17203 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17204
17205 /**
17206  * Used to derive a revocation key for transactions broadcast by counterparty
17207  */
17208 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17209
17210 /**
17211  * Used to derive a revocation key for transactions broadcast by counterparty
17212  */
17213 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17214
17215 /**
17216  * A payment key to sender for transactions broadcast by counterparty
17217  */
17218 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17219
17220 /**
17221  * A payment key to sender for transactions broadcast by counterparty
17222  */
17223 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17224
17225 /**
17226  * Used to derive a payment key to sender for transactions broadcast by sender
17227  */
17228 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17229
17230 /**
17231  * Used to derive a payment key to sender for transactions broadcast by sender
17232  */
17233 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17234
17235 /**
17236  * Used to derive an HTLC payment key to sender
17237  */
17238 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17239
17240 /**
17241  * Used to derive an HTLC payment key to sender
17242  */
17243 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17244
17245 /**
17246  * The first to-be-broadcast-by-sender transaction's per commitment point
17247  */
17248 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17249
17250 /**
17251  * The first to-be-broadcast-by-sender transaction's per commitment point
17252  */
17253 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17254
17255 /**
17256  * Channel flags
17257  */
17258 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
17259
17260 /**
17261  * Channel flags
17262  */
17263 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
17264
17265 /**
17266  * Creates a copy of the OpenChannel
17267  */
17268 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
17269
17270 /**
17271  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
17272  */
17273 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
17274
17275 /**
17276  * A temporary channel ID, until the funding outpoint is announced
17277  */
17278 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
17279
17280 /**
17281  * A temporary channel ID, until the funding outpoint is announced
17282  */
17283 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17284
17285 /**
17286  * The threshold below which outputs on transactions broadcast by sender will be omitted
17287  */
17288 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17289
17290 /**
17291  * The threshold below which outputs on transactions broadcast by sender will be omitted
17292  */
17293 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17294
17295 /**
17296  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17297  */
17298 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17299
17300 /**
17301  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
17302  */
17303 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17304
17305 /**
17306  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17307  */
17308 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17309
17310 /**
17311  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
17312  */
17313 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17314
17315 /**
17316  * The minimum HTLC size incoming to sender, in milli-satoshi
17317  */
17318 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17319
17320 /**
17321  * The minimum HTLC size incoming to sender, in milli-satoshi
17322  */
17323 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
17324
17325 /**
17326  * Minimum depth of the funding transaction before the channel is considered open
17327  */
17328 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17329
17330 /**
17331  * Minimum depth of the funding transaction before the channel is considered open
17332  */
17333 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
17334
17335 /**
17336  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17337  */
17338 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17339
17340 /**
17341  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
17342  */
17343 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
17344
17345 /**
17346  * The maximum number of inbound HTLCs towards sender
17347  */
17348 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17349
17350 /**
17351  * The maximum number of inbound HTLCs towards sender
17352  */
17353 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
17354
17355 /**
17356  * The sender's key controlling the funding transaction
17357  */
17358 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17359
17360 /**
17361  * The sender's key controlling the funding transaction
17362  */
17363 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17364
17365 /**
17366  * Used to derive a revocation key for transactions broadcast by counterparty
17367  */
17368 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17369
17370 /**
17371  * Used to derive a revocation key for transactions broadcast by counterparty
17372  */
17373 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17374
17375 /**
17376  * A payment key to sender for transactions broadcast by counterparty
17377  */
17378 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17379
17380 /**
17381  * A payment key to sender for transactions broadcast by counterparty
17382  */
17383 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17384
17385 /**
17386  * Used to derive a payment key to sender for transactions broadcast by sender
17387  */
17388 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17389
17390 /**
17391  * Used to derive a payment key to sender for transactions broadcast by sender
17392  */
17393 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17394
17395 /**
17396  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
17397  */
17398 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17399
17400 /**
17401  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
17402  */
17403 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17404
17405 /**
17406  * The first to-be-broadcast-by-sender transaction's per commitment point
17407  */
17408 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
17409
17410 /**
17411  * The first to-be-broadcast-by-sender transaction's per commitment point
17412  */
17413 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17414
17415 /**
17416  * Creates a copy of the AcceptChannel
17417  */
17418 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
17419
17420 /**
17421  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
17422  */
17423 void FundingCreated_free(struct LDKFundingCreated this_obj);
17424
17425 /**
17426  * A temporary channel ID, until the funding is established
17427  */
17428 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
17429
17430 /**
17431  * A temporary channel ID, until the funding is established
17432  */
17433 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17434
17435 /**
17436  * The funding transaction ID
17437  */
17438 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
17439
17440 /**
17441  * The funding transaction ID
17442  */
17443 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17444
17445 /**
17446  * The specific output index funding this channel
17447  */
17448 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
17449
17450 /**
17451  * The specific output index funding this channel
17452  */
17453 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
17454
17455 /**
17456  * The signature of the channel initiator (funder) on the initial commitment transaction
17457  */
17458 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
17459
17460 /**
17461  * The signature of the channel initiator (funder) on the initial commitment transaction
17462  */
17463 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
17464
17465 /**
17466  * Constructs a new FundingCreated given each field
17467  */
17468 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);
17469
17470 /**
17471  * Creates a copy of the FundingCreated
17472  */
17473 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
17474
17475 /**
17476  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
17477  */
17478 void FundingSigned_free(struct LDKFundingSigned this_obj);
17479
17480 /**
17481  * The channel ID
17482  */
17483 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
17484
17485 /**
17486  * The channel ID
17487  */
17488 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17489
17490 /**
17491  * The signature of the channel acceptor (fundee) on the initial commitment transaction
17492  */
17493 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
17494
17495 /**
17496  * The signature of the channel acceptor (fundee) on the initial commitment transaction
17497  */
17498 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17499
17500 /**
17501  * Constructs a new FundingSigned given each field
17502  */
17503 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
17504
17505 /**
17506  * Creates a copy of the FundingSigned
17507  */
17508 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
17509
17510 /**
17511  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
17512  */
17513 void FundingLocked_free(struct LDKFundingLocked this_obj);
17514
17515 /**
17516  * The channel ID
17517  */
17518 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
17519
17520 /**
17521  * The channel ID
17522  */
17523 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17524
17525 /**
17526  * The per-commitment point of the second commitment transaction
17527  */
17528 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
17529
17530 /**
17531  * The per-commitment point of the second commitment transaction
17532  */
17533 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17534
17535 /**
17536  * Constructs a new FundingLocked given each field
17537  */
17538 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
17539
17540 /**
17541  * Creates a copy of the FundingLocked
17542  */
17543 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
17544
17545 /**
17546  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
17547  */
17548 void Shutdown_free(struct LDKShutdown this_obj);
17549
17550 /**
17551  * The channel ID
17552  */
17553 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
17554
17555 /**
17556  * The channel ID
17557  */
17558 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17559
17560 /**
17561  * The destination of this peer's funds on closing.
17562  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17563  */
17564 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
17565
17566 /**
17567  * The destination of this peer's funds on closing.
17568  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
17569  */
17570 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17571
17572 /**
17573  * Constructs a new Shutdown given each field
17574  */
17575 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
17576
17577 /**
17578  * Creates a copy of the Shutdown
17579  */
17580 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
17581
17582 /**
17583  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
17584  */
17585 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
17586
17587 /**
17588  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17589  * transaction.
17590  */
17591 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17592
17593 /**
17594  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
17595  * transaction.
17596  */
17597 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17598
17599 /**
17600  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17601  * transaction.
17602  */
17603 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
17604
17605 /**
17606  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
17607  * transaction.
17608  */
17609 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
17610
17611 /**
17612  * Constructs a new ClosingSignedFeeRange given each field
17613  */
17614 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
17615
17616 /**
17617  * Creates a copy of the ClosingSignedFeeRange
17618  */
17619 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
17620
17621 /**
17622  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
17623  */
17624 void ClosingSigned_free(struct LDKClosingSigned this_obj);
17625
17626 /**
17627  * The channel ID
17628  */
17629 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
17630
17631 /**
17632  * The channel ID
17633  */
17634 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17635
17636 /**
17637  * The proposed total fee for the closing transaction
17638  */
17639 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17640
17641 /**
17642  * The proposed total fee for the closing transaction
17643  */
17644 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
17645
17646 /**
17647  * A signature on the closing transaction
17648  */
17649 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17650
17651 /**
17652  * A signature on the closing transaction
17653  */
17654 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17655
17656 /**
17657  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17658  * nodes.
17659  *
17660  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17661  */
17662 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
17663
17664 /**
17665  * The minimum and maximum fees which the sender is willing to accept, provided only by new
17666  * nodes.
17667  *
17668  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17669  */
17670 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
17671
17672 /**
17673  * Constructs a new ClosingSigned given each field
17674  */
17675 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);
17676
17677 /**
17678  * Creates a copy of the ClosingSigned
17679  */
17680 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
17681
17682 /**
17683  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
17684  */
17685 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
17686
17687 /**
17688  * The channel ID
17689  */
17690 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17691
17692 /**
17693  * The channel ID
17694  */
17695 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17696
17697 /**
17698  * The HTLC ID
17699  */
17700 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17701
17702 /**
17703  * The HTLC ID
17704  */
17705 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17706
17707 /**
17708  * The HTLC value in milli-satoshi
17709  */
17710 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17711
17712 /**
17713  * The HTLC value in milli-satoshi
17714  */
17715 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
17716
17717 /**
17718  * The payment hash, the pre-image of which controls HTLC redemption
17719  */
17720 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
17721
17722 /**
17723  * The payment hash, the pre-image of which controls HTLC redemption
17724  */
17725 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17726
17727 /**
17728  * The expiry height of the HTLC
17729  */
17730 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
17731
17732 /**
17733  * The expiry height of the HTLC
17734  */
17735 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
17736
17737 /**
17738  * Creates a copy of the UpdateAddHTLC
17739  */
17740 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
17741
17742 /**
17743  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
17744  */
17745 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
17746
17747 /**
17748  * The channel ID
17749  */
17750 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17751
17752 /**
17753  * The channel ID
17754  */
17755 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17756
17757 /**
17758  * The HTLC ID
17759  */
17760 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
17761
17762 /**
17763  * The HTLC ID
17764  */
17765 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
17766
17767 /**
17768  * The pre-image of the payment hash, allowing HTLC redemption
17769  */
17770 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
17771
17772 /**
17773  * The pre-image of the payment hash, allowing HTLC redemption
17774  */
17775 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17776
17777 /**
17778  * Constructs a new UpdateFulfillHTLC given each field
17779  */
17780 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
17781
17782 /**
17783  * Creates a copy of the UpdateFulfillHTLC
17784  */
17785 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
17786
17787 /**
17788  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
17789  */
17790 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
17791
17792 /**
17793  * The channel ID
17794  */
17795 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
17796
17797 /**
17798  * The channel ID
17799  */
17800 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17801
17802 /**
17803  * The HTLC ID
17804  */
17805 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
17806
17807 /**
17808  * The HTLC ID
17809  */
17810 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
17811
17812 /**
17813  * Creates a copy of the UpdateFailHTLC
17814  */
17815 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
17816
17817 /**
17818  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
17819  */
17820 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
17821
17822 /**
17823  * The channel ID
17824  */
17825 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
17826
17827 /**
17828  * The channel ID
17829  */
17830 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17831
17832 /**
17833  * The HTLC ID
17834  */
17835 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17836
17837 /**
17838  * The HTLC ID
17839  */
17840 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
17841
17842 /**
17843  * The failure code
17844  */
17845 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
17846
17847 /**
17848  * The failure code
17849  */
17850 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
17851
17852 /**
17853  * Creates a copy of the UpdateFailMalformedHTLC
17854  */
17855 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
17856
17857 /**
17858  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
17859  */
17860 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
17861
17862 /**
17863  * The channel ID
17864  */
17865 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
17866
17867 /**
17868  * The channel ID
17869  */
17870 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17871
17872 /**
17873  * A signature on the commitment transaction
17874  */
17875 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
17876
17877 /**
17878  * A signature on the commitment transaction
17879  */
17880 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
17881
17882 /**
17883  * Signatures on the HTLC transactions
17884  */
17885 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
17886
17887 /**
17888  * Constructs a new CommitmentSigned given each field
17889  */
17890 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
17891
17892 /**
17893  * Creates a copy of the CommitmentSigned
17894  */
17895 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
17896
17897 /**
17898  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
17899  */
17900 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
17901
17902 /**
17903  * The channel ID
17904  */
17905 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
17906
17907 /**
17908  * The channel ID
17909  */
17910 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17911
17912 /**
17913  * The secret corresponding to the per-commitment point
17914  */
17915 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
17916
17917 /**
17918  * The secret corresponding to the per-commitment point
17919  */
17920 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17921
17922 /**
17923  * The next sender-broadcast commitment transaction's per-commitment point
17924  */
17925 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
17926
17927 /**
17928  * The next sender-broadcast commitment transaction's per-commitment point
17929  */
17930 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17931
17932 /**
17933  * Constructs a new RevokeAndACK given each field
17934  */
17935 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);
17936
17937 /**
17938  * Creates a copy of the RevokeAndACK
17939  */
17940 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
17941
17942 /**
17943  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
17944  */
17945 void UpdateFee_free(struct LDKUpdateFee this_obj);
17946
17947 /**
17948  * The channel ID
17949  */
17950 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
17951
17952 /**
17953  * The channel ID
17954  */
17955 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17956
17957 /**
17958  * Fee rate per 1000-weight of the transaction
17959  */
17960 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
17961
17962 /**
17963  * Fee rate per 1000-weight of the transaction
17964  */
17965 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
17966
17967 /**
17968  * Constructs a new UpdateFee given each field
17969  */
17970 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
17971
17972 /**
17973  * Creates a copy of the UpdateFee
17974  */
17975 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
17976
17977 /**
17978  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
17979  */
17980 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
17981
17982 /**
17983  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
17984  * belonging to the recipient
17985  */
17986 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
17987
17988 /**
17989  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
17990  * belonging to the recipient
17991  */
17992 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17993
17994 /**
17995  * The sender's per-commitment point for their current commitment transaction
17996  */
17997 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
17998
17999 /**
18000  * The sender's per-commitment point for their current commitment transaction
18001  */
18002 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18003
18004 /**
18005  * Constructs a new DataLossProtect given each field
18006  */
18007 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
18008
18009 /**
18010  * Creates a copy of the DataLossProtect
18011  */
18012 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
18013
18014 /**
18015  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
18016  */
18017 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
18018
18019 /**
18020  * The channel ID
18021  */
18022 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
18023
18024 /**
18025  * The channel ID
18026  */
18027 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18028
18029 /**
18030  * The next commitment number for the sender
18031  */
18032 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
18033
18034 /**
18035  * The next commitment number for the sender
18036  */
18037 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
18038
18039 /**
18040  * The next commitment number for the recipient
18041  */
18042 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
18043
18044 /**
18045  * The next commitment number for the recipient
18046  */
18047 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
18048
18049 /**
18050  * Creates a copy of the ChannelReestablish
18051  */
18052 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
18053
18054 /**
18055  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
18056  */
18057 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
18058
18059 /**
18060  * The channel ID
18061  */
18062 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
18063
18064 /**
18065  * The channel ID
18066  */
18067 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18068
18069 /**
18070  * The short channel ID
18071  */
18072 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18073
18074 /**
18075  * The short channel ID
18076  */
18077 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
18078
18079 /**
18080  * A signature by the node key
18081  */
18082 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18083
18084 /**
18085  * A signature by the node key
18086  */
18087 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
18088
18089 /**
18090  * A signature by the funding key
18091  */
18092 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
18093
18094 /**
18095  * A signature by the funding key
18096  */
18097 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
18098
18099 /**
18100  * Constructs a new AnnouncementSignatures given each field
18101  */
18102 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);
18103
18104 /**
18105  * Creates a copy of the AnnouncementSignatures
18106  */
18107 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
18108
18109 /**
18110  * Frees any resources used by the NetAddress
18111  */
18112 void NetAddress_free(struct LDKNetAddress this_ptr);
18113
18114 /**
18115  * Creates a copy of the NetAddress
18116  */
18117 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
18118
18119 /**
18120  * Utility method to constructs a new IPv4-variant NetAddress
18121  */
18122 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
18123
18124 /**
18125  * Utility method to constructs a new IPv6-variant NetAddress
18126  */
18127 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
18128
18129 /**
18130  * Utility method to constructs a new OnionV2-variant NetAddress
18131  */
18132 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
18133
18134 /**
18135  * Utility method to constructs a new OnionV3-variant NetAddress
18136  */
18137 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
18138
18139 /**
18140  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
18141  */
18142 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
18143
18144 /**
18145  * Read a NetAddress from a byte array, created by NetAddress_write
18146  */
18147 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
18148
18149 /**
18150  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
18151  */
18152 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
18153
18154 /**
18155  * The advertised features
18156  */
18157 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18158
18159 /**
18160  * The advertised features
18161  */
18162 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
18163
18164 /**
18165  * A strictly monotonic announcement counter, with gaps allowed
18166  */
18167 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18168
18169 /**
18170  * A strictly monotonic announcement counter, with gaps allowed
18171  */
18172 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
18173
18174 /**
18175  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
18176  * to this node).
18177  */
18178 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
18179
18180 /**
18181  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
18182  * to this node).
18183  */
18184 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18185
18186 /**
18187  * An RGB color for UI purposes
18188  */
18189 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
18190
18191 /**
18192  * An RGB color for UI purposes
18193  */
18194 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
18195
18196 /**
18197  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
18198  * of uniqueness.
18199  */
18200 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
18201
18202 /**
18203  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
18204  * of uniqueness.
18205  */
18206 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18207
18208 /**
18209  * List of addresses on which this node is reachable
18210  */
18211 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
18212
18213 /**
18214  * Creates a copy of the UnsignedNodeAnnouncement
18215  */
18216 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
18217
18218 /**
18219  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
18220  */
18221 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
18222
18223 /**
18224  * The signature by the node key
18225  */
18226 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
18227
18228 /**
18229  * The signature by the node key
18230  */
18231 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18232
18233 /**
18234  * The actual content of the announcement
18235  */
18236 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
18237
18238 /**
18239  * The actual content of the announcement
18240  */
18241 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
18242
18243 /**
18244  * Constructs a new NodeAnnouncement given each field
18245  */
18246 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
18247
18248 /**
18249  * Creates a copy of the NodeAnnouncement
18250  */
18251 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
18252
18253 /**
18254  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
18255  */
18256 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
18257
18258 /**
18259  * The advertised channel features
18260  */
18261 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18262
18263 /**
18264  * The advertised channel features
18265  */
18266 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
18267
18268 /**
18269  * The genesis hash of the blockchain where the channel is to be opened
18270  */
18271 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
18272
18273 /**
18274  * The genesis hash of the blockchain where the channel is to be opened
18275  */
18276 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18277
18278 /**
18279  * The short channel ID
18280  */
18281 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18282
18283 /**
18284  * The short channel ID
18285  */
18286 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
18287
18288 /**
18289  * One of the two node_ids which are endpoints of this channel
18290  */
18291 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18292
18293 /**
18294  * One of the two node_ids which are endpoints of this channel
18295  */
18296 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18297
18298 /**
18299  * The other of the two node_ids which are endpoints of this channel
18300  */
18301 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18302
18303 /**
18304  * The other of the two node_ids which are endpoints of this channel
18305  */
18306 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18307
18308 /**
18309  * The funding key for the first node
18310  */
18311 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18312
18313 /**
18314  * The funding key for the first node
18315  */
18316 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18317
18318 /**
18319  * The funding key for the second node
18320  */
18321 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
18322
18323 /**
18324  * The funding key for the second node
18325  */
18326 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18327
18328 /**
18329  * Creates a copy of the UnsignedChannelAnnouncement
18330  */
18331 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
18332
18333 /**
18334  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
18335  */
18336 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
18337
18338 /**
18339  * Authentication of the announcement by the first public node
18340  */
18341 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18342
18343 /**
18344  * Authentication of the announcement by the first public node
18345  */
18346 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18347
18348 /**
18349  * Authentication of the announcement by the second public node
18350  */
18351 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18352
18353 /**
18354  * Authentication of the announcement by the second public node
18355  */
18356 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18357
18358 /**
18359  * Proof of funding UTXO ownership by the first public node
18360  */
18361 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18362
18363 /**
18364  * Proof of funding UTXO ownership by the first public node
18365  */
18366 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18367
18368 /**
18369  * Proof of funding UTXO ownership by the second public node
18370  */
18371 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18372
18373 /**
18374  * Proof of funding UTXO ownership by the second public node
18375  */
18376 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
18377
18378 /**
18379  * The actual announcement
18380  */
18381 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
18382
18383 /**
18384  * The actual announcement
18385  */
18386 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
18387
18388 /**
18389  * Constructs a new ChannelAnnouncement given each field
18390  */
18391 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);
18392
18393 /**
18394  * Creates a copy of the ChannelAnnouncement
18395  */
18396 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
18397
18398 /**
18399  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
18400  */
18401 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
18402
18403 /**
18404  * The genesis hash of the blockchain where the channel is to be opened
18405  */
18406 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
18407
18408 /**
18409  * The genesis hash of the blockchain where the channel is to be opened
18410  */
18411 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18412
18413 /**
18414  * The short channel ID
18415  */
18416 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18417
18418 /**
18419  * The short channel ID
18420  */
18421 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
18422
18423 /**
18424  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
18425  */
18426 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18427
18428 /**
18429  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
18430  */
18431 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18432
18433 /**
18434  * Channel flags
18435  */
18436 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18437
18438 /**
18439  * Channel flags
18440  */
18441 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
18442
18443 /**
18444  * The number of blocks such that if:
18445  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
18446  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
18447  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
18448  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
18449  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
18450  * forwarding. Note that the HTLC sender is the one who originally sets this value when
18451  * constructing the route.
18452  */
18453 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18454
18455 /**
18456  * The number of blocks such that if:
18457  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
18458  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
18459  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
18460  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
18461  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
18462  * forwarding. Note that the HTLC sender is the one who originally sets this value when
18463  * constructing the route.
18464  */
18465 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
18466
18467 /**
18468  * The minimum HTLC size incoming to sender, in milli-satoshi
18469  */
18470 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18471
18472 /**
18473  * The minimum HTLC size incoming to sender, in milli-satoshi
18474  */
18475 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
18476
18477 /**
18478  * The base HTLC fee charged by sender, in milli-satoshi
18479  */
18480 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18481
18482 /**
18483  * The base HTLC fee charged by sender, in milli-satoshi
18484  */
18485 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18486
18487 /**
18488  * The amount to fee multiplier, in micro-satoshi
18489  */
18490 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
18491
18492 /**
18493  * The amount to fee multiplier, in micro-satoshi
18494  */
18495 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
18496
18497 /**
18498  * Creates a copy of the UnsignedChannelUpdate
18499  */
18500 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
18501
18502 /**
18503  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
18504  */
18505 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
18506
18507 /**
18508  * A signature of the channel update
18509  */
18510 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
18511
18512 /**
18513  * A signature of the channel update
18514  */
18515 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
18516
18517 /**
18518  * The actual channel update
18519  */
18520 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
18521
18522 /**
18523  * The actual channel update
18524  */
18525 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
18526
18527 /**
18528  * Constructs a new ChannelUpdate given each field
18529  */
18530 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
18531
18532 /**
18533  * Creates a copy of the ChannelUpdate
18534  */
18535 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
18536
18537 /**
18538  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
18539  */
18540 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
18541
18542 /**
18543  * The genesis hash of the blockchain being queried
18544  */
18545 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
18546
18547 /**
18548  * The genesis hash of the blockchain being queried
18549  */
18550 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18551
18552 /**
18553  * The height of the first block for the channel UTXOs being queried
18554  */
18555 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18556
18557 /**
18558  * The height of the first block for the channel UTXOs being queried
18559  */
18560 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18561
18562 /**
18563  * The number of blocks to include in the query results
18564  */
18565 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
18566
18567 /**
18568  * The number of blocks to include in the query results
18569  */
18570 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18571
18572 /**
18573  * Constructs a new QueryChannelRange given each field
18574  */
18575 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
18576
18577 /**
18578  * Creates a copy of the QueryChannelRange
18579  */
18580 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
18581
18582 /**
18583  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
18584  */
18585 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
18586
18587 /**
18588  * The genesis hash of the blockchain being queried
18589  */
18590 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
18591
18592 /**
18593  * The genesis hash of the blockchain being queried
18594  */
18595 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18596
18597 /**
18598  * The height of the first block in the range of the reply
18599  */
18600 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18601
18602 /**
18603  * The height of the first block in the range of the reply
18604  */
18605 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18606
18607 /**
18608  * The number of blocks included in the range of the reply
18609  */
18610 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18611
18612 /**
18613  * The number of blocks included in the range of the reply
18614  */
18615 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
18616
18617 /**
18618  * True when this is the final reply for a query
18619  */
18620 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
18621
18622 /**
18623  * True when this is the final reply for a query
18624  */
18625 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
18626
18627 /**
18628  * The short_channel_ids in the channel range
18629  */
18630 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18631
18632 /**
18633  * Constructs a new ReplyChannelRange given each field
18634  */
18635 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);
18636
18637 /**
18638  * Creates a copy of the ReplyChannelRange
18639  */
18640 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
18641
18642 /**
18643  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
18644  */
18645 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
18646
18647 /**
18648  * The genesis hash of the blockchain being queried
18649  */
18650 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
18651
18652 /**
18653  * The genesis hash of the blockchain being queried
18654  */
18655 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18656
18657 /**
18658  * The short_channel_ids that are being queried
18659  */
18660 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18661
18662 /**
18663  * Constructs a new QueryShortChannelIds given each field
18664  */
18665 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
18666
18667 /**
18668  * Creates a copy of the QueryShortChannelIds
18669  */
18670 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
18671
18672 /**
18673  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
18674  */
18675 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
18676
18677 /**
18678  * The genesis hash of the blockchain that was queried
18679  */
18680 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
18681
18682 /**
18683  * The genesis hash of the blockchain that was queried
18684  */
18685 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18686
18687 /**
18688  * Indicates if the query recipient maintains up-to-date channel
18689  * information for the chain_hash
18690  */
18691 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
18692
18693 /**
18694  * Indicates if the query recipient maintains up-to-date channel
18695  * information for the chain_hash
18696  */
18697 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
18698
18699 /**
18700  * Constructs a new ReplyShortChannelIdsEnd given each field
18701  */
18702 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
18703
18704 /**
18705  * Creates a copy of the ReplyShortChannelIdsEnd
18706  */
18707 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
18708
18709 /**
18710  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
18711  */
18712 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
18713
18714 /**
18715  * The genesis hash of the blockchain for channel and node information
18716  */
18717 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
18718
18719 /**
18720  * The genesis hash of the blockchain for channel and node information
18721  */
18722 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18723
18724 /**
18725  * The starting unix timestamp
18726  */
18727 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18728
18729 /**
18730  * The starting unix timestamp
18731  */
18732 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18733
18734 /**
18735  * The range of information in seconds
18736  */
18737 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
18738
18739 /**
18740  * The range of information in seconds
18741  */
18742 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
18743
18744 /**
18745  * Constructs a new GossipTimestampFilter given each field
18746  */
18747 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
18748
18749 /**
18750  * Creates a copy of the GossipTimestampFilter
18751  */
18752 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
18753
18754 /**
18755  * Frees any resources used by the ErrorAction
18756  */
18757 void ErrorAction_free(struct LDKErrorAction this_ptr);
18758
18759 /**
18760  * Creates a copy of the ErrorAction
18761  */
18762 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
18763
18764 /**
18765  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
18766  */
18767 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
18768
18769 /**
18770  * Utility method to constructs a new IgnoreError-variant ErrorAction
18771  */
18772 struct LDKErrorAction ErrorAction_ignore_error(void);
18773
18774 /**
18775  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
18776  */
18777 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
18778
18779 /**
18780  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
18781  */
18782 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
18783
18784 /**
18785  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
18786  */
18787 void LightningError_free(struct LDKLightningError this_obj);
18788
18789 /**
18790  * A human-readable message describing the error
18791  */
18792 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
18793
18794 /**
18795  * A human-readable message describing the error
18796  */
18797 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
18798
18799 /**
18800  * The action which should be taken against the offending peer.
18801  */
18802 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
18803
18804 /**
18805  * The action which should be taken against the offending peer.
18806  */
18807 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
18808
18809 /**
18810  * Constructs a new LightningError given each field
18811  */
18812 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
18813
18814 /**
18815  * Creates a copy of the LightningError
18816  */
18817 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
18818
18819 /**
18820  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
18821  */
18822 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
18823
18824 /**
18825  * update_add_htlc messages which should be sent
18826  */
18827 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18828
18829 /**
18830  * update_add_htlc messages which should be sent
18831  */
18832 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
18833
18834 /**
18835  * update_fulfill_htlc messages which should be sent
18836  */
18837 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18838
18839 /**
18840  * update_fulfill_htlc messages which should be sent
18841  */
18842 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
18843
18844 /**
18845  * update_fail_htlc messages which should be sent
18846  */
18847 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18848
18849 /**
18850  * update_fail_htlc messages which should be sent
18851  */
18852 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
18853
18854 /**
18855  * update_fail_malformed_htlc messages which should be sent
18856  */
18857 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18858
18859 /**
18860  * update_fail_malformed_htlc messages which should be sent
18861  */
18862 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
18863
18864 /**
18865  * An update_fee message which should be sent
18866  *
18867  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18868  */
18869 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18870
18871 /**
18872  * An update_fee message which should be sent
18873  *
18874  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18875  */
18876 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
18877
18878 /**
18879  * Finally, the commitment_signed message which should be sent
18880  */
18881 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
18882
18883 /**
18884  * Finally, the commitment_signed message which should be sent
18885  */
18886 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
18887
18888 /**
18889  * Constructs a new CommitmentUpdate given each field
18890  */
18891 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);
18892
18893 /**
18894  * Creates a copy of the CommitmentUpdate
18895  */
18896 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
18897
18898 /**
18899  * Calls the free function if one is set
18900  */
18901 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
18902
18903 /**
18904  * Calls the free function if one is set
18905  */
18906 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
18907
18908 /**
18909  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
18910  */
18911 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
18912
18913 /**
18914  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
18915  */
18916 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
18917
18918 /**
18919  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
18920  */
18921 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
18922
18923 /**
18924  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
18925  */
18926 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
18927
18928 /**
18929  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
18930  */
18931 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
18932
18933 /**
18934  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
18935  */
18936 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
18937
18938 /**
18939  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
18940  */
18941 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
18942
18943 /**
18944  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
18945  */
18946 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
18947
18948 /**
18949  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
18950  */
18951 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
18952
18953 /**
18954  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
18955  */
18956 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
18957
18958 /**
18959  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
18960  */
18961 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
18962
18963 /**
18964  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
18965  */
18966 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
18967
18968 /**
18969  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
18970  */
18971 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
18972
18973 /**
18974  * Read a FundingCreated from a byte array, created by FundingCreated_write
18975  */
18976 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
18977
18978 /**
18979  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
18980  */
18981 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
18982
18983 /**
18984  * Read a FundingSigned from a byte array, created by FundingSigned_write
18985  */
18986 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
18987
18988 /**
18989  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
18990  */
18991 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
18992
18993 /**
18994  * Read a FundingLocked from a byte array, created by FundingLocked_write
18995  */
18996 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
18997
18998 /**
18999  * Serialize the Init object into a byte array which can be read by Init_read
19000  */
19001 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
19002
19003 /**
19004  * Read a Init from a byte array, created by Init_write
19005  */
19006 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
19007
19008 /**
19009  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
19010  */
19011 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
19012
19013 /**
19014  * Read a OpenChannel from a byte array, created by OpenChannel_write
19015  */
19016 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
19017
19018 /**
19019  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
19020  */
19021 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
19022
19023 /**
19024  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
19025  */
19026 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
19027
19028 /**
19029  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
19030  */
19031 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
19032
19033 /**
19034  * Read a Shutdown from a byte array, created by Shutdown_write
19035  */
19036 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
19037
19038 /**
19039  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
19040  */
19041 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
19042
19043 /**
19044  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
19045  */
19046 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
19047
19048 /**
19049  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
19050  */
19051 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
19052
19053 /**
19054  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
19055  */
19056 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
19057
19058 /**
19059  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
19060  */
19061 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
19062
19063 /**
19064  * Read a UpdateFee from a byte array, created by UpdateFee_write
19065  */
19066 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
19067
19068 /**
19069  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
19070  */
19071 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
19072
19073 /**
19074  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
19075  */
19076 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
19077
19078 /**
19079  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
19080  */
19081 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
19082
19083 /**
19084  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
19085  */
19086 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
19087
19088 /**
19089  * Serialize the Ping object into a byte array which can be read by Ping_read
19090  */
19091 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
19092
19093 /**
19094  * Read a Ping from a byte array, created by Ping_write
19095  */
19096 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
19097
19098 /**
19099  * Serialize the Pong object into a byte array which can be read by Pong_read
19100  */
19101 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
19102
19103 /**
19104  * Read a Pong from a byte array, created by Pong_write
19105  */
19106 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
19107
19108 /**
19109  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
19110  */
19111 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
19112
19113 /**
19114  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
19115  */
19116 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
19117
19118 /**
19119  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
19120  */
19121 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
19122
19123 /**
19124  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
19125  */
19126 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
19127
19128 /**
19129  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
19130  */
19131 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
19132
19133 /**
19134  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
19135  */
19136 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
19137
19138 /**
19139  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
19140  */
19141 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
19142
19143 /**
19144  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
19145  */
19146 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
19147
19148 /**
19149  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
19150  */
19151 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
19152
19153 /**
19154  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
19155  */
19156 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
19157
19158 /**
19159  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
19160  */
19161 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
19162
19163 /**
19164  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
19165  */
19166 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
19167
19168 /**
19169  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
19170  */
19171 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
19172
19173 /**
19174  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
19175  */
19176 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
19177
19178 /**
19179  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
19180  */
19181 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
19182
19183 /**
19184  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
19185  */
19186 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
19187
19188 /**
19189  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
19190  */
19191 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
19192
19193 /**
19194  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
19195  */
19196 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
19197
19198 /**
19199  *\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
19200  */
19201 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
19202
19203 /**
19204  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
19205  */
19206 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
19207
19208 /**
19209  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
19210  */
19211 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
19212
19213 /**
19214  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
19215  */
19216 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
19217
19218 /**
19219  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
19220  */
19221 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
19222
19223 /**
19224  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
19225  */
19226 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
19227
19228 /**
19229  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
19230  */
19231 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
19232
19233 /**
19234  * Calls the free function if one is set
19235  */
19236 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
19237
19238 /**
19239  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
19240  */
19241 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
19242
19243 /**
19244  * Constructs a new IgnoringMessageHandler given each field
19245  */
19246 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
19247
19248 /**
19249  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19250  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19251  */
19252 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19253
19254 /**
19255  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
19256  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
19257  */
19258 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19259
19260 /**
19261  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
19262  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
19263  */
19264 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19265
19266 /**
19267  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
19268  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
19269  */
19270 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
19271
19272 /**
19273  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
19274  */
19275 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
19276
19277 /**
19278  * Constructs a new ErroringMessageHandler
19279  */
19280 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
19281
19282 /**
19283  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19284  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19285  */
19286 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
19287
19288 /**
19289  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
19290  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
19291  */
19292 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
19293
19294 /**
19295  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
19296  */
19297 void MessageHandler_free(struct LDKMessageHandler this_obj);
19298
19299 /**
19300  * A message handler which handles messages specific to channels. Usually this is just a
19301  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
19302  *
19303  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19304  */
19305 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
19306
19307 /**
19308  * A message handler which handles messages specific to channels. Usually this is just a
19309  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
19310  *
19311  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19312  */
19313 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
19314
19315 /**
19316  * A message handler which handles messages updating our knowledge of the network channel
19317  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
19318  * [`IgnoringMessageHandler`].
19319  *
19320  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
19321  */
19322 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
19323
19324 /**
19325  * A message handler which handles messages updating our knowledge of the network channel
19326  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
19327  * [`IgnoringMessageHandler`].
19328  *
19329  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
19330  */
19331 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
19332
19333 /**
19334  * Constructs a new MessageHandler given each field
19335  */
19336 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
19337
19338 /**
19339  * Creates a copy of a SocketDescriptor
19340  */
19341 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
19342
19343 /**
19344  * Calls the free function if one is set
19345  */
19346 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
19347
19348 /**
19349  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
19350  */
19351 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
19352
19353 /**
19354  * Used to indicate that we probably can't make any future connections to this peer, implying
19355  * we should go ahead and force-close any channels we have with it.
19356  */
19357 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
19358
19359 /**
19360  * Used to indicate that we probably can't make any future connections to this peer, implying
19361  * we should go ahead and force-close any channels we have with it.
19362  */
19363 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
19364
19365 /**
19366  * Constructs a new PeerHandleError given each field
19367  */
19368 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
19369
19370 /**
19371  * Creates a copy of the PeerHandleError
19372  */
19373 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
19374
19375 /**
19376  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
19377  */
19378 void PeerManager_free(struct LDKPeerManager this_obj);
19379
19380 /**
19381  * Constructs a new PeerManager with the given message handlers and node_id secret key
19382  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
19383  * cryptographically secure random bytes.
19384  */
19385 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);
19386
19387 /**
19388  * Get the list of node ids for peers which have completed the initial handshake.
19389  *
19390  * For outbound connections, this will be the same as the their_node_id parameter passed in to
19391  * new_outbound_connection, however entries will only appear once the initial handshake has
19392  * completed and we are sure the remote peer has the private key for the given node_id.
19393  */
19394 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
19395
19396 /**
19397  * Indicates a new outbound connection has been established to a node with the given node_id.
19398  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
19399  * descriptor but must disconnect the connection immediately.
19400  *
19401  * Returns a small number of bytes to send to the remote node (currently always 50).
19402  *
19403  * Panics if descriptor is duplicative with some other descriptor which has not yet been
19404  * [`socket_disconnected()`].
19405  *
19406  * [`socket_disconnected()`]: PeerManager::socket_disconnected
19407  */
19408 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);
19409
19410 /**
19411  * Indicates a new inbound connection has been established.
19412  *
19413  * May refuse the connection by returning an Err, but will never write bytes to the remote end
19414  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
19415  * call socket_disconnected for the new descriptor but must disconnect the connection
19416  * immediately.
19417  *
19418  * Panics if descriptor is duplicative with some other descriptor which has not yet been
19419  * [`socket_disconnected()`].
19420  *
19421  * [`socket_disconnected()`]: PeerManager::socket_disconnected
19422  */
19423 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
19424
19425 /**
19426  * Indicates that there is room to write data to the given socket descriptor.
19427  *
19428  * May return an Err to indicate that the connection should be closed.
19429  *
19430  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
19431  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
19432  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
19433  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
19434  * sufficient!
19435  *
19436  * [`send_data`]: SocketDescriptor::send_data
19437  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
19438  */
19439 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
19440
19441 /**
19442  * Indicates that data was read from the given socket descriptor.
19443  *
19444  * May return an Err to indicate that the connection should be closed.
19445  *
19446  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
19447  * Thus, however, you should call [`process_events`] after any `read_event` to generate
19448  * [`send_data`] calls to handle responses.
19449  *
19450  * If `Ok(true)` is returned, further read_events should not be triggered until a
19451  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
19452  * send buffer).
19453  *
19454  * [`send_data`]: SocketDescriptor::send_data
19455  * [`process_events`]: PeerManager::process_events
19456  */
19457 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);
19458
19459 /**
19460  * Checks for any events generated by our handlers and processes them. Includes sending most
19461  * response messages as well as messages generated by calls to handler functions directly (eg
19462  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
19463  *
19464  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
19465  * issues!
19466  *
19467  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
19468  * or one of the other clients provided in our language bindings.
19469  *
19470  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
19471  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
19472  * [`send_data`]: SocketDescriptor::send_data
19473  */
19474 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
19475
19476 /**
19477  * Indicates that the given socket descriptor's connection is now closed.
19478  */
19479 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
19480
19481 /**
19482  * Disconnect a peer given its node id.
19483  *
19484  * Set `no_connection_possible` to true to prevent any further connection with this peer,
19485  * force-closing any channels we have with it.
19486  *
19487  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
19488  * peer. Thus, be very careful about reentrancy issues.
19489  *
19490  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
19491  */
19492 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
19493
19494 /**
19495  * Disconnects all currently-connected peers. This is useful on platforms where there may be
19496  * an indication that TCP sockets have stalled even if we weren't around to time them out
19497  * using regular ping/pongs.
19498  */
19499 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
19500
19501 /**
19502  * Send pings to each peer and disconnect those which did not respond to the last round of
19503  * pings.
19504  *
19505  * This may be called on any timescale you want, however, roughly once every five to ten
19506  * seconds is preferred. The call rate determines both how often we send a ping to our peers
19507  * and how much time they have to respond before we disconnect them.
19508  *
19509  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
19510  * issues!
19511  *
19512  * [`send_data`]: SocketDescriptor::send_data
19513  */
19514 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
19515
19516 /**
19517  * Build the commitment secret from the seed and the commitment number
19518  */
19519 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
19520
19521 /**
19522  * Build a closing transaction
19523  */
19524 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);
19525
19526 /**
19527  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
19528  * from the base secret and the per_commitment_point.
19529  *
19530  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19531  * generated (ie our own).
19532  */
19533 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
19534
19535 /**
19536  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
19537  * from the base point and the per_commitment_key. This is the public equivalent of
19538  * derive_private_key - using only public keys to derive a public key instead of private keys.
19539  *
19540  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19541  * generated (ie our own).
19542  */
19543 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
19544
19545 /**
19546  * Derives a per-commitment-transaction revocation key from its constituent parts.
19547  *
19548  * Only the cheating participant owns a valid witness to propagate a revoked
19549  * commitment transaction, thus per_commitment_secret always come from cheater
19550  * and revocation_base_secret always come from punisher, which is the broadcaster
19551  * of the transaction spending with this key knowledge.
19552  *
19553  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19554  * generated (ie our own).
19555  */
19556 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
19557
19558 /**
19559  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
19560  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
19561  * public key instead of private keys.
19562  *
19563  * Only the cheating participant owns a valid witness to propagate a revoked
19564  * commitment transaction, thus per_commitment_point always come from cheater
19565  * and revocation_base_point always come from punisher, which is the broadcaster
19566  * of the transaction spending with this key knowledge.
19567  *
19568  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
19569  * generated (ie our own).
19570  */
19571 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
19572
19573 /**
19574  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
19575  */
19576 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
19577
19578 /**
19579  * The broadcaster's per-commitment public key which was used to derive the other keys.
19580  */
19581 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19582
19583 /**
19584  * The broadcaster's per-commitment public key which was used to derive the other keys.
19585  */
19586 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19587
19588 /**
19589  * The revocation key which is used to allow the broadcaster of the commitment
19590  * transaction to provide their counterparty the ability to punish them if they broadcast
19591  * an old state.
19592  */
19593 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19594
19595 /**
19596  * The revocation key which is used to allow the broadcaster of the commitment
19597  * transaction to provide their counterparty the ability to punish them if they broadcast
19598  * an old state.
19599  */
19600 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19601
19602 /**
19603  * Broadcaster's HTLC Key
19604  */
19605 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19606
19607 /**
19608  * Broadcaster's HTLC Key
19609  */
19610 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19611
19612 /**
19613  * Countersignatory's HTLC Key
19614  */
19615 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19616
19617 /**
19618  * Countersignatory's HTLC Key
19619  */
19620 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19621
19622 /**
19623  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19624  */
19625 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
19626
19627 /**
19628  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
19629  */
19630 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19631
19632 /**
19633  * Constructs a new TxCreationKeys given each field
19634  */
19635 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);
19636
19637 /**
19638  * Creates a copy of the TxCreationKeys
19639  */
19640 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
19641
19642 /**
19643  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
19644  */
19645 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
19646
19647 /**
19648  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
19649  */
19650 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
19651
19652 /**
19653  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
19654  */
19655 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
19656
19657 /**
19658  * The public key which is used to sign all commitment transactions, as it appears in the
19659  * on-chain channel lock-in 2-of-2 multisig output.
19660  */
19661 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19662
19663 /**
19664  * The public key which is used to sign all commitment transactions, as it appears in the
19665  * on-chain channel lock-in 2-of-2 multisig output.
19666  */
19667 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19668
19669 /**
19670  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19671  * revocation keys. This is combined with the per-commitment-secret generated by the
19672  * counterparty to create a secret which the counterparty can reveal to revoke previous
19673  * states.
19674  */
19675 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19676
19677 /**
19678  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
19679  * revocation keys. This is combined with the per-commitment-secret generated by the
19680  * counterparty to create a secret which the counterparty can reveal to revoke previous
19681  * states.
19682  */
19683 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19684
19685 /**
19686  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19687  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19688  * static across every commitment transaction.
19689  */
19690 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19691
19692 /**
19693  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
19694  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
19695  * static across every commitment transaction.
19696  */
19697 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19698
19699 /**
19700  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19701  * public key which receives non-HTLC-encumbered funds which are only available for spending
19702  * after some delay (or can be claimed via the revocation path).
19703  */
19704 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19705
19706 /**
19707  * The base point which is used (with derive_public_key) to derive a per-commitment payment
19708  * public key which receives non-HTLC-encumbered funds which are only available for spending
19709  * after some delay (or can be claimed via the revocation path).
19710  */
19711 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19712
19713 /**
19714  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19715  * which is used to encumber HTLC-in-flight outputs.
19716  */
19717 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
19718
19719 /**
19720  * The base point which is used (with derive_public_key) to derive a per-commitment public key
19721  * which is used to encumber HTLC-in-flight outputs.
19722  */
19723 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19724
19725 /**
19726  * Constructs a new ChannelPublicKeys given each field
19727  */
19728 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);
19729
19730 /**
19731  * Creates a copy of the ChannelPublicKeys
19732  */
19733 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
19734
19735 /**
19736  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
19737  */
19738 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
19739
19740 /**
19741  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
19742  */
19743 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
19744
19745 /**
19746  * Create per-state keys from channel base points and the per-commitment point.
19747  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19748  */
19749 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);
19750
19751 /**
19752  * Generate per-state keys from channel static keys.
19753  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
19754  */
19755 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);
19756
19757 /**
19758  * A script either spendable by the revocation
19759  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
19760  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
19761  */
19762 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
19763
19764 /**
19765  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
19766  */
19767 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
19768
19769 /**
19770  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19771  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19772  * need to compare this value to whether the commitment transaction in question is that of
19773  * the counterparty or our own.
19774  */
19775 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19776
19777 /**
19778  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
19779  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
19780  * need to compare this value to whether the commitment transaction in question is that of
19781  * the counterparty or our own.
19782  */
19783 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
19784
19785 /**
19786  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19787  * this divided by 1000.
19788  */
19789 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19790
19791 /**
19792  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
19793  * this divided by 1000.
19794  */
19795 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
19796
19797 /**
19798  * The CLTV lock-time at which this HTLC expires.
19799  */
19800 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19801
19802 /**
19803  * The CLTV lock-time at which this HTLC expires.
19804  */
19805 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
19806
19807 /**
19808  * The hash of the preimage which unlocks this HTLC.
19809  */
19810 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
19811
19812 /**
19813  * The hash of the preimage which unlocks this HTLC.
19814  */
19815 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19816
19817 /**
19818  * The position within the commitment transactions' outputs. This may be None if the value is
19819  * below the dust limit (in which case no output appears in the commitment transaction and the
19820  * value is spent to additional transaction fees).
19821  */
19822 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
19823
19824 /**
19825  * The position within the commitment transactions' outputs. This may be None if the value is
19826  * below the dust limit (in which case no output appears in the commitment transaction and the
19827  * value is spent to additional transaction fees).
19828  */
19829 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19830
19831 /**
19832  * Constructs a new HTLCOutputInCommitment given each field
19833  */
19834 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);
19835
19836 /**
19837  * Creates a copy of the HTLCOutputInCommitment
19838  */
19839 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
19840
19841 /**
19842  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
19843  */
19844 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
19845
19846 /**
19847  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
19848  */
19849 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
19850
19851 /**
19852  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
19853  * does not need to have its previous_output_index filled.
19854  */
19855 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
19856
19857 /**
19858  * Gets the redeemscript for a funding output from the two funding public keys.
19859  * Note that the order of funding public keys does not matter.
19860  */
19861 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
19862
19863 /**
19864  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
19865  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
19866  * transaction which needs signing, and can be used to construct an HTLC transaction which is
19867  * broadcastable given a counterparty HTLC signature.
19868  *
19869  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
19870  * commitment transaction).
19871  */
19872 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);
19873
19874 /**
19875  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19876  */
19877 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
19878
19879 /**
19880  * Holder public keys
19881  */
19882 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19883
19884 /**
19885  * Holder public keys
19886  */
19887 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
19888
19889 /**
19890  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19891  */
19892 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19893
19894 /**
19895  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
19896  */
19897 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
19898
19899 /**
19900  * Whether the holder is the initiator of this channel.
19901  * This is an input to the commitment number obscure factor computation.
19902  */
19903 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19904
19905 /**
19906  * Whether the holder is the initiator of this channel.
19907  * This is an input to the commitment number obscure factor computation.
19908  */
19909 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
19910
19911 /**
19912  * The late-bound counterparty channel transaction parameters.
19913  * These parameters are populated at the point in the protocol where the counterparty provides them.
19914  *
19915  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19916  */
19917 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19918
19919 /**
19920  * The late-bound counterparty channel transaction parameters.
19921  * These parameters are populated at the point in the protocol where the counterparty provides them.
19922  *
19923  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19924  */
19925 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
19926
19927 /**
19928  * The late-bound funding outpoint
19929  *
19930  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19931  */
19932 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
19933
19934 /**
19935  * The late-bound funding outpoint
19936  *
19937  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19938  */
19939 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19940
19941 /**
19942  * Constructs a new ChannelTransactionParameters given each field
19943  */
19944 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);
19945
19946 /**
19947  * Creates a copy of the ChannelTransactionParameters
19948  */
19949 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
19950
19951 /**
19952  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
19953  */
19954 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
19955
19956 /**
19957  * Counter-party public keys
19958  */
19959 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
19960
19961 /**
19962  * Counter-party public keys
19963  */
19964 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
19965
19966 /**
19967  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
19968  */
19969 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
19970
19971 /**
19972  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
19973  */
19974 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
19975
19976 /**
19977  * Constructs a new CounterpartyChannelTransactionParameters given each field
19978  */
19979 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
19980
19981 /**
19982  * Creates a copy of the CounterpartyChannelTransactionParameters
19983  */
19984 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
19985
19986 /**
19987  * Whether the late bound parameters are populated.
19988  */
19989 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
19990
19991 /**
19992  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
19993  * given that the holder is the broadcaster.
19994  *
19995  * self.is_populated() must be true before calling this function.
19996  */
19997 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
19998
19999 /**
20000  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
20001  * given that the counterparty is the broadcaster.
20002  *
20003  * self.is_populated() must be true before calling this function.
20004  */
20005 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
20006
20007 /**
20008  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
20009  */
20010 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
20011
20012 /**
20013  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
20014  */
20015 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
20016
20017 /**
20018  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
20019  */
20020 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
20021
20022 /**
20023  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
20024  */
20025 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
20026
20027 /**
20028  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
20029  */
20030 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
20031
20032 /**
20033  * Get the channel pubkeys for the broadcaster
20034  */
20035 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20036
20037 /**
20038  * Get the channel pubkeys for the countersignatory
20039  */
20040 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20041
20042 /**
20043  * Get the contest delay applicable to the transactions.
20044  * Note that the contest delay was selected by the countersignatory.
20045  */
20046 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20047
20048 /**
20049  * Whether the channel is outbound from the broadcaster.
20050  *
20051  * The boolean representing the side that initiated the channel is
20052  * an input to the commitment number obscure factor computation.
20053  */
20054 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20055
20056 /**
20057  * The funding outpoint
20058  */
20059 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
20060
20061 /**
20062  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
20063  */
20064 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
20065
20066 /**
20067  * Our counterparty's signature for the transaction
20068  */
20069 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
20070
20071 /**
20072  * Our counterparty's signature for the transaction
20073  */
20074 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
20075
20076 /**
20077  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
20078  */
20079 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
20080
20081 /**
20082  * Creates a copy of the HolderCommitmentTransaction
20083  */
20084 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
20085
20086 /**
20087  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
20088  */
20089 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
20090
20091 /**
20092  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
20093  */
20094 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
20095
20096 /**
20097  * Create a new holder transaction with the given counterparty signatures.
20098  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
20099  */
20100 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);
20101
20102 /**
20103  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
20104  */
20105 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
20106
20107 /**
20108  * The commitment transaction
20109  */
20110 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
20111
20112 /**
20113  * The commitment transaction
20114  */
20115 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
20116
20117 /**
20118  * The txid for the commitment transaction.
20119  *
20120  * This is provided as a performance optimization, instead of calling transaction.txid()
20121  * multiple times.
20122  */
20123 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
20124
20125 /**
20126  * The txid for the commitment transaction.
20127  *
20128  * This is provided as a performance optimization, instead of calling transaction.txid()
20129  * multiple times.
20130  */
20131 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20132
20133 /**
20134  * Constructs a new BuiltCommitmentTransaction given each field
20135  */
20136 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
20137
20138 /**
20139  * Creates a copy of the BuiltCommitmentTransaction
20140  */
20141 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
20142
20143 /**
20144  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
20145  */
20146 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
20147
20148 /**
20149  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
20150  */
20151 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
20152
20153 /**
20154  * Get the SIGHASH_ALL sighash value of the transaction.
20155  *
20156  * This can be used to verify a signature.
20157  */
20158 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);
20159
20160 /**
20161  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
20162  * because we are about to broadcast a holder transaction.
20163  */
20164 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);
20165
20166 /**
20167  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
20168  */
20169 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
20170
20171 /**
20172  * Construct an object of the class
20173  */
20174 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);
20175
20176 /**
20177  * Trust our pre-built transaction.
20178  *
20179  * Applies a wrapper which allows access to the transaction.
20180  *
20181  * This should only be used if you fully trust the builder of this object. It should not
20182  * be used by an external signer - instead use the verify function.
20183  */
20184 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20185
20186 /**
20187  * Verify our pre-built transaction.
20188  *
20189  * Applies a wrapper which allows access to the transaction.
20190  *
20191  * An external validating signer must call this method before signing
20192  * or using the built transaction.
20193  */
20194 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
20195
20196 /**
20197  * The value to be sent to the holder, or zero if the output will be omitted
20198  */
20199 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20200
20201 /**
20202  * The value to be sent to the counterparty, or zero if the output will be omitted
20203  */
20204 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20205
20206 /**
20207  * The destination of the holder's output
20208  */
20209 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20210
20211 /**
20212  * The destination of the counterparty's output
20213  */
20214 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
20215
20216 /**
20217  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
20218  */
20219 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
20220
20221 /**
20222  * The pre-built Bitcoin commitment transaction
20223  */
20224 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
20225
20226 /**
20227  * Get the SIGHASH_ALL sighash value of the transaction.
20228  *
20229  * This can be used to verify a signature.
20230  */
20231 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);
20232
20233 /**
20234  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
20235  * because we are about to broadcast a holder transaction.
20236  */
20237 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);
20238
20239 /**
20240  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
20241  */
20242 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
20243
20244 /**
20245  * Creates a copy of the CommitmentTransaction
20246  */
20247 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
20248
20249 /**
20250  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
20251  */
20252 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
20253
20254 /**
20255  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
20256  */
20257 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
20258
20259 /**
20260  * The backwards-counting commitment number
20261  */
20262 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20263
20264 /**
20265  * The value to be sent to the broadcaster
20266  */
20267 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20268
20269 /**
20270  * The value to be sent to the counterparty
20271  */
20272 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20273
20274 /**
20275  * The feerate paid per 1000-weight-unit in this commitment transaction.
20276  */
20277 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20278
20279 /**
20280  * Trust our pre-built transaction and derived transaction creation public keys.
20281  *
20282  * Applies a wrapper which allows access to these fields.
20283  *
20284  * This should only be used if you fully trust the builder of this object.  It should not
20285  * be used by an external signer - instead use the verify function.
20286  */
20287 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
20288
20289 /**
20290  * Verify our pre-built transaction and derived transaction creation public keys.
20291  *
20292  * Applies a wrapper which allows access to these fields.
20293  *
20294  * An external validating signer must call this method before signing
20295  * or using the built transaction.
20296  */
20297 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);
20298
20299 /**
20300  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
20301  */
20302 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
20303
20304 /**
20305  * The transaction ID of the built Bitcoin transaction
20306  */
20307 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20308
20309 /**
20310  * The pre-built Bitcoin commitment transaction
20311  */
20312 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20313
20314 /**
20315  * The pre-calculated transaction creation public keys.
20316  */
20317 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
20318
20319 /**
20320  * Get a signature for each HTLC which was included in the commitment transaction (ie for
20321  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
20322  *
20323  * The returned Vec has one entry for each HTLC, and in the same order.
20324  */
20325 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);
20326
20327 /**
20328  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
20329  * shared secret first. This prevents on-chain observers from discovering how many commitment
20330  * transactions occurred in a channel before it was closed.
20331  *
20332  * This function gets the shared secret from relevant channel public keys and can be used to
20333  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
20334  */
20335 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
20336
20337 /**
20338  * Checks if two InitFeaturess contain equal inner contents.
20339  * This ignores pointers and is_owned flags and looks at the values in fields.
20340  * Two objects with NULL inner values will be considered "equal" here.
20341  */
20342 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
20343
20344 /**
20345  * Checks if two NodeFeaturess contain equal inner contents.
20346  * This ignores pointers and is_owned flags and looks at the values in fields.
20347  * Two objects with NULL inner values will be considered "equal" here.
20348  */
20349 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
20350
20351 /**
20352  * Checks if two ChannelFeaturess contain equal inner contents.
20353  * This ignores pointers and is_owned flags and looks at the values in fields.
20354  * Two objects with NULL inner values will be considered "equal" here.
20355  */
20356 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
20357
20358 /**
20359  * Checks if two InvoiceFeaturess contain equal inner contents.
20360  * This ignores pointers and is_owned flags and looks at the values in fields.
20361  * Two objects with NULL inner values will be considered "equal" here.
20362  */
20363 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
20364
20365 /**
20366  * Creates a copy of the InitFeatures
20367  */
20368 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
20369
20370 /**
20371  * Creates a copy of the NodeFeatures
20372  */
20373 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
20374
20375 /**
20376  * Creates a copy of the ChannelFeatures
20377  */
20378 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
20379
20380 /**
20381  * Creates a copy of the InvoiceFeatures
20382  */
20383 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
20384
20385 /**
20386  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
20387  */
20388 void InitFeatures_free(struct LDKInitFeatures this_obj);
20389
20390 /**
20391  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
20392  */
20393 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
20394
20395 /**
20396  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
20397  */
20398 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
20399
20400 /**
20401  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
20402  */
20403 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
20404
20405 /**
20406  * Create a blank Features with no features set
20407  */
20408 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
20409
20410 /**
20411  * Creates a Features with the bits set which are known by the implementation
20412  */
20413 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
20414
20415 /**
20416  * Returns true if this `Features` object contains unknown feature flags which are set as
20417  * \"required\".
20418  */
20419 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
20420
20421 /**
20422  * Create a blank Features with no features set
20423  */
20424 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
20425
20426 /**
20427  * Creates a Features with the bits set which are known by the implementation
20428  */
20429 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
20430
20431 /**
20432  * Returns true if this `Features` object contains unknown feature flags which are set as
20433  * \"required\".
20434  */
20435 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
20436
20437 /**
20438  * Create a blank Features with no features set
20439  */
20440 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
20441
20442 /**
20443  * Creates a Features with the bits set which are known by the implementation
20444  */
20445 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
20446
20447 /**
20448  * Returns true if this `Features` object contains unknown feature flags which are set as
20449  * \"required\".
20450  */
20451 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
20452
20453 /**
20454  * Create a blank Features with no features set
20455  */
20456 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
20457
20458 /**
20459  * Creates a Features with the bits set which are known by the implementation
20460  */
20461 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
20462
20463 /**
20464  * Returns true if this `Features` object contains unknown feature flags which are set as
20465  * \"required\".
20466  */
20467 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
20468
20469 /**
20470  * Returns whether the `payment_secret` feature is supported.
20471  */
20472 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
20473
20474 /**
20475  * Returns whether the `payment_secret` feature is supported.
20476  */
20477 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
20478
20479 /**
20480  * Returns whether the `payment_secret` feature is supported.
20481  */
20482 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
20483
20484 /**
20485  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
20486  */
20487 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
20488
20489 /**
20490  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
20491  */
20492 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
20493
20494 /**
20495  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
20496  */
20497 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
20498
20499 /**
20500  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
20501  */
20502 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
20503
20504 /**
20505  * Read a InitFeatures from a byte array, created by InitFeatures_write
20506  */
20507 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
20508
20509 /**
20510  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
20511  */
20512 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
20513
20514 /**
20515  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
20516  */
20517 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
20518
20519 /**
20520  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
20521  */
20522 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
20523
20524 /**
20525  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
20526  */
20527 void ShutdownScript_free(struct LDKShutdownScript this_obj);
20528
20529 /**
20530  * Creates a copy of the ShutdownScript
20531  */
20532 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
20533
20534 /**
20535  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
20536  */
20537 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
20538
20539 /**
20540  * The script that did not meet the requirements from [BOLT #2].
20541  *
20542  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20543  */
20544 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
20545
20546 /**
20547  * The script that did not meet the requirements from [BOLT #2].
20548  *
20549  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
20550  */
20551 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20552
20553 /**
20554  * Constructs a new InvalidShutdownScript given each field
20555  */
20556 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
20557
20558 /**
20559  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
20560  */
20561 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
20562
20563 /**
20564  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
20565  */
20566 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
20567
20568 /**
20569  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
20570  */
20571 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
20572
20573 /**
20574  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
20575  */
20576 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
20577
20578 /**
20579  * Generates a witness script pubkey from the given segwit version and program.
20580  *
20581  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
20582  * [`ShutdownScript::new_p2wsh`] instead.
20583  *
20584  * # Errors
20585  *
20586  * This function may return an error if `program` is invalid for the segwit `version`.
20587  */
20588 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
20589
20590 /**
20591  * Converts the shutdown script into the underlying [`Script`].
20592  */
20593 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
20594
20595 /**
20596  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
20597  *
20598  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20599  */
20600 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
20601
20602 /**
20603  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
20604  *
20605  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
20606  */
20607 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
20608
20609 /**
20610  * Calls the free function if one is set
20611  */
20612 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
20613
20614 /**
20615  * Calls the free function if one is set
20616  */
20617 void Type_free(struct LDKType this_ptr);
20618
20619 /**
20620  * Calls the free function if one is set
20621  */
20622 void Score_free(struct LDKScore this_ptr);
20623
20624 /**
20625  * Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
20626  */
20627 void LockableScore_free(struct LDKLockableScore this_obj);
20628
20629 /**
20630  * Constructs a new LockableScore from a Score
20631  */
20632 MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score);
20633
20634 /**
20635  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
20636  */
20637 void NodeId_free(struct LDKNodeId this_obj);
20638
20639 /**
20640  * Creates a copy of the NodeId
20641  */
20642 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
20643
20644 /**
20645  * Create a new NodeId from a public key
20646  */
20647 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
20648
20649 /**
20650  * Get the public key slice from this NodeId
20651  */
20652 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
20653
20654 /**
20655  * Checks if two NodeIds contain equal inner contents.
20656  */
20657 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
20658
20659 /**
20660  * Serialize the NodeId object into a byte array which can be read by NodeId_read
20661  */
20662 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
20663
20664 /**
20665  * Read a NodeId from a byte array, created by NodeId_write
20666  */
20667 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
20668
20669 /**
20670  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
20671  */
20672 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
20673
20674 /**
20675  * Creates a copy of the NetworkGraph
20676  */
20677 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
20678
20679 /**
20680  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
20681  */
20682 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
20683
20684 /**
20685  * Frees any resources used by the NetworkUpdate
20686  */
20687 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
20688
20689 /**
20690  * Creates a copy of the NetworkUpdate
20691  */
20692 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
20693
20694 /**
20695  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
20696  */
20697 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
20698
20699 /**
20700  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
20701  */
20702 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
20703
20704 /**
20705  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
20706  */
20707 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
20708
20709 /**
20710  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
20711  */
20712 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
20713
20714 /**
20715  * Constructs a new EventHandler which calls the relevant methods on this_arg.
20716  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
20717  */
20718 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20719
20720 /**
20721  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
20722  */
20723 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
20724
20725 /**
20726  * Creates a new tracker of the actual state of the network of channels and nodes,
20727  * assuming an existing Network Graph.
20728  * Chain monitor is used to make sure announced channels exist on-chain,
20729  * channel data is correct, and that the announcement is signed with
20730  * channel owners' keys.
20731  */
20732 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
20733
20734 /**
20735  * Adds a provider used to check new announcements. Does not affect
20736  * existing announcements unless they are updated.
20737  * Add, update or remove the provider would replace the current one.
20738  */
20739 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
20740
20741 /**
20742  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
20743  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
20744  */
20745 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20746
20747 /**
20748  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20749  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20750  */
20751 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
20752
20753 /**
20754  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
20755  */
20756 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
20757
20758 /**
20759  * When the last update to the channel direction was issued.
20760  * Value is opaque, as set in the announcement.
20761  */
20762 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20763
20764 /**
20765  * When the last update to the channel direction was issued.
20766  * Value is opaque, as set in the announcement.
20767  */
20768 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
20769
20770 /**
20771  * Whether the channel can be currently used for payments (in this one direction).
20772  */
20773 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20774
20775 /**
20776  * Whether the channel can be currently used for payments (in this one direction).
20777  */
20778 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
20779
20780 /**
20781  * The difference in CLTV values that you must have when routing through this channel.
20782  */
20783 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20784
20785 /**
20786  * The difference in CLTV values that you must have when routing through this channel.
20787  */
20788 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
20789
20790 /**
20791  * The minimum value, which must be relayed to the next hop via the channel
20792  */
20793 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20794
20795 /**
20796  * The minimum value, which must be relayed to the next hop via the channel
20797  */
20798 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
20799
20800 /**
20801  * The maximum value which may be relayed to the next hop via the channel.
20802  */
20803 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20804
20805 /**
20806  * The maximum value which may be relayed to the next hop via the channel.
20807  */
20808 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20809
20810 /**
20811  * Fees charged when the channel is used for routing
20812  */
20813 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20814
20815 /**
20816  * Fees charged when the channel is used for routing
20817  */
20818 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
20819
20820 /**
20821  * Most recent update for the channel received from the network
20822  * Mostly redundant with the data we store in fields explicitly.
20823  * Everything else is useful only for sending out for initial routing sync.
20824  * Not stored if contains excess data to prevent DoS.
20825  *
20826  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20827  */
20828 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
20829
20830 /**
20831  * Most recent update for the channel received from the network
20832  * Mostly redundant with the data we store in fields explicitly.
20833  * Everything else is useful only for sending out for initial routing sync.
20834  * Not stored if contains excess data to prevent DoS.
20835  *
20836  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20837  */
20838 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
20839
20840 /**
20841  * Constructs a new DirectionalChannelInfo given each field
20842  */
20843 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);
20844
20845 /**
20846  * Creates a copy of the DirectionalChannelInfo
20847  */
20848 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
20849
20850 /**
20851  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
20852  */
20853 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
20854
20855 /**
20856  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
20857  */
20858 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
20859
20860 /**
20861  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
20862  */
20863 void ChannelInfo_free(struct LDKChannelInfo this_obj);
20864
20865 /**
20866  * Protocol features of a channel communicated during its announcement
20867  */
20868 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20869
20870 /**
20871  * Protocol features of a channel communicated during its announcement
20872  */
20873 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
20874
20875 /**
20876  * Source node of the first direction of a channel
20877  */
20878 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20879
20880 /**
20881  * Source node of the first direction of a channel
20882  */
20883 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
20884
20885 /**
20886  * Details about the first direction of a channel
20887  *
20888  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20889  */
20890 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20891
20892 /**
20893  * Details about the first direction of a channel
20894  *
20895  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20896  */
20897 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20898
20899 /**
20900  * Source node of the second direction of a channel
20901  */
20902 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20903
20904 /**
20905  * Source node of the second direction of a channel
20906  */
20907 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
20908
20909 /**
20910  * Details about the second direction of a channel
20911  *
20912  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20913  */
20914 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20915
20916 /**
20917  * Details about the second direction of a channel
20918  *
20919  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20920  */
20921 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
20922
20923 /**
20924  * The channel capacity as seen on-chain, if chain lookup is available.
20925  */
20926 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20927
20928 /**
20929  * The channel capacity as seen on-chain, if chain lookup is available.
20930  */
20931 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20932
20933 /**
20934  * An initial announcement of the channel
20935  * Mostly redundant with the data we store in fields explicitly.
20936  * Everything else is useful only for sending out for initial routing sync.
20937  * Not stored if contains excess data to prevent DoS.
20938  *
20939  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20940  */
20941 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
20942
20943 /**
20944  * An initial announcement of the channel
20945  * Mostly redundant with the data we store in fields explicitly.
20946  * Everything else is useful only for sending out for initial routing sync.
20947  * Not stored if contains excess data to prevent DoS.
20948  *
20949  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20950  */
20951 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
20952
20953 /**
20954  * Constructs a new ChannelInfo given each field
20955  */
20956 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);
20957
20958 /**
20959  * Creates a copy of the ChannelInfo
20960  */
20961 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
20962
20963 /**
20964  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
20965  */
20966 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
20967
20968 /**
20969  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
20970  */
20971 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
20972
20973 /**
20974  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
20975  */
20976 void RoutingFees_free(struct LDKRoutingFees this_obj);
20977
20978 /**
20979  * Flat routing fee in satoshis
20980  */
20981 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20982
20983 /**
20984  * Flat routing fee in satoshis
20985  */
20986 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20987
20988 /**
20989  * Liquidity-based routing fee in millionths of a routed amount.
20990  * In other words, 10000 is 1%.
20991  */
20992 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
20993
20994 /**
20995  * Liquidity-based routing fee in millionths of a routed amount.
20996  * In other words, 10000 is 1%.
20997  */
20998 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
20999
21000 /**
21001  * Constructs a new RoutingFees given each field
21002  */
21003 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
21004
21005 /**
21006  * Checks if two RoutingFeess contain equal inner contents.
21007  * This ignores pointers and is_owned flags and looks at the values in fields.
21008  * Two objects with NULL inner values will be considered "equal" here.
21009  */
21010 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
21011
21012 /**
21013  * Creates a copy of the RoutingFees
21014  */
21015 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
21016
21017 /**
21018  * Checks if two RoutingFeess contain equal inner contents.
21019  */
21020 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
21021
21022 /**
21023  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
21024  */
21025 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
21026
21027 /**
21028  * Read a RoutingFees from a byte array, created by RoutingFees_write
21029  */
21030 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
21031
21032 /**
21033  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
21034  */
21035 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
21036
21037 /**
21038  * Protocol features the node announced support for
21039  */
21040 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21041
21042 /**
21043  * Protocol features the node announced support for
21044  */
21045 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21046
21047 /**
21048  * When the last known update to the node state was issued.
21049  * Value is opaque, as set in the announcement.
21050  */
21051 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21052
21053 /**
21054  * When the last known update to the node state was issued.
21055  * Value is opaque, as set in the announcement.
21056  */
21057 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
21058
21059 /**
21060  * Color assigned to the node
21061  */
21062 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
21063
21064 /**
21065  * Color assigned to the node
21066  */
21067 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21068
21069 /**
21070  * Moniker assigned to the node.
21071  * May be invalid or malicious (eg control chars),
21072  * should not be exposed to the user.
21073  */
21074 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
21075
21076 /**
21077  * Moniker assigned to the node.
21078  * May be invalid or malicious (eg control chars),
21079  * should not be exposed to the user.
21080  */
21081 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21082
21083 /**
21084  * Internet-level addresses via which one can connect to the node
21085  */
21086 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21087
21088 /**
21089  * An initial announcement of the node
21090  * Mostly redundant with the data we store in fields explicitly.
21091  * Everything else is useful only for sending out for initial routing sync.
21092  * Not stored if contains excess data to prevent DoS.
21093  *
21094  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21095  */
21096 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
21097
21098 /**
21099  * An initial announcement of the node
21100  * Mostly redundant with the data we store in fields explicitly.
21101  * Everything else is useful only for sending out for initial routing sync.
21102  * Not stored if contains excess data to prevent DoS.
21103  *
21104  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21105  */
21106 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
21107
21108 /**
21109  * Constructs a new NodeAnnouncementInfo given each field
21110  */
21111 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);
21112
21113 /**
21114  * Creates a copy of the NodeAnnouncementInfo
21115  */
21116 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
21117
21118 /**
21119  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
21120  */
21121 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
21122
21123 /**
21124  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
21125  */
21126 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
21127
21128 /**
21129  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
21130  */
21131 void NodeInfo_free(struct LDKNodeInfo this_obj);
21132
21133 /**
21134  * All valid channels a node has announced
21135  */
21136 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21137
21138 /**
21139  * Lowest fees enabling routing via any of the enabled, known channels to a node.
21140  * The two fields (flat and proportional fee) are independent,
21141  * meaning they don't have to refer to the same channel.
21142  *
21143  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21144  */
21145 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
21146
21147 /**
21148  * Lowest fees enabling routing via any of the enabled, known channels to a node.
21149  * The two fields (flat and proportional fee) are independent,
21150  * meaning they don't have to refer to the same channel.
21151  *
21152  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21153  */
21154 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
21155
21156 /**
21157  * More information about a node from node_announcement.
21158  * Optional because we store a Node entry after learning about it from
21159  * a channel announcement, but before receiving a node announcement.
21160  *
21161  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21162  */
21163 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
21164
21165 /**
21166  * More information about a node from node_announcement.
21167  * Optional because we store a Node entry after learning about it from
21168  * a channel announcement, but before receiving a node announcement.
21169  *
21170  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21171  */
21172 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
21173
21174 /**
21175  * Constructs a new NodeInfo given each field
21176  */
21177 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
21178
21179 /**
21180  * Creates a copy of the NodeInfo
21181  */
21182 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
21183
21184 /**
21185  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
21186  */
21187 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
21188
21189 /**
21190  * Read a NodeInfo from a byte array, created by NodeInfo_write
21191  */
21192 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
21193
21194 /**
21195  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
21196  */
21197 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
21198
21199 /**
21200  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
21201  */
21202 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
21203
21204 /**
21205  * Creates a new, empty, network graph.
21206  */
21207 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
21208
21209 /**
21210  * Returns a read-only view of the network graph.
21211  */
21212 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
21213
21214 /**
21215  * For an already known node (from channel announcements), update its stored properties from a
21216  * given node announcement.
21217  *
21218  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21219  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21220  * routing messages from a source using a protocol other than the lightning P2P protocol.
21221  */
21222 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
21223
21224 /**
21225  * For an already known node (from channel announcements), update its stored properties from a
21226  * given node announcement without verifying the associated signatures. Because we aren't
21227  * given the associated signatures here we cannot relay the node announcement to any of our
21228  * peers.
21229  */
21230 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);
21231
21232 /**
21233  * Store or update channel info from a channel announcement.
21234  *
21235  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21236  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21237  * routing messages from a source using a protocol other than the lightning P2P protocol.
21238  *
21239  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
21240  * the corresponding UTXO exists on chain and is correctly-formatted.
21241  */
21242 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);
21243
21244 /**
21245  * Store or update channel info from a channel announcement without verifying the associated
21246  * signatures. Because we aren't given the associated signatures here we cannot relay the
21247  * channel announcement to any of our peers.
21248  *
21249  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
21250  * the corresponding UTXO exists on chain and is correctly-formatted.
21251  */
21252 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);
21253
21254 /**
21255  * Close a channel if a corresponding HTLC fail was sent.
21256  * If permanent, removes a channel from the local storage.
21257  * May cause the removal of nodes too, if this was their last channel.
21258  * If not permanent, makes channels unavailable for routing.
21259  */
21260 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
21261
21262 /**
21263  * Marks a node in the graph as failed.
21264  */
21265 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
21266
21267 /**
21268  * For an already known (from announcement) channel, update info about one of the directions
21269  * of the channel.
21270  *
21271  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
21272  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
21273  * routing messages from a source using a protocol other than the lightning P2P protocol.
21274  */
21275 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
21276
21277 /**
21278  * For an already known (from announcement) channel, update info about one of the directions
21279  * of the channel without verifying the associated signatures. Because we aren't given the
21280  * associated signatures here we cannot relay the channel update to any of our peers.
21281  */
21282 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
21283
21284 /**
21285  * Get network addresses by node id.
21286  * Returns None if the requested node is completely unknown,
21287  * or if node announcement for the node was never received.
21288  */
21289 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
21290
21291 /**
21292  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
21293  */
21294 void RouteHop_free(struct LDKRouteHop this_obj);
21295
21296 /**
21297  * The node_id of the node at this hop.
21298  */
21299 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21300
21301 /**
21302  * The node_id of the node at this hop.
21303  */
21304 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21305
21306 /**
21307  * The node_announcement features of the node at this hop. For the last hop, these may be
21308  * amended to match the features present in the invoice this node generated.
21309  */
21310 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21311
21312 /**
21313  * The node_announcement features of the node at this hop. For the last hop, these may be
21314  * amended to match the features present in the invoice this node generated.
21315  */
21316 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21317
21318 /**
21319  * The channel that should be used from the previous hop to reach this node.
21320  */
21321 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21322
21323 /**
21324  * The channel that should be used from the previous hop to reach this node.
21325  */
21326 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
21327
21328 /**
21329  * The channel_announcement features of the channel that should be used from the previous hop
21330  * to reach this node.
21331  */
21332 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21333
21334 /**
21335  * The channel_announcement features of the channel that should be used from the previous hop
21336  * to reach this node.
21337  */
21338 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21339
21340 /**
21341  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
21342  * For the last hop, this should be the full value of the payment (might be more than
21343  * requested if we had to match htlc_minimum_msat).
21344  */
21345 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21346
21347 /**
21348  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
21349  * For the last hop, this should be the full value of the payment (might be more than
21350  * requested if we had to match htlc_minimum_msat).
21351  */
21352 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
21353
21354 /**
21355  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
21356  * expected at the destination, in excess of the current block height.
21357  */
21358 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
21359
21360 /**
21361  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
21362  * expected at the destination, in excess of the current block height.
21363  */
21364 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
21365
21366 /**
21367  * Constructs a new RouteHop given each field
21368  */
21369 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);
21370
21371 /**
21372  * Creates a copy of the RouteHop
21373  */
21374 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
21375
21376 /**
21377  * Checks if two RouteHops contain equal inner contents.
21378  */
21379 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
21380
21381 /**
21382  * Checks if two RouteHops contain equal inner contents.
21383  * This ignores pointers and is_owned flags and looks at the values in fields.
21384  * Two objects with NULL inner values will be considered "equal" here.
21385  */
21386 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
21387
21388 /**
21389  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
21390  */
21391 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
21392
21393 /**
21394  * Read a RouteHop from a byte array, created by RouteHop_write
21395  */
21396 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
21397
21398 /**
21399  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
21400  */
21401 void Route_free(struct LDKRoute this_obj);
21402
21403 /**
21404  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
21405  * last RouteHop in each path must be the same.
21406  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
21407  * destination. Thus, this must always be at least length one. While the maximum length of any
21408  * given path is variable, keeping the length of any path to less than 20 should currently
21409  * ensure it is viable.
21410  */
21411 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
21412
21413 /**
21414  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
21415  * last RouteHop in each path must be the same.
21416  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
21417  * destination. Thus, this must always be at least length one. While the maximum length of any
21418  * given path is variable, keeping the length of any path to less than 20 should currently
21419  * ensure it is viable.
21420  */
21421 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
21422
21423 /**
21424  * The `payee` parameter passed to [`find_route`].
21425  * This is used by `ChannelManager` to track information which may be required for retries,
21426  * provided back to you via [`Event::PaymentPathFailed`].
21427  *
21428  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21429  *
21430  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21431  */
21432 struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
21433
21434 /**
21435  * The `payee` parameter passed to [`find_route`].
21436  * This is used by `ChannelManager` to track information which may be required for retries,
21437  * provided back to you via [`Event::PaymentPathFailed`].
21438  *
21439  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21440  *
21441  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21442  */
21443 void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
21444
21445 /**
21446  * Constructs a new Route given each field
21447  */
21448 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
21449
21450 /**
21451  * Creates a copy of the Route
21452  */
21453 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
21454
21455 /**
21456  * Checks if two Routes contain equal inner contents.
21457  */
21458 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
21459
21460 /**
21461  * Checks if two Routes contain equal inner contents.
21462  * This ignores pointers and is_owned flags and looks at the values in fields.
21463  * Two objects with NULL inner values will be considered "equal" here.
21464  */
21465 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
21466
21467 /**
21468  * Returns the total amount of fees paid on this [`Route`].
21469  *
21470  * This doesn't include any extra payment made to the recipient, which can happen in excess of
21471  * the amount passed to [`find_route`]'s `params.final_value_msat`.
21472  */
21473 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
21474
21475 /**
21476  * Returns the total amount paid on this [`Route`], excluding the fees.
21477  */
21478 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
21479
21480 /**
21481  * Serialize the Route object into a byte array which can be read by Route_read
21482  */
21483 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
21484
21485 /**
21486  * Read a Route from a byte array, created by Route_write
21487  */
21488 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
21489
21490 /**
21491  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
21492  */
21493 void RouteParameters_free(struct LDKRouteParameters this_obj);
21494
21495 /**
21496  * The recipient of the failed payment path.
21497  */
21498 struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21499
21500 /**
21501  * The recipient of the failed payment path.
21502  */
21503 void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
21504
21505 /**
21506  * The amount in msats sent on the failed payment path.
21507  */
21508 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21509
21510 /**
21511  * The amount in msats sent on the failed payment path.
21512  */
21513 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
21514
21515 /**
21516  * The CLTV on the final hop of the failed payment path.
21517  */
21518 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
21519
21520 /**
21521  * The CLTV on the final hop of the failed payment path.
21522  */
21523 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
21524
21525 /**
21526  * Constructs a new RouteParameters given each field
21527  */
21528 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
21529
21530 /**
21531  * Creates a copy of the RouteParameters
21532  */
21533 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
21534
21535 /**
21536  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
21537  */
21538 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
21539
21540 /**
21541  * Read a RouteParameters from a byte array, created by RouteParameters_write
21542  */
21543 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
21544
21545 /**
21546  * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
21547  */
21548 void Payee_free(struct LDKPayee this_obj);
21549
21550 /**
21551  * The node id of the payee.
21552  */
21553 struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
21554
21555 /**
21556  * The node id of the payee.
21557  */
21558 void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21559
21560 /**
21561  * Features supported by the payee.
21562  *
21563  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
21564  * does not contain any features.
21565  *
21566  * [`for_keysend`]: Self::for_keysend
21567  *
21568  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21569  */
21570 struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
21571
21572 /**
21573  * Features supported by the payee.
21574  *
21575  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
21576  * does not contain any features.
21577  *
21578  * [`for_keysend`]: Self::for_keysend
21579  *
21580  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21581  */
21582 void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
21583
21584 /**
21585  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
21586  */
21587 struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
21588
21589 /**
21590  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
21591  */
21592 void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
21593
21594 /**
21595  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
21596  */
21597 struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
21598
21599 /**
21600  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
21601  */
21602 void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21603
21604 /**
21605  * Constructs a new Payee given each field
21606  */
21607 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);
21608
21609 /**
21610  * Creates a copy of the Payee
21611  */
21612 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
21613
21614 /**
21615  * Checks if two Payees contain equal inner contents.
21616  */
21617 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
21618
21619 /**
21620  * Checks if two Payees contain equal inner contents.
21621  * This ignores pointers and is_owned flags and looks at the values in fields.
21622  * Two objects with NULL inner values will be considered "equal" here.
21623  */
21624 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
21625
21626 /**
21627  * Serialize the Payee object into a byte array which can be read by Payee_read
21628  */
21629 struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
21630
21631 /**
21632  * Read a Payee from a byte array, created by Payee_write
21633  */
21634 struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
21635
21636 /**
21637  * Creates a payee with the node id of the given `pubkey`.
21638  */
21639 MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
21640
21641 /**
21642  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
21643  */
21644 MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
21645
21646 /**
21647  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
21648  */
21649 void RouteHint_free(struct LDKRouteHint this_obj);
21650
21651 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
21652
21653 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
21654
21655 /**
21656  * Constructs a new RouteHint given each field
21657  */
21658 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
21659
21660 /**
21661  * Creates a copy of the RouteHint
21662  */
21663 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
21664
21665 /**
21666  * Checks if two RouteHints contain equal inner contents.
21667  */
21668 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
21669
21670 /**
21671  * Checks if two RouteHints contain equal inner contents.
21672  * This ignores pointers and is_owned flags and looks at the values in fields.
21673  * Two objects with NULL inner values will be considered "equal" here.
21674  */
21675 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
21676
21677 /**
21678  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
21679  */
21680 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
21681
21682 /**
21683  * Read a RouteHint from a byte array, created by RouteHint_write
21684  */
21685 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
21686
21687 /**
21688  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
21689  */
21690 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
21691
21692 /**
21693  * The node_id of the non-target end of the route
21694  */
21695 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21696
21697 /**
21698  * The node_id of the non-target end of the route
21699  */
21700 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21701
21702 /**
21703  * The short_channel_id of this channel
21704  */
21705 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21706
21707 /**
21708  * The short_channel_id of this channel
21709  */
21710 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
21711
21712 /**
21713  * The fees which must be paid to use this channel
21714  */
21715 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21716
21717 /**
21718  * The fees which must be paid to use this channel
21719  */
21720 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
21721
21722 /**
21723  * The difference in CLTV values between this node and the next node.
21724  */
21725 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21726
21727 /**
21728  * The difference in CLTV values between this node and the next node.
21729  */
21730 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
21731
21732 /**
21733  * The minimum value, in msat, which must be relayed to the next hop.
21734  */
21735 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21736
21737 /**
21738  * The minimum value, in msat, which must be relayed to the next hop.
21739  */
21740 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21741
21742 /**
21743  * The maximum value in msat available for routing with a single HTLC.
21744  */
21745 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
21746
21747 /**
21748  * The maximum value in msat available for routing with a single HTLC.
21749  */
21750 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21751
21752 /**
21753  * Constructs a new RouteHintHop given each field
21754  */
21755 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);
21756
21757 /**
21758  * Creates a copy of the RouteHintHop
21759  */
21760 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
21761
21762 /**
21763  * Checks if two RouteHintHops contain equal inner contents.
21764  */
21765 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
21766
21767 /**
21768  * Checks if two RouteHintHops contain equal inner contents.
21769  * This ignores pointers and is_owned flags and looks at the values in fields.
21770  * Two objects with NULL inner values will be considered "equal" here.
21771  */
21772 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
21773
21774 /**
21775  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
21776  */
21777 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
21778
21779 /**
21780  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
21781  */
21782 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
21783
21784 /**
21785  * Finds a route from us (payer) to the given target node (payee).
21786  *
21787  * If the payee provided features in their invoice, they should be provided via `params.payee`.
21788  * Without this, MPP will only be used if the payee's features are available in the network graph.
21789  *
21790  * Private routing paths between a public node and the target may be included in `params.payee`.
21791  *
21792  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
21793  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
21794  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
21795  *
21796  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
21797  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
21798  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
21799  *
21800  * # Note
21801  *
21802  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
21803  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
21804  * function.
21805  *
21806  * # Panics
21807  *
21808  * Panics if first_hops contains channels without short_channel_ids;
21809  * [`ChannelManager::list_usable_channels`] will never include such channels.
21810  *
21811  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
21812  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
21813  *
21814  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
21815  */
21816 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);
21817
21818 /**
21819  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
21820  */
21821 void Scorer_free(struct LDKScorer this_obj);
21822
21823 /**
21824  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
21825  */
21826 void ScoringParameters_free(struct LDKScoringParameters this_obj);
21827
21828 /**
21829  * A fixed penalty in msats to apply to each channel.
21830  */
21831 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21832
21833 /**
21834  * A fixed penalty in msats to apply to each channel.
21835  */
21836 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21837
21838 /**
21839  * A penalty in msats to apply to a channel upon failure.
21840  *
21841  * This may be reduced over time based on [`failure_penalty_half_life`].
21842  *
21843  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
21844  */
21845 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21846
21847 /**
21848  * A penalty in msats to apply to a channel upon failure.
21849  *
21850  * This may be reduced over time based on [`failure_penalty_half_life`].
21851  *
21852  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
21853  */
21854 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21855
21856 /**
21857  * The time needed before any accumulated channel failure penalties are cut in half.
21858  */
21859 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
21860
21861 /**
21862  * The time needed before any accumulated channel failure penalties are cut in half.
21863  */
21864 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
21865
21866 /**
21867  * Constructs a new ScoringParameters given each field
21868  */
21869 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);
21870
21871 /**
21872  * Creates a new scorer using the given scoring parameters.
21873  */
21874 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
21875
21876 /**
21877  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
21878  */
21879 MUST_USE_RES struct LDKScorer Scorer_default(void);
21880
21881 /**
21882  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
21883  */
21884 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
21885
21886 /**
21887  * Constructs a new Score which calls the relevant methods on this_arg.
21888  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
21889  */
21890 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
21891
21892 /**
21893  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
21894  */
21895 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
21896
21897 /**
21898  * Initialize a new FilesystemPersister and set the path to the individual channels'
21899  * files.
21900  */
21901 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
21902
21903 /**
21904  * Get the directory which was provided when this persister was initialized.
21905  */
21906 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
21907
21908 /**
21909  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
21910  * initialization, within a file called \"manager\".
21911  */
21912 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
21913
21914 /**
21915  * Read `ChannelMonitor`s from disk.
21916  */
21917 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
21918
21919 /**
21920  * Constructs a new Persist which calls the relevant methods on this_arg.
21921  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
21922  */
21923 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
21924
21925 /**
21926  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
21927  */
21928 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
21929
21930 /**
21931  * Calls the free function if one is set
21932  */
21933 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
21934
21935 /**
21936  * Start a background thread that takes care of responsibilities enumerated in the [top-level
21937  * documentation].
21938  *
21939  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
21940  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
21941  * either [`join`] or [`stop`].
21942  *
21943  * # Data Persistence
21944  *
21945  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
21946  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
21947  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
21948  * provided implementation.
21949  *
21950  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
21951  * error or call [`join`] and handle any error that may arise. For the latter case,
21952  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
21953  *
21954  * # Event Handling
21955  *
21956  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
21957  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
21958  * functionality implemented by other handlers.
21959  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
21960  *
21961  * [top-level documentation]: Self
21962  * [`join`]: Self::join
21963  * [`stop`]: Self::stop
21964  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21965  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
21966  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
21967  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
21968  *
21969  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
21970  */
21971 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);
21972
21973 /**
21974  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
21975  * [`ChannelManager`].
21976  *
21977  * # Panics
21978  *
21979  * This function panics if the background thread has panicked such as while persisting or
21980  * handling events.
21981  *
21982  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21983  */
21984 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
21985
21986 /**
21987  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
21988  * [`ChannelManager`].
21989  *
21990  * # Panics
21991  *
21992  * This function panics if the background thread has panicked such as while persisting or
21993  * handling events.
21994  *
21995  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
21996  */
21997 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
21998
21999 /**
22000  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
22001  *
22002  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
22003  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
22004  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
22005  * since this check is fast we recommend to do it anyway.
22006  *
22007  * If this function fails this is considered a bug. Please open an issue describing your
22008  * platform and stating your current system time.
22009  *
22010  * # Panics
22011  * If the check fails this function panics. By calling this function on startup you ensure that
22012  * this wont happen at an arbitrary later point in time.
22013  */
22014 void check_platform(void);
22015
22016 /**
22017  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
22018  */
22019 void Invoice_free(struct LDKInvoice this_obj);
22020
22021 /**
22022  * Checks if two Invoices contain equal inner contents.
22023  * This ignores pointers and is_owned flags and looks at the values in fields.
22024  * Two objects with NULL inner values will be considered "equal" here.
22025  */
22026 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
22027
22028 /**
22029  * Creates a copy of the Invoice
22030  */
22031 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
22032
22033 /**
22034  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
22035  */
22036 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
22037
22038 /**
22039  * Checks if two SignedRawInvoices contain equal inner contents.
22040  * This ignores pointers and is_owned flags and looks at the values in fields.
22041  * Two objects with NULL inner values will be considered "equal" here.
22042  */
22043 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
22044
22045 /**
22046  * Creates a copy of the SignedRawInvoice
22047  */
22048 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
22049
22050 /**
22051  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
22052  */
22053 void RawInvoice_free(struct LDKRawInvoice this_obj);
22054
22055 /**
22056  * data part
22057  */
22058 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
22059
22060 /**
22061  * data part
22062  */
22063 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
22064
22065 /**
22066  * Checks if two RawInvoices contain equal inner contents.
22067  * This ignores pointers and is_owned flags and looks at the values in fields.
22068  * Two objects with NULL inner values will be considered "equal" here.
22069  */
22070 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
22071
22072 /**
22073  * Creates a copy of the RawInvoice
22074  */
22075 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
22076
22077 /**
22078  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
22079  */
22080 void RawDataPart_free(struct LDKRawDataPart this_obj);
22081
22082 /**
22083  * generation time of the invoice
22084  */
22085 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
22086
22087 /**
22088  * generation time of the invoice
22089  */
22090 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
22091
22092 /**
22093  * Checks if two RawDataParts contain equal inner contents.
22094  * This ignores pointers and is_owned flags and looks at the values in fields.
22095  * Two objects with NULL inner values will be considered "equal" here.
22096  */
22097 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
22098
22099 /**
22100  * Creates a copy of the RawDataPart
22101  */
22102 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
22103
22104 /**
22105  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
22106  */
22107 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
22108
22109 /**
22110  * Checks if two PositiveTimestamps contain equal inner contents.
22111  * This ignores pointers and is_owned flags and looks at the values in fields.
22112  * Two objects with NULL inner values will be considered "equal" here.
22113  */
22114 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
22115
22116 /**
22117  * Creates a copy of the PositiveTimestamp
22118  */
22119 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
22120
22121 /**
22122  * Creates a copy of the SiPrefix
22123  */
22124 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
22125
22126 /**
22127  * Utility method to constructs a new Milli-variant SiPrefix
22128  */
22129 enum LDKSiPrefix SiPrefix_milli(void);
22130
22131 /**
22132  * Utility method to constructs a new Micro-variant SiPrefix
22133  */
22134 enum LDKSiPrefix SiPrefix_micro(void);
22135
22136 /**
22137  * Utility method to constructs a new Nano-variant SiPrefix
22138  */
22139 enum LDKSiPrefix SiPrefix_nano(void);
22140
22141 /**
22142  * Utility method to constructs a new Pico-variant SiPrefix
22143  */
22144 enum LDKSiPrefix SiPrefix_pico(void);
22145
22146 /**
22147  * Checks if two SiPrefixs contain equal inner contents.
22148  * This ignores pointers and is_owned flags and looks at the values in fields.
22149  */
22150 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
22151
22152 /**
22153  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
22154  * This is effectively 10^12 * the prefix multiplier
22155  */
22156 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
22157
22158 /**
22159  * Creates a copy of the Currency
22160  */
22161 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
22162
22163 /**
22164  * Utility method to constructs a new Bitcoin-variant Currency
22165  */
22166 enum LDKCurrency Currency_bitcoin(void);
22167
22168 /**
22169  * Utility method to constructs a new BitcoinTestnet-variant Currency
22170  */
22171 enum LDKCurrency Currency_bitcoin_testnet(void);
22172
22173 /**
22174  * Utility method to constructs a new Regtest-variant Currency
22175  */
22176 enum LDKCurrency Currency_regtest(void);
22177
22178 /**
22179  * Utility method to constructs a new Simnet-variant Currency
22180  */
22181 enum LDKCurrency Currency_simnet(void);
22182
22183 /**
22184  * Utility method to constructs a new Signet-variant Currency
22185  */
22186 enum LDKCurrency Currency_signet(void);
22187
22188 /**
22189  * Checks if two Currencys contain equal inner contents.
22190  */
22191 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
22192
22193 /**
22194  * Checks if two Currencys contain equal inner contents.
22195  * This ignores pointers and is_owned flags and looks at the values in fields.
22196  */
22197 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
22198
22199 /**
22200  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
22201  */
22202 void Sha256_free(struct LDKSha256 this_obj);
22203
22204 /**
22205  * Creates a copy of the Sha256
22206  */
22207 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
22208
22209 /**
22210  * Checks if two Sha256s contain equal inner contents.
22211  */
22212 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
22213
22214 /**
22215  * Checks if two Sha256s contain equal inner contents.
22216  * This ignores pointers and is_owned flags and looks at the values in fields.
22217  * Two objects with NULL inner values will be considered "equal" here.
22218  */
22219 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
22220
22221 /**
22222  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
22223  */
22224 void Description_free(struct LDKDescription this_obj);
22225
22226 /**
22227  * Creates a copy of the Description
22228  */
22229 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
22230
22231 /**
22232  * Checks if two Descriptions contain equal inner contents.
22233  */
22234 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
22235
22236 /**
22237  * Checks if two Descriptions contain equal inner contents.
22238  * This ignores pointers and is_owned flags and looks at the values in fields.
22239  * Two objects with NULL inner values will be considered "equal" here.
22240  */
22241 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
22242
22243 /**
22244  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
22245  */
22246 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
22247
22248 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
22249
22250 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22251
22252 /**
22253  * Constructs a new PayeePubKey given each field
22254  */
22255 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
22256
22257 /**
22258  * Creates a copy of the PayeePubKey
22259  */
22260 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
22261
22262 /**
22263  * Checks if two PayeePubKeys contain equal inner contents.
22264  */
22265 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
22266
22267 /**
22268  * Checks if two PayeePubKeys contain equal inner contents.
22269  * This ignores pointers and is_owned flags and looks at the values in fields.
22270  * Two objects with NULL inner values will be considered "equal" here.
22271  */
22272 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
22273
22274 /**
22275  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
22276  */
22277 void ExpiryTime_free(struct LDKExpiryTime this_obj);
22278
22279 /**
22280  * Creates a copy of the ExpiryTime
22281  */
22282 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
22283
22284 /**
22285  * Checks if two ExpiryTimes contain equal inner contents.
22286  */
22287 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
22288
22289 /**
22290  * Checks if two ExpiryTimes contain equal inner contents.
22291  * This ignores pointers and is_owned flags and looks at the values in fields.
22292  * Two objects with NULL inner values will be considered "equal" here.
22293  */
22294 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
22295
22296 /**
22297  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
22298  */
22299 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
22300
22301 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
22302
22303 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
22304
22305 /**
22306  * Constructs a new MinFinalCltvExpiry given each field
22307  */
22308 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
22309
22310 /**
22311  * Creates a copy of the MinFinalCltvExpiry
22312  */
22313 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
22314
22315 /**
22316  * Checks if two MinFinalCltvExpirys contain equal inner contents.
22317  */
22318 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
22319
22320 /**
22321  * Checks if two MinFinalCltvExpirys contain equal inner contents.
22322  * This ignores pointers and is_owned flags and looks at the values in fields.
22323  * Two objects with NULL inner values will be considered "equal" here.
22324  */
22325 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
22326
22327 /**
22328  * Frees any resources used by the Fallback
22329  */
22330 void Fallback_free(struct LDKFallback this_ptr);
22331
22332 /**
22333  * Creates a copy of the Fallback
22334  */
22335 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
22336
22337 /**
22338  * Utility method to constructs a new SegWitProgram-variant Fallback
22339  */
22340 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
22341
22342 /**
22343  * Utility method to constructs a new PubKeyHash-variant Fallback
22344  */
22345 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
22346
22347 /**
22348  * Utility method to constructs a new ScriptHash-variant Fallback
22349  */
22350 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
22351
22352 /**
22353  * Checks if two Fallbacks contain equal inner contents.
22354  */
22355 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
22356
22357 /**
22358  * Checks if two Fallbacks contain equal inner contents.
22359  * This ignores pointers and is_owned flags and looks at the values in fields.
22360  */
22361 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
22362
22363 /**
22364  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
22365  */
22366 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
22367
22368 /**
22369  * Creates a copy of the InvoiceSignature
22370  */
22371 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
22372
22373 /**
22374  * Checks if two InvoiceSignatures contain equal inner contents.
22375  * This ignores pointers and is_owned flags and looks at the values in fields.
22376  * Two objects with NULL inner values will be considered "equal" here.
22377  */
22378 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
22379
22380 /**
22381  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
22382  */
22383 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
22384
22385 /**
22386  * Creates a copy of the PrivateRoute
22387  */
22388 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
22389
22390 /**
22391  * Checks if two PrivateRoutes contain equal inner contents.
22392  */
22393 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
22394
22395 /**
22396  * Checks if two PrivateRoutes contain equal inner contents.
22397  * This ignores pointers and is_owned flags and looks at the values in fields.
22398  * Two objects with NULL inner values will be considered "equal" here.
22399  */
22400 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
22401
22402 /**
22403  * Disassembles the `SignedRawInvoice` into its three parts:
22404  *  1. raw invoice
22405  *  2. hash of the raw invoice
22406  *  3. signature
22407  */
22408 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
22409
22410 /**
22411  * The `RawInvoice` which was signed.
22412  */
22413 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22414
22415 /**
22416  * The hash of the `RawInvoice` that was signed.
22417  */
22418 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
22419
22420 /**
22421  * InvoiceSignature for the invoice.
22422  */
22423 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22424
22425 /**
22426  * Recovers the public key used for signing the invoice from the recoverable signature.
22427  */
22428 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22429
22430 /**
22431  * Checks if the signature is valid for the included payee public key or if none exists if it's
22432  * valid for the recovered signature (which should always be true?).
22433  */
22434 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
22435
22436 /**
22437  * Calculate the hash of the encoded `RawInvoice`
22438  */
22439 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22440
22441 /**
22442  *
22443  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22444  */
22445 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22446
22447 /**
22448  *
22449  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22450  */
22451 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22452
22453 /**
22454  *
22455  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22456  */
22457 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22458
22459 /**
22460  *
22461  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22462  */
22463 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22464
22465 /**
22466  *
22467  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22468  */
22469 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22470
22471 /**
22472  *
22473  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22474  */
22475 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22476
22477 /**
22478  *
22479  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22480  */
22481 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22482
22483 /**
22484  *
22485  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22486  */
22487 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22488
22489 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22490
22491 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22492
22493 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
22494
22495 /**
22496  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
22497  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
22498  * `CreationError::TimestampOutOfBounds`.
22499  */
22500 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
22501
22502 /**
22503  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
22504  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
22505  * `CreationError::TimestampOutOfBounds`.
22506  */
22507 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
22508
22509 /**
22510  * Returns the UNIX timestamp representing the stored time
22511  */
22512 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
22513
22514 /**
22515  * Returns a reference to the internal `SystemTime` time representation
22516  */
22517 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
22518
22519 /**
22520  * Transform the `Invoice` into it's unchecked version
22521  */
22522 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
22523
22524 /**
22525  * Check that the invoice is signed correctly and that key recovery works
22526  */
22527 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
22528
22529 /**
22530  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
22531  * ```
22532  * use lightning_invoice::*;
22533  *
22534  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
22535  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
22536  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
22537  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
22538  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
22539  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
22540  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
22541  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
22542  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
22543  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
22544  * j5r6drg6k6zcqj0fcwg\";
22545  *
22546  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
22547  *
22548  * assert!(Invoice::from_signed(signed).is_ok());
22549  * ```
22550  */
22551 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
22552
22553 /**
22554  * Returns the `Invoice`'s timestamp (should equal it's creation time)
22555  */
22556 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
22557
22558 /**
22559  * Returns the hash to which we will receive the preimage on completion of the payment
22560  */
22561 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
22562
22563 /**
22564  * Get the payee's public key if one was included in the invoice
22565  *
22566  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22567  */
22568 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
22569
22570 /**
22571  * Get the payment secret if one was included in the invoice
22572  */
22573 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
22574
22575 /**
22576  * Get the invoice features if they were included in the invoice
22577  *
22578  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22579  */
22580 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
22581
22582 /**
22583  * Recover the payee's public key (only to be used if none was included in the invoice)
22584  */
22585 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
22586
22587 /**
22588  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
22589  */
22590 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
22591
22592 /**
22593  * Returns whether the invoice has expired.
22594  */
22595 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
22596
22597 /**
22598  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
22599  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
22600  */
22601 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
22602
22603 /**
22604  * Returns a list of all routes included in the invoice
22605  */
22606 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
22607
22608 /**
22609  * Returns a list of all routes included in the invoice as the underlying hints
22610  */
22611 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
22612
22613 /**
22614  * Returns the currency for which the invoice was issued
22615  */
22616 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
22617
22618 /**
22619  * Returns the amount if specified in the invoice as millisatoshis.
22620  */
22621 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
22622
22623 /**
22624  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
22625  * returns `CreationError::DescriptionTooLong` otherwise
22626  *
22627  * Please note that single characters may use more than one byte due to UTF8 encoding.
22628  */
22629 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
22630
22631 /**
22632  * Returns the underlying description `String`
22633  */
22634 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
22635
22636 /**
22637  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
22638  * overflow on adding the `EpiryTime` to it then this function will return a
22639  * `CreationError::ExpiryTimeOutOfBounds`.
22640  */
22641 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
22642
22643 /**
22644  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
22645  * would overflow on adding the `EpiryTime` to it then this function will return a
22646  * `CreationError::ExpiryTimeOutOfBounds`.
22647  */
22648 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
22649
22650 /**
22651  * Returns the expiry time in seconds
22652  */
22653 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
22654
22655 /**
22656  * Returns a reference to the underlying `Duration` (=expiry time)
22657  */
22658 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
22659
22660 /**
22661  * Creates a new (partial) route from a list of hops
22662  */
22663 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
22664
22665 /**
22666  * Returns the underlying list of hops
22667  */
22668 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
22669
22670 /**
22671  * Creates a copy of the CreationError
22672  */
22673 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
22674
22675 /**
22676  * Utility method to constructs a new DescriptionTooLong-variant CreationError
22677  */
22678 enum LDKCreationError CreationError_description_too_long(void);
22679
22680 /**
22681  * Utility method to constructs a new RouteTooLong-variant CreationError
22682  */
22683 enum LDKCreationError CreationError_route_too_long(void);
22684
22685 /**
22686  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
22687  */
22688 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
22689
22690 /**
22691  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
22692  */
22693 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
22694
22695 /**
22696  * Checks if two CreationErrors contain equal inner contents.
22697  * This ignores pointers and is_owned flags and looks at the values in fields.
22698  */
22699 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
22700
22701 /**
22702  * Get the string representation of a CreationError object
22703  */
22704 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
22705
22706 /**
22707  * Creates a copy of the SemanticError
22708  */
22709 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
22710
22711 /**
22712  * Utility method to constructs a new NoPaymentHash-variant SemanticError
22713  */
22714 enum LDKSemanticError SemanticError_no_payment_hash(void);
22715
22716 /**
22717  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
22718  */
22719 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
22720
22721 /**
22722  * Utility method to constructs a new NoDescription-variant SemanticError
22723  */
22724 enum LDKSemanticError SemanticError_no_description(void);
22725
22726 /**
22727  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
22728  */
22729 enum LDKSemanticError SemanticError_multiple_descriptions(void);
22730
22731 /**
22732  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
22733  */
22734 enum LDKSemanticError SemanticError_no_payment_secret(void);
22735
22736 /**
22737  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
22738  */
22739 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
22740
22741 /**
22742  * Utility method to constructs a new InvalidFeatures-variant SemanticError
22743  */
22744 enum LDKSemanticError SemanticError_invalid_features(void);
22745
22746 /**
22747  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
22748  */
22749 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
22750
22751 /**
22752  * Utility method to constructs a new InvalidSignature-variant SemanticError
22753  */
22754 enum LDKSemanticError SemanticError_invalid_signature(void);
22755
22756 /**
22757  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
22758  */
22759 enum LDKSemanticError SemanticError_imprecise_amount(void);
22760
22761 /**
22762  * Checks if two SemanticErrors contain equal inner contents.
22763  * This ignores pointers and is_owned flags and looks at the values in fields.
22764  */
22765 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
22766
22767 /**
22768  * Get the string representation of a SemanticError object
22769  */
22770 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
22771
22772 /**
22773  * Frees any resources used by the SignOrCreationError
22774  */
22775 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
22776
22777 /**
22778  * Creates a copy of the SignOrCreationError
22779  */
22780 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
22781
22782 /**
22783  * Utility method to constructs a new SignError-variant SignOrCreationError
22784  */
22785 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
22786
22787 /**
22788  * Utility method to constructs a new CreationError-variant SignOrCreationError
22789  */
22790 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
22791
22792 /**
22793  * Checks if two SignOrCreationErrors contain equal inner contents.
22794  * This ignores pointers and is_owned flags and looks at the values in fields.
22795  */
22796 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
22797
22798 /**
22799  * Get the string representation of a SignOrCreationError object
22800  */
22801 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
22802
22803 /**
22804  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
22805  */
22806 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
22807
22808 /**
22809  * Calls the free function if one is set
22810  */
22811 void Payer_free(struct LDKPayer this_ptr);
22812
22813 /**
22814  * Calls the free function if one is set
22815  */
22816 void Router_free(struct LDKRouter this_ptr);
22817
22818 /**
22819  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
22820  */
22821 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
22822
22823 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
22824
22825 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
22826
22827 /**
22828  * Constructs a new RetryAttempts given each field
22829  */
22830 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
22831
22832 /**
22833  * Creates a copy of the RetryAttempts
22834  */
22835 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
22836
22837 /**
22838  * Checks if two RetryAttemptss contain equal inner contents.
22839  * This ignores pointers and is_owned flags and looks at the values in fields.
22840  * Two objects with NULL inner values will be considered "equal" here.
22841  */
22842 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
22843
22844 /**
22845  * Checks if two RetryAttemptss contain equal inner contents.
22846  */
22847 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
22848
22849 /**
22850  * Frees any resources used by the PaymentError
22851  */
22852 void PaymentError_free(struct LDKPaymentError this_ptr);
22853
22854 /**
22855  * Creates a copy of the PaymentError
22856  */
22857 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
22858
22859 /**
22860  * Utility method to constructs a new Invoice-variant PaymentError
22861  */
22862 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
22863
22864 /**
22865  * Utility method to constructs a new Routing-variant PaymentError
22866  */
22867 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
22868
22869 /**
22870  * Utility method to constructs a new Sending-variant PaymentError
22871  */
22872 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
22873
22874 /**
22875  * Creates an invoice payer that retries failed payment paths.
22876  *
22877  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
22878  * `retry_attempts` has been exceeded for a given [`Invoice`].
22879  */
22880 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);
22881
22882 /**
22883  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
22884  *
22885  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
22886  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
22887  * for you.
22888  */
22889 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
22890
22891 /**
22892  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
22893  * case a retry is needed.
22894  *
22895  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
22896  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
22897  * for you.
22898  */
22899 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);
22900
22901 /**
22902  * Removes the payment cached by the given payment hash.
22903  *
22904  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
22905  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
22906  */
22907 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
22908
22909 /**
22910  * Constructs a new EventHandler which calls the relevant methods on this_arg.
22911  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
22912  */
22913 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
22914
22915 /**
22916  * Utility to construct an invoice. Generally, unless you want to do something like a custom
22917  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
22918  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
22919  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
22920  * that the payment secret is valid when the invoice is paid.
22921  */
22922 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);
22923
22924 /**
22925  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
22926  */
22927 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
22928
22929 /**
22930  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
22931  */
22932 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
22933
22934 /**
22935  * Constructs a new Router which calls the relevant methods on this_arg.
22936  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
22937  */
22938 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
22939
22940 /**
22941  * Constructs a new Payer which calls the relevant methods on this_arg.
22942  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
22943  */
22944 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
22945
22946 /**
22947  * Read a SiPrefix object from a string
22948  */
22949 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
22950
22951 /**
22952  * Read a Invoice object from a string
22953  */
22954 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
22955
22956 /**
22957  * Read a SignedRawInvoice object from a string
22958  */
22959 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
22960
22961 /**
22962  * Get the string representation of a Invoice object
22963  */
22964 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
22965
22966 /**
22967  * Get the string representation of a SignedRawInvoice object
22968  */
22969 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
22970
22971 /**
22972  * Get the string representation of a Currency object
22973  */
22974 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
22975
22976 /**
22977  * Get the string representation of a SiPrefix object
22978  */
22979 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
22980
22981 #endif /* LDK_C_BINDINGS_H */
22982
22983 #include "ldk_ver.h"